• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:18
CEST 10:18
KST 17:18
  • 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
Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12TL.net Map Contest #22 - Voting & Ladder Map Selection7Code S Season 2 (2026) - RO8 Preview7[ASL21] Finals Preview: Two Legacies21
Community News
Weekly Cups (June 8-14): Clem and Solar double, PTR tested0RSL: S6 Finals played at BlizzCon 202611Douyu Cup 2026: $20,000 Legends Event (June 26-28)10[BSL22] Non-Korean Championship from 13 to 28 June4Weekly Cups (May 25-31): Clem doubles, 2v2 circuit heads toward finale0
StarCraft 2
General
Daily SC2 Player Grid - feedback wanted StarCraft II 5.0.16 PTR Patch Notes may 26th TL Poll: How do you feel about the 5.0.16 PTR balance changes? Code S Season 2 (2026) - RO8 Preview Updates to The Core/Core Lite for v5.0.16?
Tourneys
Master Swan Open (Global Bronze-Master 2) GSL CK #4 20-21th June Crank Gathers Season 4: BW vs SC2 Team League Douyu Cup 2026: $20,000 Legends Event (June 26-28) Maestros of The Game 2 announcement and schedule !
Strategy
[G] Having the right mentality to improve
Custom Maps
Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
Mutation # 530 One For All The PondCast: SC2 News & Results Mutation # 529 Opportunities Unleashed Mutation # 528 Infection Detected
Brood War
General
BW General Discussion vespene.gg — BW replays in browser Where is EffOrt? BGH Auto Balance -> http://bghmmr.eu/ Quality of life changes in BW that you will like ?
Tourneys
[Megathread] Daily Proleagues [ASL21] Grand Finals [BSL22] Grand Finals - Sunday 21:00 CEST Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers Relatively freeroll strategies Creating a full chart of Zerg builds Why doesn't anyone use restoration?
Other Games
General Games
Stormgate/Frost Giant Megathread ZeroSpace Megathread Nintendo Switch Thread Beyond All Reason Total War: Warhammer 40K
Dota 2
Looking for a Dota Mentor 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
TL Mafia
Vanilla Mini Mafia
Community
General
US Politics Mega-thread The Games Industry And ATVI UK Politics Mega-thread Russo-Ukrainian War Thread [H]Internet/Gaming Cafe Tips and Tricks
Fan Clubs
The HerO Fan Club! The herO Fan Club!
Media & Entertainment
Movie Discussion! [Req][Books] Good Fantasy/SciFi books [TV/BOOK] *SPOILERS* Game of Thrones Discussion [Manga] One Piece
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion Cricket [SPORT] NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Does Workplace Frustration D…
TrAiDoS
An Exploration of th…
waywardstrategy
I'm an arrogant trash talke…
FlaShFTW
Gauntlet SC2: A Retrospectiv…
Ctone23
Why RTS gamers make better f…
gosubay
Customize Sidebar...

Website Feedback

Closed Threads



Active: 15711 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
Spain18318 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
Hyrule19221 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
Poland17768 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 43m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 152
StarCraft: Brood War
Rain 2363
Sea 1979
actioN 368
Leta 64
Backho 38
ZergMaN 35
soO 32
Sharp 22
NotJumperer 21
Bale 19
[ Show more ]
Purpose 8
Mong 1
League of Legends
JimRising 620
Counter-Strike
ceh9619
m0e_tv511
Other Games
WinterStarcraft506
Liquid`RaSZi458
Happy214
RuFF_SC217
Trikslyr17
trigger4
Organizations
Dota 2
PGL Dota 2 - Secondary Stream4917
Other Games
gamesdonequick545
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH265
• StrangeGG 52
• LUISG 4
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo849
Upcoming Events
The PondCast
1h 43m
WardiTV Spring Champion…
2h 43m
MaxPax vs SHIN
ByuN vs herO
Solar vs Zoun
OSC
4h 43m
OSC
15h 43m
CranKy Ducklings
1d 1h
WardiTV Spring Champion…
1d 2h
Cure vs SKillous
WardiTV Spring Champion…
2 days
GSL
2 days
Maru vs ShoWTimE
Classic vs Reynor
herO vs Lambo
Solar vs Clem
BSL22 NKC (BSL vs China)
2 days
XuanXuan vs Jaystar
Mihu vs Messiah
eOnzErG vs Dewalt
Bonyth vs Jaystar
TerrOr vs Messiah
XuanXuan vs Mihu
eOnzErG vs Jaystar
Replay Cast
2 days
[ Show More ]
WardiTV Spring Champion…
3 days
GSL
3 days
Patches Events
3 days
BSL22 NKC (BSL vs China)
3 days
Dewalt vs Messiah
Bonyth vs Mihu
TerrOr vs XuanXuan
eOnzErG vs Messiah
Jaystar vs Mihu
Dewalt vs XuanXuan
Bonyth vs TerrOr
Replay Cast
3 days
WardiTV Weekly
4 days
Sparkling Tuna Cup
5 days
Douyu Cup 2020
6 days
Oliveira vs Trap
Jieshi vs XY
soO vs FanTaSy
TY vs Coffee
Liquipedia Results

Completed

Proleague 2026-06-16
uThermal 2v2 2026 Main Event
Heroes Pulsing #1

Ongoing

IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
CSCL: Masked Kings S4
YSL S3
BSL 22 Non-Korean Championship
SCTL 2026 Spring
Maestros of the Game 2
WardiTV Spring 2026
Murky Cup 2026
Heroes Pulsing #2
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026

Upcoming

CSL 2026 Summer (S21)
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
Douyu Cup 2026
BCC 2026
Heroes Pulsing #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 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.