ruby

Migrating from processing many small data files to a few large files in ruby

What should I keep in mind when migrating from processing many small data files to a few large data files in ruby? Background: I'm a bioinformatician who is processing next generation sequencing data, which produces about one million sequences per run. I previously saved each one of the million sequences to its own file, and did a few p...

DataMapper has n with conditions

Hello, By any chance is it possible to create a conditional association with DataMapper? For example: I want the User have n Apps just if that user have the attribute :developer => true something like this: class User include DataMapper::Resource property :id, Serial property :name, String, :nullable => false property :scre...

Do you know of any Rails "Announcements" plugins?

I've noticed in various web apps that users are prompted with initial announcements to help them use the app for the first time (and users have the option to click "Don't show this message again in the future" or something similar) Is there a plugin that does that? Or, would you simply program a many-to-many relationship between users a...

Problem Installing Tioga - Mac OS X Leopard, Ruby 1.9

Has anyone successfully installed Tioga for use with Ruby 1.9? I'm trying to install it on my Macbook Pro running Leopard and am not succeeding. When executing 'ruby extconf.rb', I get the following: checking for zlib.h... yes checking for compress() in -lz... yes checking for ieee754.h... no You lack the ieee754.h header file, whic...

Ruby web spider & search engine library

I'm looking for a Ruby library or gem (or set of gems) which will not only do spidering, but also collect the data into, say, a database, and allow basic searches on the data (i.e. a typical web search). I've found several spidering libraries, so that part seems well covered (I was going to try Anemone first), but I can't find anything ...

Python on Rails?

Would it be possible to translate the Ruby on Rails code base to Python? I think many people like Python more than Ruby, but find Ruby on Rails features better (as a whole) than the ones in Python web frameworks. So that, would it be possible? Or does Ruby on Rails utilize language-specific features that would be difficult to translate...

Sequel::Model: Where the methods like create_table come from?

I am trying to understand how Sequel works. The example below inherit from Sequel::Model and calls set_schema, create_table, etc. I was trying to find the documentation for these methods, but no luck on the rdoc for Sequel::Model: http://sequel.rubyforge.org/rdoc/classes/Sequel/Model.html Where are these methods coming from and how doe...

User-generated database entries in rails

I am trying to do something in Rails and will admit that I'm no genius programmer, but I'm attempting to learn. I want to create a database with user-generated entries of no specific number. The best example of what I am trying to do can be illustrated by twitter. I assume every time the user adds a new tweet it adds a row to the use...

BrowserCMS portlet

This is probably a dumb question, but.. Any ideas how to insert BrowserCMS portlet into an actual page? What is weird, yes, I couldn't find that in their docs.... ...

Ruby Net::FTP Progress Bar

Does anyone know of a way to get a status update from ruby's Net::FTP library while downloading a file? I am trying to implement a web interface that shows a progress bar for percentage remaining when downloading a file from a remote ftp server. ...

Ruby 1.8.6, SQLite3 thread safety.

Is the sqlite3 Ruby gem thread safe? I can't find any documentation to say that it is. In my experiments, accessing a database from multiple Ruby threads eventually leads to the following error: /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/driver/native/driver.rb:84: [BUG] Bus Error Is there anything I'm missing? If not...

localize strftime rails 2.2

<% @recently_active_objects = Activity.find(:all, :limit => 10, :order => "id DESC") %> <% @recently_active_objects.group_by{ |object| object.created_at.midnight }.each do |day, objects| %> <h3><%= day.strftime("%A, %B %e") %></h3> <% objects.each do |object| %> <%= activity_message_for_activity(object) %> ...

Email not going out

I want to generate Email from my ruby application, So i used Action mail class for that. I configured the Email setting on environment.rb my configuration is as follows ActionMailer::Base.raise_delivery_errors = false ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "mail.authsmtp.com",...

Best way to reload parts of a form

I want to reload a part of a form generated with the form_for-helper via AJAX. After reloading the part I still want to have access to the form object. How can I do this? Best regards ...

virtual model and form_for (or formtastic)

Hi, all. Sometimes we need form without model creation - for example search field or email, where should be send some instructions. What is the best way to create this forms? Can i create virtual model or something like this? I'd like to use formtastic, but not form_tag. ...

when building a web spider, should you use recursion ?

building a depth-first web spider, meaning it will visit all links on first page, and go to each link, and visit links on all second page... should you use recursion ? i find this to be cpu intensive. def recursion() linkz_on_first_page.each do |link| recursion(link) end end recursion(firstpage) ...

What gem can I use to generate a HTML file for offline use?

I have to create a report, and in order to do some colouring and tables, I decided on HTML. Is there any gem I could use to do this? I'd like to avoid having to write the tags myself. ...

Rails - Remote Domain Name

Hi, A remote IP can be recive via: request.remote_ip (http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html). But is there a simple way to try to get the remote domain name (of this IP)? Thanks ...

Regular expression to match a pattern either at the beginning of the line or after a space character

I've been trying to dry up the following regexp that matches hashtags in a string with no success: /^#(\w+)|\s#(\w+)/i This won't work: /^|\s#(\w+)/i And no, I don't want to comma the alternation at the beginning: /(^|\s)#(\w+)/i I'm doing this in Ruby - though that should not be relevant I suppose. To give some examples of mat...

Why are there so many slightly different ways to do the same thing in Ruby?

I am learning Ruby. My background is C++/Java/C#. Overall, I like the language, but I am a little confused about why there are so many different ways to accomplish the same thing, each with their own slightly different semantics. Take string creation, for example. I can use '', "", q%, Q%, or just % to create strings. Some forms support...