From estrabd at yahoo.com Thu Jul 1 10:44:42 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Fwd: Solutions and Discussion for Perl Quiz of the Week #18 Message-ID: <1088696682.26019.199560970@webmail.messagingengine.com> ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ----- Original message ----- From: "Jon Bjornstad" To: perl-qotw@plover.com Date: Mon, 28 Jun 2004 23:28:11 -0700 Subject: Solutions and Discussion for Perl Quiz of the Week #18 Sample solutions and discussion Perl Quiz of The Week #18 (20040623) [Note: This was quiz #18, not #16. I sent out the quiz with the wrong Subject line. -Mark Jason Dominus] For statewide elections, the state of California uses a "random alphabetic" sort to order the candidates' names on the ballot. This link describes that special sort: http://www.ss.ca.gov/elections/elections_ra.htm (mirrored at http://perl.plover.com/qotw/misc/r018/elections_ra.htm ) The idea is this: a random order is selected for the twenty-six letters of the alphabet, and then the names on the ballot are sorted according to this random order, instead of according to the usual order. This is the order in which the names appear on the ballot in Assembly District 1. In Assembly District 2, the order is the same, except that the first name on the list has been moved to the end of the list. In Assembly District 3, the next name on the list is moved to the end of the list, and so on. You will write a program to generate ballots. The program will be invoked like this: elect.pl [-r] [permutation] [district-number] [namefile] (Items in [square brackets] are optional.) The 'permuation' argument will default to 'randlet.txt'. If the file exists, it should contain a single line of text with a random permutation of the 26 letters of the alphabet. If this file does not exist, the program should generate one at random. The -r option will force the file to be regenerated even if it exists already. The 'district-number' is the number of the Assembly District for which the ballot will be generated. If omitted, the program should generate the ballot for Assembly District 1. The 'namefile' is a file that contains the names of the candidates. The names come one per line with first name then last name: Jill Harmon Gus Tribble Walter Reston Norma Kretschmer Fiorella Squamuglia Vern Smith Bill Smith Ed Squid John Macdonald Angus MacDonald If the namefile is omitted, the program should read the names from the standard input. The program should print out the candidates' names, one per line, in the order specified by California state law, sorted according to the random permutation of the alphabet, with names rearranged as appropriate for the specified Assembly District. For example, if the file 'permutation' contains QWERTYUIOPASDFGHJKLZXCVBNM and the 'namefile' contains the names listed above, then the output for Assembly District 1 should be: Walter Reston Gus Tribble Ed Squid Fiorella Squamuglia Vern Smith Bill Smith Jill Harmon Norma Kretschmer Angus MacDonald John Macdonald For Assembly District 4, it should be: Fiorella Squamuglia Vern Smith Bill Smith Jill Harmon Norma Kretschmer Angus MacDonald John Macdonald Walter Reston Gus Tribble Ed Squid ---------------------------------------------------------------- When I first encountered the 'random alphabetic ordering' method of the California election system I immediately thought it would make for an interesting Perl challenge and it has. These people submitted ideas/solutions (in no particular order :): Matthew Walton Christer Ekholm John J. Trammell Yitzchak Scott-Thoennes Randy W. Sims Adrian Scottow Rod Adams Kester Allen Jonathan Scott Duff Mark Jason Dominus Torsten Hofmann the hatter Patrick LeBoutillier Rick Measham Mark Morgan There was first a discussion to refine the specification. Command line arguments and how to separate first and last names and what about non-alphabetic characters in names. [Some of this was my fault. Jon's original request was for a program whose input was in a different format than what I sent out; I rewrote it considerably. I was aware that the argument format I inserted was ambiguous, but didn't think it would be a big problem. -MJD] I tried to short circuit some of this discussion as the point of the quiz was to have some fun with sorting techniques. Because of this I won't discuss the various ways of using command line options to get the required data into the program. I'll focus on the sort itself. Many people saw right away that since comparing two names would be a complex affair that this was a prime opportunity for using a Schwartzian Transform. This is a technique invented by and named after (not by) Randall Schwartz, author of the classic "Learning Perl". If any of you do not know of this technique you can read about it in several places (Perl Cookbook, Effective Perl, perldoc -f sort, etc). The key idea in a complex sort is to pre-generate a sort key for each item BEFORE you do the sort rather than each time the sort compares two elements. This is much more efficient and simply darn clever! The use of anonymous arrays and maps unwind the pregenerated sort keys from the desired result: # schwartzian transform for efficiency and fun @names = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, sortkey $_ ] } @names; How to generate a sort key in this case? The tr/// function comes in quite handy here. If the permuted alphabet in in $alphabet then this will do it: sub sortkey { my $name = shift; $name =~ tr/$alphabet/A-Z/; return $name; } After this transformation the name we can simply do a simple compare and the result will be to have respected the new alphabetic ordering. Unfortunately tr/// does not do variable interpolation (why?). So we need to wrap the tr/// in an eval. There is also the need to swap first and last names and do the sort case-insensitively. So here is what Rick Measham coded: sub encode { # Case insensitive my $switch = uc shift; my $permutation = shift; # Last name first $switch =~ s/^([\w-]+)\s+(.+)$/$2 $1/; # Switch in the new alphabet -- tr doesn't take # variables so we have to eval the # transliteration. We checked the permutation # before so we can trust it. It's just a list # of letters. eval "\$switch =~ tr/$permutation/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"; return $switch; } # Schwartzian Transform -- see note below my @sorted = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { [ encode($_, $permutation), $_ ] } @names; That pretty much summarizes what I think is the optimal approach. One improvement suggested by Mark Jason Dominus was to only do ONE eval rather than one for each name in the list. Here is his offering: [I sent this to Jon in private email ome time ago when we were first discussing the question; it wasn't intended as a complete solution to the problem. -MJD] open IN, "rlets" or die "can't open rlets\n"; my $rlets = ; print $rlets; chomp $rlets; my $candidates = shift; open IN, "<", $candidates or die "cannot open $candidates: $!\n"; my $code = q{ print sort { my $aa = lc $a; my $bb = lc $b; $aa =~ tr/RLETS/a-z/; $bb =~ tr/RLETS/a-z/; $aa cmp $bb } ; }; $code =~ s/RLETS/$rlets/g; eval $code; Note that the q{ } does a single quoting - no interpolation. I'm surprised that Perl knows about balanced {}'s and does not end the quoted string after "$aa cmp $bb". Or maybe I'm not surprised! :) This code does not use a Schwartzian Transform but is just as quick - evals are apparently quite expensive! [I think that's because Perl must run its parser. -MJD] On other points of the problem: Generating a random permutation of A to Z was accomplished in a variety of ways. Here is one by Mark Morgan: my @letters = ( 'A' .. 'Z' ); my $alphabet = ''; $alphabet .= splice( @letters, rand(@letters), 1 ) while @letters; Kester Allen and John Trammell used a module to generate the permutation: use List::Util qw/shuffle/; Rick Measham offered this regex to ensure that a permutation (not generated by the program) was an actual permutation of A..Z: die("Permutation file '$permutation_file' does not contain a permutation\n") unless $permutation =~ /^(?:([A-Z])(?!.*?\1)){26}$/; Wow! I'd have to study on that one! [Let's do that. The first part locates a capital letter, and captures it in $1: ([A-Z]) The next part uses the 'negative lookahead' construction to require that the same letter *not* appear a second time; the letter may *not* be followed by some sequence of characters (.*) and $1 again (\1): (?! .* \1) The whole thing is wrapped in /^(...){26}$/ which requires that the entire string consist of just 26 such letters, each of which does not appear a second time. I do not know why Pr. Measham used .*? instead of .* . -MJD] Matthew Walton submitted solutions in both Perl and a language called Haskell 98. I'd never heard of it! Thanks, Matthew, for opening my eyes to other realms. I do tend to get somewhat narrow minded in my Perl obsessiveness. I've heard good things about Ruby but have not perused it much yet... [Haskell is my favorite programming language! One thing I learned from Haskell is that inferring block structure from white space is not an intrinsically dumb idea; what is dumb is the way Python has implemented it. It's always nice to find out that a dumb idea is smarter than you thought it was. Haskell has two flagship features. First, it has an extremely powerful type system, and the Haskell compier figures out all the types for you so that it is very rare to have to declare any variables; if the compiler figures out the wrong type, it is almost always because you made a serious programming error. See http://perl.plover.com/yak/typing/ for more details about this. That article is about SML, which has a less sophisticated type system than Haskell, but perhaps it gives the flavor. Second, Haskell uses "lazy evaluation", which means that it never evaluates anythig it doesn't have to. Consider Perl code: my ($y) = grep /foo/, glob("*"); This searches the entire directory, constructs a list of files, scans the entire list, constructs another list of all the files whose names contain "foo", puts the first one into $y, and throws the rest away, wasting most of the work it just did. In the Haskell analog of this code, no work will be done until the value of $y is actually required, and then the directory will be searched and scanned only far enough to find the right value for $y. This happens automatically. One result is that you can write carrots = "carrot" : carrots; and get an infinite list of carrots; Haskell is happy to manipulate infinite lists. Another result is that you can write max = hd sort numbers; to get the smallest number in the list ("hd" gets the value at the head of a list) and this runs in time proportional to the length of the list, because the sort only sorts enough of the list to find the first element of the result. -MJD] Christopher Eckholm submitted his solution on a web page which made it easy to look at! [http://www.chrekh.se/qotw/elect.pl] Everyone's code was rather neatly done and well documented. It would be a pleasure to work with any of you as a team member! Jon [Thanks to everyone who participated, and particularly to those who did so in private and never told anyone about it. I will send the new quiz tomorrow. -MJD] From estrabd at yahoo.com Wed Jul 7 14:16:56 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Fwd: Perl Quiz-of-the-Week #19 Message-ID: <1089227816.10387.199918482@webmail.messagingengine.com> ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ----- Original message ----- From: "Belden Lyman" To: perl-qotw@plover.com Date: Wed, 07 Jul 2004 12:49:53 -0400 Subject: Perl Quiz-of-the-Week #19 IMPORTANT: Please do not post solutions, hints, or other spoilers until at least 60 hours after the date of this message. Thanks. IMPORTANTE: Por favor, no envi?is soluciones, pistas, o cualquier otra cosa que pueda echar a perder la resoluci?n del problema hasta que hayan pasado por lo menos 60 horas desde el env?o de este mensaje. Gracias. IMPORTANT: S'il vous pla?t, attendez au minimum 60 heures apr?s la date de ce message avant de poster solutions, indices ou autres r?v?lations. Merci. WICHTIG: Bitte schicken Sie keine L?sungen, Tipps oder Hinweise f?r diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser Mail. Danke. BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de eerste 60 uur na het verzendingstijdstip van dit bericht. Waarvoor dank. VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i voobshe lyubye podskazki v techenie po krajnej mere 60 chasov ot daty etogo soobshenija. Spasibo. Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60 Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4 Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4. ---------------------------------------------------------------- When you think of a sailing vessel, chances are good that you think of a bermudan rig, which has two triangular sails arranged like this: |* | * | * | * *| * * | * * | * * | * * | * * | * * | * * | * * | * * | * * | mainsail * * jib | * * |________________* * | --------------| ,--------------|------------------. front \ / back \_____________________________/ (A bermudan-rigged vessel) If you've ever seen a Chinese junk, a Norse longboat, or a Polynesian sailing outrigger, then you know that there are many other sail shapes. For example, many popular small sailing dinghies use a lateen sail because it is easy for a single person to manage. Notice the lack of right angles: | /\ | ,/ \. | /' `\ |,/ \. /' `\ ,/ \. /' lateen `\ ,/ mainsail \. /' `\ / \ ---------------------------- | ,--------|------------------------. front \ / back \_____________________________/ (A lateen-rigged vessel) Finally, there are non-triangular sails, such as a gaff-rigged sail. These look similar to a triangular bermudan mainsail, but have an extra boom (the "gaff") at the *top* of the sail: gaff--> /* / * |/ * | * | * | * | * | * | * | * | * | * | gaffed * | mainsail * | * |__________________* | | ,-----------|--------------------. front \ / back \_____________________________/ (A gaff-rigged vessel) You will write a program, sailarea.pl, capable of calculating the sail area of triangular and gaff-rigged sails. The program is run as follows: sailarea.pl filename [scale] Scale, if given, is a percentage by which to increase or decrease the calculated sail area. If not given, scale defaults to 100% (no scaling). The input file contains the coordinates of each sail in the sailplan; units are implied to be in centimeters. Blank and commented lines are valid. sailname.a: x,y sailname.b: x,y sailname.c: x,y anothersail.a: x,y anothersail.b: x,y anothersail.c: x,y The various sail shapes cannot be intuited from 'sailname'. 'sailname' exists only as a tag to associate various points with a single sail. Assume that the sail is gaff-rigged if it has four coordinates, and triangular if it has only three. For example, given bermudan.txt: # coordinates for a bermudan rig mainsail.a: 0, 450 mainsail.b: 0, 50 mainsail.c: 200, 50 jib.a: 0,400 jib.b: 150,0 jib.c: 0,0 When run as sailarea.pl bermudan.txt the program responds with individual sail areas and the total sail area: mainsail.area: 40000 cm^2 jib.area: 30000 cm^2 total.area: 70000 cm^2 From dave at gnofn.org Fri Jul 9 10:01:26 2004 From: dave at gnofn.org (Dave Cash) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Meeting Tonight Message-ID: <20040709095836.E21748@sparkie.gnofn.org> Hello, all. Just a reminder: our monthly meeting is tonight, 5pm to 7pm at Fair Grinds Coffee House, 3133 Ponce de Leon (a few doors down from Whole Foods on Esplanade). See you then and there! Dave /L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\ Dave Cash Power to the People! Frolicking in Fields of Garlic Right On-Line! dave@gnofn.org Dig it all. From dave at gnofn.org Sat Jul 10 06:43:37 2004 From: dave at gnofn.org (Dave Cash) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Testing a Curses-Based App Message-ID: <20040710064016.Q21748@sparkie.gnofn.org> Hi, group. A question I meant to ask at the meeting last night, but didn't: A friend of mine needs to write some Test::Harness tests that will ensure the proper functioning of a Curses-based application. He wanted me to ask the group if anyone knew of a good way to do this with Perl. So have any of y'all done this before or heard tell of doing it? If I don't hear back here, I'll probably post to Perl Monks. Thanks, Dave /L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\ Dave Cash Power to the People! Frolicking in Fields of Garlic Right On-Line! dave@gnofn.org Dig it all. From dave at gnofn.org Sat Jul 10 07:33:14 2004 From: dave at gnofn.org (Dave Cash) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Meeting Summary for July 9, 2004 Message-ID: <20040710073019.H21748@sparkie.gnofn.org> I've posted to the wiki a meeting summary for last night's meeting. I may have forgotten things we talked about. If so, could folks who were there please add in anything I forgot to mention? Thanks! Here's what I wrote: ---------- Four people attended the meeting July 9, 2004 meeting: * DonnieCameron * DaveCash * DavidKeeney * FranLedger Donnie talked about some concerns he was having related to hosting his clients' web sites at his house, over his cable internet line. They talked about the options for dedicated hosting or co-location. Dave recommended the site [http://www.webhostingtalk.com/ Web Hosting Talk] as a good resource for finding a good hosting company. Dave gave a status report on the open, distributed library application he's been writing. He's building it around some groovy Perl technologies, like Class::DBI, Template Toolkit, DBD::!SQLite, YAML. He hopes to have it completed by the August meeting. He also plans to open-source the project and to package it in such a way that it can (once its dependencies have been installed) be easily installed on any system for use by any group. He will also be happy to give a presentation about its insides at a future Perl Mongers meeting, if members so desire. We spent a little time talking about other programming languages. Donnie is crazy about C# and talked a little about it. We also talked about Python a bit. Parrot and ponie came up briefly. We got into a discussion of the trials and tribulations of making web applications work for Internet Explorer vs. for any of the other, more feature-rich, frequently updated browsers (Mozilla, FireFox, Opera, etc.). Donnie predicted that within one year, Internet Explorer's market share would drop below 60%. The others at the meeting didn't think this would happen (thought they all hoped it would). They all agreed to keep an eye on it to see if Donnie's prediction is correct. ---------- Thanks! Dave /L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\ Dave Cash Power to the People! Frolicking in Fields of Garlic Right On-Line! dave@gnofn.org Dig it all. From estrabd at yahoo.com Thu Jul 15 19:23:32 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Fwd: Perl 'Expert' Quiz-of-the-Week #19 Message-ID: <1089937412.17846.200463277@webmail.messagingengine.com> ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ----- Original message ----- From: "Jerrad Pierce" To: perl-qotw@plover.com Date: Thu, 15 Jul 2004 19:54:46 -0400 Subject: Perl 'Expert' Quiz-of-the-Week #19 IMPORTANT: Please do not post solutions, hints, or other spoilers until at least 60 hours after the date of this message. Thanks. IMPORTANTE: Por favor, no envi?is soluciones, pistas, o cualquier otra cosa que pueda echar a perder la resoluci?n del problema hasta que hayan pasado por lo menos 60 horas desde el env?o de este mensaje. Gracias. IMPORTANT: S'il vous pla?t, attendez au minimum 60 heures apr?s la date de ce message avant de poster solutions, indices ou autres r?v?lations. Merci. WICHTIG: Bitte schicken Sie keine L?sungen, Tipps oder Hinweise f?r diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser Mail. Danke. BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de eerste 60 uur na het verzendingstijdstip van dit bericht. Waarvoor dank. VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i voobshe lyubye podskazki v techenie po krajnej mere 60 chasov ot daty etogo soobshenija. Spasibo. Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60 Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4 Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4. ---------------------------------------------------------------- banner(1) and cursive(1) are old UNIX utilities that take ASCII input (0-127) and render the input in a hard-coded font like the examples below. Later, FIGlet was created to use a plain text format font file to allow a wider variety of output styles. % banner japh # # ###### # # # # # # # # # # # # # # # # # # # ###### ####### # # ####### # # # # # # # # # # ##### # # # # # % cursive japh / o __. _ /_ /_(_/|_/_)_/ /_ / / -' ' Write a program to do "optical" character recognition of ASCII-Art text. Given an input string provided on STDIN print the text represented by the ASCII-art to STDOUT. There are three milestones for this puzzle. 1) Process any output produced by banner(1) and print the result to STDOUT. Your program should obviously print "JAPH" or "japh" at your discretion, if given the output from banner above; but not "jAph". If you do not have banner(1) or your banner prints vertically instead of horizontally use the banner font for FIGlet. Both the font and FIGlet itself are available at http://figlet.org/ OR ftp://pthbb.org/mirror-mirror/figlet/ Instead, you could also use one of the many web interfaces for generating FIGlet output such as http://wfiglet.handalak.com/ For the next two milestones you need to download some FIGlet fonts available at ftp://ftp.figlet.org/pub/figlet/fonts/contributed.tar.gz OR ftp://pthbb.org/mirror-mirror/figlet/fonts/contributed.tar.gz The FIGlet font file format is rather intuitive but described at length in the FIGlet man page widely available online including http://www.redstone.army.mil/documents/figlet-2.1.1.man.html A tarball with a special issue of the Text::FIGlet module is available at ftp://pthbb.org/pub/misc/qotw.tgz It includes perl versions bof figlet and banner, and the figlet man page 2) Process any output produced by FIGlet with the basic and drpepper fonts. Your output should be as before. In addition to the text to process from STDIN you must accept an argument -f= specifying the path to the font the input was created with. % figlet -f basic -A basic d88b .d8b. d8888b. db db `8P' d8' `8b 88 `8D 88 88 88 88ooo88 88oodD' 88ooo88 88 88~~~88 88~~~ 88~~~88 db. 88 88 88 88 88 88 Y8888P YP YP 88 YP YP % !! | yourprogram.pl -f=figlib/basic.flf JAPH % figlet -f drpepper -A japh _ _ <_> ___ ___ | |_ | |<_> || . \| . | | |<___|| _/|_|_| <__' |_| % !! | yourprogram.pl -f=figlib/drpepper.flf japh 3) Process any output produced by FIGlet with the argument -m-1 and a font from the library listed above. You should accept an argument -d= which specifies the location of the font library. Programatically determine the font used to render the provided input and process accordingly. Your output should be as before with the name of the font chosen printed to STDERR before the results are printed to STDOUT. / # #/ ### ## # ## ## ### /### /### ## /## ### / ### / / ### / ## / ### ## / ###/ / ###/ ##/ ### / ## ## ## ## ## ## / ## ## ## ## ## ## ### ## ## ## ## ## ## ### ## ## ## ## ## ## ### ## /# ## ## ## ## ### ####/ ## ####### ## ## ## ### ## ###### ## ## ## ## / / ## / / ## / / ## / PS> For the interminably curious to see why the condition of -m-1 is imposed compare the output of the font slscript with and wihtout it. From EmailLists at SimonDorfman.com Fri Jul 16 00:01:40 2004 From: EmailLists at SimonDorfman.com (Simon Dorfman) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] XHTML Validator to RSS Message-ID: http://www.benhammersley.com/tools/xhtml_validator_to_rss.html Useful script for checking W3C compliance of webpages and seeing results in RSS feed. I use an RSS newsreader (NetNewsWire - MacOSX only app) every day so this is handy for me to make sure I stay in line while making changes to webpages. Source code here: http://www.benhammersley.com/code/xhtml_validator_to_rss_source.html Simon From donnie at solomonstreet.com Fri Jul 16 11:47:55 2004 From: donnie at solomonstreet.com (Donnie Cameron) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Re: Caught a comment on NewOrleans.pm In-Reply-To: References: Message-ID: <40F806BB.8000800@solomonstreet.com> James, Thank you very much for your comments. I started with voxrox.com today. The server is already up, running Debian Sarge, and everything seems ok so far. I plan to start moving some of my Web sites, all of which are driven by a large Perl program and the PostgreSQL database, to the new server over the weekend. Voxrox.com seems a little expensive, but after some research I determined that they were among the most reliable. I've been having some really bad experiences with local service providers; no one can keep their line up for a whole week. This is playing havoc with some of my billing systems, so I was very sensitive to finding a dedicated machine that would never go down. I researched the subject thoroughly on Google and on webhostingtalk.com, which provided some very insightful comments. I hope everything goes well. I've never colocated or done anything like that, so I am afraid. I've always set up my own networks and used my own hosts; I don't mind being down for an hour or two a year. But keeping your own hosts is impossible in New Orleans. The quality of the high speed lines that one can find in this city are substandard. I've had high-speed lines in several other states and going down is normally somewhat rare. I've gone through several DSL and Cable Internet service providers, including Bell South, Covad, XO, Cox, and others in this city and no one can keep a line up for a whole week in a row. Sometimes, as I'm experiencing now, we go down several times a day for a few seconds. The most incredible thing is that no one seems to care. The tech support people around here are impervious to panic. But this is New Orleans; I don't think being online all the time really matters all that much. Thanks!! --Donnie Thompson, James wrote: > I noted in the ?minutes? from the last NewOrleans.pm meeting that you > were looking for some dedicated or co-location hosting options? I have > had a good experience with http://www.ait.com > although the cost of support could kill you if you don?t know what > you?re doing. I have one FreeBSD 4.9 box running Plesk for web hosting > with them and will probably add another next month for test development. > They will install Win2K3, Fedora Core 1, Red Hat 7.x and FreeBSD 4.10. I > downgraded to 4.9 for plesk. The cost is $50/month for a Pentium 4 > 2.8GHz machine with 80GB hard drive, 512MB of RAM and all standard Intel > chipset stuff (LAN, etc.) which will run Linux/BSD just fine. Just > thought I?d let you know. Maybe I?ll see you at the next NewOrleans.pm > if I get some time. > > > > If you want to get back in touch with me email me at > jwthompson2@gmail.com > > > > > > Later! > > James W. Thompson, II > > /*/Web/*//*/ Administrator/*/ > > //NOBTS//// - ////ITC// > > //Extension: 8180// > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.721 / Virus Database: 477 - Release Date: 7/16/2004 > From EmailLists at SimonDorfman.com Fri Jul 16 12:48:23 2004 From: EmailLists at SimonDorfman.com (Simon Dorfman) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Re: Caught a comment on NewOrleans.pm In-Reply-To: <40F806BB.8000800@solomonstreet.com> Message-ID: On 7/16/04 11:47 AM, "Donnie Cameron" wrote: > I started with voxrox.com today. Hi Donnie, As a possible alternative to Voxrox, I happened to see this co-location hosting which looks quite good: http://www.johncompanies.com I saw the link to it on http://www.phrack.org/ (upper left corner) which gives it some credibility in my mind. Other than that, I know nothing about them. Simon From estrabd at yahoo.com Sun Jul 18 15:08:26 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] fair grinds Message-ID: <1090181306.24761.200592759@webmail.messagingengine.com> Hi from the fair grinds :) ... I finally got my freebsd laptap set up for wireless using dhcp - just wanted to shoot a note from here. I will try my best to make the next meeting. Brett ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com From estrabd at yahoo.com Wed Jul 21 08:50:36 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Fwd: Solutions and Discussion for Perl Quiz of the Week #19 (Expert Edition) Message-ID: <1090417836.15442.200793482@webmail.messagingengine.com> ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ----- Original message ----- From: "Jerrad Pierce" , belg4mit@MIT.EDU To: perl-qotw@plover.com Date: Tue, 20 Jul 2004 17:42:34 -0400 Subject: Solutions and Discussion for Perl Quiz of the Week #19 (Expert Edition) Sample solutions and discussion Perl Expert Quiz of The Week #19 (20040712) banner(1) and cursive(1) are old UNIX utilities that take ASCII input (0-127) and render the input in a hard-coded font like the examples below. Later, FIGlet was created to use a plain text format font file to allow a wider variety of output styles. % banner japh # # ###### # # # # # # # # # # # # # # # # # # # ###### ####### # # ####### # # # # # # # # # # ##### # # # # # % cursive japh / o __. _ /_ /_(_/|_/_)_/ /_ / / -' ' Write a program to do "optical" character recognition of ASCII-Art text. Given an input string provided on STDIN print the text represented by the ASCII-art to STDOUT. There are three milestones for this puzzle. 1) Process any output produced by banner(1) and print the result to STDOUT. Your program should obviously print "JAPH" or "japh" at your discretion, if given the output from banner above; but not "jAph". If you do not have banner(1) or your banner prints vertically instead of horizontally use the banner font for FIGlet. Both the font and FIGlet itself are available at http://figlet.org/ OR ftp://pthbb.org/mirror-mirror/figlet/ Instead, you could also use one of the many web interfaces for generating FIGlet output such as http://wfiglet.handalak.com/ For the next two milestones you need to download some FIGlet fonts available at ftp://ftp.figlet.org/pub/figlet/fonts/contributed.tar.gz OR ftp://pthbb.org/mirror-mirror/figlet/fonts/contributed.tar.gz The FIGlet font file format is rather intuitive but described at length in the FIGlet man page widely available online including http://www.redstone.army.mil/documents/figlet-2.1.1.man.html A tarball with a special issue of the Text::FIGlet module is available at ftp://pthbb.org/pub/misc/qotw.tgz It includes perl versions bof figlet and banner, and the figlet man page 2) Process any output produced by FIGlet with the basic and drpepper fonts. Your output should be as before. In addition to the text to process from STDIN you must accept an argument -f= specifying the path to the font the input was created with. % figlet -f basic -A basic d88b .d8b. d8888b. db db `8P' d8' `8b 88 `8D 88 88 88 88ooo88 88oodD' 88ooo88 88 88~~~88 88~~~ 88~~~88 db. 88 88 88 88 88 88 Y8888P YP YP 88 YP YP % !! | yourprogram.pl -f=figlib/basic.flf JAPH % figlet -f drpepper -A japh _ _ <_> ___ ___ | |_ | |<_> || . \| . | | |<___|| _/|_|_| <__' |_| % !! | yourprogram.pl -f=figlib/drpepper.flf japh 3) Process any output produced by FIGlet with the argument -m-1 and a font from the library listed above. You should accept an argument -d= which specifies the location of the font library. Programatically determine the font used to render the provided input and process accordingly. Your output should be as before with the name of the font chosen printed to STDERR before the results are printed to STDOUT. / # #/ ### ## # ## ## ### /### /### ## /## ### / ### / / ### / ## / ### ## / ###/ / ###/ ##/ ### / ## ## ## ## ## ## / ## ## ## ## ## ## ### ## ## ## ## ## ## ### ## ## ## ## ## ## ### ## /# ## ## ## ## ### ####/ ## ####### ## ## ## ### ## ###### ## ## ## ## / / ## / / ## / / ## / PS> For the interminably curious to see why the condition of -m-1 is imposed compare the output of the font slscript with and wihtout it. ---------------------------------------------------------------- This goal of this weeks quiz was to write a program to perform "OCR" on ASCII-Art and determine what text the image represents. For details see the original lengthy problem statement at http://perl.plover.com/qotw/e/019 The quiz had three milestones, and the four particpants' entries were as follows Milestone 1 (M1): Jurgen Pletinckx http://perl.plover.com/~alias/list.cgi?1:mss:1892 Patrick LeBoutillier http://perl.plover.com/~alias/list.cgi?1:mss:1888 Jerrad Pierce http://perl.plover.com/~alias/list.cgi?1:mss:1878 Milestone 2 (M2): Jurgen Pletinckx Same as above Jerrad Pierce Same as above Milestone 3 (M3): Jurgen Pletinckx Same as above Jerrad Pierce http://perl.plover.com/~alias/list.cgi?1:mss:1891 Ronald J Kimball http://perl.plover.com/~alias/list.cgi?1:mss:1889 I expected most people to use the same program for each milestone, or at least M1 and M2, it seemed easier to develop a script and enhance it to comply with subsequent requirements. Not to get ahead of myself, but I think it's interesting, and speaks to the nature of the challenge that all of the submissions require perfect input in order to work. My own submission for M3 fails to recognize "hello" in fraktur for the mismatch of a single "pixel". All of the programs could be described on some level as "brute force", though some more than others. Jurgen and Ronald's solutions for M3 process the input with all available fonts, and they have the false positives of rot13 and term as a result. There were four approaches to the guts of character matching, substr, shift, regexp and serialization. Jurgen used substr for each row of input to extract the section of input corresponding to a figlet character for comparison. Patrick used a combination of substr and serialized figlet characters (a one line representation for easy storage and retrieval in a lookup table on disk). Ronald showed his expert knowledge by using /\G//g against a string of serialized input that had been effectively rotated the text 90 degrees clockwise. Jerrad had a similarly interesting strategy of rotating the input with Text::Orientation 90 degrees clockwise in order to swap columns for rows; making it easy to shift lines off the resulting array as they are used in a match. Jerrad's program also included several optimizations including a character frequency table and short-circuiting once a sole potential match remained. Jurgen's program had an internal requirement that characters be tested widest first and others used ASCII order. Jerrad and Jurgen's programs both performed many more tests to accquire a match due to the placement of tests for equality inside several levels of loops. I (Jerrad) had experimented with something more "liberal" that would have alleviated this and made the engine less finicky about input, "low-resolution" matching. I checked the 0th, 3rd, and 6th columns for equality. It worked rather well however h, m and n were often indistinguishable. That could have been fixed with a progressive scan scheme but at the expense of readily avoiding an infinite loop for fonts such as basic where lowercase and uppercase have the same representation. Jurgen and Ronald's M3 submissions were the only ones that worked out of the box. All of the font-matching engines excluded fonts whose height was not a multiple of the input height; fonts 4 and 8 line high allowed for 16 line high input, but not 6, 9 or 10 line high fonts. Jurgen and Ronald both then proceeded to process the text against the remaining fonts. Jerrad adapted Patrick's fingerprint cache on disk, eliminating fonts that did not include all of the characters used in the input; helas this high pay-off optimization is another example of requiring perfect input. [ Thanks to Jerrad Pierce for running the QOTW this week. New quiz tomorrow. -MJD ] From estrabd at yahoo.com Wed Jul 21 08:50:58 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Fwd: Perl Quiz-of-the-Week #20 Message-ID: <1090417858.15588.200793513@webmail.messagingengine.com> ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ----- Original message ----- From: "Roger Burton West" To: perl-qotw@plover.com Date: Wed, 21 Jul 2004 04:37:46 -0400 Subject: Perl Quiz-of-the-Week #20 IMPORTANT: Please do not post solutions, hints, or other spoilers until at least 60 hours after the date of this message. Thanks. IMPORTANTE: Por favor, no envi?is soluciones, pistas, o cualquier otra cosa que pueda echar a perder la resoluci?n del problema hasta que hayan pasado por lo menos 60 horas desde el env?o de este mensaje. Gracias. IMPORTANT: S'il vous pla?t, attendez au minimum 60 heures apr?s la date de ce message avant de poster solutions, indices ou autres r?v?lations. Merci. WICHTIG: Bitte schicken Sie keine L?sungen, Tipps oder Hinweise f?r diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser Mail. Danke. BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de eerste 60 uur na het verzendingstijdstip van dit bericht. Waarvoor dank. VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i voobshe lyubye podskazki v techenie po krajnej mere 60 chasov ot daty etogo soobshenija. Spasibo. Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60 Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4 Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4. ---------------------------------------------------------------- I run mailing lists. People subscribe, people unsubscribe, and people get unsubscribed automatically when their addresses generate too many bounces. I run these mailing lists using SmartList. I'd like to find out how my lists are being used - do people unsubscribe in a bunch when a flame war happens, or do they just drift in and out over time? What does the total-membership graph look like? You are to write a function, parse_smartlist_log. It takes three parameters: (1) the name of a SmartList log file. (2) the total current membership of the list. (3) the base name of the output file. It should parse a SmartList log file and generate a graph of total list membership against time. Note that not all subscriptions and unsubscriptions will be in the log; it's possible that the listmaster has added or removed addresses without using the administrative interface, especially when the list was first set up. This is the reason for the second parameter. Take whatever action seems appropriate. (The graph can be a bitmap, ASCII, or whatever else - just give it a sensible filename based on the third parameter.) A log file includes lines such as: subscribe: foo@bar.com by: foo@bar.com Thu Mar 21 15:30:35 GMT 2002 unsubscribe: 9 foo@bar.com 32760 foo@bar.com by: foo@bar.com Sat Mar 23 16:27:35 GMT 2002 procbounce: Removed: foo@bar.com 32718 SmartList has fuzzy matching on unsubscription requests - if the addresses in the line differ, use the first one. There are many other lines that may appear in the log file. Sometimes, as seen above for procbounce, there may be no date on the log line. Some sample log files may be obtained from http://firedrake.org/roger/sample_logs.zip or from http://perl.plover.com/qotw/misc/r020/sample_logs.zip http://perl.plover.com/qotw/misc/r020/sample_logs.tgz From estrabd at yahoo.com Thu Jul 29 08:18:17 2004 From: estrabd at yahoo.com (Brett D. Estrade) Date: Mon Aug 2 21:33:04 2004 Subject: [Neworleans-pm] Fwd: Perl 'Expert' Quiz-of-the-Week #20 Message-ID: <1091107097.18549.201316801@webmail.messagingengine.com> ===== http://www.brettsbsd.net/~estrabd __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ----- Original message ----- From: "Mark Jason Dominus" To: perl-qotw@plover.com Date: Thu, 29 Jul 2004 07:39:24 -0400 Subject: Perl 'Expert' Quiz-of-the-Week #20 IMPORTANT: Please do not post solutions, hints, or other spoilers until at least 60 hours after the date of this message. Thanks. IMPORTANTE: Por favor, no envi?is soluciones, pistas, o cualquier otra cosa que pueda echar a perder la resoluci?n del problema hasta que hayan pasado por lo menos 60 horas desde el env?o de este mensaje. Gracias. IMPORTANT: S'il vous pla?t, attendez au minimum 60 heures apr?s la date de ce message avant de poster solutions, indices ou autres r?v?lations. Merci. WICHTIG: Bitte schicken Sie keine L?sungen, Tipps oder Hinweise f?r diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser Mail. Danke. BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de eerste 60 uur na het verzendingstijdstip van dit bericht. Waarvoor dank. VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i voobshe lyubye podskazki v techenie po krajnej mere 60 chasov ot daty etogo soobshenija. Spasibo. Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60 Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4 Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4. ---------------------------------------------------------------- This week's quiz is to write a limited replacement for the CPAN 'MLDBM' module. The purpose of MLDBM is to allow storage of complex Perl data structures in a DBM file. The typical DBM implementation (such as SDBM_File, which comes standard with Perl) allows the programmer to manipulate a disk database as if it were an ordinary hash variable. One says something like tie %hash, 'SDBM_File', $filename; and thereafter, $hash{"key"} = "value"; stores "value" in the disk file under the key "key", and $x = $hash{"key"}; rerieves the value again. But most DBM implementations are limited to storing plain strings as values. Attempting to store undef as a value actualy stores the empty string instead, so that $hash{"key"} = undef; print defined($hash{"key"}) ? "oops" : "OK"; prints "oops". Similarly, attempting to store a compound object such as [1, 2, 3] or {name => "bill", numbers => [1, 2, 3] } actually stores a useless string like "ARRAY(0x436c1d)" or "HASH(0x436c1d)". Similarly, $hash{"this"}{"that"} = "ouch"; causes a "strict refs" failure, if you have "strict refs" checking on, and a bizarre error if not. (Sub-quiz: Why?) The purpose of MLDBM is to work around this. (See http://search.cpan.org/~chamas/MLDBM-2.01/lib/MLDBM.pm for complete details.) Your task this week is to write a version of MLDBM. It should be a tied hash class named 'ML_DBM', such that after tie %mldbm, 'ML_DBM', \%hash; the user can access %mldbm as if it were an ordinary hash, but all data apparently stored in %mldbm is actually stored in %hash instead. For example, this must work: $mldbm{'array'} = [5,6,7]; print $mldbm{'array'}[2]; # This must print 7 as must this: $mldbm{'hash'} = { I => { like => "pie" } } print $mldbm{'hash'}{'I'}{'like'}; # This must print "pie" and this: $mldbm{'a'}{'a2'} = 'AA'; $z = $mldbm{'a'}; $z->{'b2'} = "BB"; print $mldbm{'a'}{'b2'}; # This must print "b2" There is a trivial solution to this, which is just to store the values into %hash and fetch them back as requested. However, this quiz has a restriction which rules out that solution: The values that ML_DBM stores in %hash must always be ordinary strings. The idea is that the user can tie %hash to their favorite DBM implementation, and then use that as the backing hash for ML_DBM: tie %hash => 'NDBM_File', $filename or die ...; tie %db => 'ML_DBM', \%hash; and ML_DBM will (unknowingly, but faithfully) store the data into the underlying disk file via %hash. ML_DBM must restrict the values it stores into %hash to ordinary strings, or else the underlying DBM implementation (NDBM_File in this case) will not faithfully preserve them.