• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:57
CET 08:57
KST 16: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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (October 19-25): Clem triples first in 5.0.171Evil Geniuses - shutting down17ISSL (IntoTheTV x SOOP SC2 League): Premier5Weekly Cups (October 12-18): 5.0.17 era begins1[$1250] International ShieldBattery League86
StarCraft 2
General
Evil Geniuses - shutting down Weekly Cups (October 19-25): Clem triples first in 5.0.17 REPORT: StarCraft 2: Remastered In Development How do you feel about the mass reverts in the 5.0.17 PTR? Team Liquid Map Contest #22: Results and Winners
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 ScienceCraft (October 24-25) - Live Event Sparkling Tuna Cup - Weekly Open Tournament ISSL (IntoTheTV x SOOP SC2 League): Premier WORTEX Challenger Series — Open SC2 LAN in Budapes
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps [A] Nemrods 1/4 players [M] (2) Sweltering Sands
External Content
Mutation # 549 Endless Sparkles The PondCast: SC2 News & Results Mutation # 548 Shining Bright Mutation # 547 Temple Of Terror
Brood War
General
BW General Discussion [BW] Looking for Clan Thread! [ASL22] Finals Preview: Sweet Victory! Recent recommended BW games [Megathread] Daily Funny Videos
Tourneys
[$1250] International ShieldBattery League [Megathread] Daily Proleagues [ASL22] Grand Finals [BSL23] RO24 Group C
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Mobile Legends: Bang Bang Armies of Exigo - YesYes? General RTS Discussion Thread
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread European Politico-economics QA Mega-thread US Politics Mega-thread Russo-Ukrainian War Thread
Fan Clubs
Reynor Fan Club The Flash Fan Club Serral Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 10655 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
Portugal3319 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
IntoTheTV X SOOP
11:00
Replaycast Group C
PiGosaur Cup
09:30
#105
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 154
StarCraft: Brood War
Rain 3289
Leta 529
Mong 308
Hyuk 286
Shine 85
Dewaltoss 65
910 37
ProTech28
NotJumperer 16
soO 15
[ Show more ]
Force[name] 6
Other Games
summit1g11022
Happy329
Livibee147
Sick94
Organizations
Other Games
gamesdonequick724
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• Azhi_Dahaki57
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2380
League of Legends
• Rush1363
• Stunt583
Other Games
• Shiphtur536
Upcoming Events
The PondCast
2h 3m
Kung Fu Cup
3h 3m
IntoTheTV X SOOP
1d 3h
SHIN vs GuMiho
Clem vs Classic
OSC
1d 14h
WardiTV Invitational
2 days
GSL
2 days
Epic.LAN
2 days
Replay Cast
2 days
Sparkling Tuna Cup
3 days
Epic.LAN
3 days
[ Show More ]
AI Arena Tournament
3 days
Yamato Cup
4 days
Map Test Tournament
4 days
WardiTV Weekly
5 days
Replay Cast
5 days
Rogue vs Classic
Patches Events
6 days
PiGosaur Cup
6 days
Liquipedia Results

Completed

Proleague 2026-10-27
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026

Upcoming

IPSL Winter 2026-27
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 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.