Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

ichimunki's scratchpad

by ichimunki (Priest)
on Jun 02, 2004 at 19:27 UTC ( [id://359680]=scratchpad: print w/replies, xml ) Need Help??

Answers to Ovid's programmer questions:

1. This is a problem because although efficient on short arrays, it does not scale (i.e. O(n-squared) type algorithm). Better to sort the arrays (or copies of the arrays) first (assuming sortable elements), then you can simply hopscotch along them both comparing elements, and shuttling matches to a new array. Depends on arrays being sorted efficiently.

#!/usr/bin/ruby -w class Array def my_reverse tmp = self.dup #function is destructive new = [] while tmp.size > 0 new.push( tmp.pop ) end return new end end a = ['foo', 'bar', 'baz', 'cheeze whiz'] puts a.my_reverse
3. Request manager gets request, asks translator for standard query form, gives that to DB interface, gives result to output translator. As much as possible the input/output handlers are subclasses of main input and output superclasses . Request manager sets up a queue (FIFO) of requests, each one containing it's own "blackboard" space to be used at will by each of the components. Of course, if the database is a bottleneck, it might be wise to do I/O with one program/thread and queue them to the db program/thread so that request fetching/output is not blocked by this step. Of course output is still throttled by the db, but assuming variable input rate, it should "catch up" during slow request times.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-20 15:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found