[MarkovBlogger] Oracle headaches Perl.

jjohn on 2004-09-24T07:32:47

or DocBook or LaTeX for making presentation-quality printable documents. I have with the journalizer (except for setting the resting position on the MSDN site.

I thought about it!

(Pudge, slash needs to get involved with this idea after jumping into makefiles while installing Bundle::LWP from CPAN.pm, somewhere around #20, so this is a hard sell; possibly because most of the Congress almost two years and years, suddenly in the Free Software Foundation to help the Scots in the nineties on my short list of films so odd and/or well done (along with Kylie Minogue, Natalie Imbruglia and Jason Donovan)?

gav^ Adobe is asking the judge to rule in this confusing, dark, though provoking masterpiece.

Guy Pearce is great, but now he doesn't like to the normal people would use a grammar/lexer. For our entire process). Hopefully we can have:

# begin file package Foo; my $x = 0; sub foo { print $x++ }
__END__ 
.. and in the last few evenings.

I started writing my slides up here .

I'll be moving Daisypark from my apartment. I'm trying to patch WWW::UsePerl::Journal::Entry as well.)

  • journalstat.perl
#!/usr/local/bin/perl5.8.0 -- # -*- perl -*- use warnings;
use strict; use lib $ENV{HOME}; use WWW::UsePerl::Journal;
my($user) = @ARGV; foreach my $user (@ARGV) {  my $journal
= WWW::UsePerl::Journal->new($user);  my @entries =
$journal->entryids();  # Originally I took the date of the
first and last entries, but  # actually I want the current
date as an endpoint. (If you stop  # posting, that means
your average rate should gradually decrease  # as time
progresses.)  my $firstdate =
$journal->entry($entries[0])->date;  my $numentries =
scalar @entries;  use Time::Piece;  my $lastdate =
localtime;  my $interval = $lastdate - $firstdate;  my
$per_day = $numentries / $interval->days;  print "$user has
written $per_day entries per day\n"; } 
  • journalmonths.perl
#!/usr/local/bin/perl5.8.0 -- # -*- perl -*- use warnings;
use strict; use lib $ENV{HOME}; use WWW::UsePerl::Journal;
my($user) = @ARGV; foreach my $user (@ARGV) {  my $journal
= WWW::UsePerl::Journal->new($user);  my %entries =
$journal->entryhash;  my %count;  foreach my $entrynum
(sort keys %entries)  {  my $entry = $entries{$entrynum}; 
my $date = $entry->date;  my($month, $year) = ($date->mon,
$date->year);  $month = sprintf "%02d", $month; 
$count{"$year$month"}++;  }  foreach my $month (sort keys
%count)  {  print "$month:\t$count{$month}\n";	} }
  • WWW::UsePerl::Journal patch
 ---
/usr/local/perl580/lib/site_perl/5.8.0/WWW/UsePerl/Journal.
pm 2002-09-26 04:51:29.000000000 -0500 +++
WWW/UsePerl/Journal.pm 2002-09-27 10:24:17.000000000 -0500
@@ -1,4 +1,6 @@ -package WWW::UsePerl::Journal; +package
WWW::UsePerl::Journal; # -*- perl -*- + +BEGIN {warn "Using
local copy of WWW::UsePerl::Journal!"}	=head1 NAME @@
-30,6 +32,7 @@	use HTTP::Request::Common;  use
Data::Dumper;  use Carp; +use Time::Piece;  use
WWW::UsePerl::Journal::Entry; @@ -171,19 +174,25 @@  my
$content = $self->{ua}->request(  GET UP_URL .
"/journal.pl?op=list&uid=$UID")->content;  die "could not
create entry list" unless $content; - my @lines = split
/\n/, $content;  my %entries; - foreach my $line (@lines){
- next unless $line =~ m#~$user/journal/#ism; - $line =~
m#~$user/journal/(\d+)">(.*?)#ism; - + my $count
= 0; + while ( $content =~
m{~$user/journal/(\d+).>(.*?)\s+([\d.\s:]+)}ig) + {  next unless
defined $1; - $entries{$1} =
WWW::UsePerl::Journal::Entry->new( + my($id, $subject,
$datestr) = ($1, $2, $3); + $datestr =~
m/(\d+).(\d+).(\d+)\s+(\d+):(\d+)/; + my($year, $month,
$dateofmonth, $hour, $minute) = + ($1, $2, $3, $4, $5); +
my $formatteddate = + "$year-$month-$dateofmonth
$hour:$minute:00"; + my $date =
Time::Piece->new(HTTP::Date::str2time($formatteddate)); +
$entries{$id} = WWW::UsePerl::Journal::Entry->new(  j =>
$self,	user => $user, - id => $1, - subject => $2, + id =>
$id, + subject => $subject, + date => $date,  );  } @@
-203,7 +212,7 @@  my %entries = $self->entryhash;  my @IDs;
- foreach (sort keys %entries) { + foreach (sort {$a <=>
$b} keys %entries) {  $IDs[$#IDs+1] = $_;  }  return @IDs;
  • WWW::UsePerl::Journal::Entry
 ---
/usr/local/perl580/lib/site_perl/5.8.0/WWW/UsePerl/Journal/
Entry.pm 2002-03-03 14:13:05.000000000 -0600 +++
WWW/UsePerl/Journal/Entry.pm 2002-09-27 10:00:49.000000000
-0500 @@ -1,4 +1,4 @@ -package
WWW::UsePerl::Journal::Entry; +package
WWW::UsePerl::Journal::Entry; # -*- perl -*-  =head1 NAME
@@ -15,6 +15,7 @@  use Data::Dumper;  use Carp;  use
WWW::UsePerl::Journal; +use Time::Piece;  our $VERSION =
'0.03';  use constant UP_URL => 'http://use.perl.org'; @@
-58,6 +59,10 @@  sub date  {  my $self = shift; + unless
(defined $self->{date}) + { + $self->get_content; + } 
return $self->{date};  } @@ -132,6 +137,27 @@  if $content
=~  m#Sorry, there are no journal entries  found for this
user.

#ismx; + $content =~ m{ +

((Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Satur day) + [^<]*)

+ }x; + my $datestring = $1; + $datestring =~ m/(.*day)\s+(.*)\s+(\d+),\s+(\d+)/; + my($day, $month, $dateofmonth, $year) = ($1, $2, $3, $4); + $content =~ m{ + ((\d+):(\d+)\s+[AP]M) + }x; + my $timestring = $1; + $timestring =~ m/(\d+):(\d+)\s+([AP]M)/; + my($hour, $minute, $ampm) = ($1, $2, $3); + $hour += 12 if $ampm eq "PM"; + $hour = 0 if $hour == 24; + $month = substr($month, 0, 3); + $day = substr($day, 0, 3); + my $formatteddate = "$day $month $dateofmonth $hour:$minute:00 $year"; + my $dateseconds = HTTP::Date::str2time($formatteddate); + my $date = Time::Piece->new($dateseconds); + $self->{date} = $date; $content =~ m#.*?$ID\n]\n\s*\n\s*

\n\s*(.*?) \n\s*

.*#ismx; HTTP resumer Dear Log and Everyone,

What does everyone think of this? It's like an extremely primitive wget that I threw together tonight just as needed; except you can interrupt the HTTP transfer and resume it later, which at the old wget that I have doesn't know how to do. Busy Busy Busy It's always something. I got a copy of an O'Reilly book for tech review today. I need to read it in the next two weeks, type up my notes, and send them in. I am glad that I decided not to actually work on writing this book, because I can barely find time to review it. Tonight I try to do some cleanup for MacPerl 5.6.1b2 (I expect its release before November). I am slightly discouraged as I find more bugs for MacPerl that I cannot fix, and must rely on Matthias to help me with. Oh well. whither irc.infobot.org? Is it me or is the DNS for irc.infobot.org FUBAR? Showing Great Restraint The nms support list just got an email from a church in Nigeria who confused us with bible salesmen. I sent them a polite email back pointing out that they had the wrong address as we didn't sell bibles. I didn't add the bit that I wanted to, where I would have told them that we didn't sell bibles as we've been told it's an evil book by our Lord Beezlebub. I wasn't sure they'd see the joke. Do not try this at home I've been battling insomnia recently. God knows why I can't sleep, I wish I did. Last night I decided to shave at 3am. I was bored and couldn't think of anything else to do. I have trimmers that I use to shave, it's easy, fast and works better than regular electric shavers. I also have the attachments for longer trims. I though that the .5 inch one would be long enough to cut my hair, after all, I needed a hair cut. Let me tell you, .5 inches of hair is much smaller than you think. Now I'm all fuzzy on top. It doesn't look bad, just really different. I'll say it again, don't do this. Warchalking

The simple technology of chalk marks is solving the problem of wireless internet access.

Get out there with your Pringles tubes and a packet of chalk :)

Link of the day

Web Dawn - Rebirth of the Social Marketplace is a Movable Type powered site, but with an interesting spin -- it looks like a forum rather than a blog.

You can also post anonymously because Mark has used the little script I wrote. It makes me feel warm and tingly inside.

Utility: tgz Dear Log,

The spotlight dancer today is: tgz -- altho you'll probably want to rename that, as there's already a GNU utility by the same name now. (Weirdass GNU people always tryin' to bite my style!) Trial By Accident Oh, okay, so I forgot I had a test in my network class.

Anyway, while I've got network access, I figured I'd drop a few notes in here.

It suddenly has occurred to me that it might have been a hell of a lot easier to have a different separator for the name and the rest of the data (especially if I ever roll this whole bunch of files together into one huge combined inventory/cost file).

I think I have an idea of how to do this. A search in the Perl Cookbook (now that I have the CD Bookshelf version, it's so friggin' easy) revealed that I can dump arrays into hashes. If I make the name of the card the key and the rest of it as a two-element array, I think my problems are over. I can sort with that, I can do pretty much all I need to do with it. (And, despite my whining, I can still work around the problem of my separators. s/// is supposed to be greedy, so I'll do a match for the first string that is a bunch of letters and then a colon, rip that out of the string...no, wait, the best way to do it would be to make it a step in reading the file: Rip each line into three parts, then map that three-element array into one key and one (two-element array) element in the hash. Once that's all mapped, working with the hash itself should be pie.

I hope.

I guess I'm officially back on track; most of what I'm doing tonight is going to be scribblework, not typingwork, so I probably won't post tonight. Got a 7:00 class tomorrow morning. 7:00-9:45 is Discrete Math and then 10:00-11:20 is Statistics. Four hours of nearly continual math, math, math. No wonder I need all that Dew.

Oh, and I have something to scribble *on* now. I can go through a legal pad in about a month, so I've upgraded: I bought a smallish dry-erase board, something I can carry around with me and use like a pad. (Well, except I can't look through my scribbles. Gotta be careful about keeping good things when they come up.) It was over at Staples for ten bucks; worth it, when your legal pad expenses in a year are well into the double digits.

Well, back to the drawing board. ;-)

With apologies to ASCII art farts Dear Log,

 
IM TORGOX IM BUSY STUFFING MY FACE WITH  CHOLE AND KASHA,
ALSO REFACTORING PERLDOC  NONE OF THESE THINGS ARE VEGAN
BECAUSE  THERE IS BUTTER IN THE CHOLE AND BEEF	BOULLION IN
THE KASHA AND A HUMAN PANCREAS	IN PERLDOC I DONT KNOW
WHOSE IT IS BUT ITS  DISEASED PROBABLY MMMMM DISEASED  /  /
 ,==. |~~~  / 66\ |  \c -_) |~~~  `) ( |  / \ |~~~  / \ \ |
 (( /\ \_ |~~~	\ \ `--`|  / / / |~~~ ___ (_(___)_|
jgs
Dynastics Dear All,

As Kommissar of your horrible future, I have decided to rename all the modern presidents in a dynastic lineage starting with Nixon:

Nixon I ("Nixon the Progenitor")
Nixon II (Ford)
Nixon III (Carter)
Nixon IV (Reagan)
Nixon V (Bush Major)
Nixon VI (Clinton)
Nixon VII (Bush Minor; Gore as Antinixon, during the Squism)
Nixon VIII (Carey)
Nixon IX (Drew Carey)
Nixon X (Snicket)
Nixon XI (Oprah.com)
Nixon XII (Kermit D. Frog)
Nixon XIII (Sudsy the Urinal Cake)
Nixon XIV (Sudsy the Other Urinal Cake)
Nixon XV-XIX (the baskets of hissing feral kittens)
Nixon XX (Olsen and Olsen) Cautionary tale Yahoo reports on chest injuries from a poorly-designed bong.

Tabula Rasa Fed up with Suse's lack of gcc, my TV tuner failing under Windows, and the screwed up file associations in BeOS, I did what any fed-up computer geek would do - I wiped the hard drive and reloaded everything.

Windows 98 didn't like things so much the second time around. We'll see how it goes. I can honestly say the first time around I didn't see a single BSOD. Hopefully, that trend will continue. I'm a bit concerned, though, since now I don't seem to be getting sound in the TV tuner.

Suse 8.0 was replaced with Mandrake 8.2. The TV tuner seems to work. I accidentally had the VCR on, so at first I thought Mandrake had stuck some kind of jingle in the startup, but it turned out to be a TV commercial. Oh, and I have a copy of Suse 8.0 for sale - cheap.

I'll be re-installing BeOS tonight, which shouldn't take long. I'm gonna take it easy on the software this time, and only install those apps that I know I'll use - Process Controller, SoundPlay, StripZilla and BeShare. Testing, Testing...Is This Thing On? I started to download the stable perlbot before I realized I had already downloaded it yesterday.

Stop downloading again, start unpacking. Fiddle fiddle, try the test...no dice.

Aha! Net::IRC! Off to CPAN, and after a very short download and installation (I should note here that the kindly T.J. Eckman pointed out the best way to handle Winstallation) I tested it and promptly worried that I had sent an unsupervised IRC bot out into the world.

I'm going to do another test. However, many of the perlbot plugins seem deadly useful, where the Engrishifier is -- let's face it -- a perhaps funny but utterly pointless thing. Lessons to learn from Dell Don't do anything stupid. Hehe

I've had article submissions accepted on slashdot before, but usually there is a discouraging lack of discussion. Not today. :)

Dominus Talks How weird. I posted those on Wednesday and I haven't heard anything except "how do I get my Linux quicktime player to work?". Does anyone watch these movies? Should I bother doing any more?

(You've probably also heard this: that you should always start with a joke. Also bullshit. --mjd) President Ketchupvegetable Dear Log,

I reprint here, in full, an article from today's Counterpunch cowboy round-up of articles about the forty-years-too-late death of Gran dpa Calig ula:

Ronald Reagan, 1911-2004
In a Nutshell

By SUSAN DAVIS

Any kid from Dixon, Illinois can make it..as long as they cultivate a relationship with the FBI, bust a union or two, rat out their Hollywood friends, and fire a few philsophers.

After that, it was a down hill coast for Ronnie.

But why did he call his wife "Mommy?"

Susan Davis teaches at the University of Illinois, Urbana-Champaign.

Yet another unpack trick While going through John's code (free code review for John!), I came across this tidbit:

map(ord, split('', $word));

Well, Ruby doesn't have an 'ord()' function, so I used this instead:

word.unpack("c*")

At RubyConf 2002, I demonstrated that Perl's 'split()' function by itself is faster than 'unpack()' for splitting words up into chars. But I figured that a split + map combo would be slower. Naturally, I did a benchmark.

use strict; use Benchmark; our $word = "Hello"; timethese(1000000,{ "unpack" => q{ unpack("c*",$word); }, "map n split" => q{ map(ord, split('', $word)); }, }); Benchmark: timing 1000000 iterations of map n split, unpack... map n split: 29 wallclock secs (26.92 usr + 0.00 sys = 26.92 CPU) @ 37147.10/s (n=1000000) unpack: 5 wallclock secs ( 4.17 usr + 0.00 sys = 4.17 CPU) @ 239808.15/s (n=1000000)

John's code only does this once per file IIRC, so no big deal. Just something to keep in mind. :) Planting Metaphors Since I'm usually not smart enough to reinstall things (even though I keep all the friggin' installation packages I've ever downloaded), I resort to transplants, packing the loose soil of a fresh hard drive around the dry roots of previously installed (and then burned for archive's sake) programs.

Yuck. Note to self: No more planting metaphors.

Copy copy copy, look around, attempt to run Apache:

Syntax error on line 61 of c:/apache group/apache/conf/httpd.conf: ServerRoot must be a valid directory Note the errors or messages above, and press the key to exit.
Wonderful. Time to locate PFE and get fixin'. Minor Panic

I, of course, use Linux for most of my day-to-day computing, but Gill still likes to use Windows. This works fine. She runs Windows on a laptop and connects to the internet via a Linux gateway box on the home network.

Currently Gill's studying for a PhD. This involves lots or reading books and then condensing what she's read into notes that she writes in Word files. She's three months into the course and has about 2.5 Mb of data. Being more cautious than me, she's been asking me for some time to sort out a way to back up her data - she doesn't to have to retype all of those notes if anything happens to the laptop.

So, over the weekend, I installed Samba on one of the Linux boxes and set up a shared directory that she can see from the Windows box. Now, whenever she wants to backup her data she can just drag and drop the latest files into the backup directory.

Now, one of the things that I had to do was to switch on "profiles" on the Windows box[1]. This means that you know have to log on to Windows and every user that logs on gets their own desktop to configure to their liking.

I explain this to Gill and she goes off to try it all out whilst I start cooking. Thirty seconds later, there's a shout from upstairs, "Where have all my files gone?". I run upstairs to find that the PhD folder she had on her desktop is no longer there. I start to explore a few likely areas on the disk but to no avail. I start to panic slightly - whichh doesn't improve my problem resolution skills. I'm sure that I didn't delete anything, but maybe I did it by accident. This looks nasty.

Eventually, I work it out. As Gill is now logged on as herself, she sees her desktop, not the default user one that she saw before. Her files are still there, but on a different desktop. It's simply a case of finding where Windows has hidden the old desktop files and moving them to the new desktop directory. Everyone is happy. And the backup facilty works.

But I thought I was in serious trouble for a while there :-/

[1] Well, maybe I didn't have to do it, but it certainly seemed the simplest way to set up Samba.

Homestar fun Dear Log,

I just set up this experimental feed: http://interglacial.com/rss/homestar.rss

It's a list of main files at the Homestar Runner site. Not new main files, all main files -- so it's no good for using as a Slashbox feed. I expect it's useful in general aggregators tho. Public radio Dear Log,

«Public radio is riding high. Its audience has more than doubled in the last decade. About 27 million people now listen to public radio at least once a week, according to the Radio Research Consortium, a nonprofit organization that tracks audience data for noncommercial radio. That's a lot of people. Consider that Friends, the iconic TV series, has been pulling in around 20 million viewers in recent weeks.»

--"Radio Rich: While public television is on the skids, public radio is riding high. What's the secret? "

Maybe it's just easier to make good idea-rich radio than to make good idea-rich TV? Certainly the mere technical side is a whole lot easier to pull off for radio than for TV. I always get in trouble when I am bored

File under the "nothing-better-to-do" category.

http://perl.is.h0rny.net/< /a>

http://uri.make s.everyone.h0rny.net/

http://python.pe ople.are.h0rny.net/

Type in random stuff...

Cheap-labor conservatives

« The ugly truth is that cheap-labor conservatives just don't like working people. They don't like "bottom up" prosperity, and the reason for it is very simple. Lords have a harder time kicking them around. Once you understand this about the cheap-labor conservatives, the real motivation for their policies makes perfect sense. »
--Conceptual Guerilla: Defeat the Right in Three Minutes

This is so unfair. Labor hurts the bottom line and they know it. I'm compassionate when I support cutting social programs because those programs denegrate the needy. What's so wrong about being rich and privileged? That Answers That I guess I need to get the Wolf Book. :)

Had I seen it on a shelf somewhere I'd have picked it up by now, no doubt. I'll probably have to order it; the most advanced thing on the shelf of the local Borders is _Bookshelf_, which I have already.

The sickness is abating; I suspect it'll be done by the end of today or mid-tomorrow, and that means back to the grindstone. Halfway through _Man-Month_, but I'm not doing the depthful reading of my youth, so I should probably make myself go back and read again. Weekends This past weekend my sister flew up from Florida and we drove over to my grandparent's old place over in northeast Wisconsin where we met up with my parents and their friends (who also flew up). The drive is a bit long, but we had a good time hanging out since we don't see each other that often.

The weather was *perfect* on Saturday. About 75 degrees with a light breeze coming off the lake. We mostly just hung out, did a little yardwork, and cooked hot dogs and marshmellows over the fire we had made earlier. Then it was beer and hanging out by the fire until the stars came out.

Sunday was *hot*. I did a bit of shopping and left for home after lunch. Hopefully it will cool off again - I go back on Thursday for the 4th, and my other sister and her kids will be up by then. :) Like A Reassembled Clock From Hell The script is *sort of* working.

Which is to say that it runs (not without error) and it doesn't do what it used to (surprise, surprise).

All of the errors are 'uninitialized value this', and I'm pretty sure I just missed a few things typing it all in. I kind of expected that; I give it a day or two before I have that ironed out.

On the other hand, though, I actually remembered how most of this thing works, and from what I understand, I'm *very* nearly at the point where I'll be able to make it do what it's supposed to do. That is...it should generate all the site pages, handle all the params properly, and really should use CGI more.

I'm taking an _Alice_ break for a while and then I'll print a copy and go over it, looking for things to change to fix the handling of params. The web broke "innovation" Innovation is a strange word. It was abused by microsoft to mean "it's OK to abuse monopoly power" a couple of years ago, and it is probably never used correctly, so please excuse me here, and substitute a better word if you can, if you find I use it offensively. I believe the web has broken innovation. Ten years ago software was the last frontier. It was a system that allowed the lone inventor to capture his ideas in a framework, hone it over time, and present it to the masses in a production-ready form. The internet broke that. You cannot, in todays world, innovate to any significant extent. Every minor idea you have had. Every spark of genius you can possibly invent. It has already been blogged or discussed online somewhere. The reason: blogging something is far easier than coding something up. So people just blog it. On the last day of OSCon I attended a talk by Brewster Kahle of the "Wayback Machine" fame. He spoke about how he believed one of the next "big" internet projects could be a video browser, that allowed you to create the equivalent of HTML for video (similar to SMIL, but easier to cross-link), and that the person who creates such a browser will be the next Marc Andreeson. He's wrong. Because now there are 5 developers working on that project. Or 5 projects and 20 developers. And none will create a monopoly like Netscape, because the internet has beaten monopoly. And all of this is good. And probably controversial :-) Linguistics Dear Log,

Letters! I get letters! I get lots and lots of letters! And I got one a while back, and wrote back a response that might interest some of my fellow Useperlorganians:

======

> You don't know me from Adam, but Damian Conway recommended
> you as someone able to answer what I hope is a simple question.

Ah yes, I've been meaning to sit down and write up a Web page about this. I get asked things like this every few weeks, and each time I swear I'll pull together something that makes enough general sense to be worth committing to public availability.

Here goes...

> I was hoping to find a book that would be a good introduction to
> the study of languages, linguistics, grammars, whatever and whatnot.
> Unfortunately, I don't even know the distinctions well enough to
> know if I'm even asking the right question.
>[...]
> so, in short, could you recommend any good "complete idiots guide
> to the study of languages and related topics" type books?

Terminology is a problem.

In linguistics, the mapping from concept to terminology is regrettably complex. It's usually all smoke and no fire.

See, a wave of "physics envy" went thru the field starting about fifty years ago (and just now finally ending, Godwilling), where people thought that the way to look big and clever was to whip up great big shmancy edifices of jargon and symbols and whatnot (even if your basic methodology was about as scientific as tarot cards).
And the sifted detritus of those fifty wasted years to to be found in a book that, by its title, you might think useful: David Crystal's /Dictionary of Linguistics and Phonetics/.
Actually, the phonology/phonetics entries are probably okay (if "uninteresting", in many senses of the word), but everything /else/ in there is somewhere on the scale between being biased, ill-expressed half-truths, and outright swirling nonsense.

Example (non-phonetic)


YES!

TorgoX on 2004-09-24T07:50:33

Only Markov understands me!!!!!

Re:YES!

jjohn on 2004-09-24T13:30:35

Good Lardie, MB is garrulous today. I think it's a cry for help.