similar to: Code blocks syntax as method arguments

Displaying 20 results from an estimated 30000 matches similar to: "Code blocks syntax as method arguments"

2006 Jul 28
4
add one month or one year to a date
Hi, I need to be able to add one month or in some cases on eyear to a Date. Does anyone know of any easy ways of doing this? thanks scott -- Posted via http://www.ruby-forum.com/.
2009 Feb 20
3
Years gone by (deprecation of years method)
Can anyone give me some insight as to why the ActiveSupport::CoreExtensions::Float::Time method ''years'' is being deprecated? I have an application managing contracts and being able to manipulate and report on them based on the number of years the contract lasts, is very convenient. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~
2009 Apr 07
4
/lib daemon folder: how do i add a module into the daemon?
I am using the daemons plugin. I have just one problem how do i add modules from the /lib folder to the /lib/daemons/daemon.rb file eg. /lib/basic_functions.rb this is the file i want to load in daemon.rb contents daemon.rb: #!/usr/bin/env ruby # You might want to change this ENV["RAILS_ENV"] ||= "production" require File.dirname(__FILE__) +
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on this, I think it''s time to ask the list. Postgres stores a Date in YYYY-MM-DD format. My users want the dates in MM/DD/YYYY format. Sure, I could explicitly convert it on the app level every place where a date is displayed, but that seemed like a DRY violation. I thought I''d be clever and simply
2006 Apr 04
11
Date/Time format and syntax
Hi, Just wondering how I get both the current date and time to display here (so far I can only get the date OR the time): @tblregisteredphone.txtregisterdatetime = Date.today Also, how can I change the format of the date and time from: Tue Apr 04 00:00:00 GMT Daylight Time 2006 to 2006-04-04 12:04:00 ?? I''m sure it''s very simple, I just don''t know how
2000 Nov 21
4
Session logging in Windows98?
I'd like to log all console I/O for an entire session while maintaining normal console I/O. I'm working in Windows98, RGui, R1.1.1. The sink() function is not the answer since it diverts output from the console. In the RFAQ I see references to "...save the contents of the interaction buffer to a file..." and in the R-Help Archive "...just save the console output...". I
2012 Apr 12
6
beginning_of_month problem
Rails 2.3.2, Ruby 1.9.3 I want to get all records for one month from charges table. recs = Charge.where(["date >= ? and date < ?", t.beginning_of_month, t.next_month.beginning_of_month]) and this transforms into this query on PostgreSQL SELECT "charges".* FROM "charges" WHERE (date >= ''2012-03-31 22:00:00.000000'' and date <
2008 Jun 26
1
Undefined method: camelize
Hi, I am fairly new at Rails, and attempting to deploy an application that''s running fine using InstantRails on my PC. On the deployment server (I use railsplayground.net), I get the following error: Processing ApplicationController#index (for 220.224.229.156 at 2008-06-25 18:49:34) [GET] Session ID: 5921e7d789ee3aaa214f2d59aa40986a Parameters: {"action"=>:index,
2009 Jun 15
1
calendardateselect problem
I am using http://code.google.com/p/calendardateselect/ for my date time picker. I am using dd.mm.yyyy format (:finnish) and i am using ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge! (:default => "%d.%m.%Y") ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge! (:default => "%d.%m.%Y %H:%M") in my enviroment. Everything is working
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all, I am getting ActiveRecord to produce XML with render :xml => @user.to_xml However, on the client end it is a bit annoying for me to deal with attributes like first-name. I would much rather have first_name. Is there any way for me to turn off the behavior of converting _ to -? This seems to be done by a call to dasherize inside the to_xml of
2006 Mar 23
5
Custom date format
Hi, I''ve followed these directions : http://railswiki.pdxruby.org/HowToDefineYourOwnDateFormat.html It seems pretty straightforward but obviously it doesn''t work for me... article.date_edited.to_formatted_s(:my_format_1) produce a default formatted date, not the one I''ve defined in environment.rb : ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
2006 Jul 17
2
european date format
hi, overhere users go nuts if they have to enter the date in iso format, so i have to make my applications in such a way that not only dates are displayed in the "dd-mm-yyy" format but also can be entered in that way. somewhere i found this code to put in the environment script: ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update( :default => ''%d/%m/%Y
2006 Jun 14
5
display formatted date
Hi, In my form I have date field set as ''datetime_select'' which is fine as I wanted it in the same format. But while displaying (list action) it displays date in long format i.e. ''Tue May 30 15:39:00 Central Daylight Time 2006''. How can I format it so that it will just be diaplyed as ''dd/mm/yyyy'' format? Thanks -- Posted via
2009 May 02
1
Trouble installing packages on Macintosh OS-X 10.5.6
I just upgraded my version of R from 2.8.1 to 2.9.0. After doing so, I now have problems using the package installer to reinstall all my packages. Some download and install without problems, but for others, I get the spinning pinwheel and after even 10 minutes, nothing is downloaded. R stops responding. At first, I had not deleted the old version of 2.8.1 before installing 2.9.0. However, I
2010 Feb 02
2
Error with write.table
I was trying to save a data frame to an excel file using the following command: write.table(myData, file="myData.csv",sep=",", row.names=F) The command works for some data frames, but for other data frames, I get the following error: Error in if (inherits(X[[j]], "data.frame") && ncol(xj) > 1L) X[[j]] <- as.matrix(X[[j]]) : missing value where
2006 May 11
4
string to date/time?
Hey All, Anyone know of a library for parsing "human" dates, like "this friday" or "2 days ago"? I used to use strtotime in php, but starting from here; http://wiki.rubyonrails.com/rails/pages/PhpStrtotime and doing lots of googling, I haven''t been able to find anything similar for ruby. I know of javascript solutions to this, but I''d need to do
2005 Oct 11
6
adding 1 month to a date
Within an R dataset, I have a date field called “date_”. (The dates are in the format “YYYY-MM-DD”, e.g. “1995-12-01”.) How can I add or subtract “1 month” from this date, to get “1996-01-01” or “ “1995-11-01”. --------------------------------- [[alternative HTML version deleted]]
2006 May 21
5
model methods
Hello everyone, In my model, I have def leave_at_formatted leave_at.strftime("%I:%M %p") end I was wondering if there were any way to define to_s for leave_at in order to get the same result? Thanks!
2006 Jan 07
1
How to DRY with Fixtures (helper or extend Time class, how)?
I have a test/fixtures/users.yml like so: apa: id: 1 username: apa [...] created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> I don''t like how I''m repeating myself with the strftime bit. Is there some shorter Time method to format time for a (MySQL) datetime field that
2010 Dec 02
2
Any way to get syntax-highlighted code blocks with Text::MultiMarkdown?
Hello, I'm using Text::MultiMarkdown in my website, and I would like to know if there is any way to get syntax highlighting in code blocks. Thanks, -Mike Doherty