hi all
I am having an array like "author","post title","date","time","post category", etc etc
I scrape the details from a forum and I want to
save the data using ruby
update the data using ruby
update the data using text editor or I was thinking of one of OpenOffice programs? Calc would be the best.
I guess to have some kind of S...
I want to distribute a Rails application within a .app package, so it can run from 10.4 to 10.6; is there any howto or hint on how to do that? Especially the following things make me twist my head:
I want to repackage the app with Ruby 1.8.6, so it would run even if there is an older version of Ruby installed on the system (such as 1.8...
It also needs to work for {{ article |image}} or any other withespace combination inside the double braces.
...
I am having a difficult time loading ruby-mode in emacs on my mac.
The .emacs file is located at ~/.emacs I've added several commands to it (many pasted from this site) and none seem to get loaded. Any advise? I"m not sure if the file isn't loading or I have the command syntax wrong.
All I need is the following
4 space indent (auto...
Hi,
I installed Sphinx and Thinking-Sphinx some days ago on my ruby on rails 2.3.2, and basic searching works great. This means, without any conditions. Now, I want to filter the search with some conditions.
I have the Announcement model, and the index looks as follows:
define_index do
indexes title, :as => :title, :sortable => ...
Is it possible to alias an attr_reader method in Ruby? I have a class with a favourites property that I want to alias to favorites for American users. What's the idiomatic Ruby way to do this?
...
I want to parse a continuous stream of bytes (from a socket) with a state machine using Ragel
However, all the Examples I have found are either parsing a complete file in one pass (like the Gherkin lexer or are using Ragels C Target (like the mongrel HTTP1.1 Parser)
I'm looking for some advice or examples on how to instantiate a Ragel ...
I'm new to Ruby, so this may be a pretty basic question.
I have a Windows batch file that I use all the time to interface with my source control system . The batch file issues various command-line commands supported by the source control system's command line interface (CLI).
I'd like to write a Ruby program that issues some of these ...
You can dynamically define a class method for a class like so:
class Foo
end
bar = %q{def bar() "bar!" end}
Foo.instance_eval(bar)
But how do you do the opposite: remove/undefine a class method? I suspect Module's remove_method and undef_method methods might be able to be used for this purpose, but all of the examples I've seen after...
How can I get the opposite of a boolean in Ruby (I know that it is converted to 0/1) using a method inline?
say I have the given instance:
class Vote
def return_opposite
self.value
end
end
Which obviously doesn't do anything, but I can't seem to find a method that is simple and short something like opposite() or the like. D...
I have an object Results that contains an array of result objects along with some cached statistics about the objects in the array. I'd like the Results object to be able to behave like an array. My first cut at this was to add methods like this
def <<(val)
@result_array << val
end
This feels very c-like and I know Ruby has be...
I'm fairly new to Rails and am trying to figure out how to add a method to the String class and have the code in my partial know that the String class has been added to. I'm not sure where I should put the require statement.
...
I'm fairly new to Rails and am trying to figure out how to add a method to the ActiveView class so I can then access a new method from the partials.
Here's some sample code:
%li
=link_to "#{h aim_small.description.shorten} #{"(current aim)" if aim_small.description == current_aim.description}", :action => 'show', :id => aim_small
....
I am currently writing an application that pulls new information from RSS sources and has to update those RSS sources in a certain frequency. Currently I am pulling only when the user requests a feed but I want to change that behavior to automatic periodic fetching.
I was writing a shellscript that would interact with the database and g...
hi all, i'v been new to ruby and rails and encountered a rather strange error:
class Person < ActiveRecord::Base
validates_presence_of :description, :if => require_description_presence?
def require_description_presence?
self.can_send_email
end
end
raises
NoMethodError in PeopleController#index
undefined method ...
I can do bit of coding in ruby. I just touched objects and I am not so object literate, I mean I do not think in objects yet :-)
I have data that I scrape from the forum on regular basis. I need fields like
author, date posted, title, category, number of views, etc etc = array in my point of view.
Then I want to be able to these ...
I have not found any documentation nor tutorial for that. Does anything like that exist?
doc.xpath('//table/tbody[@id="threadbits_forum_251"]/tr')
the code above will get me any table, anywhere, that has a tbody child with the attribute id equal to threadbits_forum_251. But why does it start with double //? why there is /tr at the e...
Hi Folks,
I am running Ruby 1.9 (ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10]) on Slow Leopard (installed via MacPorts).
I then installed the Ruby MySQL client library via MacPorts:
install rb19-mysql
Trying to use it I get the following error:
db.rb:4:in `initialize': wrong number of arguments(4 for 0) (ArgumentError...
My web application writes some kind of log during runtime.
I don't want to write this log when running my test suite using cucumber.
So, how can I check my current runtime environment (TEST, DEV or PROD)?
I'm looking for the C equivalent to i.e. :
#ifdef DEBUG
// just run in debug mode
#endif
Thank you very much for ...
Hi all
I have a variable number of tables with variable number of rows and I want to have them displaying one after the other but if a table doesn't fit on the current page put it on the next then continue on. I have put the table in a transaction so I can roll back then print it if the height will fit on curent page but how do I get th...