Do you do this? Why would not pass the whole request through, like a proxy server?
Cheers,
Patrick
···
On Monday, August 23, 2004, at 04:26 PM, Kirk Haines wrote:
Let me throw you a wrinkle to think about.
File uploads. If you adopt a model where you are passing a request object
to the webapp, and the webapp may not even be on the same machine as the
webserver, what is the best way to handle uploaded files?
You can't just create a tempfile like the current CGI does. Do you transfer
the data with the request, but then write it to tempfiles on the other
side? Does Drb provide a way that one could write the uploaded files to
tempfiles on the server, but that one could access the tempfiles via the
request object in the webapp? Could be cool. Might be a bad idea.
Another beautiful solution for my eyes. Thanks so much David! i am getting so used to the "or" instead of ||
Zach
David A. Black wrote:
···
Hi --
On Fri, 20 Aug 2004, Zach Dennis wrote:
David A. Black wrote:
I'm not quite following. What's not working as you'd like exactly?
hsh = { '*' => '(*)' , 'a' => '(1){2}' }
val = "b"
a = hsh[ val ] or hsh['*'] #to give me, a = '(*)'
puts a
val = "a"
a = hsh[ val ] or hsh['*'] #to give me, a = '(1){2}'
puts a
I want the fourth line to output (*) instead it gives me nil.
process = proc { |str,val|
process_hsh = { "String" => true , "Fixnum" => true }
re = /\((.*)\)|\{(.*)\}/;
m = str.scan( re )
if( process_hsh["#{val.class.to_s}"] ) then
m.each{ |v|
next if( not v); #<-----------------THIS IS THE CULPRIT
puts v
}
end
}
But "v" is always put to the screen. The output I get is:
···
*
nil
*
nil
*
nil
*
nil
In my test case, I am expecting:
*
Does MatchData not take advantage of iterating via "next" ? Thanks,
is giving me "v" as an array of matches....I should have tested first!
Zach
Zach Dennis wrote:
···
I've got a block of code:
process = proc { |str,val|
process_hsh = { "String" => true , "Fixnum" => true }
re = /\((.*)\)|\{(.*)\}/;
m = str.scan( re )
if( process_hsh["#{val.class.to_s}"] ) then
m.each{ |v|
next if( not v); #<-----------------THIS IS THE CULPRIT
puts v
}
end
}
But "v" is always put to the screen. The output I get is:
*
nil
*
nil
*
nil
*
nil
In my test case, I am expecting:
*
Does MatchData not take advantage of iterating via "next" ? Thanks,
process = proc { |str,val|
process_hsh = { "String" => true , "Fixnum" => true }
re = /\((.*)\)|\{(.*)\}/;
m = str.scan( re )
if( process_hsh["#{val.class.to_s}"] ) then
m.each{ |v|
next if( not v); #<-----------------THIS IS THE CULPRIT
[...]
Does MatchData not take advantage of iterating via "next" ? Thanks,
m isn't a MatchData object; it's an Array (returned by scan). 'next'
definitely works; if it doesn't move to the next iteration, then "not
v" is not true. I think you may be testing for empty strings with
'not', which doesn't work because "" is true. If that turns out to be
the problem, you can do: