• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 18:43
CET 00:43
KST 08:43
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)15Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1832
StarCraft 2
General
SC2 All-Star Invitational: Jan 17-18 Stellar Fest "01" Jersey Charity Auction Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets When will we find out if there are more tournament SC2 Spotted on the EWC 2026 list?
Tourneys
OSC Season 13 World Championship SC2 AI Tournament 2026 Sparkling Tuna Cup - Weekly Open Tournament $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) $25,000 Streamerzone StarCraft Pro Series announced
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
BW General Discussion [ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ A cwal.gg Extension - Easily keep track of anyone Potential ASL qualifier breakthroughs?
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Awesome Games Done Quick 2026! Beyond All Reason Nintendo Switch Thread Mechabellum Stormgate/Frost Giant Megathread
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
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2148 users

The Big Programming Thread - Page 719

Forum Index > General Forum
Post a Reply
Prev 1 717 718 719 720 721 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.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2016-04-15 07:12:38
April 15 2016 07:09 GMT
#14361
idk, I used to think exactly like that until I realized that's a stupid way of thinking about it. Just because the language looks similar shouldn't imply that previous ideas from other languages should map onto the new language. If it does, then yay, if it doesn't then sure, it's not the same language, what should I actually be doing? Just remember the first time you learned a language. You knew nothing and made assumptions and had them proven true or false. Now you know stuff that may or may not be relevant to the language, just because some of your assumptions work doesn't mean that they all will.

Essentially it's really our fault when we make implicit assumptions about a language's api calls based off of our own models of what api calls should look like from other languages.

I thought like you did too and circle jerked around Javascript being shitty until I actually used it more than in passing. Eh, it's just like any other language's idiosyncrasies.
There is no one like you in the universe.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
April 15 2016 08:25 GMT
#14362
On April 15 2016 16:09 Blisse wrote:
idk, I used to think exactly like that until I realized that's a stupid way of thinking about it. Just because the language looks similar shouldn't imply that previous ideas from other languages should map onto the new language. If it does, then yay, if it doesn't then sure, it's not the same language, what should I actually be doing? Just remember the first time you learned a language. You knew nothing and made assumptions and had them proven true or false. Now you know stuff that may or may not be relevant to the language, just because some of your assumptions work doesn't mean that they all will.

Essentially it's really our fault when we make implicit assumptions about a language's api calls based off of our own models of what api calls should look like from other languages.

I thought like you did too and circle jerked around Javascript being shitty until I actually used it more than in passing. Eh, it's just like any other language's idiosyncrasies.


Pretty much that.

JavaScript isn't actually terrible. It has a terrible reputation because of different browser implementations and such, but as a language it's actually pretty nice, just very different. It's much closer to languages like Perl or even Lisp than to "classic" languages like C++.

I used to hate JavaScript with a passion, but the more I accepted it as a language that just requires a different mindset, the more I saw some of the advantages it had. Of course there are still some things I don't like about it, every language has it's problems, but by now I prefer it to PHP by a large margin.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2016-04-15 08:36:46
April 15 2016 08:35 GMT
#14363
--- Nuked ---
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
April 15 2016 09:24 GMT
#14364
On April 15 2016 17:35 Nesserev wrote:
There are some things that I like about JavaScript, but there are a lot more things that I hate about it... it really is a shitty language as a whole, but it's a necessary evil if you ever wanna touch a browser, and you can circumvent most shitty things. The worst things that you constantly have to watch out for, are:
- hoisting
- implicit global variables
- only function-scope, no block-scope

There's also the lack of const'ness outside of declaring constant variables, but this is a problem for a lot of languages. Outside of those few things, it's actually an okay language in my opinion.


The first two are the result of poor programming, the function scope is true, though it's not really a problem imho since you'll want to make heavy use of functions and lambdas anyways, e.g. you don't use a for loop but a forEach method that executes a function on each element, so blocks aren't really that relevant.

For global variables you'll want to use the module pattern, which is essentially just

(function(){
// code here
})();

(function(globalVar){
// code using globalVar here
})(globalVar);

// common use:
(function($){
// $ is now always jQuery with no conflict with other libraries using the $ variable
})(jQuery);


That way all variables are scoped inside the module and don't affect the outside unless you use global variables that were defined outside the module.

The one thing that is annoying about JavaScript and even more Node.JS is the potential for callback hell, though there are also methods to avoid or at least reduce that.
BisuDagger
Profile Blog Joined October 2009
Bisutopia19300 Posts
April 15 2016 11:59 GMT
#14365
Are the any unity guys out there who have successful used multiple displays for a game? I need display 1 to be on one monitor and display two on another monitor. I have extensively researched for answers on this and found none.
ModeratorFormer Afreeca Starleague Caster: http://afreeca.tv/ASL2ENG2
Cyx.
Profile Joined November 2010
Canada806 Posts
Last Edited: 2016-04-15 14:34:56
April 15 2016 14:33 GMT
#14366
On April 15 2016 17:35 Nesserev wrote:
There are some things that I like about JavaScript, but there are a lot more things that I hate about it... it really is a shitty language as a whole, but it's a necessary evil if you ever wanna touch a browser, and you can circumvent most shitty things. The worst things that you constantly have to watch out for, are:
- hoisting
- implicit global variables
- only function-scope, no block-scope

There's also the lack of const'ness outside of declaring constant variables, but this is a problem for a lot of languages. Outside of those few things, it's actually an okay language in my opinion.

Well at least ES6 makes two of those problems go away :D and implicit globals aren't possible with 'use strict' either.

edit:
On April 15 2016 18:24 Morfildur wrote:
The first two are the result of poor programming

Disagree strongly that implicit globals hurt you because of 'poor programming' - if you consider 'making typos' to be 'poor programming' I don't think I want to work with you
supereddie
Profile Joined March 2011
Netherlands151 Posts
April 15 2016 16:17 GMT
#14367
On April 15 2016 07:31 Manit0u wrote:
Show nested quote +
On April 13 2016 16:20 supereddie wrote:
On April 12 2016 10:03 Manit0u wrote:

Speaking of DB queries and all... Do you think it would be possible to turn this into a query (PostgreSQL)?


$string = 'AB.6740.D.336.2011.AP';
$regex = '/\.(\D)\./';
$alphabet = range('a', 'z');

preg_match($regex, $string, $matches);

if (!empty($matches)) {
$letter = strtolower($matches[1]);
$num = array_search($letter, $alphabet) + 1;

$string = preg_replace($regex, sprintf('.%d.', $num), $string);
}

echo $string;


This would have to update all the rows of course. The things I have to deal with...

I know that you can do WHERE field *~ '\.(\D)\.', but I'm not sure you can do replaces with regex.

Well, if it is a one-time thing you can just write out the update and do 26 replaces...


The thing is, I need to update over 120k rows in the db, replacing all .[LETTER]. patterns with the corresponding number.

Well, if the pattern is consistent and you're really desperate:

update table set column = left(column, 4) +
case charAt(column, 5)
when '0' then 'A'
when '1' then 'B'
when '2' then 'C'
when '3' then 'D'
...
end +
case charAt(column, 6)
when '0' then 'A'
when '1' then 'B'
when '2' then 'C'
when '3' then 'D'
...
end + ... + ...

I am unfamiliar with PostgreSQL syntax, but this is doable in MS SQL
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Manit0u
Profile Blog Joined August 2004
Poland17603 Posts
April 15 2016 17:27 GMT
#14368
On April 16 2016 01:17 supereddie wrote:
Show nested quote +
On April 15 2016 07:31 Manit0u wrote:
On April 13 2016 16:20 supereddie wrote:
On April 12 2016 10:03 Manit0u wrote:

Speaking of DB queries and all... Do you think it would be possible to turn this into a query (PostgreSQL)?


$string = 'AB.6740.D.336.2011.AP';
$regex = '/\.(\D)\./';
$alphabet = range('a', 'z');

preg_match($regex, $string, $matches);

if (!empty($matches)) {
$letter = strtolower($matches[1];
$num = array_search($letter, $alphabet) + 1;

$string = preg_replace($regex, sprintf('.%d.', $num), $string);
}

echo $string;


This would have to update all the rows of course. The things I have to deal with...

I know that you can do WHERE field *~ '\.(\D)\.', but I'm not sure you can do replaces with regex.

Well, if it is a one-time thing you can just write out the update and do 26 replaces...


The thing is, I need to update over 120k rows in the db, replacing all .[LETTER]. patterns with the corresponding number.

Well, if the pattern is consistent and you're really desperate:

update table set column = left(column, 4) +
case charAt(column, 5)
when '0' then 'A'
when '1' then 'B'
when '2' then 'C'
when '3' then 'D'
...
end +
case charAt(column, 6)
when '0' then 'A'
when '1' then 'B'
when '2' then 'C'
when '3' then 'D'
...
end + ... + ...

I am unfamiliar with PostgreSQL syntax, but this is doable in MS SQL


The pattern is consistent but the ".A." stuff won't be at the same spot all the time since everything inbetween the dots is variable and depends on gazillion things.
Time is precious. Waste it wisely.
Erasme
Profile Blog Joined February 2011
Bahamas15899 Posts
Last Edited: 2016-04-16 02:53:22
April 16 2016 02:31 GMT
#14369
i am sure i will figure eveyrthing out
its pretty basic
https://www.youtube.com/watch?v=d7lxwFEB6FI “‘Drain the swamp’? Stupid saying, means nothing, but you guys loved it so I kept saying it.”
lilwisper
Profile Joined April 2010
United States2515 Posts
Last Edited: 2016-04-16 02:47:26
April 16 2016 02:42 GMT
#14370
Okay I am 99% through this bit of a batch file for changing the default folders in Sketchup 2016. The batch file changes several registry values. For sake of focus I am just placing the 1% that I am having trouble with in the following code block:



set key="HKCU\Software\Sketchup\Sketchup 2016\File Locations"

set sketchpart1=%USERPROFILE%

set sketchpart1=%sketchpart1:\=\\%

set sketchloc2="\"%sketchpart1%\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\""

reg add %key% /v Classifications /d %sketchloc2% /f



Now if you run this in a batch, it changes the key just fine, no syntax errors or such. However if you open Sketchup 2016, you get an error saying that there is trouble with one of the default paths. After you go to the place it points to, you see one of the paths surrounded in red. Inspection of the offending path shows as:

"C_\users\lilwisper\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Classifications\

I know I have to change the set sketchloc2 portion of my code, I just can't think of the way to change it to make it appear properly inside of Sketchup 2016.
Ropid
Profile Joined March 2009
Germany3557 Posts
Last Edited: 2016-04-16 12:17:44
April 16 2016 09:44 GMT
#14371
In what you see, I don't know where the "_" comes from instead of ":". The text it builds should be this:

\"C:\\user\\lilwisper\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\"


The question I have is, is this correct with all those \" and \\ instead of just " and \?

You can play with all of this on the command line prompt. Like, you can do this here:

> echo %USERPROFILE%
C:\users\lilwisper

> echo %USERPROFILE:\=\\%
C:\\users\\lilwisper

> echo "%USERPROFILE%"
"C:\users\lilwisper"

> echo "\"%USERPROFILE:\=\\%\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\""
"\"C:\\users\\lilwisper\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\""


What I wonder is, are you sure you don't want just this here:

> echo "%USERPROFILE%\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Classifications"               
"C:\users\lilwisper\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Classifications"


You could also take a look at what 'reg query' outputs after you have manually set up the path in SketchUp's menus, to compare with what you are trying to do in your batch file. I think it would be this:

> set key="HKCU\Software\Sketchup\Sketchup 2016\File Locations"

> reg query %key% /v Classifications
"My goal is to replace my soul with coffee and become immortal."
lilwisper
Profile Joined April 2010
United States2515 Posts
April 16 2016 11:15 GMT
#14372
On April 16 2016 18:44 Ropid wrote:
In what you see, I don't know where the "_" comes from instead of ":". The text it builds should be this:

\"C:\\user\\lilwisper\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\"


The question I have is, is this correct with all those \" and \\ instead of just " and \?

You can play with all of this on the command line prompt. Like, you can do this here:

> echo %USERPROFILE%
C:\users\lilwisper

> echo %USERPROFILE:\=\\%
C:\\users\\lilwisper


> echo "%USERPROFILE%"
"C:\users\lilwisper"

> echo "\"%USERPROFILE:\=\\%\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\""
"\"C:\\users\\lilwisper\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Classifications\""

What I wonder is, are you sure you don't want just this here:

> echo "%USERPROFILE%\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Classifications"               
"C:\users\lilwisper\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Classifications"


You could also take a look at what 'reg query' outputs after you have manually set up the path in SketchUp's menus, to compare with what you are trying to do in your batch file. I think it would be this:

> set key="HKCU\Software\Sketchup\Sketchup 2016\File Locations"

> reg query %key% /v Classifications
[/code]

As far as I read online, the string the current code builds is the one needed to have it pass the reg command correctly. It is due to the space in the path. The slashes and quotes all need to be escaped so that the string builds properly.
xtorn
Profile Blog Joined December 2013
4060 Posts
April 16 2016 19:44 GMT
#14373
<3 good times

+ Show Spoiler +
Life - forever the Legend in my heart
waffelz
Profile Blog Joined June 2012
Germany711 Posts
Last Edited: 2016-04-17 20:36:16
April 17 2016 20:32 GMT
#14374
...Here I sit, explaining a 4.th semester computer science student why

Classname1.doSomethingWhichAccessesAttributes();

doesn't work, only to get asked by the same student just a bit later why

Classname1 myClass = Classname2.doSomethingWhichAccessesAttributes();

doesn’t work...

I am not a big fan of java myself, but at least it saves me from always answering the same questions regarding pointers and references... and this particularly mistake has nothing to do with any of javas quirks.
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
solidbebe
Profile Blog Joined November 2010
Netherlands4921 Posts
April 17 2016 20:40 GMT
#14375
Hmm, if for some reason your programme doesnt really teach any OOP I can get why a student would into static vs instance confusion. If you do get OOP stuff then that guy is one of those few students who arent capable of anything but still manage to stick around somehow .
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
waffelz
Profile Blog Joined June 2012
Germany711 Posts
April 17 2016 20:45 GMT
#14376
He had OOP since the very first semester
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
Wrath
Profile Blog Joined July 2014
3174 Posts
April 17 2016 20:49 GMT
#14377
On April 18 2016 05:40 solidbebe wrote:
Hmm, if for some reason your programme doesnt really teach any OOP I can get why a student would into static vs instance confusion. If you do get OOP stuff then that guy is one of those few students who arent capable of anything but still manage to stick around somehow .


... I was like him one day... But now I get it...
Acrofales
Profile Joined August 2010
Spain18185 Posts
April 18 2016 01:17 GMT
#14378
On April 18 2016 05:45 waffelz wrote:
He had OOP since the very first semester

Hit him over the head with an object and tell him you couldn't do that if you were static
lilwisper
Profile Joined April 2010
United States2515 Posts
April 18 2016 02:31 GMT
#14379
On April 18 2016 10:17 Acrofales wrote:
Show nested quote +
On April 18 2016 05:45 waffelz wrote:
He had OOP since the very first semester

Hit him over the head with an object and tell him you couldn't do that if you were static


I have to laugh at this one. Good example. Lol
waffelz
Profile Blog Joined June 2012
Germany711 Posts
April 18 2016 07:35 GMT
#14380
On April 18 2016 10:17 Acrofales wrote:
Show nested quote +
On April 18 2016 05:45 waffelz wrote:
He had OOP since the very first semester

Hit him over the head with an object and tell him you couldn't do that if you were static


Already did that to a fellow student of his. Doesn’t really help them with understanding the problem but it helps myself a lot… Can highly recommend this to keep your insanity to normal levels while tutoring/lecturing.
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
Prev 1 717 718 719 720 721 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 12h 17m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft417
WinterStarcraft332
White-Ra 183
SpeCial 131
StarCraft: Brood War
Shuttle 198
910 32
HiyA 10
League of Legends
C9.Mang0206
Super Smash Bros
Chillindude11
Other Games
tarik_tv15679
gofns8779
summit1g5136
Grubby2361
FrodaN1079
shahzam432
Liquid`Hasu225
XaKoH 131
Maynarde84
KnowMe42
minikerr15
ViBE4
Organizations
Other Games
gamesdonequick2459
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 21 non-featured ]
StarCraft 2
• davetesta49
• RyuSc2 41
• musti20045 35
• Hupsaiya 34
• Kozan
• Migwel
• sooper7s
• AfreecaTV YouTube
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• blackmanpl 61
• RayReign 27
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21232
League of Legends
• Doublelift4809
Other Games
• imaqtpie2161
• Scarra790
• Shiphtur171
Upcoming Events
OSC
12h 17m
SKillous vs ArT
ArT vs Babymarine
NightMare vs TriGGeR
YoungYakov vs TBD
All Star Teams
1d 2h
INnoVation vs soO
Serral vs herO
Cure vs Solar
sOs vs Scarlett
Classic vs Clem
Reynor vs Maru
uThermal 2v2 Circuit
1d 12h
AI Arena Tournament
1d 20h
All Star Teams
2 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
2 days
OSC
2 days
Replay Cast
3 days
Wardi Open
3 days
Monday Night Weeklies
3 days
[ Show More ]
The PondCast
5 days
Liquipedia Results

Completed

Proleague 2026-01-14
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
OSC Championship Season 13
Underdog Cup #3
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025

Upcoming

Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
SC2 All-Star Inv. 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 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.