Re: Perl commandments
Thou shalt optimise for programmer time unless absolutely necessary, Thou shalt optimise for programmer time unless O(x(n)) O(y(n)) and n is a suitably large value, where programmer time is both the time for the current programming task and any future programming time that may be expended maintaining this code. Maybe that's not quite as snappy as the Brocard's. Hmm. It would be easier if I could type omegas and stuff. -- print "\n",map{my$a="\n"if(length$_6);' 'x(36-length($_)/2)."$_\n$a"} ( Name = 'Mark Fowler',Title = 'Technology Developer' , Firm = 'Profero Ltd',Web = 'http://www.profero.com/' , Email = '[EMAIL PROTECTED]', Phone = '+44 (0) 20 7700 9960' )
JOB: Re: Hiring (not another one :) )
While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. -- print "\n",map{my$a="\n"if(length$_6);' 'x(36-length($_)/2)."$_\n$a"} ( Name = 'Mark Fowler',Title = 'Technology Developer' , Firm = 'Profero Ltd',Web = 'http://www.profero.com/' , Email = '[EMAIL PROTECTED]', Phone = '+44 (0) 20 7700 9960' )
Re: Perl commandments
* Mark Fowler ([EMAIL PROTECTED]) wrote: Thou shalt optimise for programmer time unless absolutely necessary, Thou shalt optimise for programmer time unless O(x(n)) O(y(n)) and n is what are O(x(n)) and O(y(n)), i'm not familiar with the x and y notation -- Greg McCarroll http://www.mccarroll.uklinux.net
Re: Perl commandments
what are O(x(n)) and O(y(n)), i'm not familiar with the x and y notation Okay, I was making it up on the fly; - They're meant to be the functions you're implementing. Hence O(x(n)) is running time of x on the data n, and the same for y. I think the point I was trying to make about future programming time was much more important. Pah...I'm going to read some comics and install FreeBSD now... Later. Mark. -- print "\n",map{my$a="\n"if(length$_6);' 'x(36-length($_)/2)."$_\n$a"} ( Name = 'Mark Fowler',Title = 'Technology Developer' , Firm = 'Profero Ltd',Web = 'http://www.profero.com/' , Email = '[EMAIL PROTECTED]', Phone = '+44 (0) 20 7700 9960' )
Re: JOB: Re: Hiring (not another one :) )
Mark Fowler [EMAIL PROTECTED] writes: While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. Reading Room has a PS2 in Dean Street and a pool table and space invaders machine in Wardour St. So ner. -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
Re: Perl commandments
Greg McCarroll [EMAIL PROTECTED] writes: * Mark Fowler ([EMAIL PROTECTED]) wrote: what are O(x(n)) and O(y(n)), i'm not familiar with the x and y notation Okay, I was making it up on the fly; - They're meant to be the functions you're implementing. Hence O(x(n)) is running time of x on the data n, and the same for y. I think the point I was trying to make about future programming time was much more important. ok, but it gets more interesting as take into account moores law that reduces the effectiveness of optmisation by halving the improvement of the optimization every year, Err... Twice as fast is still twice as fast when it's running on a processor that's twice as fast as it would have been. I now can't remember where I read a fascinating piece on the value of more efficient algorithms as computers got faster. But it was worth reading. It was by that guy. Y'know, the guy who wrote that paper. -- Piers
Re: Perl commandments
* Mark Fowler ([EMAIL PROTECTED]) wrote: Err... Twice as fast is still twice as fast when it's running on a processor that's twice as fast as it would have been. I now can't remember where I read a fascinating piece on the value of more efficient algorithms as computers got faster. But it was worth reading. It was by that guy. Y'know, the guy who wrote that paper. ah, but its half the difference and thats whats important in this context, besides i think we'll all agree we are not talking about magnitudes of difference in this advice -- Greg McCarroll http://www.mccarroll.uklinux.net
Re: Perl commandments
In article [EMAIL PROTECTED] you write: ok, but it gets more interesting as take into account moores law that reduces the effectiveness of optmisation by halving the improvement of the optimization every year [...] This depends. If you're just doing an optimisation that changes one O(N) algorithm for another, then you're probably better off with the most clear version and wait for Moore's Law to help. Cycle-pinching optimisation doesn't really gain much anyway. [Mind you, I suspect that index and the equivalent regexen may have different O() scores. Discuss.] However, the problem is with programmers that don't really understand algorithms and implement something the "obvious" way, e.g. O(N^2) instead of O(NlogN) then this is not going to help when you attempt to scale your website or whatever to a million users instead of a test set of five. Of course, when the offending O(N^2) is found by the BPFH and the original coder LARTed, then the replacement O(NlogN) code should still indicate the API, be well commented and document where the algorithm came from (Mastering Algorithms with Perl / Knuth / wherever.) Of course, for small N, crude and simple O(N^2) algorithms can be faster than fancy ones, but for many cases, N is going to be directly proportional to your expected profit ;)
Re: Perl commandments
* Peter Corlett ([EMAIL PROTECTED]) wrote: In article [EMAIL PROTECTED] you write: ok, but it gets more interesting as take into account moores law that reduces the effectiveness of optmisation by halving the improvement of the optimization every year [...] This depends. If you're just doing an optimisation that changes one O(N) algorithm for another, then you're probably better off with the most clear version and wait for Moore's Law to help. Cycle-pinching optimisation doesn't really gain much anyway. [Mind you, I suspect that index and the equivalent regexen may have different O() scores. Discuss.] However, the problem is with programmers that don't really understand algorithms and implement something the "obvious" way, e.g. O(N^2) instead of O(NlogN) then this is not going to help when you attempt to scale your website or whatever to a million users instead of a test set of five. the best way to do this, if you see something is N^2 is to figure out how you could do it with a sort and hey presto it usually can be turned into NlogN+N .. NlogN -- Greg McCarroll http://www.mccarroll.uklinux.net
Re: Perl commandments
Greg McCarroll [EMAIL PROTECTED] writes: the best way to do this, if you see something is N^2 is to figure out how you could do it with a sort and hey presto it usually can be turned into NlogN+N .. NlogN This would involve beating aforementioned programmers round the head with Programming Pearls and if they _still_ don't get it, slamming their fingers under a full set of Knuth? -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
Re: Perl commandments
David Hodgkinson [EMAIL PROTECTED] writes: Greg McCarroll [EMAIL PROTECTED] writes: the best way to do this, if you see something is N^2 is to figure out how you could do it with a sort and hey presto it usually can be turned into NlogN+N .. NlogN This would involve beating aforementioned programmers round the head with Programming Pearls and if they _still_ don't get it, slamming their fingers under a full set of Knuth? Programming Pearls! That's where the discussion of good algorithms used on accelerating hardware was. I think. -- Piers
Re: JOB: Re: Hiring (not another one :) )
David Hodgkinson ([EMAIL PROTECTED]) wrote: Mark Fowler [EMAIL PROTECTED] writes: While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. Reading Room has a PS2 in Dean Street and a pool table and space invaders machine in Wardour St. Dircon took away their pool table recently to replace it with office space. G. I think all companies should have at least something... it helps with team building, ummm, team moral and I guess wasting time? The MAME machine sounds very cool, does it have authentic joysticks? (BTW, if any one knows where I could pickup some old AsciiWare Nintendo joysticks please drop me a email) John -- :wq
Re: JOB: Re: Hiring (not another one :) )
On Wed, 10 Jan 2001, John wrote: David Hodgkinson ([EMAIL PROTECTED]) wrote: Mark Fowler [EMAIL PROTECTED] writes: While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. Reading Room has a PS2 in Dean Street and a pool table and space invaders machine in Wardour St. Dircon took away their pool table recently to replace it with office space. G. I think all companies should have at least something... it helps with team building, ummm, team moral and I guess wasting time? The MAME machine sounds very cool, does it have authentic joysticks? (BTW, if any one knows where I could pickup some old AsciiWare Nintendo joysticks please drop me a email) Yes. It's an authentic 2-player table-stylie thing with a bigger brain. Don't challenge Graham to Track And Field tho. nice. John -- Paul Sharpe Tel: +44 (20) 7407 5557 Miraclefish Ltd. Fax: +44 (20) 7378 8711 Studio 12 mailto:[EMAIL PROTECTED] 37 Tanner Street London SE1 3LF UNITED KINGDOM
Re: Manning Tk book
On Sun, Jan 07, 2001 at 07:47:27PM -, Dean S Wilson wrote: Was anyone on list involved in the beta reading of this one? http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=1884777937 If so did it look promising? It was going in the right direction, but there hasn't seemed to have been much activity on it in the last few months ... dj
RE: Manning Tk book
From: DJ Adams [EMAIL PROTECTED] Sent: 10 January 2001 14:33 On Sun, Jan 07, 2001 at 07:47:27PM -, Dean S Wilson wrote: Was anyone on list involved in the beta reading of this one? http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=1884777937 If so did it look promising? It was going in the right direction, but there hasn't seemed to have been much activity on it in the last few months ... I chatted to Andrew Johnson about this yesterday. He's just very busy right now and this doesn't seem to be particularly close to the top of his list of priorities. It will happen, but he's loathe to give any timeframes. Cheers, Dave... -- The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system.
Re: Directory to Data Structure
On Wed, Jan 10, 2001 at 09:16:57AM -0500, Andy Williams wrote: What I need to do is put this into a data structure like: $dirstruct{"mydir"}-{dir1}-{dir2}-["A.A","B.B"] The directory listing would be: /dir1/dir2/A.A /dir1/dir2/B.B $file =~ s/^\\//g; my @fp = split(/\//,$file); # Somehow need to get this into %DIRSTRUCT!! ...insert code here :) How about this. It's not entirely sensible but should do the job ... # untested code $file=~!(.*)/(.*)!; ($dir, $file)=($1, $2); # Get the directory and filename portions # there's a module to do that, but I can't remember what it's called $dir=~s!/!}{!; $dir='{'.$dir.'}';# now looks like {dir1}{dir2} eval('$dirstruct{mydir}'.$dir.'=$file'); # Hah! Just you try that in C! Adapting this for systems which use different directory seperators and making it store more than one file per directory is left as a trivial exercise for the reader :-) This will break if you have silly directory or filenames, but can easily be made more bulletproof. Please remember that using eval is Really Really Bad unless you are absolutely 100% confident that no-one has been playing silly buggers. Like, for example, creating directories with names like system("format c: "); chuckle -- David Cantrell | [EMAIL PROTECTED] | http://www.cantrell.org.uk/david Any technology distinguishable from magic is insufficiently advanced
Re: Directory to Data Structure
Andy Williams wrote: I'm using File::Find to recursively get all the files from a directory structure, then splitting each $File::Find::name into an array. What I need to do is put this into a data structure like: $dirstruct{"mydir"}-{dir1}-{dir2}-["A.A","B.B"] $dirstruct{"mydir"}-{dir1}-{dir3}-{dir4}-["C.C","D.D"] $dirstruct{"mydir"}-{dir4}-{dir5}-["E.E"] The directory listing would be: /dir1/dir2/A.A /dir1/dir2/B.B /dir1/dir3/dir4/C.C /dir1/dir3/dir4/D.D /dir4/dir5/E.E I don't think that's possible the way you spec'ed it. Consider this directory structure: /dir1/dir2/file1.txt /dir1/dir2/file2.txt /dir1/dir2/dir3/notherfile.txt then you would need the following data structure: $dirstruct{'mydir'}-{'dir1'}-{'dir2'}-['file1.txt', 'file2.txt'] $dirstruct{'mydir'}-{'dir1'}-{'dir2'}-{'dir3'}-['notherfile.txt'] That is, ...-{'dir2'} would need to be a hashref and an arrayref simultaneously. I don't think that works, unless you're more evil than I am. (Maybe some trick with globs?) You could make it work if you represent files by hash keys with a value of undef, I suppose, but not if you represent them by array elements. Unless your files *only* reside in "leaf" directories and never in any directory that also contains subdirectories. Cheers, Philip
Re: Directory to Data Structure
Andy Williams wrote: eval('push @{$DIRSTRUCT'.$dir.'}, $f'); Urgle. Don't use string eval without vetting your data. Try the version I submitted a couple of minutes ago. I'm afraid it's a bit more readable, though. Cheers, Philip
Re: JOB: Re: Hiring (not another one :) )
On Wed, Jan 10, 2001 at 11:17:54AM +, David Cantrell wrote: /me thinks more people should demand silly toys as signing-on bonuses http://www.ericharshbarger.org/lego/desk.html -- David H. Adler - [EMAIL PROTECTED] - http://www.panix.com/~dha/ "We Americans stand on the shoulders of freaks." - Doctor Demento
Re: Perl 6
David Hodgkinson wrote: Or am I missing something? But you have to think about what new features you want to add when you're redesigning the internals.
Re: Perl 6
David Hodgkinson writes: If we can get past Larry, I imagine we'll make really rapid progress. Is a coup out of the question? The emergency backup plan of airlifting him from California to Colorado and chaining him to the keyboard remains a backup plan. Will advise HQ when time is ripe. Nat
Re: JOB: Re: Hiring (not another one :) )
On Wed, Jan 10, 2001 at 06:46:23PM +, David Cantrell wrote: On Wed, Jan 10, 2001 at 12:45:11PM -0500, David H. Adler wrote: On Wed, Jan 10, 2001 at 11:17:54AM +, David Cantrell wrote: /me thinks more people should demand silly toys as signing-on bonuses http://www.ericharshbarger.org/lego/desk.html Old news mate :-) Well, yes, but it seemed appropriate anyway. dha -- David H. Adler - [EMAIL PROTECTED] - http://www.panix.com/~dha/ "It's all in the mind." - Madness
Re: JOB: Re: Hiring (not another one :) )
Mark Fowler wrote: While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) slaps head How could I have forgot that ... :))) And a very good machine it is too :) We have been trying to persuade them to put it in the programmer's room :) cheers Graham Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. -- print "\n",map{my$a="\n"if(length$_6);' 'x(36-length($_)/2)."$_\n$a"} ( Name = 'Mark Fowler',Title = 'Technology Developer' , Firm = 'Profero Ltd',Web = 'http://www.profero.com/' , Email = '[EMAIL PROTECTED]', Phone = '+44 (0) 20 7700 9960' )
Re: JOB: Re: Hiring (not another one :) )
Hi, John wrote: David Hodgkinson ([EMAIL PROTECTED]) wrote: Mark Fowler [EMAIL PROTECTED] writes: While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. Reading Room has a PS2 in Dean Street and a pool table and space invaders machine in Wardour St. Dircon took away their pool table recently to replace it with office space. G. I think all companies should have at least something... it helps with team building, ummm, team moral and I guess wasting time? The MAME machine sounds very cool, does it have authentic joysticks? (BTW, if any one knows where I could pickup some old AsciiWare Nintendo joysticks please drop me a email) The joysticks certainly seem authentic enough :) I'll ask if anyone knows where to get the Nintendo ones Cheers Graham John -- :wq
Re: JOB: Re: Hiring (not another one :) )
Hi, Piers Cawley wrote: Paul Sharpe [EMAIL PROTECTED] writes: On Wed, 10 Jan 2001, John wrote: David Hodgkinson ([EMAIL PROTECTED]) wrote: Mark Fowler [EMAIL PROTECTED] writes: While hiring seems to be the order of the day, just to let you know that AL Digital are hiring at the moment .. (permies only at the moment) ... I can't believe that you didn't mention the really cool arcade machine in reception[1] in the sales pitch. I think that most Perl Mongers would be swayed by this as much as by anything else ;-) Later Mark. (Happily Employed) [1] Table top cabinet[2] with a PC running MAME inside. [2] The kind you can rest a pint on. Reading Room has a PS2 in Dean Street and a pool table and space invaders machine in Wardour St. Dircon took away their pool table recently to replace it with office space. G. I think all companies should have at least something... it helps with team building, ummm, team moral and I guess wasting time? The MAME machine sounds very cool, does it have authentic joysticks? (BTW, if any one knows where I could pickup some old AsciiWare Nintendo joysticks please drop me a email) Yes. It's an authentic 2-player table-stylie thing with a bigger brain. Don't challenge Graham to Track And Field tho. I used to be a demon at track and field. The button bashing version. But it depended somewhat on the buttons used. This is the button bashing version :)) Does look strange from the otherside of the table when someone is bashing the buttons and concentrating Cheers Graham -- Piers
Re: joke or bug?
On Wed, Jan 10, 2001 at 11:12:06PM +, Dave Cross wrote: I just sent Randal an email and got an automated response from his "answering machine". All very clever stuff, but the subject of the email is given below: "answering machine message, most recently updated 100/11/14" What do you think? Joke or bug? I would think joke, but you never know... :-) dha -- David H. Adler - [EMAIL PROTECTED] - http://www.panix.com/~dha/ Also know as the first rule of finance: "Don't run out of money". - Tony Bowden
Re: joke or bug?
On Wed, Jan 10, 2001 at 08:02:01PM -0500, David H. Adler ([EMAIL PROTECTED]) wrote: On Wed, Jan 10, 2001 at 11:12:06PM +, Dave Cross wrote: I just sent Randal an email and got an automated response from his "answering machine". All very clever stuff, but the subject of the email is given below: "answering machine message, most recently updated 100/11/14" What do you think? Joke or bug? I would think joke, but you never know... :-) Randal says bug. Dave... -- http://www.dave.org.uk | [EMAIL PROTECTED] | [EMAIL PROTECTED] plugData Munging with Perl http://www.manning.com/cross//plug
Re: joke or bug?
On Thu, Jan 11, 2001 at 06:52:56AM +, Dave Cross wrote: On Wed, Jan 10, 2001 at 08:02:01PM -0500, David H. Adler ([EMAIL PROTECTED]) wrote: On Wed, Jan 10, 2001 at 11:12:06PM +, Dave Cross wrote: I just sent Randal an email and got an automated response from his "answering machine". All very clever stuff, but the subject of the email is given below: "answering machine message, most recently updated 100/11/14" What do you think? Joke or bug? I would think joke, but you never know... :-) Randal says bug. But not his. Says he. :-) -- David H. Adler - [EMAIL PROTECTED] - http://www.panix.com/~dha/ The Inferno video is really in colour.