Is there a rails-like way to divide results from an activerecord query? For example, I did @results = Items.find(:all), but I want the top half of items from @results to appear in a line item under <ul class="part1">, and the other half of them to appear under <ul class="part2">.
<ul class="part1">
<li><a href="#">result["name"]</a...
In my rails application, I render a partial on multiple pages, and in that partial is a variable. So currently, lets say I have 5 pages that render :partial => "partialname", and inside of partialname is @variable.
Can I have it so that partialname has its own action with @variable instantiated inside, rather than having @variable be...
Is there a way to print slots/elements or an entire window under Shoes?
By this, I mean to direct output to the default system printer?
Thanks!
JP
...
I'm looking for a server provisioning tool, hopefully in Ruby, that fits in the gap between tools like Kickstart and tools like Chef.
I need something that can connect over SSH and set up users, keys, install tools, etc. Something that can go from an empty OS to a working Chef instance, at least.
I've been experimenting with mass.pl (...
How can you determine which rubygem is being used in response to a "require" statement? gem which doesn't seem to help.
Background: for the project hornsby-herbarium-parser, I'm using the gem roo.
I used the github gem hmcgowan-roo , as at that time it was more recent than the rubyforge version of roo. I tried testing the code on runco...
In this question, I mentioned my assumption that rubyforge gems are more official, authoritative, and stable than github forks. One of the people replying to my question said that my assumption might not be accurate.
What have you observed? Do people use github to release early and release often, only putting stable releases on rubyforg...
Hi all,
I'm currently writing an app that pulls all the tweets from twitter with links in them and puts them into our searchable database.
Our database tables look like this:
Tweets
content
tweet_id
Links
url
title
count
User
username
user_image
We'd like to be able to search through the tweet.content column for a s...
What's the best way to create a gzipped tar archive with Ruby?
I have a Rails app that needs to create a compressed archive in response to user actions. Ideally, it would be possible to write directly to a compressed file without needing to generate intermediate temp files first. The Ruby Zlib library appears to support direct gzip comp...
Is there a version of require in ruby that either loads the whole file, or nothing at all?
The problem is that require starts loading from the top, and if it faces problems you end up with uncompleted definitions, for example, the following would still load a class A even if module C is not defined:
class B
include C
end
In my part...
There is a lot of discussions of Python vs Ruby, and I all find them completely unhelpful, because they all turn around why feature X sucks in language Y, or that claim language Y doesn't have X, although in fact it does. I also know exactly why I prefer Python, but that's also subjective, and wouldn't help anybody choosing, as they migh...
I'd like to not store times in my local timezone, but Sequel is making it really tough on me. I can set them to UTC before I put them in there (a bit of a pain), but then when I take them back out it assumes that they are local dates and then they are all 8 hours in the future. Is this something that hasn't been implemented yet? And if s...
With Ruby 1.9 the YARV-VM was merged into Ruby. So http://www.atdot.net/yarv seems to be outdated.
Where can I find documentation on RubyVM::InstructionSequence?
Especially on #compile_file?
Where can I find an up-to-date Instruction Table like http://www.atdot.net/yarv/insnstbl.html ?
...
Can I ask ruby or rubygems to use the latest gem regardless of its source?
As mentioned in the update to this question, it turns out that ruby is using an older github gem (hmcgowan-roo 1.3.5) over a newer rubyforge gem that was installed more recently (roo 1.3.6).
My suspicion is that the magic pixy (either ruby or rubygems) looks und...
I want to use nokogiri to loop through a html and create an object corresponding to every row. I am able to define the root xpaths where I want the data to fill the object varibles comes from but I dont know how to group these as an object.
My code is below. I know it doesn't work but I dont know what direction to go to make it work.
...
Hi, I am having a problem with using session variables. I have two controllers named 'graduate_students_controller' and 'current_students_controller'. Each of these controllers control different view files. I am using session variables with both these controllers to store session information.
Here's the problem. Let's say I have two vie...
when i used to use Qt3, i was only have to design my program interface, then use the "rbuic" command to convert the .ui file into a .rb file, and problem solved ...
but the thing is, now I'm using Qt4, and there is no such thing like "rbuic", so I'm i suppose to write the whole ruby program to run an interface by my self, if yes, then I'...
I'm trying to get Hpricot working with Rails on my dev machine.
I've installed Hpricot [0.8.1] using the standard 'gem install hpricot' and confirmed it works fine with my standard Ruby installation [1.8.7]; however when I try the same with my Rails [2.1.0] installation, I get an error -
TypeError: superclass mismatch for class BogusET...
Hey guys.
I am working on some code that scrapes a page for two css classes on a page. I am simply using the Hpricot search method for this as so:
webpage.search("body").search("div.first_class | div.second_class")
...for each item found i create an object and put it into an array, this works great except for one thing.
The search...
I have a function which compares 2 strings char by char. I needed it to run much faster than it is in Ruby so I used RubyInline to rewrite the function in C. It did increase the speed about 100 fold. The function looks like this:
require 'inline'
inline do |builder|
builder.c "
static int distance(char *s, char *t){
...
I guess the default encodings have changed with 1.9, but I thought Ramaze was supposed to be fully 1.9 compatible? I'm really not sure what going on here. Thanks for any help!
...