is that even possible? what I need to pass to mechanize? With what url I can start then?
I cannot manage (so far) to log into one website using mechanize so I was thinking if I can do this little workaround. I believe I can capture all cookies and everything else and then pass it to ruby/mechanize to do the rest ...
screenshots below a...
I'm trying to get simple option handling in my ruby app. Looks like OptionParser does most of what I want, though I can't figure out a way to gracefully handle unexpected arguments.
If any unexpected arguments are provided I want to treat it as if the -h argument was passed (show usage and quit). I'm not seeing any way to handle that ...
I'm using gets to pause my script's output until the user hits the enter key. If I don't pass any arguments to my script then it works fine. However, if I pass any arguments to my script then gets dies with the following error:
ruby main.rb -i
main.rb:74:in `gets': No such file or directory - -i (Errno::ENOENT)
from main.rb:74:in ...
What's the difference between require 'cool_lib' and gem 'cool_lib'?
...
this questions is linked with my other question log in with browser and then ruby/mechanize takes it over?
I am not able (hopefully I will in near future :-) to log into one website using ruby/mechanize so I was thinking if there is any workaround for the log in part. After that I want my script to take over and do its job.
Could some...
looking for something similiar to
http://code.google.com/p/templatemaker/
but for ruby...
basically comparing a variety of sample of random strings (100) and extracting only unique strings...
...
I'm learning Selenium now. I'm going to use it in the Ruby on Rails project. Now I created demo project just to test Selenium on Rails.
Content of #{RAILS_ROOT}/test/selenium/articles/delete_article.rsel is following:
setup :fixtures => :all
open "/articles"
assert_text_present("First Article title")
assert_text_present("Destroy")
c...
Is there any better alternative to this?
name.gsub('è','e').gsub('à','a').gsub('ò','o').gsub('ì','i').gsub('ù','u')
thanks
...
I can accomplish this dynamic nature in other ways, but it caused me to be curious. Is there a similar mechanism to this in Ruby?
$varname = "hello";
$$varname = "world";
echo $hello; //Output: world
...
Historically I have used Thin as an application server (for Ramaze apps, but it could easily be for Rails), which receives requests from an Nginx web server.
Does anyone have experiences between using Thin/Mongrel/anything else to server Ruby applications to a web server? I am keen to keep things lean and fast.
...
I am seeing a very strange issue with a simple controller method. Either I am missing something fundamental or I am encountering a bug. My bet is on the former.
I have a Thing model with a ThingController.
A Thing has two variables, name and display, both strings.
ThingController (code below) has a method toggle_display, that toggles...
I have a Ruby String that contains decimal-containing numbers. What's the best way to convert this into a decimal (fixed-point)?
"Best" means:
Reliable given a wide range of input options
Simple to write
Easy to read
DRY
...in roughly that order.
...
Most of the time the autocomplete feature in VIM works nicely for me, but sometimes it seems to be scanning files which the current file references, and then it becomes painfully slow, sometimes taking several seconds to release focus back to me.
Sometimes VIM tells me simply that it is "Scanning" other times, it's saying "Scanning tags...
Hi,
I'm trying to use the Friendly ORM in combination with Sinatra for a small side project, but I'm having trouble implementing a DISTINCT type pattern.
Here is an example of the model class:
class Game
include Friendly::Document
attribute :user_id, Friendly::UUID
attribute :friendly_team, String
attribute :opposing_team, String
a...
Hey all,
Currently, in my request model I have:
belongs_to :requestor, :class_name => 'User'
So the requestor is the current_user.
Problem is when the current_user clicks the create button to submit a form for a request, all of the attributes get updated to the database that are in the form.
But since requestor_id is not a valu...
This is all new territory for me, but I am working through a Rails book that was written before start_form_tag was deprecated and I am running into problems with the books example code using remote_form_tag. I have the other forms working but can't get this one up and running. Here's the code:
<h1>Categories</h1>
<ul id="category_list"...
I want a method in app/controllers/application.rb that can prepend/append text to whatever template gets rendered. Of course I can't call render twice w/o getting a double render error, so is this possible?
I want to redirect after a delay using a meta refresh. Here's what I've got:
app/controllers/application_controller.rb:
def red...
I have been having a problem with using Bundler and being able to access my gems without having to require them somewhere, as config.gem used to do that for me (as far as I know). In my Rails 3 app, I defined my Gemfile like so:
clear_sources
source "http://gemcutter.org"
source "http://gems.github.com"
bundle_path "vendor/bundler_gems"...
I've attached an image of what JRuby.jar contains:
http://www.freeimagehosting.net/uploads/fbfd966375.png
The problem is that even for simple scripts, the resulting jars have about 8mb. Can you tell me which folders I could remove from there, and still have it running ... or what's the purpose of some of that folders?
...
In http://stackoverflow.com/questions/2170001/select-n-objects-randomly-with-condition-in-rails Anurag kindly proposed this answer to randomly select n posts with votes >= x
Post.all(:conditions => ["votes >= ?", x], :order => "rand()", :limit => n)
my concern is that the number of posts that have more than x votes is very big.
what ...