• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 05:24
CET 11:24
KST 19:24
  • 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 Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
RSL Offline Finals Info - Dec 13 and 14! StarCraft Evolution League (SC Evo Biweekly) RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread The Perfect Game Path of Exile
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
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1778 users

The Big Programming Thread - Page 546

Forum Index > General Forum
Post a Reply
Prev 1 544 545 546 547 548 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
November 12 2014 20:18 GMT
#10901
My problem is that you're trading off readability for compiler debugging. Since we spent 2 pages talking about the Hungarian notation I would still prefer x == false to false == x because reading x is false is much more intuitive than false is x.
There is no one like you in the universe.
MysteryMeat1
Profile Blog Joined June 2011
United States3292 Posts
November 12 2014 20:43 GMT
#10902
So i started learning ruby on my own and was doing just a basic 9 hour course to introduce syntax and stuff one of the erros that I ran into in this code

+ Show Spoiler +

print "Gimme the string boy:"
user_input = gets.chomp.downcase!
if user_input.include? "s"
user_input.gsub!(/s/, "th")
else
puts "no 's' in your string"
end
puts "adios, #{user_input}!"


was that if i put in a lower case string it would give an error that said include? not defined which didn't make any sense to me but it would work if the string was uppercase to begin with. Am i gonna learn why this occurs later or am i missing something basic?
"Cause ya know, Style before victory." -The greatest mafia player alive
supereddie
Profile Joined March 2011
Netherlands151 Posts
November 12 2014 21:19 GMT
#10903
Just use google to find the answer?

+ Show Spoiler +

http://www.ruby-doc.org/core-2.1.4/String.html#method-i-downcase-21
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Alzadar
Profile Blog Joined April 2010
Canada5009 Posts
November 12 2014 21:25 GMT
#10904
Ugh Ruby.

mystery = 4

def mystery
return 2
end

puts mystery
I am the Town Medic.
MysteryMeat1
Profile Blog Joined June 2011
United States3292 Posts
November 13 2014 00:32 GMT
#10905
On November 13 2014 06:19 supereddie wrote:
Just use google to find the answer?

+ Show Spoiler +

http://www.ruby-doc.org/core-2.1.4/String.html#method-i-downcase-21


I don't think thats quite it, the downcase method works and prints out a downcase version of my string and then goes through the program correctly. Its when my string is already downcased that I get an error and nothing happens.
"Cause ya know, Style before victory." -The greatest mafia player alive
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-11-13 01:35:52
November 13 2014 01:25 GMT
#10906
On November 13 2014 09:32 MysteryMeat1 wrote:
Show nested quote +
On November 13 2014 06:19 supereddie wrote:
Just use google to find the answer?

+ Show Spoiler +

http://www.ruby-doc.org/core-2.1.4/String.html#method-i-downcase-21


I don't think thats quite it, the downcase method works and prints out a downcase version of my string and then goes through the program correctly. Its when my string is already downcased that I get an error and nothing happens.


What happens if you put this after downcasing your string and before the rest of the code?


unless user_input.nil?


Obviously, you'll need an end there too
Time is precious. Waste it wisely.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
November 13 2014 01:32 GMT
#10907
On November 13 2014 03:25 sabas123 wrote:
(false == somevar) makes no logical sense in normal langauges?

