• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:40
CEST 09:40
KST 16:40
  • 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
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Weekly Cups (July 27-Aug 2): SHIN's big week0SC4ALL II: Brood War - $2500 - Dec 5-69SC4ALL II announced - $10,000 prize pool, Dec 5-64PIG STY FESTIVAL 8.0! (13 - 23 August)14Neeb returns to progaming; rejoins ONSYDE18
StarCraft 2
General
StarCraft 2 at SC4ALL II Invite #4/8 - Percival Balance hotfix patch 5.0.16b (July 16) Protoss AoE skill expression 5.0.16 patch for SC2 goes live (8 worker start) StarCraft 2 at SC4ALL II Invite #3/8 - Clem
Tourneys
RSL Revival: Season 6 - Qualifiers and Main Event Sparkling Tuna Cup - Weekly Open Tournament PIG STY FESTIVAL 8.0! (13 - 23 August) Tasteless Time Warp: SC Evo Showmatch (May 25) SC4ALL II announced - $10,000 prize pool, Dec 5-6
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
The PondCast: SC2 News & Results Mutation # 537 Hostile Territory Mutation # 536 Railroad Switch Mutation # 535 Assembly of Vengeance
Brood War
General
ASL 22 Proposed Map Pool Recent recommended BW games Making an Online Broodwar Manager Game ASL22 General Discussion [Personal Project Share] Terran Defense v0.60
Tourneys
KCM Race Survival 2026 Season 3 [Megathread] Daily Proleagues Escore Tournament - Season 3 SC4ALL II: Brood War - $2500 - Dec 5-6
Strategy
Odyssey Mineral Stack Saturation Any training maps people recommend? Fighting Spirit mining rates Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread General RTS Discussion Thread Nintendo Switch Thread ZeroSpace Early Access is Now Live! Beyond All Reason
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
Iain M Banks Says He Has Cancer And Months To Live US Politics Mega-thread European Politico-economics QA Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread
Fan Clubs
The Clem Fan Club INnoVation Fan Club The Scarlett Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! Series you have seen recently... [Req][Books] Good Fantasy/SciFi books
Sports
NBA General Discussion Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Please support my new stand…
Peanutsc
What is a Gamer?
TrAiDoS
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 6991 users

The Big Programming Thread - Page 677

Forum Index > General Forum
Post a Reply
Prev 1 675 676 677 678 679 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.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 16 2015 20:06 GMT
#13521
What are your opinions on the best Javascript IDE? Writing it normally is kinda painful. I tried WebStorm and it looked good but it costs money. What are good free options?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Acrofales
Profile Joined August 2010
Spain18406 Posts
November 16 2015 20:34 GMT
#13522
On November 16 2015 05:27 Cyx. wrote:
Show nested quote +
On November 16 2015 04:26 spinesheath wrote:
Assignment in if conditions is never forgiveable, be it line reading or anything else.

Putting the constant first makes code harder to read - at least for me and all the programmers I know. And it only fixes part of the problem. It doesn't do anything when you compare/assign two variables. You should just rely on automated code checks to prevent that kind of stuff. Just have it enforce a "no assignment in condition" rule.

I know a lot of C programmers who prefer


while ((c = getchar()) != EOF) {...}


to


char c = getchar();
while (c != EOF) {
...
c = getchar();
}


I used to really dislike assignments in conditionals too, but in this situation, it significantly reduces the typing and repetition necessary to manage the loop variable, so... I don't mind it at all now, especially since any decent C compiler will warn you if there's an un-bracketed assignment in a condition.

Yeah. I don't mind assignment in a while loop as long as it is completely explicitly separate from the condition, as in the code sample you gave. It gets hairy when you assign and implicitly check for something that breaks out of the clause (such as assigning 0 to your variable).

And in if statements it just plain always gets my hackles up. Assignments don't belong in if conditions.
tofucake
Profile Blog Joined October 2009
Hyrule19235 Posts
November 16 2015 20:46 GMT
#13523
On November 17 2015 05:06 WarSame wrote:
What are your opinions on the best Javascript IDE? Writing it normally is kinda painful. I tried WebStorm and it looked good but it costs money. What are good free options?

