• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 22:57
CET 04:57
KST 12:57
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband Information Request Regarding Chinese Ladder SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion FlaSh's Valkyrie Copium BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread The Perfect Game Path of Exile Nintendo Switch Thread Should offensive tower rushing be viable in RTS games?
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
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
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1276 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
Portugal3241 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
PiGosaur Monday
01:00
#60
PiGStarcraft627
SteadfastSC168
CranKy Ducklings103
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft627
SteadfastSC 168
RuFF_SC2 121
Nathanias 78
StarCraft: Brood War
PianO 130
Noble 38
Icarus 9
Dota 2
monkeys_forever497
Counter-Strike
Coldzera 23
Other Games
summit1g13375
JimRising 675
WinterStarcraft409
C9.Mang0376
ViBE165
Mew2King30
Organizations
Other Games
gamesdonequick1147
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Hupsaiya 77
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki16
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo625
• Stunt343
Other Games
• Scarra1376
Upcoming Events
Wardi Open
8h 3m
StarCraft2.fi
13h 3m
Replay Cast
20h 3m
The PondCast
1d 6h
OSC
1d 12h
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 20h
Korean StarCraft League
2 days
CranKy Ducklings
3 days
SC Evo League
3 days
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
[ Show More ]
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
4 days
OSC
4 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
5 days
Wardi Open
5 days
StarCraft2.fi
5 days
Replay Cast
5 days
StarCraft2.fi
6 days
PiGosaur Monday
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.