Thanks for the results, Jim. You’re right that the digits are there,
the subtraction above proves it. But why wouldn’t they print? They
are Floats. Float#to_s prints digits (e.g. the literal 1.5).
It is as if the results from Time.to_f are singleton objects whose #to_s has been rewritten!
I wish there was a way to know if an object is a singleton or has
otherwise been structually modified.
Gavin
···
On Tuesday, January 14, 2003, 12:50:24 AM, Jim wrote:
On Monday, 13 January 2003 at 22:46:25 +0900, Gavin Sinclair wrote:
On Tuesday, January 14, 2003, 12:43:40 AM, Gavin wrote:
I think I’m going mad…
Let me provide further evidence:
>> f = Time.now.to_f
=> 1042465453
>> g = Time.now.to_f
=> 1042465457
>> f - g
=> -4.146000028
[Expected behaviour is displayed in 1.7]
I think the digits are there, they just are not printing.
I have searched the archives and posted this message three times
and have yet to get a response. I am trying to create a web page
that let’s a user upload a file.
OK, I felt sorry for you and looked in too it just now (but I
had already deleted your mail, so I high-jacked another one from
you, possibly upsetting people’s threading mail-clients, inserting
the contents of your original posting from the mailinglist archive).
I have worked through most of the issues, and can even get
a file on to my server, but it is embedded in a binary file
whose format is unknown.
Has anyone experience with this, or is there documentation on
how to extract the file data from what is sent to the server?
Below is an example of the file I get from webrick.
The original contents of the file v.rb is “This is a test.\n”
The spooky data is a boundary, which also is submitted via the
CONTENT_TYPE environment variable.
Test the following html-file (invalid, lacks head, body, and such):
···
On Mon, Jan 13, 2003 at 10:50:24PM +0900, Jim Freeze wrote:
--
with this ruby-snipet as the responding cgi action[1]:
env.rb
#!/usr/bin/ruby -w
puts “Content-type: text/html\n\n”;
puts “–START– \n”;
while line = gets()
puts line;
end
puts “ –STOP– \n”;
ENV.each_pair { |e, v|
puts "#{e} = #{v}<br>\n";
}
Look especially at the value of CONTENT_TYPE. Is it not that boundary
that comes before and after the actual contents of the file you chose
to upload?
Best Regards /Selander
[1] I hope your web-server supports Ruby-cgi:s. If not, try to
experiment with the directive “AddType application/x-httpd-cgi .rb”
in an own .htaccess file, if the server allows that. It, of course,
still requires that the web-server have Ruby installed, but it
should be possible to have it installet in your own home directory
and direct the shebang-line to it. Just don’t tell your sysadmin or
he might consider it as an violation of security.
Anders Selander Centre for Parallel Computers selander@pdc.kth.se
Programmer Royal Institute of Technology +46 (0)8 790 72 11
SE-100 44 STOCKHOLM, SWEDEN +46 (0)70 266 29 67