• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:27
CEST 06:27
KST 13:27
  • 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
TL.net Map Contest #21: Voting7[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Weekly Cups (Oct 6-12): Four star herO65.0.15 Patch Balance Hotfix (2025-10-8)79Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition325.0.15 Balance Patch Notes (Live version)119
StarCraft 2
General
Revisiting the game after10 years and wow it's bad 5.0.15 Patch Balance Hotfix (2025-10-8) TL.net Map Contest #21: Voting How to Block Australia, Brazil, Singapore Servers The New Patch Killed Mech!
Tourneys
RSL Offline Finals Dates + Ticket Sales! SC4ALL $6,000 Open LAN in Philadelphia Crank Gathers Season 2: SC II Pro Teams LiuLi Cup - September 2025 Tournaments Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
External Content
Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More
Brood War
General
Question regarding recent ASL Bisu vs Larva game BW General Discussion [Interview] Grrrr... 2024 BW caster Sayle Map with fog of war removed for one player?
Tourneys
[ASL20] Semifinal B [Megathread] Daily Proleagues [ASL20] Semifinal A SC4ALL $1,500 Open Bracket LAN
Strategy
Current Meta Relatively freeroll strategies BW - ajfirecracker Strategy & Training Siegecraft - a new perspective
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread ZeroSpace Megathread Path of Exile
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Men's Fashion Thread Sex and weight loss
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
[Manga] One Piece Series you have seen recently... Anime Discussion Thread Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Inbreeding: Why Do We Do It…
Peanutsc
From Tilt to Ragequit:The Ps…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1710 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
Spain18089 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
Hyrule19141 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
Poland17378 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 6h 33m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nathanias 183
RuFF_SC2 172
Nina 116
StarCraft: Brood War
PianO 260
Noble 41
Bale 21
Icarus 9
NotJumperer 2
League of Legends
JimRising 738
Counter-Strike
Stewie2K586
PGG 219
Coldzera 34
Other Games
summit1g8932
gofns3418
C9.Mang0340
Mew2King61
Models3
Organizations
Other Games
gamesdonequick3422
Counter-Strike
PGL212
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH156
• practicex 15
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV761
League of Legends
• Rush1277
Upcoming Events
Wardi Open
6h 33m
CranKy Ducklings
1d 5h
Safe House 2
1d 12h
Sparkling Tuna Cup
2 days
Safe House 2
2 days
Tenacious Turtle Tussle
5 days
The PondCast
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 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.