• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:12
CEST 06:12
KST 13:12
  • 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
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles2[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
The GOAT ranking of GOAT rankings The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site Flash Announces Hiatus From ASL
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Summer Games Done Quick 2025! Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
momentary artworks from des…
tankgirl
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 644 users

The Big Programming Thread - Page 677

Forum Index > General Forum
Post a Reply
Prev 1 675 676 677 678 679 1031 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
Spain17971 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
Hyrule19031 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
Poland17244 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 5h 48m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 182
ProTech59
StarCraft: Brood War
GuemChi 1080
Leta 419
MaD[AoV]41
PianO 38
Bale 15
Icarus 9
Dota 2
monkeys_forever810
League of Legends
JimRising 789
Counter-Strike
Stewie2K246
Super Smash Bros
Mew2King216
Other Games
summit1g10181
WinterStarcraft345
Maynarde153
SortOf102
NeuroSwarm59
Organizations
Other Games
gamesdonequick43598
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH324
• practicex 28
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo679
Other Games
• Scarra2306
• Shiphtur270
Upcoming Events
Sparkling Tuna Cup
5h 48m
WardiTV European League
11h 48m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
19h 48m
The PondCast
1d 5h
WardiTV European League
1d 7h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 11h
Replay Cast
1d 19h
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
2 days
RSL Revival
3 days
Classic vs Cure
[ Show More ]
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
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
IEM Cologne 2025
FISSURE Playground #1
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.