• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 18:50
CEST 00:50
KST 07:50
  • 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
[ASL21] Ro8 Preview Pt2: Progenitors2Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event10Code S Season 1 (2026) - RO12 Results02026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Code S Season 1 (2026) - RO12 Results Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid
Tourneys
RSL Revival: Season 5 - Qualifiers and Main Event GSL Code S Season 1 (2026) SC2 INu's Battles#15 <BO.9 2Matches> WardiTV Spring Cup SEL Masters #6 - Solar vs Classic (SC: Evo)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
[ASL21] Ro8 Preview Pt2: Progenitors Why there arent any 256x256 pro maps? BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion
Tourneys
[ASL21] Ro8 Day 2 [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread Daigo vs Menard Best of 10 Diablo IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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 TL Mafia Community Thread Five o'clock TL Mafia
Community
General
European Politico-economics QA Mega-thread US Politics Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1954 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
Poland17743 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
Poland17743 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
Poland17743 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
IPSL
19:00
Ro24 Group F
eOnzErG vs TBD
G5 vs Nesh
Liquipedia
BSL
19:00
RO16 Group B
Bonyth vs Sterling
KwarK vs JDConan
ZZZero.O273
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 192
JuggernautJason118
StarCraft: Brood War
Artosis 478
ZZZero.O 273
NaDa 20
Dota 2
monkeys_forever728
League of Legends
Doublelift3499
JimRising 309
Super Smash Bros
hungrybox494
C9.Mang0470
Mew2King77
Other Games
gofns12486
tarik_tv9805
summit1g7150
Liquid`RaSZi1099
FrodaN1031
UpATreeSC41
Dewaltoss33
NightEnD17
Organizations
Other Games
gamesdonequick1671
Dota 2
PGL Dota 2 - Main Stream47
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• musti20045 25
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie1267
Upcoming Events
Patches Events
1h 10m
Replay Cast
10h 10m
Wardi Open
11h 10m
Afreeca Starleague
11h 10m
Jaedong vs Light
Monday Night Weeklies
17h 10m
Replay Cast
1d 1h
Sparkling Tuna Cup
1d 11h
Afreeca Starleague
1d 11h
Snow vs Flash
WardiTV Invitational
1d 12h
SHIN vs Nicoract
Solar vs Nice
GSL
2 days
Classic vs Cure
Maru vs Rogue
[ Show More ]
GSL
3 days
SHIN vs Zoun
ByuN vs herO
OSC
3 days
OSC
3 days
Replay Cast
4 days
Escore
4 days
The PondCast
4 days
WardiTV Invitational
4 days
Zoun vs Ryung
Lambo vs ShoWTimE
Replay Cast
5 days
CranKy Ducklings
5 days
RSL Revival
5 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
5 days
Krystianer vs TriGGeR
Cure vs Rogue
BSL
5 days
Replay Cast
6 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
6 days
BSL
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
KK 2v2 League Season 1
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W6
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 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.