search for: rjust

Displaying 10 results from an estimated 10 matches for "rjust".

Did you mean: just
2007 Sep 21
2
text formatting
Dear all, Does R have any functions for C/Fortran style text formatting when a number needs to be output right-justified in a fixed length field? say '%2d %3d %5.3f' or like python .rjust(n) and .zfill(n) I can do it paste(), but it is very clumsy. Thank you very much Stephen
2006 Jan 24
7
formatting numbers with commas
I needed to format numbers with commas to make it more human readable. Here''s how I did it. def commify(number) c = { :value => "", :length => 0 } r = number.to_s.reverse.split("").inject(c) do |t, e| iv, il = t[:value], t[:length] iv += '','' if il % 3 == 0 && il != 0 { :value => iv + e, :length =>
2006 Apr 30
8
format numbers as words
Does anyone know if there is a function available which can format any entered number as words? eg: ''1234'' would be ''One Thousand Two Hundred and Thirty Four'' In the past, I would have said this is a tall order, but from what I''ve seen with playing with rails for a short time, I don''t know what to expect. :) Thanks for any help, Damien
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
2012 Jan 19
4
redirect_to with a hash instead of parameters
...gt; @date.day I''d like to replace the :year, :month and :day parameters with a hash containing the three parameters. @date is an instance of a Date class, and the trouble with that is Date.month is a single character. I''d like it to be null-padded, but it seems messy to put .rjust(2, ''0'') against all three parameters everywhere in the code. Is it possible to do something like this? redirect_to :action => ''foo'', :uid => @schedule.first.train_uid, params_hash ...where params_hash contains { :year => ''2011'',...
2009 Jul 06
0
[PATCH server] UI for accumulated uptime for VMs. (revised2)
...ath(source) compute_public_path(source, 'swfs', 'swf') end + + def number_to_duration(input_num) + input_int = input_num.to_i + hours_to_seconds = [input_int/3600 % 24, + input_int/60 % 60, + input_int % 60].map{|t| t.to_s.rjust(2,'0')}.join(':') + days = input_int / 86400 + day_str = "" + if days > 0 + day_label = (days > 1) ? "days" : "day" + day_str = "#{days} #{day_label} " + end + day_str + hours_to_seconds + end end diff --git a/...
2009 Jul 02
1
[PATCH server] UI for accumulated uptime for VMs. (revised)
...ath(source) compute_public_path(source, 'swfs', 'swf') end + + def number_to_duration(input_num) + input_int = input_num.to_i + hours_to_seconds = [input_int/3600 % 24, + input_int/60 % 60, + input_int % 60].map{|t| t.to_s.rjust(2,'0')}.join(':') + days = input_int / 86400 + day_str = "" + if days > 0 + day_label = (days > 1) ? "days" : "day" + day_str = "#{days} #{day_label} " + end + day_str + hours_to_seconds + end end diff --git a/...
2009 Jul 06
2
[PATCH server] UI for accumulated uptime for VMs. (revised3)
...ath(source) compute_public_path(source, 'swfs', 'swf') end + + def number_to_duration(input_num) + input_int = input_num.to_i + hours_to_seconds = [input_int/3600 % 24, + input_int/60 % 60, + input_int % 60].map{|t| t.to_s.rjust(2,'0')}.join(':') + days = input_int / 86400 + day_str = "" + if days > 0 + day_label = (days > 1) ? "days" : "day" + day_str = "#{days} #{day_label} " + end + day_str + hours_to_seconds + end end diff --git a/...
2009 Jun 29
3
[PATCH server] UI for accumulated uptime for VMs.
...ath(source) compute_public_path(source, 'swfs', 'swf') end + + def number_to_duration(input_num) + input_int = input_num.to_i + hours_to_seconds = [input_int/3600 % 24, + input_int/60 % 60, + input_int % 60].map{|t| t.to_s.rjust(2,'0')}.join(':') + days = input_int / 86400 + day_str = "" + if days > 0 + day_label = (days > 1) ? "days" : "day" + day_str = "#{days} #{day_label} " + end + day_str + hours_to_seconds + end end diff --git a/...
2007 Apr 25
5
Upload PDF / Save as tiff
Hi, I''m trying to automate the conversion of a PDF document received via a browser upload to a tiff image via ghostscript. I have the PDF data in a string, and I need the tiff data returned into a string. The general command I want to emulate is: type test.pdf | "c:\program files\gs\gs8.56\bin\gswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -sOutputFile=- > test5.tiff