ruby

What IDE / Editor do you use for Ruby on Windows?

The SciTE editor comes with the Ruby installer, and it's just a generic code editor. I installed FreeRIDE but it seems a little buggy; it actually just crashed on me for no reason. :( So my question is... What IDE / Editor do you use for Ruby on Windows? What are the best editors out there? ...

PL/Ruby equivalent in MySQL

PL/Ruby is a loadable procedural language for Postgres that lets you use Ruby to write user defined functions for the database. Anyone know of an equivalent way of writing user defined functions for MySQL in Ruby? ...

How to use regex for utf8 in ruby

In RoR,how to validate a Chinese or a Japanese word for a posting form with utf8 code. In GBK code, it uses [\u4e00-\u9fa5]+ to validate Chinese words. In Php, it uses /^[\x{4e00}-\x{9fa5}]+$/u for utf-8 pages. ...

Ruby on Rails XML generation

I am attempting to build a simple method that creates an XML file from a database in ruby on rails. I feel like my code is right but I am not seeing all of the users in the XML. I am a complete newbie to RoR. Here's my code: def create_file @users = User.find(:all) file = File.new('dir.xml','w') doc = Document.new make = Ele...

Python vs Groovy vs Ruby? (based on criteria listed in question)

Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Lib...

In Ruby how can I abort a connection with a RESET?

In any socket API the close() method closes a connection with a FIN. If I want to abort a connection with a RST how can I do it? ...

How can I detect Gnome Terminal?

I am writing a console application which makes use of the F1 key (for help). Unfortunately, while Konsole (of KDE) doesn't use this key, Gnome Terminal does, so the F1 key becomes inaccessible to my application. I don't think there's a way to detect whether the F1 key is already mapped in the GUI side of things (Gnome Terminal), but if...

Fragment Caching with Memcached

Is there any way of using Memcached for fragment caching in Rails? ...

How do I add the condition "IS NOT NULL" to a Thinking Sphinx search

I'm using Thinking Sphinx for full-text search, following this video. I'd like to do the following: @articles = Article.search(params[:search], :conditions => "published_at IS NOT NULL", :order => :created_at) The problem is that this doesn't work. It seems that the search method only accepts conditions that are a hash. I've tried a ...

Portable Ruby on Rails environment

I got myself a new 8 gig USB key and I'm looking for a decent solution to have a portable RoR environment to learn on. I did the google on it and found a few possibilities, but I'm curious to hear some real life experiences and opinions. Thanks! ...

Drb and "is recycled object" exception

Hi all, I'm running in a strange issue. My controller calls a drb object @request_handler = DRbObject.new(nil, url) availability_result = @request_handler.fetch_availability(request, @reservation_search, params[:selected_room_rates]) and this Drb object is making some searches. but sometimes, in a linux environments, I get a "0xdba...

Does ruby have a stepwise debugger, similar to perl's "perl -d"?

Does ruby have a stepwise debugger, similar to perl's "perl -d"? ...

How can I find a model's relationships?

I want to, when given a particular model, return all the related models it is associated with. For example: class Dog < ActiveRecord::Base has_many :bones belongs_to :master end d = Dog.first d.associations #<== should return [Bone, Master] Is there a way to do this already without having to roll my own? Failing that, any sugge...

Building dynamic fields using ActiveRecord::Serialization.to_xml

I'm curious about people's experiences using AR's to_xml() to build non-entity fields (as in, not an attribute of the model you are serializing, but perhaps, utilizing the attributes in the process) from a controller. to_xml seems to supply a few options for doing this. One is by passing in references to methods on the object being...

What's the best/easiest GUI Library for Ruby?

Whats the best/easiest GUI library out there for Ruby? I would prefer a cross-platform GUI library, but currently I'm only concerned about Windows (Win32). I am having difficulting finding any that seem to be easy to use. Are there any? ...

conditional formating in rails partials

I am rendering a rails partial and I want to alternate the background color when it renders the partial. I know that is not super clear so here is an example of what I want to do: Row One grey Background Row Two yellow background Row Three grey Background Row Four yellow background sorry stackoverflow seams to prevent the b...

What's the best way to perform system tasks from Ruby on Rails?

I am building a small system administration web application (think Web-Min, but in RoR) and I need to be able to access system parameters from my Ruby code. For instance, I want to allow the user to change the hostname, time zone, or network config of the server. My current thoughts are to have a separate setuid script (Perl, Ruby, ?...

Content Voting Database and Application Design

How would you design a content voting mechanism that could be applied polymorphically to multiple models / classes. (in a ruby on rails context preferably, but others are fine) Given that instances of these classes can be voted on: - Article - Question - Product Voters should not be required to register. Best effort should be made to ...

Algorithm for organizing emails into threads?

Are there any named/famous/particularly good algorithms for organizing email messages into threads? I'm looking to add a feature to my site similar to Google Groups (and other mailing lists) and I was just wondering if there were any published algorithms for such organizing. I know it would probably be fairly easy to roll my own, but t...

What do you think of "RubyMine".

Jetbrains has just released a "public preview" of a Ruby IDE called RubyMine The roadmap follows: Nov 1 - Public Preview Release Nov 10 - EAP Opens Q1 2009 - RubyMine 1.0 Release May 28 '09 - RubyMine 1.1 Released Oct '09 - RubyMine 2.0 Beta I don't have much Ruby experience myself, but coming from the creators of IntelliJ IDEA...