Hello, I have two ruby files. The first is
require 'www/poster'
poster = Poster.new()
The second ('www/poster.rb') is
require ...
class Poster ... end
The problem is, when I run the first file, I get an error:
in `': uninitialized constant Poster (NameError)
But if I replace the original code with just
require ...
class Poster...
I want to programatically download the contents of a web page, but that page is generated as the result of a POST and I cant seem to get it working.
This is the page: http://jp.translink.com.au/mobile/Input.aspx
You can enter the following values to see how it works:
From: Coorparoo Railway Station
To: Central Railway Station
I have...
Hi all,
I have AMQ + Activemessaging running in a Rails App.
I'm facing a problem with activemessaging not acting on messages when they are received. This is solved once i restart the client. Apparently, it works for a while but not sure when it stops acting weirdly.
This is resulting in loss of messages as they are being read, the St...
I write my first project wich using Datamapper as ORM, so please be patient. :)
I try to do get String from DateTime field:
Error.first.submitted_at.to_s
=> "2009-08-24T12:13:32+02:00"
Returned String is not good for me. In ActiveRecord I can do something like that:
Error.first.submitted_at.to_s(:only_date)
or any other da...
When I load andand in Ruby 1.9 I get the warning
andand.rb:111: warning: undefining 'object_id' may cause serious problem
Does anyone know a way, other than modifying andand to not remove object_id, to avoid this warning?
Thanks!
...
Unfortunately, the Unicode 0.1 (sudo gem install unicode) doesn't work on Ruby 1.9. I have the following snippet:
require "rubygems"
require "unicode"
str = "áéíóúç"
Unicode.normalize_KD(str).gsub(/[^\x00-\x7F]/n, "")
#=> aeiouc
I use it to convert titles to permalink, without removing accented characters.
Is there a way of converti...
We've inherited an application that uses a script to import data from a text file, but doesn't test the import script.
I'd like to write some tests for that script, and will need test text files (these are not fixture files).
Where would you normally put those files? A data directory? In the new support directory?
...
Hello, the following code raises the aforementioned error, how can I fix that?
require 'mechanize'
m = WWW::Mechanize.new
p = m.get('http://art-mobile.com.ua/register.php')
f = p.forms.first
f.submit(f.buttons.last)
Just in case, here is the full description of an error on my box
D:/ruby/lib/ruby/gems/1.9.1/gems/mechanize-0.9.3/lib/w...
I'm having problems setting up wirble on XP machine. when i run IRB i get sth like this:
"foo".capitalize
=> ←[0;31m"←[0;0m←[0;36mFoo←[0;0m←[0;31m"←[0;0m
this occurs only if I call colorize on wirble either in .irbrc or after starting irb. I installed ruby 1.8.6 with the all-in-one installer. Any ideas on how to get col...
Given this hash that comes though :params
"positions"=>{
"1"=>{"x"=>"50", "y"=>"30"},
"2"=>{"x"=>"22", "y"=>"53"},
"3"=>{"x"=>"68", "y"=>"35"}
}
How would I do this? (doesn't work, but attempting to show what I want to do)
params[:positions].each do |position|
logger.info(position.x)
end
I know, painfully beginner ...
I'm developing several apps at the moment which will require a global accounts system across all of the apps and I'm unsure of what's the best way of going about doing this.
The most obvious option is to have each app connect to 1 database but that would require duplicating the MVC login code across all the apps which would make updatin...
Hey,
I'm trying to read unsigned integers from a file (stored as consecutive byte) and convert them to Integers. I've tried this:
file = File.new(filename,"r")
num = file.read(2).unpack("S") #read an unsigned short
puts num #value will be less than expected
What am I doing wrong here?
Cheers,
Pete
...
If true it will send an error message to the user.
If false delivery errors wont be noticed.
What's the recommended way to handle this?
...
Hi,
Am trying out Ruby on Rails in Windows XP using the Hello World example. Encountered this error ? Not sure how to fix this
When I downloaded sqllite from the website, copy the dll to windows/system32.
then run "gem install sqlite3-ruby". It shows up with lots of "No definition for _wrap_sqlite3_*"
then in Firefox, http://loc...
My simple date validation regex is not working correctly...
validates_format_of :dob, :with => /\d{2}\/\d{2}\/\d{4}/, :message => "^Date must be in the following format: mm/dd/yyyy"
What am I missing here? I'm trying to validate that a date is in the following format: mm/dd/yyyy - When I enter what should be valid data, I still get th...
I need as much knowledge as a college graduate! What books should I read? If you had to study PHP, Java, Ruby or Python, I'm even more interested in your answer.
...
I have models Foo and Bar. Bar has column foo_id.
When I call Bar.foo_id I get the error missing attribute: foo_id
Keep in mind that this is not an undefined method error and the column definitely is in the db. What are some common causes of this?
Thanks
...
[see later answer for more]
I think this is just a simple rails question, and mostly on how i've named my models and reference them in my view. So a little background, I'm using the vote_fu plugin, which I think is great, however I'm having a hard time getting the voting to work from a link as follows:
<%= link_to "vote for", current_u...
How can we lock an IO that has been shared by multiple ruby process?
Consider this script:
#!/usr/bin/ruby -w
# vim: ts=2 sw=2 et
if ARGV.length != 2
$stderr.puts "Usage: test-io-fork.rb num_child num_iteration"
exit 1
end
CHILD = ARGV[0].to_i
ITERATION = ARGV[1].to_i
def now
t = Time.now
"#{t.strftime('%H:%M:%S')}.#{t.usec}"
...
Hello all,
I searched a lot on this but haven't yet got any standard or rather systematic guide for Win32Ole in Ruby. Ruby on windows by David is very good but I need a complete, systematic standard tutorial for WIN32OLE ruby APIs.
Please suggest!
Thanks
Pradyumna
...