• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 19:15
CEST 01:15
KST 08:15
  • 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
[ASL22] Ro16 Preview: Rough Waters10[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244
Community News
StarCraft open world shooter announced at BlizzCon43Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism10Official StarCraft website teases new content ahead of BlizzCon?158Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3
StarCraft 2
General
StarCraft open world shooter announced at BlizzCon Balance hotfix patch 5.0.16b (July 16) Team Liquid Map Contest #22: Results and Winners Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism SC4ALL: II Winner will earn a spot at HSC 30!
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 KSL Week #92 IntoTheTV X SOOP SC2 League : Weekly & Monthly 2026 GSTL Announcement Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 542 The Ascended Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Official StarCraft website teases new content ahead of BlizzCon? Broodwar Prediction Market Practice Partners (Official) [D] Brainstorming a balance patch for Brood war
Tourneys
[ASL22] Ro16 Group A [ASL22] Ro16 Group B Escore Tournament - Season 3 Small VOD Thread 2.0
Strategy
Replay Review Process - What do you do? Simple Questions, Simple Answers Odyssey Mineral Stack Saturation Game Theory for Starcraft
Other Games
General Games
EVE Corporation Diablo IV Nintendo Switch Thread [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread UK Politics Mega-thread Things Aren’t Peaceful in Palestine Trading/Investing Thread Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Diablo Animated Series on Netflix Movie Discussion!
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Virtual Romance, Real-Life C…
TrAiDoS
Regacy Esports:Our Goa…
regacyesports
Dreaming of BW patches (mod…
c3rberUs
LOCKPICKING NOOB
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 7316 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
Poland17843 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
Poland17843 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
Poland17843 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
OSC
20:30
Masters Cup #151
davetesta59
Liquipedia
AI Arena Tournament
17:00
Swiss - Round 1
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 442
Nina 113
ViBE105
StarCraft: Brood War
Britney 13939
Artosis 559
NaDa 43
Dota 2
monkeys_forever326
canceldota55
LuMiX2
League of Legends
Doublelift7506
JimRising 476
Counter-Strike
fl0m4289
Coldzera 1413
minikerr85
Super Smash Bros
C9.Mang0292
Chillindude16
Heroes of the Storm
Liquid`Hasu758
Other Games
summit1g10374
B2W.Neo943
RotterdaM293
XaKoH 187
Trikslyr59
Organizations
Heroes of the Storm
Heroes of the Storm2257
StarCraft 2
StarCraft886
StarCraft: Brood War
Afreeca ASL 527
Other Games
BasetradeTV211
[ Show 12 non-featured ]
StarCraft 2
• Hupsaiya 95
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• HerbMon 21
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota21625
Other Games
• imaqtpie851
Upcoming Events
Sparkling Tuna Cup
10h 45m
WardiTV Invitational
11h 45m
ByuN vs Percival
Cure vs Classic
Shopify Rebellion Sundays
15h 45m
Spirit vs Mixu
Clem vs TBD
RSL Revival
16h 45m
Serral vs Rogue
BlizzCon
19h 15m
IdrA vs MC
Replay Cast
1d
Afreeca Starleague
1d 10h
Light vs JyJ
Soulkey vs hero
WardiTV Weekly
1d 11h
Monday Night Weeklies
1d 16h
Afreeca Starleague
2 days
Snow vs Shinee
Shine vs EffOrt
[ Show More ]
GSL
2 days
PiGosaur Cup
3 days
The PondCast
3 days
Kung Fu Cup
3 days
Replay Cast
4 days
KCM Race Survival
4 days
IntoTheTV X SOOP
4 days
Replay Cast
5 days
IntoTheTV X SOOP
5 days
Replay Cast
6 days
GSL
6 days
Liquipedia Results

Completed

Acropolis #5 - TRS
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
RSL Revival: Season 6
Calamity Invitational
FISSURE Playground #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

Upcoming

Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Blizzard Classic Cup 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 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.