Inspired by this discussion, after some googling I wasn't able to find an answer to a pretty simple question regarding methods in Ruby: are methods objects or not?
There are different opinions here and there, and I would really like to hear, let's say, an in-depth explanation.
I'm aware of Object#method method, which takes a method nam...
When I try rake db:migrate, I get the following error:
The bundled mysql.rb driver has been removed from Rails 2.2.
Please install the mysql gem and try again: gem install mysql.
rake aborted! no such file to load -- mysql
And when I try to gem install mysql
Building native extensions. This could take a while... ERROR: Error installi...
I have a bunch of string with special escape codes that I want to store unescaped- eg, the interpreter shows
"\\014\"\\000\"\\016smoothing\"\\011mean\"\\022color\"\\011zero@\\016"
but I want it to show (when inspected) as
"\014\"\000\"\016smoothing\"\011mean\"\022color\"\011zero@\016"
What's the method to unescape them? I imagine that ...
I want to log into https://www.t-mobile.com/ programmatically. My first idea was to use Mechanize to submit the login form:
However, it turns out that this isn't even a real form. Instead, when you click "Log in" some javascript grabs the values of the fields, creates a new form dynamically, and submits it.
"Log in" button HTML:
<bu...
I'll be taking a trip soon with my iPad, without my laptop. I'd like to continue to tinker with Ruby while I'm on the road. I have an iPhone developer program membership, and I'm not interested in submitting this stuff to the app store.
I found the shinycocos project, which appears to embed a Ruby interpreter in an app. But I can't g...
With vim how do I to turn this:
t.string :crypted_password :null => false
t.string :password_salt, :null => false
into this:
t.string :crypted_password, :null => false
t.string :password_salt, :null => false
without manually adding the spaces to each line?
...
I'm using ruby's ai4r gem, building a neural network. Version 1.1 of the gem allowed me to simply do a Marshal.dump(network) to a file, and I could load the network back up whenever I wanted.
With version 1.9 a couple years later, I'm no longer able to do this. It generates this error when I try:
no marshal_dump is defined for class...
I'm trying to understand the best options for pulling off a wizard form in ruby on rails. Ideally I'd like to have it so the application signup has a back and next button that allows the user to submit data in steps.
So in step 1 they could fill out contact info. Once they are done they could click next and be on step 2 to fill out paym...
I have an array of tags per item like so:
item1 = ['new', 'expensive']
item2 = ['expensive', 'lame']
I also have a boolean expression as a string based on possible tags:
buy_it = "(new || expensive) && !lame"
How can I determine if an item matches the buying criteria based on the tags associated with it? My original thought was to ...
What is the best way to write a function (or something DSLish) that will allow me to write this code in Ruby. How would I construct the function write_pair?
username = "tyndall"
write_pair username
# where write_pair username outputs
username: tyndall
Is it possible to do? Looking for the most simple way to do this.
...
I have two Ruby arrays, and I need to see if they have any values in common. I could just loop through each of the values in one array and do include?() on the other, but I'm sure there's a better way. What is it? (The arrays both hold strings.)
Thanks.
...
I am writing my first rails app. It needs to aggregate some data from multiple sites and for each site I have a unique way of getting the data (some provide RSS, some JSON, for some I scrape the HTML etc.). These will run on schedule, probably as a rake task from cron. It seems logical to store the sites and relevant information in a mod...
Hi,
I'm a Delphi developer on the Windows platform, recently read the PHP tutorial at W3CSchools, it looks interesting.
We all know scripting languages are very good at web site development, but I also want to utilize it to improve my productivity or get some tedious tasks done quickly, maybe some quick-and-dirty string/file processin...
I have created two very simple heroku apps to test out the service, but it's often taking several seconds to load the page when I first visit them:
Cropify - Basic Sinatra App (on github)
Textile2HTML - Even more basic Sinatra App (on github)
All I did was create a simple sinatra app and deploy it. I haven't done anything to mess wi...
I'm a beginner in ruby and in programming as well and need help with system call for moving a file from source to destination like this:
system(mv "#{@SOURCE_DIR}/#{my_file} #{@DEST_DIR}/#{file}")
Is it possible to do this in Ruby? If so, what is the correct syntax?
...
I want to call few model methods and send emails through my rake task.
Any help would be apreciated
...
I've been hacking around with Ruby a little and I have been wondering if there is a utility or tool that you can use to determine all the gems that a ruby script requires. Basically, I have been finding it kind of annoying having to work with a ruby script that I didn't write, I don't know all the gem dependencies for, and I don't know ...
I have an array : keys=[["a","a","b"],["a","b","c"]]
I need to find the number of times "a","b","c" occurs in each sub-array of 'keys'.
output could be a hash : ["a"=> [2,1],"b"=>[1,1],"c"=>[0,1]]
...
I'm thinking of one day moving to Japan and I was wondering if anyone here has any experience working there.
I'm curious as to what languages/technology are popular there for web development and software development.
I have heard Ruby is/was strong there due to its founder being Japanese.
What would you recommend someone focus on if t...