At my company devs use a mix of Sublime (me and another guy), Atom (one guy), and something else (other guy on a different project). I personally love Sublime, and you can get some extensions to make autocompletes and code-aware upgrades.
Liquipediaasante sana squash banana
Nyxisto
Profile Joined August 2010
Germany6287 Posts
November 16 2015 20:50 GMT
#13524
Atom doesn't run smoothly on my 4 year old thinkpad, I'm not kidding. Why do you need a quadcore to run a text-editor? I think IntelliJ is nice as an IDE and for shorter stuff I just use Vim, with AutocompleteMe and some on it's pretty decent for Java.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 16 2015 22:30 GMT
#13525
The problem is an IDE for JS(complete with tie in to CSS/HTML preferably). I'm looking for something where I can modify the code, and simply hit a button to reset the page it's in. This is technically possible in any editor+console+browser, but I was hoping for something with auto-complete and error checking(because JS' error checking is non-existent apparently).
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-11-16 23:17:07
November 16 2015 23:16 GMT
#13526
Have you tried using liveweave? The error checking is kinda useless, but it will tell you one is there. It certainly is not as strong as an IDE, but it has css/html/js integrated.
I'll always be your shadow and veil your eyes from states of ain soph aur.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
Last Edited: 2015-11-16 23:36:33
November 16 2015 23:36 GMT
#13527
That looks promising and almost exactly what I want! Thanks for the recommendation. I would LOVE to see a full-blown IDE similar to that.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
TMG26
Profile Joined July 2012
Portugal2017 Posts
November 17 2015 03:33 GMT
#13528
On November 17 2015 05:06 WarSame wrote:
What are your opinions on the best Javascript IDE? Writing it normally is kinda painful. I tried WebStorm and it looked good but it costs money. What are good free options?



Not for me, i'm a student, YEAH!
Supporter of the situational Blink Dagger on Storm.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 17 2015 03:55 GMT
#13529
Ahhh you bugger! I just graduated this year, so I have no money for it, and no longer have student access. :'(
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2015-11-17 04:24:21
November 17 2015 04:22 GMT
#13530
Is there a better way to write nested if statements? The && operator doesn't seem that good if I have multiple different conditions within an if statement. If I have like several nested conditions the code just looks.... off and it's not that easy to read at first glance.
Cyx.
Profile Joined November 2010
Canada806 Posts
Last Edited: 2015-11-17 06:11:35
November 17 2015 05:21 GMT
#13531
On November 17 2015 04:05 spinesheath wrote:
Show nested quote +
On November 16 2015 05:27 Cyx. wrote:
On November 16 2015 04:26 spinesheath wrote:
Assignment in if conditions is never forgiveable, be it line reading or anything else.

Putting the constant first makes code harder to read - at least for me and all the programmers I know. And it only fixes part of the problem. It doesn't do anything when you compare/assign two variables. You should just rely on automated code checks to prevent that kind of stuff. Just have it enforce a "no assignment in condition" rule.

I know a lot of C programmers who prefer


while ((c = getchar()) != EOF) {...}


to


char c = getchar();
while (c != EOF) {
...
c = getchar();
}


I used to really dislike assignments in conditionals too, but in this situation, it significantly reduces the typing and repetition necessary to manage the loop variable, so... I don't mind it at all now, especially since any decent C compiler will warn you if there's an un-bracketed assignment in a condition.

I hope you treat warnings as errors then, though. Obviously the most important part is that you can't make these kinds of mistakes. If you have an automatic check in place that only allows 100% safe assignments then I guess that's fine.

Well, I can't turn -Werror on at work but I never commit compiler warnings so I feel pretty good about this one generally.
On November 16 2015 04:26 spinesheath wrote:
Plus I usually don't go as low level as reading a file line by or character by character. I instead use a method that enumerates the lines or characters for me. I'm thinking C# here, but surely C can do similar things too.

That was a bit of a simplified example - but googling 'strtok linux lxr' got me to http://lxr.free-electrons.com/source/arch/s390/hypfs/inode.c#L225 (after I learned that the Linux kernel actually uses a function called strsep() and not strtok()) which is a pretty solid example of this idiom in real-world C code.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2015-11-17 06:30:55
November 17 2015 06:30 GMT
#13532
On November 17 2015 13:22 Itsmedudeman wrote:
Is there a better way to write nested if statements? The && operator doesn't seem that good if I have multiple different conditions within an if statement. If I have like several nested conditions the code just looks.... off and it's not that easy to read at first glance.

if (foo
&& bar
&& baz
&& zyzzy) {
...
}


If you have too many conditions you may be approaching the problem in a convoluted way, try simplifying the amount of state you're holding.
Who after all is today speaking about the destruction of the Armenians?
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2015-11-17 09:14:09
November 17 2015 09:12 GMT
#13533
I meant something that could look like


if(count == 500) {
s++;
if(s > 59) {
m++;
s = 0;
if(m > 59) {
h++;
m = 0;
if(h > 12)
h = 0;
}
}
}

I could probably think of a better example where it just looks unreadable, but you get my point.
Ropid
Profile Joined March 2009
Germany3557 Posts
Last Edited: 2015-11-17 11:04:17
November 17 2015 10:50 GMT
#13534
That's just how it is.

Some languages have "stuff" where you don't have to manually manage state of things like loops. That can then be composed together. Like, if your example is C#, you might want to look at LINQ and see if it can help you write it looking like


things
.Select(...)
.Select(...)
.Where(...)
.ToList()
.ForEach(... {
...
});


In Java 8 the lambda expressions together with streams do that.

I assume C++ has a whole bunch of template libraries that do something similar.
"My goal is to replace my soul with coffee and become immortal."
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
November 17 2015 17:54 GMT
#13535
So I'll be starting a personal web project soon, all Microsoft .NET C# and ASP/MVC. Up until now, I've done very little javascript. But this project will have complex UI logic, things like if you check one box then these other boxes need to be enabled, etc. I want it to be as streamlined as possible for the user, so it feels like a lot of that UI work should be done on the client. But I've never really been able to close that gap between javascript and business rules wrapped in class objects. I don't want to just simply write some JS to do X. I'd rather write some type of dynamic layer that can interpret business rules and build the JS, so I don't have to rewrite a whole bunch of JS every time a rule changes.

Anybody know of any resources out there that can help me? Maybe a book or something? My attempts at google have yielded limited results.
Thaniri
Profile Blog Joined March 2011
1264 Posts
November 17 2015 18:06 GMT
#13536
That honestly sounds like you're over complicating a website.

If all you're doing is form controls then you can write simple onclick events where if one box is checked then other html elements get checked/appear in the dom.

You'd be using javascript to manipulate html element attributes in that case.

WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 17 2015 18:23 GMT
#13537
Every time business rules change, a lot of the code changes. That's why most legit projects design what they are going to do before implementing it. Otherwise you have to go back and change a lot. Try to have an idea of what you're going to do beforehand, but don't worry if you have to go and change things. It's a process.

Thaniri is right about you overcomplicating it. That type of implementation in js is not that hard. If checking a check box makes all other check boxes in a set become checked, then use a list of that set of check boxes. When you need to check them all just loop through the list and check them one by one.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Manit0u
Profile Blog Joined August 2004
Poland17821 Posts
Last Edited: 2015-11-17 21:32:55
November 17 2015 18:50 GMT
#13538
On November 18 2015 02:54 enigmaticcam wrote:
So I'll be starting a personal web project soon, all Microsoft .NET C# and ASP/MVC. Up until now, I've done very little javascript. But this project will have complex UI logic, things like if you check one box then these other boxes need to be enabled, etc. I want it to be as streamlined as possible for the user, so it feels like a lot of that UI work should be done on the client. But I've never really been able to close that gap between javascript and business rules wrapped in class objects. I don't want to just simply write some JS to do X. I'd rather write some type of dynamic layer that can interpret business rules and build the JS, so I don't have to rewrite a whole bunch of JS every time a rule changes.

Anybody know of any resources out there that can help me? Maybe a book or something? My attempts at google have yielded limited results.


You should really look into integrating AngularJS into your application then. It can handle all of the UI logic very well, works great with RESTful applications and can also improve UX and reduce server load if done correctly.

On November 17 2015 18:12 Itsmedudeman wrote:
I meant something that could look like


if(count == 500) {
s++;
if(s > 59) {
m++;
s = 0;
if(m > 59) {
h++;
m = 0;
if(h > 12)
h = 0;
}
}
}

I could probably think of a better example where it just looks unreadable, but you get my point.


Well, what you're describing here is pretty much the Arrow anti-pattern. The only way to combat it is structuring your code better.

In the case above, you could separate that stuff into different function calls.


struct Counters {
int x;
int y;
int z;
};

struct Counters *Counters_create(int x, int y, int z)
{
struct Counters *counters = malloc(sizeof(struct Counters));

assert(counters != NULL);

counters->x = 0;
counters->y = 0;
counters->z = 0;

return counters;
}

void Counters_destroy(struct Counters *counters)
{
assert(counters != NULL);

free(counters);
}

void Counters_test_all(struct Counters *counters, int n)
{
if (n == 500)
{
counters->x += 1;

Counters_test_x(counters, counters->x);
}
}

void Counters_test_x(struct Counters *counters, int n)
{
if (n > 59)
{
counters->y += 1;
counters->x = 0;

Counters_test_y(counters, counters->y);
}
}

void Counters_test_y(struct Counters *counters, int n)
{
if (n > 59)
{
counters->z += 1;
counters->y = 0;

Counters_test_z(counters, counters->z);
}
}

void Counters_test_z(struct Counters *counters, int n)
{
if (n > 12)
{
counters->z = 0;
}
}

int main(int argc, char *argv[])
{
struct Counters *counters = Counters_create(0, 0, 0);
int count = 0;

while (count < 501) {
Counters_test_all(counters, count);
}

Counters_destroy(counters);

return 0;
}


My C is pretty rusty, but I hope you catch the drift

Edit:
Obviously, my code is still pretty bad but way more vertical instead of horizontal. Instead of adding another block indentation you simply add another function to update your counters, which you keep in a struct somewhere and can access from other places too if required. It seems like more code, but it's actually way more managable since it's more compartmentalized.
Time is precious. Waste it wisely.
Cyanocyst
Profile Joined October 2010
2222 Posts
November 17 2015 19:15 GMT
#13539
Hey guys, I have literally no coding experience at all. Disappointingly I graduated with degrees in Accounting and Finance last year. But i honestly hate both subjects.

Anyway my university requires significantly more math as pre-requisites for computer science, than it did for either of my majors.

Is high level math directly needed to code at all? I understand that more math could probably sharpen your problem solving skills, and that could indirectly help your coding. Though wanting to know if it is directly related to any language.

Also what is the easiest language to learn for a complete noob? I would like to try to teach my self some kind of coding just to see if it truly is something i'm interested in.

Due to already having degrees, and not wanting to pay for more of them, no matter what, i'll probably never actually be good at this. Though maybe i could make a hobby out of it.
|| Fruit Dealer | Leenock | Yughio | Coca | Sniper | True | Solar | Dark |
solidbebe
Profile Blog Joined November 2010
Netherlands4921 Posts
November 17 2015 20:03 GMT
#13540
On November 18 2015 04:15 Cyanocyst wrote:
Hey guys, I have literally no coding experience at all. Disappointingly I graduated with degrees in Accounting and Finance last year. But i honestly hate both subjects.

Anyway my university requires significantly more math as pre-requisites for computer science, than it did for either of my majors.

Is high level math directly needed to code at all? I understand that more math could probably sharpen your problem solving skills, and that could indirectly help your coding. Though wanting to know if it is directly related to any language.

Also what is the easiest language to learn for a complete noob? I would like to try to teach my self some kind of coding just to see if it truly is something i'm interested in.

Due to already having degrees, and not wanting to pay for more of them, no matter what, i'll probably never actually be good at this. Though maybe i could make a hobby out of it.

There are some programming jobs where you need to have strong math knowledge like games or cgi movies. I'd wager to say this is a very small percentage of programmers who end up in these kinds of fields though.

For any other programming, you don't need anything more than basic arithmetic really.

Good languages to start with I'd say python and java. They are high level so relatively easy to learn and very well supported ( many tutorials and such ).
That's the 2nd time in a week I've seen someone sig a quote from this GD and I have never witnessed a sig quote happen in my TL history ever before. -Najda
Prev 1 675 676 677 678 679 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 1h 20m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft720
ProTech80
StarCraft: Brood War
Larva 203
Mind 128
sSak 80
Dota 2
NeuroSwarm178
XcaliburYe50
League of Legends
JimRising 546
Super Smash Bros
Mew2King121
Other Games
m0e_tv288
Livibee62
Organizations
Other Games
gamesdonequick688
[ Show 10 non-featured ]
StarCraft 2
• Berry_CruncH283
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2316
Upcoming Events
RSL Revival
1h 20m
herO vs SHIN
Clem vs Solar
Serral vs Rogue
Ladder Legends
10h 20m
Ladder Legends
12h 20m
RSL Revival
1d 1h
OSC
1d 5h
OSC
1d 16h
WardiTV Weekly
2 days
The Patches Monday
2 days
Sparkling Tuna Cup
3 days
PiG Sty Festival
3 days
[ Show More ]
PiGosaur Cup
3 days
Replay Cast
4 days
Kung Fu Cup
4 days
Replay Cast
4 days
The PondCast
5 days
Replay Cast
5 days
Liquipedia Results

Completed

Escore Tournament S3: W6
CranK Gathers Season 4: BW vs SC2 Team League
Eternal Conflict S2 Finale

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
Acropolis #5
RSL Revival: Season 6
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2

Upcoming

Escore Tournament S3: W7
CSLAN 4
ASL Season 22
Escore Tournament S3: W8
Acropolis #5 - TRS
Blizzard Classic Cup 2026
Acropolis #5 - GSA
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1
Thunderpick World Champ.
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 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.