(false == somevar) can make sense in some situations where you're similar sanity checks at the start of functions and the operand is predictable. Instead of having to read
if(somevar == 
before I get to the actual information I care about on that line I can simply read
if(condition
and know what the rest of the line will be.

Just playing devil's advocate, though I have run into this pattern from time to time when contributing to open source javascript libraries.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
November 13 2014 01:37 GMT
#10908
On November 13 2014 06:25 Alzadar wrote:
Ugh Ruby.

mystery = 4

def mystery
return 2
end

puts mystery

Ruby looks for variables first, then functions.

You should never have variables with the same name as functions within the same scope.
Also, no need for the return keyword.
phar
Profile Joined August 2011
United States1080 Posts
November 13 2014 01:44 GMT
#10909
yoda code is not useful unless your coding environment has shit static analysis that won't catch assignment errors.

If you have shit static checking that won't catch assignment errors, first see if that can be improved, because it will catch other things which yoda code doesn't help.
Who after all is today speaking about the destruction of the Armenians?
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
November 13 2014 01:46 GMT
#10910
On November 13 2014 05:43 MysteryMeat1 wrote:
So i started learning ruby on my own and was doing just a basic 9 hour course to introduce syntax and stuff one of the erros that I ran into in this code

+ Show Spoiler +

print "Gimme the string boy:"
user_input = gets.chomp.downcase!
if user_input.include? "s"
user_input.gsub!(/s/, "th")
else
puts "no 's' in your string"
end
puts "adios, #{user_input}!"


was that if i put in a lower case string it would give an error that said include? not defined which didn't make any sense to me but it would work if the string was uppercase to begin with. Am i gonna learn why this occurs later or am i missing something basic?


downcase!
returns nil if it doesn't change anything (if the string is all lowercase already).
You're also assigning results of destructive (bang!) operations to variables when you appear to be expecting the results of the non-destructive versions.

Here's a simplified version that utilizes destructive methods:
user_input = gets.chomp.downcase
puts "no 's's' in your string." unless user_input.gsub!(/s/, "th")
puts "adios, #{user_input}!"
ThatGuy
Profile Blog Joined April 2008
Canada695 Posts
Last Edited: 2014-11-13 02:30:50
November 13 2014 02:30 GMT
#10911
I've actually seen (false == somevar) before and found that curious, and asked the person why that was their style. They told me that writing the statement in that order can force the compiler to prevent a potential logical error due to a typo. For example, writing (somevar = false) instead of (somevar == false) will still compile, unlike (false = somevar).

EDIT: Yerch, apparently already been said >_>
nunez
Profile Blog Joined February 2011
Norway4003 Posts
November 13 2014 03:07 GMT
#10912
the function overload type_trait trick appears and is explained here ~4.09. even incoorporates ellipsis to get default behaviour, that's pretty nifty.
conspired against by a confederacy of dunces.
ZenithM
Profile Joined February 2011
France15952 Posts
Last Edited: 2014-11-13 03:07:48
November 13 2014 03:07 GMT
#10913
Does someone here know of cheap solutions for personal cloud computing with by hour pricing and which can provide at least 8 (better with 16) cores, and more than 30 GB of RAM? I looked at Google Computing Platform, Amazon EC2 and stuff like that, does anyone have feedback on that?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
November 13 2014 03:14 GMT
#10914
On November 13 2014 12:07 ZenithM wrote:
Does someone here know of cheap solutions for personal cloud computing with by hour pricing and which can provide at least 8 (better with 16) cores, and more than 30 GB of RAM? I looked at Google Computing Platform, Amazon EC2 and stuff like that, does anyone have feedback on that?


http://azure.microsoft.com/en-us/pricing/details/cloud-services/

not cheap but if you want ram and 16 cores
There is no one like you in the universe.
ZenithM
Profile Joined February 2011
France15952 Posts
November 13 2014 03:30 GMT
#10915
Oh yeah, I forgot Azure, I did check that, but thank you.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
November 13 2014 03:37 GMT
#10916
ah, check https://www.digitalocean.com/pricing/ too then
There is no one like you in the universe.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
November 13 2014 04:58 GMT
#10917
On November 13 2014 12:07 ZenithM wrote:
Does someone here know of cheap solutions for personal cloud computing with by hour pricing and which can provide at least 8 (better with 16) cores, and more than 30 GB of RAM? I looked at Google Computing Platform, Amazon EC2 and stuff like that, does anyone have feedback on that?


Amazon EC2 and S3 services are decent.
Time is precious. Waste it wisely.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
November 13 2014 05:17 GMT
#10918
Spot EC2 instances are the cheapest per power, but they can cease to exist at any point in time as supply/demand fluctuates.

If you're doing distributed fault tolerant computing with like a Spark cluster or something then Spot instances can be the way to go.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
November 13 2014 05:21 GMT
#10919
Depending on what you're trying to do and how much 'ops' work you want to do Digital Ocean could be a good option, the setup is super easy and you can add/remove resources from a 'droplet' without having to power it down.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
November 13 2014 08:45 GMT
#10920
Have any of you tried Rust yet? Looks pretty awesome at first glance.
Time is precious. Waste it wisely.
Prev 1 544 545 546 547 548 1032 Next
Please log in or register to reply.
Live Events Refresh
The PondCast
10:00
Episode 74
CranKy Ducklings25
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 153
ProTech51
StarCraft: Brood War
Britney 27305
GuemChi 1411
Horang2 1168
actioN 531
Jaedong 449
BeSt 356
Mini 274
firebathero 273
EffOrt 209
Hyuk 158
[ Show more ]
Dewaltoss 149
Light 102
Hyun 100
Killer 89
Pusan 89
Sharp 86
Snow 80
Last 76
Larva 61
hero 61
Barracks 52
Rush 49
ggaemo 48
Shine 45
Sacsri 44
sorry 40
ToSsGirL 29
ZerO 19
soO 18
Noble 17
Shinee 14
Bale 14
NaDa 11
Hm[arnc] 5
Dota 2
NeuroSwarm91
League of Legends
JimRising 411
C9.Mang0218
Reynor75
Counter-Strike
olofmeister1409
shoxiejesuss638
Super Smash Bros
Westballz11
Other Games
summit1g12111
ceh9596
WinterStarcraft546
Happy407
crisheroes386
Mew2King50
KnowMe40
ZerO(Twitch)3
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 604
Other Games
gamesdonequick506
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• LUISG 30
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota256
League of Legends
• Jankos1904
Upcoming Events
OSC
5h 36m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
13h 36m
Korean StarCraft League
1d 16h
CranKy Ducklings
1d 23h
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
2 days
WardiTV 2025
3 days
[ Show More ]
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
3 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 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.