RoR speed test

Seems that scgi is the fastest (that I can tell)…umm… [ran

100 immediate connections on webrick:
Slowest pages on average (worst 5):
Average times (sec)
connect write   read    close   hits    URL
2.9217  2.9217  51.6146 51.6146 500     http://localhost:3200/
Requests: 500 Time: 516.15 Req/Sec: 0.98

100 immediate connections on scgi single

Slowest pages on average (worst 5):
Average times (sec)
connect write   read    close   hits    URL
0.0005  0.0005  28.8796 28.8797 113     http://localhost:8100/
Requests: 113 Time: 40.29 Req/Sec: 8.24

Is this a joke?

Slowest pages on average (worst 5):
Average times (sec)
connect write   read    close   hits    URL
0.0002  0.0002  60.5475 60.5476 771     http://localhost:4000/
Requests: 771 Time: 598.49 Req/Sec: 1.52

Hmm. Why? I have no idea.
Using flood, scgi with one instance running, webrick on production mode.  Note mod_ruby I could not really even get to compile, and mongrel seemed slow, too.


perl cygwin

To install cygwin perl you need to first install make, then cpan will work. You may need to also install gcc. I don’t know why these are not installed.  Anyway if you get the message after Make ” — NOT OK” that means that something is not installed.

how to create a text box in html


<OPTION> Bananas
<OPTION> Oranges
<OPTION> Watermelon
<OPTION> Cantaloupe
<OPTION> Strawberries

<default select name=”Fruit”>

Notice the “size =” meaning how much of a drop down you’ll have.

SSH tunnelling

ssh -L means “connections I make ‘into’ this port on my machine, will make their way through this tunnel and into the foreign port on the foreign machine (some other prog running there that [not ssh]).

Creating fixtures that link amongst themselves

Note well that when creating fixtures for RoR testing you CANNOT really link to straight names, within other files, like

(one entry)
id: 3

and another

id: 5
single_internet_file_id: FavoriteMP3Url # uh...this doesn't seem to work
user_blended_cast_id: CoolCast
file_location_and_name: "yoyo.mp3"

where those are names–the names don’t work (just become zeroes, somehow), so…just use (hard coded) numbers.

nil in fixtures

a note:
in test/fixtures, when you write

id: 34
name: "Roger"
number: nil

this actually assigns number as 0! This means that if you test in your model code for “number.blank?” this will now return true, since it is actually zero. The use of nil is truly misleading here, and should be done away with, in my opinion. So you can instead just call
if !user and !filename
do whatever in your model “verify” methods, and nil will work. Don’t use blank, basically.

instead of
if user.blank? and filename.blank?
do whatever

How to serve a file in RoR

# this is how to send it out–through Ruby. Unfortunately it appears that webrick buffers all output, so…with a 1 gig file…that is not good–it runs out of memory.
# send_file(realFileCompleteName,
# :filename =>,
# :type => ‘image/gif’,
# :disposition => ‘attachment’,
# :streaming => ‘false’ # If false, the entire file is read into server memory and sent to the client. Otherwise, the file is read and written to the client in :buffer_size chunks. [from Agile Web Development p. 431]

# :buffer_size => ‘4096’
# }

Roger's meanderings, notes to himself, bug reports, and other things