I want to match links like <a href="mailto:[email protected]">foo</a>, but this doesn't work only works in Nokogiri:
doc/'a[href ^="mailto:"]'
What's the right way of doing that? How do I do that with Hpricot?
...
Running a Ruby on Rails (RoR) app or Ruby code which uses the ActiveRecord framework, you get the error message:
Please install the postgresql adapter:
gem install
activerecord-postgresql-adapter
Trying to run:
gem install activerecord-postgresql-adapter
also fails, leaving you at a loss.
...
I'm writing a simple web crawler in Ruby and I need to fetch all href contents on the page. What is the best way to do this, or any other web page source parsing, since some pages might not be valid, but I still want to be able to parse them.
Are there any good Ruby HTML parsers that allow validity agnostic parsing, or is the best way j...
I'm doing what a lot of people probably need to do, processing tasks that have a variable execution time. I have the following proof of concept code:
threads = []
(1...10000).each do |n|
threads << Thread.new do
run_for = rand(10)
puts "Starting thread #{n}(#{run_for})"
time=Time.new
while 1 do
if Time.new - tim...
Where do I reference my controller (Rails) URL to show the dataset that I want in the autocomplete via JQuery? Here is my head:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script>...
On a Rails site, I'd like to display a certain Twitter feed, with pagination so the visitor can see previous tweets (as far back as needed).
I implemented it using the Twitter gem, using Search method, which has a nice pagination method, but hit a limitation that Twitter will only return the statutes from the last two weeks. So after go...
Last week I successfully completed the transition of all our company applications from Ruby 1.8.6 to Ruby 1.8.7 including local and remote configurations.
From now on, development won't need to ensure backward-compatibility with Ruby 1.8.6.
For the sake of curiosity, I tried to run the test suite of a couple of projects against Ruby 1.9...
I need to find out local machine time zone name from Ruby (from the TZInfo::Timezone.all_identifiers list of values). I need it so that I could set correctly Oracle database session time zone so that I could handle correctly timestamp with time zone values in the database.
I would like to get the same value that in Java you could get wi...
I'm trying to install bcrypt-ruby on Windows Vista.
So far, I have been able to install nmake.exe from a MS knowledge base article and cl.exe from installing Visual Studio 2008 Express.
However, I am now encountering this error:
cl -nologo -Wall -I. -IC:/InstantRails/ruby/lib/ruby/1.8/i386-mswin32 -I
C:/InstantRails/ruby/lib/ruby/1.8/...
I have a string which looks like a hash:
"{ :key_a => { :key_1a => 'value_1a', :key_2a => 'value_2a' }, :key_b => { :key_1b => 'value_1b' } }"
How do I get a Hash out of it? like:
{ :key_a => { :key_1a => 'value_1a', :key_2a => 'value_2a' }, :key_b => { :key_1b => 'value_1b' } }
The string can have any depth of nesting. It has all ...
I have a multi-dimensional array that I'd like to use for building an xml output.
The array is storing a csv import. Where people[0][...] are the column names that will become the xml tags, and the people[...>0][...] are the values.
For instance, array contains:
people[0][0] => first-name
people[0][1] => last-name
people[1][0] => Bob
p...
I've been using PHP all the time.
Any advice to taking on these two languages?
...
I'm attempting to parse XML in the following format (from the European Central Bank data feed) using libxml-ruby:
<?xml version="1.0" encoding="UTF-8"?>
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01"
xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
<gesmes:subject>Reference rates</...
I am writing a program to read files and search text in it. I have written the first initial steps. In the below given code you can see a symbol ** -- **. This where I want to pass member variable value of Class [CurrentFile].
Please also suggest what improvements I can do in this code.
class CurrentFile
attr_accessor :currentFileN...
I have a web page with a grid, and some columns have a link in the column header that will sort the values by that column [by round-tripping to the server].
I want to write a single Watir test that will identify those sorting links and click each one in succession. This is a smoke test that ensures there are no runtime exceptions result...
After working with ASP.Net MVC, it has me thinking about Rails. I worked with Rails prior, but am a little rusty. ASP.Net MVC tutorials recomment hiding data layer implementation with the repository pattern. This allows easiesr Dependency Injection for Unit Testing, and nice decoupling of the controller from the model implementation. ...
I need to hack up a quick webpage that displays a log file in real time as contents get added to that file.
For example, it would be like a realtime 'tail -f error_log' type of command but would be constantly updated on the webpage.
Has anyone seen/heard/dreamt of a Ruby/Jquery solution already out there? (Plugin, gem, etc.)?
Thanks,...
I'm using mongrel + apache 2.2 + mod_proxy_balancer.
apache2.2 is IPv6 well http://httpd.apache.org/docs/2.2/en/bind.html#ipv6
Does Mongrel do IPv6 well?
Platform:RHEL ruby:1.8.6
/actionpack-2.0.5/lib/action_controller/request.rb
which is worried about the particularly .
...
I'm trying to use Sequel to access a MySQL database in Ruby. When I try accessing a table which involves a date column, I am presented with an error. When I access a table without, it functions fine. What is wrong?
Example Code:
require 'rubygems'
require 'sequel'
DB = Sequel.connect(:adapter=>'mysql', :host=>'localhost', :database=>'...
Why does this work the way it does? I thought it had something to do with pass-by-reference/value, but that's not the case. Does it have something to do with the new block scopes?
def strip_ids(array)
array.each{ |row| row.reject! {|k, v| k =~ /_id/ } }
end
class Foo
attr_accessor :array
def initialize
@array = []
@array...