Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

ichimunki's scratchpad

by ichimunki (Priest)
on Jun 02, 2004 at 19:27 UTC ( #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
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2017-03-29 06:02 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (343 votes). Check out past polls.