Hello Everyone!
I am working on a VERY simple script to clean up a few hundred thousand small XML files. My current method is to iterate through the directory and (for each file) read the file, use String::gsub! to make all my changes (not sure if this is best) and then I write the new contents to the file. My code looks something like ...
Using ruby, how can I get webdriver to click on a javascript link?
The link I'm trying to click on is:
<a class="TabOff" href=" javascript:showConfirm('/campustoolshighered/k12_admin_admin_menu.do');">Administration </a>
Would I be able to trigger the javascript with a keyPress event? If so, does anyone know the syntax for doing that?...
RSPec is a great ruby test framework (for test driven development),
anyone knows something like rspec but, for PHP?
...
I'm wondering if there is a way to extend ruby Array type to do SIMD & SSE vector calculation.
I mean implement in an low-level language to be used in ruby programs to number crunching tasks.
...
Supposing I want to query for the XPath //*[@id=$href]. How can I tell nokogiri to safely bind a value for the $href variable?
This is similar to REXML's XPath.first( node, "//*[@id=$href]", nil, {"href"=>"linktohere"})
...
Hello,
I'm attempting to create a filter on a rails application that uses multiple check boxes corresponding to one db-column/attribute to filter through results, but I'm not sure how to go about it exactly.
EX.
index shows a list of the last few years' weather and you want to filter through it
These attributes would be part of a Day c...
I'm looking for a way to add properties to my already defined class at runtime, or better:
class Client
attr_accessor :login, :password
def initialize args = {}
self.login = args[:login]
self.password = args[:password]
end
end
But then, I have this hash
{:swift_bic=>"XXXX", :account_name=>"XXXX", :id=>"...
hi,
i'm getting an error when pushing to heroku using rails 3 beta 4. i've
managed to deploy before using it but for some reason i'm getting a
strange error now.
I'm on os x, snow leopard. I've been using rvm with both 1.9.2 preview
and head, i also just reverted back to the system ruby 1.8.7 -p254 but
they all give me the same err...
Question: Where does p get it's value from below and why does it happen?
Consider this irb session:
me@somewhere:~$ irb
irb(main):001:0> a
NameError: undefined local variable or method `a' for main:Object
from (irb):1
irb(main):002:0> foo
NameError: undefined local variable or method `foo' for main:Object
from (irb):2
irb(main)...
I'm having trouble finding a nice elegant ruby way to do this. I have a deck array with 52 Card objects, and I want to iterate over it and loop through an array of Player objects, dealing one card at a time into their hand array. Something like:
deck = Card.deck.shuffle!
deck.each do |card|
@players.NEXTELEMENT.hand << card
end
wh...
Take, for example, the VSTi Triforce, by Tweakbench. When loaded up in any VST host on the market, it allows the host to send a (presumably MIDI) signal to the VSTi. The VSTi will then process that signal and output synthesized audio as created by a software instrument within the VSTi.
For example, sending an A4 (MIDI note, I believe)...
I'm in that horrible questioning state. No, not trying to figure out if I'm gay. I'm trying to decide between Django and Rails.
From what I've read, Django probably fits my needs better, both from a "cultural" and goal point of view. The baked-in admin interface pretty much sells me alone. However, I have one critical concern: it look...
Is there and way to write code like this in a way that makes what it does clearer?
a = (a.split(" ")[1..-1]).join(" ")
That deletes the first word of a sentence but the code doesn't look expressive at all.
...
For example, I've always seen methods referred to as String#split, but never String.split, which seems slightly more logical. Or maybe even String::split, because you could consider #split to be in the namespace of String. I've even seen the method alone, when the class is assumed/implied (#split).
I understand that this is the way me...
In the .Net universe I can use an arbitrary SELECT statement and load many rows into DataTable object. I can then find various DataRows using various field criteria (Name='Jack', Age=34, etc.).
In Ruby on Rails, after doing this to load all employees into memory
rs = Employee.find(:all)
I want to seek a row based an arbitrary crit...
I am very new to rails, and from what i have been reading and watching in tutorials only helps me build things from scratch, creating new databases and the models at the same time.
my company has an accounting / construction project management software system that was recently warehoused into ms sql server.
how would i build the models...
Hi,
I would like to grab a kanji table on a Wikipedia page and I have a trouble using Nokogiri with special char. Here is my script:
# -*- encoding: utf-8 -*-
require 'rubygems'
require 'nokogiri'
require 'open-uri'
link = 'http://en.wikipedia.org/wiki/List_of_j%C5%8Dy%C5%8D_kanji'
doc = Nokogiri::HTML(open(link))
doc.encoding = 'U...
I come from more of a C# background yet am learning Ruby in my spare time.
Given classes, it is possible to make their methods private, public (default) or protected. While I understand their usage, is it typical for Ruby code to make use of such modifiers, despite being a dynamic language, in which the user can easily override access?
...
Hello every body, After saving some values into the database, I am
finding it difficult to print them out. Though I have been able to
pull the data out of the database, the output is like the following:
@vars={:object=>"46789620999001", :source_id=>1, :comment=>"["This is
my first commenttoday and tommorrow", "This is my first comme...
I am not sure what causes this error but since I came across this issue in passenger and now in the console as well I am thinking maybe the mysql driver is the problem?
Everything works as expected on osx/10.6. It just won't on Ubuntu 8.04 hardy.
I nailed down the problem to either the "destroy" method or also when I call a method of a...