Is there anithing for getting the main description of a wikipedia's page?
Like in http://en.wikipedia.org/wiki/Radiohead
I want obtaing:
Radiohead are an English alternative rock band from Abingdon, Oxfordshire, formed in 1985. The band consists of Thom Yorke (lead vocals, rhythm guitar, piano, beats), Jonny Greenwood (lead guitar, ke...
So, we all strive to reduce duplication (DRY) and other smells, and keep our code as nice and clean as possible. For Ruby code, there are a lot of instruments to detect smells, for example the quite nice Caliber service.
However, it seems that I have a different definition of code duplication than the tools. I think this might be connec...
I'm using watir for safari with ruby 1.8.7 on OSX Snow leopard.
I want to click a button, the only one in the page, that has neither id nor name. It only has an onckick property and the text within the tag..
How to do that? Is there a way to list all buttons on the page, and get the first (and only) one?
thanks
...
I need to restart a script when it fails. My script fails because of a Ruby runetime bug which is another issue...
...
Hi Guys,
I have a error that I can't find the solution.
When I run:
Week.find(1).results.sum('box')
A get a SUM of column box an it works perfect!
But when I apply a filter in it:
Week.find(1).results.find(:all, :joins => [:seller],:conditions => ['sellers.user_id = ?', 1]).sum('caixas')
I get a error NoMethodError: undefined me...
Is there something similar to Ruby Benchmark within Rails? I have used Ruby benchmark in the past to compare different bits of code, but none of it was Rails related. I would like to use my application models in some benchmarking to do something along the lines of...
#!/usr/bin/ruby
require 'benchmark'
Benchmark.bmbm do |x|
x.report(...
Hi! I'm writing a simple application with Sinatra and Datamapper in Ruby and I have a trouble — when I try to save data into my SQLite database nothing is changing. But when I try to install database or change data from irb it works perfectly.
Here is my Datamapper's setup, model and database installing method (this works fine):
DataM...
Hello,
I'm working on a Ruby on Rails app which has a REST API. I manage two formats JSON and XML.
Very often to simplify the use if the API, I'm making includes. But when you add params to to_json and to_xml like :only, :except, it's not only applied on the root object but on all the objects included.
Do you know libs or methods to an...
Hi
I want to make my rails controller more flexible and try to create some Meta foo for it.
I have a problem with the redirect_to method. Can I convert the "edit_admin_post_path()" method from a string or better read out the controller name and pass it dynamicly?
this is my code for "post" in my Admin::Posts controller.
respond_to do...
The main idea is that I have several worker instances of a Rails app, and then a main aggregate
I want to do something like this with the following pseudo pseudo-code
posts = Post.all.to_json( :include => { :comments => { :include => :blah } })
# send data to another, identical, exactly the same Rails app
# ...
# Fast forward to the s...
I've got two models:
class Solution < ActiveRecord::Base
belongs_to :user
validates_attachment_presence :software
validates_presence_of :price, :language, :title
validates_uniqueness_of :software_file_name, :scope => :user_id
has_attached_file :software
end
class User < ActiveRecord::Base
acts_as_authentic
validates_pr...
I appreciate makefiles and make in all their glory, but I wonder if there isn't a more intuitive way to maintain my c/c++ builds.
Has anyone tried replacing their makefiles with ruby scripts to allow for complex and adaptive builds without sacrificing readability? Are there gems that make this easier?
...
For kicks, I'm setting up the build process of my C++ program using rake. I'd rather not reinvent the wheel, however. Are there any ruby gems that have build features similar to the cool ones in SCons (e.g., C++ dependency detection, md5 difference detection, cross-platform pathing, multi-threading, etc.)?
...
What I want is a way of not having to 'require' the class under test in each spec file.
So hoping there is a means of setting the root of the source code under test and rspec automatically mapping my tests, or any other means of automatically mapping specs to ruby files.
In Rspec for rails this happens magically, but this is not a ra...
Hello all,
I'm playing with rails for the first time and running into errors with gems. If I enter the command, sudo ./gem install rmagick, I get the following:
Building native extensions. This could take a while...
Successfully installed rmagick-2.12.2
1 gem installed
Installing ri documentation for rmagick-2.12.2...
Installing RD...
I've created an RSA private key in ruby with:
require 'openssl'
key = OpenSSL::PKey::RSA.generate(1024)
I can get the key in PEM or DER formats:
key.to_pem
key.to_der
But there doesn't seem to be a way to get it into PKCS#8 format. The best I've come up with is to call out to openssl in another process:
require 'open3'
Open3.pope...
I'm trying to read files and create a hashmap of the contents, but I'm having trouble at the parsing step. An example of the text file is
put 3
returns 3
between
3
pargraphs 1
4
3
#foo 18
****** 2
The word becomes the key and the number is the value. Notice that the spacing is fairly erratic. The word isn't always a word (which does...
During RubyAMF and AS3 interaction, I keep getting the error "Client.Data.UnderFlow" in a NetStatusEvent.NET_STATUS on the AS3 side.
On the Ruby side I get "ActiveRecord::RecordNotFound (Couldn't find {type} without an ID)", where {type} is the defined type that I'm looking up.
A google search suggests that this issue seems to have com...
Hey guys
I`m trying to figure out how to get serial and key attributes set for Resource object. Basic method DataMapper::Resource.attributes returns a collection of properties, but it does not say anything about types. Of course i can check it via system call: obj.class, but cant understand how to get type information from resource inst...
I am having trouble figuring out the elegant way to add an array of hashes
[{:a=>1,:b=>2,:c=>3},{:a=>1,:b=>2,:c=>3},{:a=>1,:b=>2,:c=>3}]
should return
[{:a=>3,:b=>6,:c=>9}]
I know it would probably involve mapping/reducing, but I can't figure out the right syntax, doesn't help that ruby-doc dot org doesn't match my version
I am us...