The Big Programming Thread - Page 546
| Forum Index > General Forum |
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
Canada3710 Posts
| ||
|
MysteryMeat1
United States3292 Posts
+ 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? | ||
|
supereddie
Netherlands151 Posts
+ Show Spoiler + | ||
|
Alzadar
Canada5009 Posts
mystery = 4 | ||
|
MysteryMeat1
United States3292 Posts
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. | ||
|
Manit0u
Poland17496 Posts
On November 13 2014 09:32 MysteryMeat1 wrote: 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?
Obviously, you'll need an end there too ![]() | ||
|
CatNzHat
United States1599 Posts
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(conditionand 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
United States1599 Posts
On November 13 2014 06:25 Alzadar wrote: Ugh Ruby. mystery = 4 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
United States1080 Posts
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. | ||
|
CatNzHat
United States1599 Posts
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 | ||
|
ThatGuy
Canada695 Posts
EDIT: Yerch, apparently already been said >_> | ||
|
nunez
Norway4003 Posts
| ||
|
ZenithM
France15952 Posts
| ||
|
Blisse
Canada3710 Posts
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 | ||
|
ZenithM
France15952 Posts
| ||
|
Blisse
Canada3710 Posts
| ||
|
Manit0u
Poland17496 Posts
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. | ||
|
CatNzHat
United States1599 Posts
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
United States1599 Posts
| ||
|
Manit0u
Poland17496 Posts
| ||
| ||
