I have a form that contains one date element and 3 time elements. This is because 3 time events will occur on one date, and I don't want the user to have to input that date 3 times.
On the server side, I would like to combine the one date with the 3 times to get 3 datetime objects. I was thinking I could just do something like:
time_...
I'm trying to extract some info from a table based website with hpricot. I get the XPath with FireBug.
/html/body/div/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/table[3]/tbody/tr
This doesn't work... Apparently, the FireBug's XPath, is the path of the rendered HTML, and no the actual HTML from the...
Suppose I wrote a compiler in Python or Ruby that translates a language into a C# AST.
How do I pretty-print this AST from Python or Ruby to get nicely indented C# code?
Thanks, Joel
...
Just wondering if there was any built in way to handle error reporting in Ruby? PHP does it on its own, Perl and Python you can import modules to use.
Levi
...
I have a fairly large Rails app, which uses memcached on a seperate server as its cache store.
The problem is that I randomly get errors in the production environment which seem to indicate that memcached is returning an incorrect object.
Examples:
In this example, current_site is a helper method which accesses a method on the Site m...
Has anyone had any problems using the AASM state machine Gem with Rails 2.3.2? It was working fine for me but is now giving a NoMethodError:
NoMethodError (undefined method `state' for #<Comment:0x25cb8ac>):
/usr/local/lib/ruby/gems/1.8/gems/rubyist-aasm-2.0.5/lib/persistence/active_record_persistence.rb:231:in `send'
/usr/local/lib...
What's the best way to require all files from a directory in ruby ?
...
I looked around and couldn't find one. Is there an equivalent of Log4X for Ruby? If not what's the best way to handle all the debug statements. I'm fairly new to Ruby.
Thanks!
...
This is something that has been bugging me for a while. When you see any ruby method printed in text, it usually appears as
Class#method
or
#method
Now, I would use
Class.method
Why are all ruby methods preceded by a pound sign? Is there any reason for it? Just curious.
...
I'm running ruby 1.8.6 and rails 2.3.2 on Mac OS X 10.5.6.
I'm trying to get ruby script/server to work...
I've waded through mysql and imagemagick installation, and I'm now faced with the following error:
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31...
Hello
I am trying to get the difference in hours for two different Time instances. I get these values from the DB as a :datetime column
How can I do this so that it includes the months and years as well in the calculation while ignoring or rounding the minutes? Can this only be done manually or is there a function to do this?
Thank y...
Are there any issues to consider when using DRb for implementing an in-memory message queue and for synchronizing actions between processes? I heard that it could be unreliable, but haven't found anything on the web that confirms this assertion.
In case it's relevant, these would be processes running with a rails app environment that...
This article states that double-checked locking is unsafe on certain language/hardware combinations when a shared variable can be updated with a reference to an object that is only partially initialized.
I was wondering: does this also apply to Ruby? Is this something that varies by the Ruby implementation on the platform that it is ...
Hi there!
Now I practice deleting characters such as:
input = input.gsub(/<\/?[^>]*>/, '')
and for special characters, example ☻ or :
input = input.gsub('&#', '')
this leaves only numbers, ok. But this only works if the user enters a special character as a code, like this:
™
My question:
How I can delete special characters...
I am looking for some free light-weight GUI alternative for IRB console on windows. What I whould like to see:
Area to write a script (so I can edit, run, edit...)
Command line to play with current variables
Output window to see results
Intellisence
Breakpoints/debugging is a plus
Actually, some thing similar to powershell_ise.exe wh...
How can I run my Carpet applications directly from Aptana Studio with RadRails? Setting the shoes.exe as VM/Interpreter won't work.
...
Is it possible to run Ruby IRB ver a named pipe, so I can send commands and get results remotely?
Generally I would like to utilize the IRB engine, while have a different UI (probably written with .Net).
...
I'm wondering how many data access should I do in a View when using a MVC framework.
For instance: In my application there is a page that shows a list of all my favorite artists and, for each artist, a list of all songs of that artist.
The question is: Should I pass only the artist list to the View, or should I pass also all the data (a...
Hey,
So I am doing a small, simple project for my class and for some reason I can't access a value using a variable.
This is my class: (I am having problems with the getAnswer method, in particular the answerArray array)
#Create random fact array
class RandomFact
def initialize()
@randomNum = rand(5)
end
def getQuesti...
I have worked on some small web development projects where the server side languages have been PHP, Java and Lisp. Now I want to learn web development seriously. I don't want to use platforms based on PHP or Java. I also want to learn Python in general. Ease of implementation and learning value is more important to me than real-world imp...