similar to: storing data from a txt file in ruby?

Displaying 20 results from an estimated 6000 matches similar to: "storing data from a txt file in ruby?"

2008 Nov 20
1
Stopping bdrb from another process gets the process killed
Hi, I''ve been having some issues integrating bdrb on a cruisecontrolrb server It''s related to the way we stop the bdrb server. The thing is, right now when we stop the process we are killing the parent of the group of the process. This is ok if you''re running script/backgroundrb stop directly from the console, but if I''m running this from another process,
2012 Mar 16
3
custom fact issue
Would anyone please assist me on this one? This fact seems to work, but it doesn''t return when called directly via facter --puppet noop, but the resulting facts end up in the reports. I''m at wits end with this. Thanks! <snip> utc_hour = Facter::Util::Resolution.exec(%q</bin/date -u +"%H">).chomp Facter.add(:noop) do setcode do
2008 Jan 11
3
Date range queries return zero results
Hello, I am having trouble getting data ranges to work correctly. I am using the following command to load the db: index << {:title => row[7].to_i, :date => Date.strptime(row[3], ''%Y-%m-%d''), :page_id => row[5].to_i, :page => row[6].to_i, :content_type => row[1].to_i,
2008 Dec 13
2
Need Help in converting php encryption decryption code to ruby on rails
Hi guys i found this encryption decryption in php and try to convert it in rails but i am unable to successfully convert it. So plz help me. I you write the whole conversion code then it will be great. PHP code is like this ================ # #/********************************************** #** #** MD5 block cypher #** #** Author..: leapinglangoor [
2009 Jun 18
3
Date.new.to_time.to_i
What''s going on here!? >> Date.new.to_time.to_i NoMethodError: undefined method `to_i'' for Mon, 01 Jan -4712 00:00:00 -0800:DateTime from (irb):25 >> Date.today.to_time.to_i => 1245308400 >> RUBY_VERSION => "1.8.7" >> Rails.version => "2.1.1" (I''m not sure if this is a rails thing, or just a ruby thing) --
2010 Aug 03
10
Returning last value
Hi. I have the following controller of the update action: [code] def update @projeto = Projeto.find(params[:id]) if (@projeto.update_attributes(params[:projeto])) ## Mesmo raciocĂ­nio utilizado no create. @permissaoA = Permissao.find(:first, :conditions => ["usuario_id = ?", @projeto.responsavel.to_i]) @permissaoAvancado1 = Permissao.find(:first, :conditions
2006 Mar 22
2
What is wrong in this method??????
Hi, This is my definition of method "add_to_cart" ======================= def add_to_cart count=params[:product][:count] while count.to_i>=0.to_i if params[:product][''dem_quantity''+count.to_s]=="" else @product = Product.find(params[:product][''product_id''+count.to_s]) print @product.name
2009 May 28
1
[PATCH server] Change default flexchart view and increase vertical dimension of flexchart area.
--- src/app/views/graph/history_graphs.rhtml | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/views/graph/history_graphs.rhtml b/src/app/views/graph/history_graphs.rhtml index 9488367..7a7e1e1 100644 --- a/src/app/views/graph/history_graphs.rhtml +++ b/src/app/views/graph/history_graphs.rhtml @@ -7,10 +7,10 @@ $('#flex_history_chart').flash( {
2006 Mar 12
2
Find all the methods on a object in an irb session?
How can I find all the methods on an object from withing irb? Thanks, Joe
2006 Mar 17
1
How to update values in database in this form?
Hi, This is my rHtml page & Corresponding actions & model pages:- ===listform.rHtml================= <h1>Products List</h1> <%= start_form_tag(:action => "add_to_cart")%> <table> <tr> <% i=0 %> <th> Product No. </th> <th> Unit Price </th> <th> Available Qty. </th> <th> Demand Qty. </th>
2008 Jan 03
5
Start script not working when run via Rake
Hi there I''m using the latest release (r300) and ''script/backgroundrb start'' works perfectly when executed on the server, but when put inside a Rake task, it doesn''t launch the worker processes. The Rake task is as follows: task :start_backgroundrb do run "cd #{current_path} && ./script/backgroundrb start" end When I run this task, the
2009 Jul 10
2
[PATCH: server 0/3] Add host-register.rb (replaces host-browser.rb in part)
Removes node identification functionality from host-browser.rb and adds a new script, host-register.rb, that takes over that functionality. The chief difference is that host-browser used a simple TCP server setup to get data from the node, while host-register uses the qpid bus to do so. Specifically, it communicates with the matahari qmf agent added to the node in two related patchsets to node
2006 May 23
2
Ordinalizing a date
I''m trying to use the ordinalize() method to ordinalize a day. Here''s how far I''ve gotten: @reportday = Time.now.at_beginning_of_week.strftime("%d").to_i @ordinalized_reportday = "#{@reportday}".ordinalize I was thinking it wasn''t working because the date is being returned as a string, however I added the .to_i and still it returns an
2006 Mar 31
10
ruby help / if (cond or cond)
Why this code doesn''t work as expected? It raises exceptions everytime. Tried with || operator, too. validates_each :x, :y do |record, attr| record.errors.add (attr, ''between 1 and 100'') if (attr.to_i>100 or attr.to_i<0) end -- They say money can''t buy happiness? Look at the smile on my face... ear to ear, baby!
2005 Dec 02
1
undefined local variable or method `errors' for Listing:Clas
I have a listing model in which I''m trying to validate a date (2005, 2, 29 - is not a valid date). def self.validate_date(year, month, day) unless Date::valid_date?(year.to_i, month.to_i, day.to_i) errors.add(:start_date, "De startdatum moet geldige datum zijn.") end end But everytime I call this code I get: undefined local variable or method
2006 Feb 27
2
Find not working
Hello all. I have the following code (taken from the depot tutorial then modified) def add_dish( dish, type, qnty ) item = @items.find {|i| i.dish_id == dish.id && i.type == type } if item item.quantity += qnty.to_i else if type == ''Fresh'' item = Fresh.for_dish(dish) else item = Frozen.for_dish(dish) end
2006 Jul 02
5
Question about setting field values for a belongs_to model
I have two tables, applicants, and skills where each applicant "has_many" skills, and each skill "belongs_to" an applicant. When I have a reference to an applicant and a (skill) id for one of their skills, I thought to update their skills by using @applicant.skills.find(id_of_skill).description = ''new description'' # even adding
2006 Sep 20
3
Range searches some times they work, some times not...
Hi i''m using ferret to enable geographical postcode. I take a postcode and distance in miles from the user, strip off the outcode and then retrieve the associated x y coordinates in metres from the db. Then i get two temp x''s and y''s and search for all results that are within the box, see code below. Problems start to occur when i search on big distances so for
2006 Apr 21
9
Yet another dry question..
One of these days I''ll figure this out, but in the meantime help me be a better programmer by eliminating some excess code: I''m trying to check to see if somebody trying to view/edit/update a product is the owner. In my scaffold I have this code that works: def edit @owner = Product.find(params[:id].to_i) if @owner.user_id == @user.id @product =
2008 Jun 13
7
Rubyscript2exe undefined ''run'' method
After I ran my program through Rubyscript2exe, the Random.exe file that it created is causing the following error: D:\Ruby projects>random.exe C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:59: undefined method ''ru n'' for Wxruby2::App (NoMethodError) from C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\bootstrap.rb:77:in `load'' from