• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:58
CEST 03:58
KST 10:58
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists16[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0
Community News
2026 GSL Season 1 Qualifiers13Maestros of the Game 2 announced82026 GSL Tour plans announced14Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid24
StarCraft 2
General
Maestros of the Game 2 announced Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid 2026 GSL Tour plans announced Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament 2026 GSL Season 1 Qualifiers GSL CK: More events planned pending crowdfunding RSL Revival: Season 5 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 522 Flip My Base The PondCast: SC2 News & Results Mutation # 521 Memorable Boss Mutation # 520 Moving Fees
Brood War
General
ASL21 General Discussion Pros React To: ASL S21, Ro.16 Group C BGH Auto Balance -> http://bghmmr.eu/ [TOOL] Starcraft Chat Translator Data needed
Tourneys
[ASL21] Ro16 Group C [Megathread] Daily Proleagues [ASL21] Ro16 Group D [ASL21] Ro16 Group B
Strategy
What's the deal with APM & what's its true value Simple Questions, Simple Answers Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Diablo IV Nintendo Switch Thread Dawn of War IV Starcraft Tabletop Miniature Game General RTS Discussion Thread
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
McBoner: A hockey love story 2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2664 users

The Big Programming Thread - Page 387

Forum Index > General Forum
Post a Reply
Prev 1 385 386 387 388 389 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
Last Edited: 2013-11-07 10:38:20
November 06 2013 22:47 GMT
#7721
On November 07 2013 00:31 AsmodeusXI wrote:
Question for the wizards in here: does anyone have any recommendations for a JavaScript library/framework for games development? I'm interested in doing game creation in HTML5 and there are a LOT of options out there, so I'm looking for some opinions.


Client side only (whole game is loaded in the browser with no interaction on server besides assets).

Or

Online multiplayer?

EaselJS is something which is like SDL for HTML5 Canvas, its quite good.
http://www.createjs.com/#!/EaselJS

Also I like to use coffeescript instead of javascript, its much nicer to code in.

I don't have a lot of experience in using off the market pre-made game engines in JS, but HTML5 Canvas is very easy to use and fast enough that you don't need to bother with optimisations for something simple. I think anything you find on google should be good enough, its not like the old days where there was a ton of boiler plate involved with drivers and there were big differences even in amateur engines (e.g 2D with .ini files vs 2.5D with relational database).

Also if you are going to use Coffeescript make sure to put undefined at the end of any long loops in order to prevent it building an array and returning it which while it is useful in web-development, it is costly for games.
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
Cyx.
Profile Joined November 2010
Canada806 Posts
November 06 2013 22:55 GMT
#7722
On November 07 2013 06:03 Zorkmid wrote:
Show nested quote +
On November 07 2013 04:17 Cyx. wrote:
On November 06 2013 12:46 Zorkmid wrote:
A lot of people that I've talked to say that IDEs are a bad way to learn a language for just that very reason.


And this is why we don't post without fully reading what we're responding to. 0o

don't listen to me, I was responding mostly to the 'why should I use an editor' rather than the 'what tools should I get to learn c' =/


I wasn't really responding to anything you said, just giving one point of view on IDEs as a learning tool. No need for the saltyness.


Sorryyyy lol, I meant that I had posted without reading, I wasn't saying anything about you ^^ badly worded, my bad.
Zorkmid
Profile Joined November 2008
4410 Posts
November 07 2013 00:14 GMT
#7723
Ah, my bad.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
November 07 2013 01:59 GMT
#7724
I'm streaming (and will be streaming this week and for several weeks) StarServer development (a new BW server). Feel free to have a look, and give tips and advice, as I'm a pretty noobie programmer. http://www.twitch.tv/birdietelevision
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
Zorkmid
Profile Joined November 2008
4410 Posts
November 07 2013 03:19 GMT
#7725
On November 07 2013 10:59 Birdie wrote:
I'm streaming (and will be streaming this week and for several weeks) StarServer development (a new BW server). Feel free to have a look, and give tips and advice, as I'm a pretty noobie programmer. http://www.twitch.tv/birdietelevision


Sounds interesting. I'll follow you.

I'll also mention that there's someone streaming development of a new version of a game called Uniball (like the pen) that I used to and still occassionally play.

http://www.uniballhq.com/
http://www.twitch.tv/ubdev
sob3k
Profile Blog Joined August 2009
United States7572 Posts
Last Edited: 2013-11-07 03:23:34
November 07 2013 03:22 GMT
#7726
CSS/HTML peeps, have you used the checkbox hack to make events happen permanently onclick?

I have it working but I can't get it to trigger an onclick on itself.

Like:

I can make clicking on div1 make div2 change color

but i cant make clicking on div1 make div1 change color

how do you do this? Why won't it work? It it because the sibling conjugator isn't working on itself?

input[type=checkbox]:checked ~ .output {
background: red;
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
TiCHEN
Profile Joined June 2011
Netherlands152 Posts
November 07 2013 18:39 GMT
#7727
Hi all,

i have a small question about javascript and html. This small part of my HTML code needs to be checked with javascript. What has to be done is that javascript needs to check if atleast 1 radio input is filled in and give an error in text, so no pop up.

I don't know how to do this. If any1 could tell me how, i would be very pleased. It is the last part of my assignment

This part with the radio which i need help on
+ Show Spoiler +
<fieldset id="inschrijving">
<div class="container">
<div class="floatLeft">
<label>22 april</label>
<br/>
<br/>
<input type="radio" name="size" value="Hele dag" />Hele dag </br>
<input type="radio" name="size" value="Ochtend" />Ochtend </br>
<input type="radio" name="size" value="Middag" />Middag </br>
<input type="checkbox" name="size3" value="I" />Inclusief lunch </br>
</div>
<div class="floatRight">
<label>23 april</label>
</br>
<br/>
<input type="radio" name="size1" value="Q" />Hele dag<br/>
<input type="radio" name="size1" value="W" />Ochtend<br/>
<input type="radio" name="size1" value="E" />Middag<br/>
<input type="checkbox" name="size2" value="R" />Inclusief lunch<br/>
</div>
</div>


This is my current javascript which includes some other stuff
+ Show Spoiler +
// <SCRIPT LANGUAGE="JavaScript">
// <script>
function validateForm()
{
var errorFound;

if (isEmpty("Naam"))
{
errorFound = true;
}

if (isEmpty("Adres"))
{
errorFound = true;
}

if (isEmpty("Postcode"))
{
errorFound = true;
}

if (isEmpty("Plaats"))
{
errorFound = true;
}

return (!errorFound)



}





function isEmpty(fieldName)
{
var x = document.forms["myForm"][fieldName].value;

if (x==null || x=="")
{
document.forms["myForm"][fieldName].className = "required";
document.getElementById(fieldName + "Verplicht").style.display = "inline";

return true;
}
else
{
document.forms["myForm"][fieldName].className = "";
document.getElementById(fieldName + "Verplicht").style.display = "none";

return false;
};
}

function myPostcode()
{
var x=document.getElementById("postcode").value;
document.getElementById("postcode").value=x.toUpperCase();
}
// </script>
// </SCRIPT>


This is my full HTML file
+ Show Spoiler +
<!DOCTYPE html>
<html>
<head>
<meta charset="iso-8859-1" />
<title>vereniging WIES</title>
<script src="file.js">
</script>
<link rel="stylesheet" type="text/css"
href="mainform.css" />
</head>
<body>
<div id="form">
<h3>Aanmelding WIES Congres</h3>


<form name="myForm" action="showform.php" onsubmit="return validateForm();" method="post">


<INPUT TYPE="hidden" NAME="to" VALUE="a" />
<p class="legend">Deelnemer</p>
<fieldset id="deelnemer">

<label>Naam</label><input type="text" name="Naam" size="30"/>
<label> Bedrijf </label><input type = "text" name = "Bedrijf" size = "30" /> </br>
<label>Adres</label><input type = "text" name = "Adres" size = "30" /><br/>
<label>Postcode</label><input type = "text" name = "Postcode" id="postcode" onblur="myPostcode();" size = "30" />
<label> Plaats</label><input type = "text" name = "Plaats" size = "30" /></br>

<label>Land</label>
<select name="land">
<option value="Nederland" selected="selected">Nederland</option>
<option value="Belgie">Belgie</option>
<option value="Duitsland">Duitsland</option>
<option value="Frankrijk">Frankrijk</option>
<option value="Luxemburg">Luxemburg</option>
</select>
<br/><br/>

<label>WIES ID</label><input type="radio" name="Ja" value="Ja" id="Ja" />Ja<input type="radio" name="Ja" value="Nee" id="Nee"/>Nee<br/>
<label class="lidnummer">Lidnummer</label><input type = "text" name = "getal1" maxlength = "6" size = "25" /><br/>
<label class="lidnummer">WIES pin</label><input type = "password" maxlength ="4" name = "getal2" size = "25" /><br/>

<div>
<span id="NaamVerplicht" class="Error">* Naam is verplicht.</span><br />
<span id="AdresVerplicht" class="Error">* Adres is verplicht.</span><br />
<span id="PostcodeVerplicht" class="Error">* Postcode is verplicht.</span><br />
<span id="PlaatsVerplicht" class="Error">* Plaats is verplicht.</span><br />
</div>

</fieldset>

<p class="legend">inschrijving</p>
<fieldset id="inschrijving">
<div class="container">
<div class="floatLeft">
<label>22 april</label>
<br/>
<br/>
<input type="radio" name="size" value="Hele dag" />Hele dag </br>
<input type="radio" name="size" value="Ochtend" />Ochtend </br>
<input type="radio" name="size" value="Middag" />Middag </br>
<input type="checkbox" name="size3" value="I" />Inclusief lunch </br>
</div>
<div class="floatRight">
<label>23 april</label>
</br>
<br/>
<input type="radio" name="size1" value="Q" />Hele dag<br/>
<input type="radio" name="size1" value="W" />Ochtend<br/>
<input type="radio" name="size1" value="E" />Middag<br/>
<input type="checkbox" name="size2" value="R" />Inclusief lunch<br/>
</div>
</div>
</br></br></br>

De kosten voor de hele dag zijn 150,--,
een enkele sessie: 90,--. <br/>
WIES leden 50% korting
De lunch kost 15,--
</fieldset>


<p class="legend">Enquete</p>
<fieldset id="Enquête">
<label>Functie</label><input type="radio" name="size6" value="H" />Manager <input type="radio" name="size6" value="H" />Informatieanalist
<input type="radio" name="size6" value="H" />Ontwikkelaar <input type="radio" name="size6" value="H" />Docent
<input type="radio" name="size6" value="H" />Overig
</br>
</br>
<label class="Vakgebied">Vakgebied </label>
<select name="beroep" id="beroep"
multiple="multiple" size="4">
<option value="automatisering" selected="selected">automatisering</option>
<option value="onderwijs">onderwijs</option>
<option value="overheid">overheid</option>
<option value="industrie">industrie</option>
<option value="handel">handel</option>
<option value="gezondheidszorg">gezondheidszorg</option>
<option value="banken
verzekeringen">banken
verzekeringen</option>
<option value="telecommunicatie">telecommunicatie</option>
<option value="Overig">Overig</option>
</select>
</br>
</br>

<label class="labelenquette">Bedrijfsgrootte</label>
<select name="personeel">
<option value="weining">0-10</option>
<option value="mkb">10-50</option>
<option value="mkbgroot">50-100</option>
<option value="zakelijk">100-500</option>
<option value="grootzakelijk">500 of meer</option>
</select>

</fieldset>
<p class="legend">Opmerkingen</p>
<fieldset id="Opmerkingen">
<TEXTAREA NAME="Opmerkingen" ROWS="5" COLS="40">

</TEXTAREA>
</fieldset>

<p id="buttons">
<input type="submit" value="Aanmelden" />
</p>
</form>
</div>
</body>
</html>


I had something like this:
if (!document.getElementById("radio button 1").checked && !document.getElementById("radio button 2").checked && !document.getElementById("radio button 3").checked && !document.getElementById("radio button 4").checked && !document.getElementById("radio button 5").checked &&!document.getElementById("radio button 6").checked )
{
errorFound=true;
}

I put this in my validateForm function. Im a big Javascript noobie so any help is appreciated.
VyingsP
Profile Joined December 2011
France174 Posts
November 07 2013 19:43 GMT
#7728
On November 08 2013 03:39 TiCHEN wrote:
Hi all,

i have a small question about javascript and html. This small part of my HTML code needs to be checked with javascript. What has to be done is that javascript needs to check if atleast 1 radio input is filled in and give an error in text, so no pop up.

I don't know how to do this. If any1 could tell me how, i would be very pleased. It is the last part of my assignment

This part with the radio which i need help on
+ Show Spoiler +
<fieldset id="inschrijving">
<div class="container">
<div class="floatLeft">
<label>22 april</label>
<br/>
<br/>
<input type="radio" name="size" value="Hele dag" />Hele dag </br>
<input type="radio" name="size" value="Ochtend" />Ochtend </br>
<input type="radio" name="size" value="Middag" />Middag </br>
<input type="checkbox" name="size3" value="I" />Inclusief lunch </br>
</div>
<div class="floatRight">
<label>23 april</label>
</br>
<br/>
<input type="radio" name="size1" value="Q" />Hele dag<br/>
<input type="radio" name="size1" value="W" />Ochtend<br/>
<input type="radio" name="size1" value="E" />Middag<br/>
<input type="checkbox" name="size2" value="R" />Inclusief lunch<br/>
</div>
</div>


This is my current javascript which includes some other stuff
+ Show Spoiler +
// <SCRIPT LANGUAGE="JavaScript">
// <script>
function validateForm()
{
var errorFound;

if (isEmpty("Naam"))
{
errorFound = true;
}

if (isEmpty("Adres"))
{
errorFound = true;
}

if (isEmpty("Postcode"))
{
errorFound = true;
}

if (isEmpty("Plaats"))
{
errorFound = true;
}

return (!errorFound)



}





function isEmpty(fieldName)
{
var x = document.forms["myForm"][fieldName].value;

if (x==null || x=="")
{
document.forms["myForm"][fieldName].className = "required";
document.getElementById(fieldName + "Verplicht").style.display = "inline";

return true;
}
else
{
document.forms["myForm"][fieldName].className = "";
document.getElementById(fieldName + "Verplicht").style.display = "none";

return false;
};
}

function myPostcode()
{
var x=document.getElementById("postcode").value;
document.getElementById("postcode").value=x.toUpperCase();
}
// </script>
// </SCRIPT>


This is my full HTML file
+ Show Spoiler +
<!DOCTYPE html>
<html>
<head>
<meta charset="iso-8859-1" />
<title>vereniging WIES</title>
<script src="file.js">
</script>
<link rel="stylesheet" type="text/css"
href="mainform.css" />
</head>
<body>
<div id="form">
<h3>Aanmelding WIES Congres</h3>


<form name="myForm" action="showform.php" onsubmit="return validateForm();" method="post">


<INPUT TYPE="hidden" NAME="to" VALUE="a" />
<p class="legend">Deelnemer</p>
<fieldset id="deelnemer">

<label>Naam</label><input type="text" name="Naam" size="30"/>
<label> Bedrijf </label><input type = "text" name = "Bedrijf" size = "30" /> </br>
<label>Adres</label><input type = "text" name = "Adres" size = "30" /><br/>
<label>Postcode</label><input type = "text" name = "Postcode" id="postcode" onblur="myPostcode();" size = "30" />
<label> Plaats</label><input type = "text" name = "Plaats" size = "30" /></br>

<label>Land</label>
<select name="land">
<option value="Nederland" selected="selected">Nederland</option>
<option value="Belgie">Belgie</option>
<option value="Duitsland">Duitsland</option>
<option value="Frankrijk">Frankrijk</option>
<option value="Luxemburg">Luxemburg</option>
</select>
<br/><br/>

<label>WIES ID</label><input type="radio" name="Ja" value="Ja" id="Ja" />Ja<input type="radio" name="Ja" value="Nee" id="Nee"/>Nee<br/>
<label class="lidnummer">Lidnummer</label><input type = "text" name = "getal1" maxlength = "6" size = "25" /><br/>
<label class="lidnummer">WIES pin</label><input type = "password" maxlength ="4" name = "getal2" size = "25" /><br/>

<div>
<span id="NaamVerplicht" class="Error">* Naam is verplicht.</span><br />
<span id="AdresVerplicht" class="Error">* Adres is verplicht.</span><br />
<span id="PostcodeVerplicht" class="Error">* Postcode is verplicht.</span><br />
<span id="PlaatsVerplicht" class="Error">* Plaats is verplicht.</span><br />
</div>

</fieldset>

<p class="legend">inschrijving</p>
<fieldset id="inschrijving">
<div class="container">
<div class="floatLeft">
<label>22 april</label>
<br/>
<br/>
<input type="radio" name="size" value="Hele dag" />Hele dag </br>
<input type="radio" name="size" value="Ochtend" />Ochtend </br>
<input type="radio" name="size" value="Middag" />Middag </br>
<input type="checkbox" name="size3" value="I" />Inclusief lunch </br>
</div>
<div class="floatRight">
<label>23 april</label>
</br>
<br/>
<input type="radio" name="size1" value="Q" />Hele dag<br/>
<input type="radio" name="size1" value="W" />Ochtend<br/>
<input type="radio" name="size1" value="E" />Middag<br/>
<input type="checkbox" name="size2" value="R" />Inclusief lunch<br/>
</div>
</div>
</br></br></br>

De kosten voor de hele dag zijn 150,--,
een enkele sessie: 90,--. <br/>
WIES leden 50% korting
De lunch kost 15,--
</fieldset>


<p class="legend">Enquete</p>
<fieldset id="Enquête">
<label>Functie</label><input type="radio" name="size6" value="H" />Manager <input type="radio" name="size6" value="H" />Informatieanalist
<input type="radio" name="size6" value="H" />Ontwikkelaar <input type="radio" name="size6" value="H" />Docent
<input type="radio" name="size6" value="H" />Overig
</br>
</br>
<label class="Vakgebied">Vakgebied </label>
<select name="beroep" id="beroep"
multiple="multiple" size="4">
<option value="automatisering" selected="selected">automatisering</option>
<option value="onderwijs">onderwijs</option>
<option value="overheid">overheid</option>
<option value="industrie">industrie</option>
<option value="handel">handel</option>
<option value="gezondheidszorg">gezondheidszorg</option>
<option value="banken
verzekeringen">banken
verzekeringen</option>
<option value="telecommunicatie">telecommunicatie</option>
<option value="Overig">Overig</option>
</select>
</br>
</br>

<label class="labelenquette">Bedrijfsgrootte</label>
<select name="personeel">
<option value="weining">0-10</option>
<option value="mkb">10-50</option>
<option value="mkbgroot">50-100</option>
<option value="zakelijk">100-500</option>
<option value="grootzakelijk">500 of meer</option>
</select>

</fieldset>
<p class="legend">Opmerkingen</p>
<fieldset id="Opmerkingen">
<TEXTAREA NAME="Opmerkingen" ROWS="5" COLS="40">

</TEXTAREA>
</fieldset>

<p id="buttons">
<input type="submit" value="Aanmelden" />
</p>
</form>
</div>
</body>
</html>


I had something like this:
if (!document.getElementById("radio button 1").checked && !document.getElementById("radio button 2").checked && !document.getElementById("radio button 3").checked && !document.getElementById("radio button 4").checked && !document.getElementById("radio button 5").checked &&!document.getElementById("radio button 6").checked )
{
errorFound=true;
}

I put this in my validateForm function. Im a big Javascript noobie so any help is appreciated.


What exactly is your problem ? The answer Mindcrime gave you seems to be working...
http://jsfiddle.net/3n3Kx/

Corrections of my bad english are much welcome
TiCHEN
Profile Joined June 2011
Netherlands152 Posts
November 07 2013 20:24 GMT
#7729
Ah yes, i got it now. I had it misstyped in my if statement . i only had 1 & in one of my lines. Idk why, probably deleted it by accident.

I got this to work now. Now what I think i need to do, is make a new function in my javascript that will tell my html that it is not checked and my html can display some kind of error,
Something like this?: <span id="sizeVerplicht" class="Error">* day required</span><br />

like i did in my first paragraph :
<div>
<span id="NaamVerplicht" class="Error">* Naam is verplicht.</span><br />
<span id="AdresVerplicht" class="Error">* Adres is verplicht.</span><br />
<span id="PostcodeVerplicht" class="Error">* Postcode is verplicht.</span><br />
<span id="PlaatsVerplicht" class="Error">* Plaats is verplicht.</span><br />
</div>

The thing is, i made this with a isEmpty function, but i can't use that for my radio buttons can i? How exactly can i do this?
VyingsP
Profile Joined December 2011
France174 Posts
November 07 2013 20:37 GMT
#7730
On November 07 2013 12:22 sob3k wrote:
CSS/HTML peeps, have you used the checkbox hack to make events happen permanently onclick?

I have it working but I can't get it to trigger an onclick on itself.

Like:

I can make clicking on div1 make div2 change color

but i cant make clicking on div1 make div1 change color

how do you do this? Why won't it work? It it because the sibling conjugator isn't working on itself?

input[type=checkbox]:checked ~ .output {
background: red;


Dunno if that's what you are looking for, or if you found by yourself already, but I think I got this working :
http://jsfiddle.net/as3nT/

But I'm pretty sure a div inside a label is not w3c compliant
Corrections of my bad english are much welcome
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
November 07 2013 21:29 GMT
#7731
.NET networking question:

All that I'm about to describe happens within a LAN...

So I have a server with a windows service that I built. This service does work all day, specifically database work. What I would like to do is build a client service that will run on individual client machines. This client service will listen for events from the server service and alert the user to key events should they happen. These key events are user specific, meaning the server service can generate an event that might only apply to one specific user.

I typically approach things from a database perspective. From that perspective, it would be easy to have the server service generate events and save them in the database, and have the client services always checking the database and looking for user specific events. But I don't think that would be practical in this case. The database is already taxed during the day. It would be hard-pressed if I had a few hundred clients constantly running checks against the server.

I think a better solution would be to have the client services to connect and talk directly to the server service via peer-to-peer network connectivity. Perhaps the client machines can send a packet to the service saying "hey, I'm here" along with the user credentials every so often, and when the service has an event specific to the user, it will alert the client that has that user's credentials if the client has pinged within a certain threshold. If it fails, it's fine; it just means the user has logged off or shutdown the computer.

I'm just not entirely sure how to do direct peer-to-peer network connectivity in .NET. Anyone have any experience with this sort of thing? Perhaps can you point me in the right direction without giving a detailed solution if you don't want to?
supereddie
Profile Joined March 2011
Netherlands151 Posts
November 07 2013 21:33 GMT
#7732
Check out WCF service with Callbacks. Might be overkill for a simple app though.
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
VyingsP
Profile Joined December 2011
France174 Posts
November 07 2013 21:42 GMT
#7733
Maybe try something like the observer pattern ? When the client app starts, it contacts the server and registers to some events and whenever an event occurs, the server contacts the app back and notifies it ? Depends on your environment obviously.
Corrections of my bad english are much welcome
ThatGuy
Profile Blog Joined April 2008
Canada695 Posts
November 07 2013 21:46 GMT
#7734
You could use the .NET Socket class to establish network connectivity and handle communication between the server and the client. You can read up on the Socket class and its usage here: http://msdn.microsoft.com/en-us/library/System.Net.Sockets.Socket(v=vs.110).aspx

As for how to approach this problem, I think a good place to start would be to have the server have a listening loop available (check Socket.Listen), awaiting incoming connections from clients. When a new client asks to connect, the server receives the request and saves it locally to a client list. Conversely, the server removes the client from its list when it detects that a connection has been terminated (plenty of exception handling you'll have to watch out for). When it has something it needs to communicate to the clients, it iterates through the list of clients, broadcasting its message.

Client side, it sits there waiting for signals from the server (like the listen loop), and does whatever you want it to .

You may want to look into multithreading this application (especially the server), to prevent your applications from stalling while it listens for information.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
November 07 2013 22:00 GMT
#7735
I've known of the Socket class, but never dabbled into it since most of the work I do is database driven. That might be the solution I'm looking for; I'll do some googling and see if I can find some basic examples using it.

For some reason, I always thought the WCF was for web services. Either way, I'll check that out too.

I wasn't expecting answers so quickly! Thanks for your help.
Zocat
Profile Joined April 2010
Germany2229 Posts
November 07 2013 22:26 GMT
#7736
WCF - MSMQ
Overall you're looking for the publish/subscribe or message queuing patterns.
Those should be able to deliver the messages even if the client went offline (as soon as he goes on he can consume it).

If you just want to broadcast to active clients, I'd say sockets & keeping a userlist (with various flags for the type of message they should receive). If you dont care about security you can perform the "is the message for me" check on the client.

misirlou
Profile Joined June 2010
Portugal3293 Posts
November 07 2013 23:56 GMT
#7737
MSMQ only really needed if you want the messages to be delivered offline. I think using WCF with callbacks (wsdualhttpbinding if I recall?) is the most appropriate option, it implements the observer pattern. Sockets are also easy to use, but they aren't really web services.
sob3k
Profile Blog Joined August 2009
United States7572 Posts
November 08 2013 07:20 GMT
#7738
On November 08 2013 05:37 VyingsP wrote:
Show nested quote +
On November 07 2013 12:22 sob3k wrote:
CSS/HTML peeps, have you used the checkbox hack to make events happen permanently onclick?

I have it working but I can't get it to trigger an onclick on itself.

Like:

I can make clicking on div1 make div2 change color

but i cant make clicking on div1 make div1 change color

how do you do this? Why won't it work? It it because the sibling conjugator isn't working on itself?

input[type=checkbox]:checked ~ .output {
background: red;


Dunno if that's what you are looking for, or if you found by yourself already, but I think I got this working :
http://jsfiddle.net/as3nT/

But I'm pretty sure a div inside a label is not w3c compliant


Thanks a ton, looks great to me!
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
PandaCore
Profile Blog Joined September 2010
Germany553 Posts
November 08 2013 14:40 GMT
#7739
This is pretty much a long shot, but I'm kind of stuck right now. I haven't been in web development for 7 years and I'm a bit out of touch concerning new technologies in that area.

Hopefully someone can point me in a direction where I can read up on a bit more.

I need to develop a rich internet application, where a user can customize their own UI. It starts as an empty page and then you can add elements for visualization (i.e. gauges, line graphs, bar graphs, etc.) and position them freely on the main window.

These visual elements receive data from a remote server and have to be able to display those within milliseconds. This is very important. Also this should just run on most of the modern browser without the need of any additional plugins. Using Flash is out of question as well, even though it seems quite good for that kind of application.

That's the very basic description. HTML5+jQuery looks nice for just visualizing data, but I'm not too sure on the actual aspect of being able to customize the appearance freely in a browser environment (i.e. being able to get context menus, adding new elements, opening configuration windows for the elements etc.).

I come from a background of desktop application development, so I probably need to rethink how to let the user interact and work with things in a browser environment as well.
I has a flavor
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
November 08 2013 17:52 GMT
#7740
On November 08 2013 23:40 PandaCore wrote:This is pretty much a long shot, but I'm kind of stuck right now. I haven't been in web development for 7 years and I'm a bit out of touch concerning new technologies in that area.

Hopefully someone can point me in a direction where I can read up on a bit more.

I need to develop a rich internet application, where a user can customize their own UI. It starts as an empty page and then you can add elements for visualization (i.e. gauges, line graphs, bar graphs, etc.) and position them freely on the main window.

These visual elements receive data from a remote server and have to be able to display those within milliseconds. This is very important. Also this should just run on most of the modern browser without the need of any additional plugins. Using Flash is out of question as well, even though it seems quite good for that kind of application.

That's the very basic description. HTML5+jQuery looks nice for just visualizing data, but I'm not too sure on the actual aspect of being able to customize the appearance freely in a browser environment (i.e. being able to get context menus, adding new elements, opening configuration windows for the elements etc.).

I come from a background of desktop application development, so I probably need to rethink how to let the user interact and work with things in a browser environment as well.


You actually don't, these days. If you want to do the displaying part yourself, familiarize yourself with the HTML5 Canvas, which is basically a 2D graphics environment that you can manipulate just like in a normal desktop environment.

Depending on wether you want to have your data transfer active or passive (polling), you can either go websockets (active) which work similar to TCP as a persistent 2-way connection or you simply use AJAX to regularly request new data (passive) and then update the canvas elements belonging to it.

There are also some libraries, jquery and otherwise, that already deal with making graphs out of things. A quick google offers 5 libraries that should do the job. About 2 years ago i worked with jqPlot for a similar use-case and it was easy enough to use, though other libraries might be better suited for your specific use-case.

You can treat it just like a desktop environment with it's own scripting language and network protocol, no real need to concern yourself too much with HTTP other than as a proxy between the browser and the database. Just think about how you would do it in a desktop application and do it just the same way except in javascript.
Prev 1 385 386 387 388 389 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
2026 GSL Season 1: Qualifiers
CranKy Ducklings167
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft291
RuFF_SC2 183
StarCraft: Brood War
Britney 13643
GuemChi 4199
Artosis 692
Dota 2
monkeys_forever574
NeuroSwarm155
LuMiX0
League of Legends
Doublelift3505
Counter-Strike
tarik_tv4642
fl0m1006
taco 698
Super Smash Bros
hungrybox1188
Other Games
summit1g10083
C9.Mang0536
JimRising 509
ViBE131
Maynarde110
Trikslyr66
Mew2King29
Organizations
Other Games
gamesdonequick1128
BasetradeTV226
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki12
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie1038
Upcoming Events
The PondCast
8h 2m
KCM Race Survival
8h 2m
WardiTV Map Contest Tou…
9h 2m
Gerald vs herO
Clem vs Cure
ByuN vs Solar
Rogue vs MaxPax
ShoWTimE vs TBD
OSC
13h 2m
CranKy Ducklings
22h 2m
Escore
1d 8h
RSL Revival
1d 15h
Replay Cast
1d 22h
WardiTV Map Contest Tou…
2 days
Universe Titan Cup
2 days
Rogue vs Percival
[ Show More ]
Ladder Legends
2 days
uThermal 2v2 Circuit
2 days
BSL
2 days
Sparkling Tuna Cup
3 days
WardiTV Map Contest Tou…
3 days
Ladder Legends
3 days
BSL
3 days
Replay Cast
3 days
Replay Cast
4 days
Wardi Open
4 days
Afreeca Starleague
4 days
Soma vs hero
Monday Night Weeklies
4 days
Replay Cast
4 days
Afreeca Starleague
5 days
Leta vs YSC
Replay Cast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-04-22
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.