I've heard great things about JRuby and I know you can run it without knowing any Java. My development skills are strong, Java is just not one of the tools I know. It's a massive tool with a myriad of accompanying tools such as Maven/Ant/JUnit etc.
Is it worth moving my current Rails applications to JRuby for performance reasons alone? ...
I'm getting the following error, seemingly randomly when trying to extract a href links from a nokogiri doc.
Related code:
nokohtml = page.doc
nokohtml.xpath('//a/@href').each do |node|
...
Dear all,
I'm working on a rails3 app and I'm a little bit confused with Active Model.
Here is my model :
class MyClass
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :foo, :foo1, foo2
def initialize(attributes = {})
attributes.each { |key, value| send "#{key}=", va...
Hello,
Do you have any preferences regarding facebook graph api in Ruby ?
My needs are quite basic: beeing able to update my facebook status.
I saw several things like:
- facebooker
- facebooker2
- facebook-client
- facebook-graph (I am studying this one)
Any preferences ?
Regards,
Luc
...
I have not used cron before, so I can't be sure that I did this right. The tasks I want to be automated don't seem to be running. I did these steps in the terminal:
sudo gem install whenever
change to the application directory
wheneverize . (this created the file schedule.rb)
I added this code to schedule.rb:
every 10.minutes do
run...
Hi
It is posible to simulate a browser in ruby?. I know about open-uri, but I mean simulate even the cookies behavior, etc.
...
In order to diagnose a tricky memory corruption bug (memory is getting randomly overwritten) I thought about utilizing Electric Fence + some custom mprotect calls to ensure that the corrupted data structures are only writable when I want them to be written to (and I immediately get a SIGSEGV when they are attempted to be written to).
Un...
I'm trying to set up a rather complex form using form_for. This form needs to be in multiple views, where some fields would be available across all actions and other fields are specific to each individual actions.
I thought that in order to save myself code duplication, I would use a layout to render the general part, like this:
# layo...
In Is there an advantage to running JRuby if you don't know any Java?, people were suggesting using JRuby if you just want a better implementation of Ruby than "Ruby" (MRI/YARV).
What potential reasons would you have for not using JRuby?
Ones that have been mentioned by others are:
Performance for short programs. JRuby is described a...
I've decided to start fresh with ubuntu 10.10.
I started with installing git and then installing rvm from the git repo. everything worked
fine and I compiled and install ruby 1.8.7 and ruby 1.9.2
the gem is also installed and I run gem -v
but when run gem list or gem install rake I get the following error
ERROR: Loading command: li...
I get this when I run a main.rb file from OSX command line
`require': no such file to load -- EngineAPIWrapper (LoadError)
I have tried putting all the files that it references within the same folder instead of sym links but I still get the problem
if I require 'rubygems' at the top of the main.rb file I get this error instead:
link...
The environment:
Mac OS X 10.6.4
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
$ rails -v
Rails 2.3.9
$ mysql --version
mysql Ver 14.14 Distrib 5.1.51, for apple-darwin10.3.0 (i386) using readline 5.1
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2009-06-12 pa...
I have a parser that reads files. Inside a file, you can declare a filename and the parser will go and read that one, then when it is done, pick up right where it left off and continue. This can happen as many levels deep as you want.
Sounds pretty easy so far. All I want to do is print out the file names and line numbers.
I have a cl...
For example I have a comments models, and I have a post model, but comments can comment on other comments.
So it seems I need a join table I'll call commentables. To create this, do I really need to create a commentable table with a post_id and a comment_id ?
Or can I do something like this without one :
has_many :comments...
If not, what is the best way to do this?
Right now I'm doing (for a django project):
if not 'thing_for_purpose' in request.session:
request.session['thing_for_purpose'] = 5
but its pretty awkward. In Ruby it would be:
request.session['thing_for_purpose'] ||= 5
which is much nicer.
...
I have one bit of javascript that fires off an ajax request, the result of which gets loaded into a popup dialog.
This is the same javascript in all cases, but in one case, the route fails.
From the new_army_list page:
Started POST "/army_lists/preview" for 127.0.0.1 at 2010-10-13 21:42:15 -0400
Processing by ArmyListsController#previ...
this code
= 5.times {|n| puts "<BR>"}
does nothing for me ...
...
Oddly I'm having a hard time finding good docs about basic error handling in rails. I'd appreciate any good links as well as thoughts on a handling errors in a really basic method like this:
def self.get_record(id)
People.first( :conditions => ["id = ?", id] )
end
1) I could verify that id != nil, and that it's numeric.
2) I ...
not sure if it matters that I run the code from haml
this line works nicely
- files = Dir['*']
but here I suspect the spaces in the path....
- files = Dir["C:\Program Files\TestPro\TestPro Automation Framework410\Output Files\builds\*.xml"]
...
how can I have in the second line the value of the variable file instead of both strings file?
- files.each do |file|
%a(href="test?run=file")click file
...