KM's Friends' Journals KM's Friends' use Perl Journals en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:09:25+00:00 pudge Technology hourly 1 1970-01-01T00:00+00:00 KM's Friends' Journals use Perl; Shutting Down Indefinitely <p>See <a href="">here</a>.</p> pudge 2010-09-08T22:07:47+00:00 useperl use Perl; <p>I am no longer working for Slashdot/Geeknet as of September 30. I am actively seeking new employment. Unless you want to hire me, you don't need to care, unless you also care about <a href="">use Perl;</a>, because it has been generously hosted by Geeknet since I started the site over 10 years ago, shortly after I was hired by Andover.Net to work on Slashdot.</p><p>Long story short, I have not done much with the site in recent years, so my options at this point are to do nothing; migrate the site to a new server and keep it running as-is; or take the data and do something with it on a new site. Or something I haven't thought of.</p><p>I am hereby accepting proposals for what to do with use Perl;. In short, I would like to donate it to someone who will give it a good home. If you're interested, give me your best pitch.</p><p>Cross-posted on <a href="">&lt;pudge/*&gt;</a>.</p> pudge 2010-08-11T23:34:11+00:00 journal Matt Trout, aka mst, is insane <p>Wow. I occasionally, but not too often, go into #perl. Very busy with family and life. So I go in today, and for no reason, <a href="">mst</a> bans me and tells me to not come back.</p><p>What's up with him being such an irrational dick?</p> pudge 2010-08-11T16:41:54+00:00 journal Summary of Celtics vs. Lakers NBA Finals History <p>There have been 60 NBA Finals. The Boston Celtics have won 17, and the Minneapolis/Los Angeles Lakers have won 15, which amounts to those teams winning more than half of all NBA Finals. This year, they play each other in the Finals again, making it 33 champions out of 61 being either the Lakers or the Celtics.</p><p>Additionally, 39 of the 61 Finals have included either the Lakers or the Celtics. Including this year, the Celtics and Lakers have played each other in the Finals a whopping 12 times (just under one-fifth of all Finals have been these two teams).</p><p>The Celtics have made 21 total Finals appearances, so have faced the Lakers more than half of the times they've been in the Finals. The Lakers have made 30 Finals appearances, facing the Celtics in two-fifths of those.</p><p>The Celtics won nine of those against the Lakers, which accounts for more than half of all their 17 championships. The Lakers' two victories over the Celtics came after the Celtics won their first eight encounters.</p><p>The longest streak without either team in the Finals was eight years from '92-'99. The longest streak <b>with</b> either the Lakers or Celtics in the Finals was 10 years, done twice (from '57-'66, in which the Celtics appears all 10 years, and the Lakers five of those; and '80-'89, in which the Lakers appeared eight times, the Celtics five).</p><p>The longest streak for one team appearing in the Finals was, as noted, Boston, in the 10 years from '57-'66. Boston won nine of those 10 years, including eight in a row (the longest winning streak from any one team) from '59-'66, and also won 10 in 12 years, from '57-'69.</p><p>The Lakers' longest appearance streak is "only" four, from '82-'85, winning twice; but they have also appeared three times in a row five additional times (including the current three-year streak). In two of those, they won all three years; in one, they lost all three.</p><p>The only other team to "threepeat" was the Bulls, winning three years in a row twice in eight years ('91-'98). No other team but the Celtics and Lakers have had four consecutive appearances. The only other team to have three consecutive appearances was the Knicks, losing all three from '51-'53.</p><p>The 2010 NBA Finals begin in Los Angeles on Thursday.</p><p>Cross-posted on <a href="">&lt;pudge/*&gt;</a>.</p> pudge 2010-05-30T05:25:50+00:00 journal Unique <p>I wonder how long it will be before people start just putting together random letters for names of companies, bands, and so on, so they can be unique in Google searches.</p><blockquote><div><p>Your search - fobhwueufg8 - did not match any documents.</p></div></blockquote><p>^^ my new band name</p><p>(Hm, "Did Not Match Any Documents" would be a fun band name. Or the name of the debut album of the band fobhwueufg8.)</p><p>Cross-posted on <a href="">&lt;pudge/*&gt;</a>.</p> pudge 2010-04-26T17:45:28+00:00 journal Bob Jacobsen interview on FLOSS Weekly Last week, I interviewed Bob Jacobsen for FLOSS Weekly. Bob used Perl's Artistic 1.0 license on some Java code to manage model trains. The code was later patented by an Oregon-based company(!) and then Bob got sued(!!) for Bob distributing the other company's patented code(!!!). The good part of the story is that this is the first test at the US Federal Appeals Court level for an open source license to be enforceable even if no money exchanges hands, and... we won! <p> Bob spent a lot of time and money on the case though. Listen to <a href="">the podcast</a> and contribute to <a href="">his legal defense</a> if you care about open source.</p> merlyn 2010-04-23T03:55:11+00:00 journal My Slashroulette Videos <p>Today Slashdot did a spoof of Chatroulette, that we called Slashroulette. We prerecorded videos of ourselves and others. Here's five of the six I did (the sixth was me tuning the guitar, I didn't post that one on YouTube): <a href="">video 1</a>, <a href="">video 2</a>, <a href="">video 3</a>, <a href="">video 4</a>, <a href="">video 5</a>.</p><p>Cross-posted on <a href="">&lt;pudge/*&gt;</a>.</p> pudge 2010-04-02T05:15:16+00:00 journal Gone <p>Like many others, I'm no longer posting here very much. You'll find my new technical journal at <a href=""></a>. It's much shinier.</p><p> <a href="">As you can see, use.perl visits have been dropping for a while</a> ( is too new to show up on that search) and the <a href="">front page of use.perl has been sadly neglected</a>. As for, after an initial rough start, <a href="">plenty</a> <a href="">of</a> <a href="">people</a> are switching over and are very happy with the shiny.</p><p>I have fond memories of, but it's just too old and out-of-date. Come on over to our new platform and look around. Plus, <a href="">tell us what you want changed about it</a>. (To be fair, while I was involved in the project to get it launched (mostly kibitzing and asking why things were stalled -- I'm such a marketroid<nobr> <wbr></nobr>:), the hands-on work was Dave Cross, Aaron Crane and the wonderful folks at <a href="">SixApart</a>.)</p> Ovid 2010-03-14T08:02:43+00:00 journal My Netgear Router is Dumber Than It Thinks It Is <p>I upgraded the firmware on my Netgear router today and it wouldn't let me use the LAN IP I usually use for it,, because it thinks my ISP uses that subnet, because I set the router to read from my own internal DNS. Took me awhile to figure out <b>why</b> it thought what it did, because it didn't occur to me that it would care what DNS addresses I gave it.</p><p>Cross-posted on <a href="">&lt;pudge/*&gt;</a>.</p> pudge 2010-02-07T02:09:27+00:00 journal Test::Class::Most <a href="">Test::Class::Most</a>. Ovid 2010-01-31T19:25:10+00:00 journal Franchise Tag Whiners <p>There's a long line of players in the NFL who claim that it is a personal offense when their teams place the franchise tag on them.</p><p>These players are big fat babies.</p><p>The players agreed to the franchise tag for the owners, as a compromise. The players take advantage of everything available to them under the contract; why shouldn't the owners do the same?</p><p>Stop crying. Stop whining. Sure, you don't like it, but so what? Grow up. Those are the rules that you agreed to.</p> pudge 2010-01-30T18:52:27+00:00 journal Testing with PostgreSQL <p>My new personal project has a PostgreSQL database. <a href="">Here's how I'm handling testing</a>.</p> Ovid 2010-01-30T16:22:57+00:00 journal Roles without Moose? <p> <a href="">Milliseconds are important</a>.</p> Ovid 2010-01-25T14:04:31+00:00 journal Unless what? <p> <a href="">Unless what?</a> </p> Ovid 2010-01-15T11:47:53+00:00 journal Dear Recruiters <p> <a href="">Dear Recruiters</a> </p> Ovid 2010-01-13T13:06:11+00:00 journal Moving 32-bit Intel Perl to Mac OS X 10.6 <p>Dear Google,</p><p>When you move a 32-bit x86 perl installation to a 64-bit Mac OS X 10.6 environment, you should edit $ARCH/ and add "-arch i386" to lddlflags, ldflags, and ccflags. The compiler and tools in Mac OS X 10.6 assume 64 bits unless you explicitly tell it otherwise, but some 32-bit installs don't bother putting in an -arch flag, because at the time it wasn't necessary.</p><p>Cross-posted on <a href="">&lt;pudge/*&gt;</a>.</p> pudge 2010-01-12T17:39:58+00:00 journal Next QA Hackathon -- What Do You Need? <p> <a href="">Read about the next QA Hackathon</a>.</p> Ovid 2010-01-12T11:37:14+00:00 journal Most Popular Testing Modules - January 2010 <p> <a href="">Most popular testing modules as of January 2010</a> </p> Ovid 2010-01-07T21:46:46+00:00 journal Cool Things in Perl 6: Subsets <p> <a href="">They're going to be a lot of fun</a>.</p> Ovid 2010-01-04T13:11:31+00:00 journal I'm twittering my Perl stuff at <p>I'll tweet at ( when I have something to say in 140 characters. I'll almost always use "Perl" when I post.</p> brian_d_foy 2010-01-02T13:06:32+00:00 journal Effective Perl Programming master class at Frozen Perl At <a href="">Frozen Perl 2010</a> in Minneapolis, I'm teaching a new master class based on my latest book, <a href="">Effective Perl Programming, 2nd Edition</a>. Perl has changed quite a bit since Joseph Hall wrote the first edition over 10 years ago. Josh McAdams and I have added a lot of new information as well as updated the existing material. In the one-day class for intermediate Perl programmers, I'll cover selected topics from the book, including: <ul> <li>Working with Unicode in Perl</li> <li>Tricks with filehandles</li> <li>New regex features in Perl 5.10 and later</li> <li>Playing with pack()</li> <li>Using closures to make things simpler</li> <li>and other topics as time allows</li> </ul><p> Although the book hasn't been published yet, it is available for pre-order, and attendees to the class can get a sneak peek at the working manuscript as well as a soft copy of the course slides.</p> brian_d_foy 2010-01-01T13:32:50+00:00 journal Perl 6 Config::INI parser on github <p> <a href="">Details here</a>.</p> Ovid 2009-12-30T17:48:47+00:00 journal Improve My Perl 6! <p> <a href="">Collaborative filtering (user recommendations) in Perl 6</a>.</p> Ovid 2009-12-24T11:29:45+00:00 journal Gitpan languages <p>What? You didn't know that <a href="">SOAP::Lite was written in Visual Basic</a>?</p> Ovid 2009-12-18T14:15:32+00:00 journal Atom Feed Help <p> <a href="">Atom feed help requested</a> </p> Ovid 2009-12-17T10:40:35+00:00 journal What's your coolest Perl one-liner? <p>Josh and I are finishing up <a href="">Effective Perl Programming, 2nd Edition</a>, and the last part to finish off is the item on Perl one-liners.</p><p>Besides going through writing a one liner, we want to list a bunch of them too. Want to get your name in the book? Give us some one-liners that you wrote yourself and a couple of sentences about what it does. Make sure you tell us how you'd like your name to appear in the book, too.<nobr> <wbr></nobr>:)</p> brian_d_foy 2009-12-17T06:19:18+00:00 journal MySQL and Oracle <p> <a href="">MySQL and Oracle</a>. (Despite teething pains, is holding up quite well on the new server)</p> Ovid 2009-12-14T12:56:02+00:00 journal What's In A Name? <p> <a href="">The actual entry is at</a>. However, here's a few extra notes about that site:</p><p>It's much more stable than last time. Aaron moved it to a new server and Dave set up MT. <a href="">The templates are on github</a> along with <a href="">an issue tracker</a>.</p><p>Barbie talked with Dave and myself at the London Perl Workshop (lpw2009) about the site and I wrote down all of his suggestions and they've now been added to the issue list. We look forward to more people trying it out and <a href="">Dave has a post asking for more feedback</a>. Also, he's aware that several people only made it partway through the registration process. Drop him a line if you're affected and he'll clear it up for you.</p><p>I can't thank Dave, Aaron and SixApart for all they're doing to create a modern blogging platform for us.</p> Ovid 2009-12-12T12:24:54+00:00 journal Regex Captures in Debugger <p>Stumbled across this weird behavior today. Took a while to debug it. In the debugger, I'm not seeing the "dollar digit" regex capture variables set, even though the regex matches.</p><blockquote><div><p> <tt>$ perl -de 1<br> <br>Loading DB routines from version 1.3<br>Editor support available.<br> <br>Enter h or `h h' for help, or `man perldebug' for more help.<br> <br>main::(-e:1):&nbsp; &nbsp;1<br>&nbsp; DB&lt;1&gt; ($foo) = ('abcd' =~<nobr> <wbr></nobr>/(bc)/)<br> <br>&nbsp; DB&lt;2&gt; x $1<br>0&nbsp; undef<br>&nbsp; DB&lt;3&gt; x $foo<br>0&nbsp; 'bc'</tt></p></div> </blockquote><p>Is this documented? I can't find it.</p><p> <strong>Update</strong>: Rafael explained it. The digit variables are lexically scoped. That's why you can assign to a package variable in a debugger, but not a lexical.</p><blockquote><div><p> <tt>&nbsp; DB&lt;6&gt;&nbsp; 'abcd' =~<nobr> <wbr></nobr>/(bc)/ &amp;&amp; print $1<br>bc</tt></p></div> </blockquote> Ovid 2009-12-08T14:02:43+00:00 journal The Implications of the Bug <p> <a href="">mscolly</a> correctly identified <a href="">the SQL bug I posted</a>. Sadly, no one discussed the implications of this bug and I think they're the most interesting part of this. Essentially, it comes down to the following:</p><blockquote><div><p> <tt>SELECT&nbsp; &nbsp; first_name,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last_name,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; order_date,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUM(price) AS total&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- what if there's no price?<br>FROM&nbsp; &nbsp; &nbsp; customer<br>LEFT JOIN orders&nbsp; &nbsp; &nbsp;ON = orders.customer_id<br>LEFT JOIN order_item ON; &nbsp;= order_item.order_id<br>GROUP BY&nbsp; first_name, last_name, order_date<br>HAVING&nbsp; &nbsp; total &lt; 15&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&nbsp; what does NULL &lt; 15 evalute to?<br>ORDER&nbsp; &nbsp; &nbsp;BY order_date ASC;</tt></p></div> </blockquote><p>The proper solution (as mscolly pointed out) is to change the "SUM" line to this:</p><blockquote><div><p> <tt>COALESCE( SUM(price), 0 ) AS total</tt></p></div> </blockquote><p>The English language, as we know, is ambiguous. If you boss had come in and asked for all customers whose orders (more accurately, whose orders with order items) totaled less than &#163;15 pounds, then the above query would have actually been correct, but another programmer coming along to maintain it could be forgiven for thinking it's in error. If you ever write SQL which is likely to produce NULLs (e.g., outer joins), you should explicitly handle that case if you actually do anything with those NULLs.</p><p>But in this case, "customers whose orders total less than &#163;15" is significantly different in meaning than "customers who spent less than &#163;15" and the latter is what we want, but the former is what we have. While the above code <em>seems</em> logical, it gives a logically incorrect answer because it omits customers without orders (or order items), even though they're clearly intended. However, NULLs make it very difficult to identify what you actually mean because the database can't know why something is NULL.</p><p>Now consider a simpler, yet silly, example:</p><blockquote><div><p> <tt>SELECT first_name<br>FROM&nbsp; &nbsp;employee<br>WHERE&nbsp; salary &gt; 50000;</tt></p></div> </blockquote><p>What happens if the <tt>salary</tt> field is NULL? You'll get a list of employees whose <em>known</em> salary is NOT NULL. Why might they not have a salary? Maybe they're an hourly employee and the <tt>salary</tt> field is not applicable. Maybe they're the CEO and he doesn't think you need to know his salary. Maybe they're an ex-employee and they have no salary.</p><p>Taking this a bit further, imagine that all employees in the table are current and all have salaries (no hourly workers), but the <tt>salary</tt> field is still sometimes NULL because the board of directors doesn't want you to know their salaries. With me so far? In this scenario, it is the case that everyone has a salary; you just don't know what some of them are. So here's the kicker:</p><blockquote><div><p> <tt>SELECT first_name<br>FROM&nbsp; &nbsp;employee<br>WHERE&nbsp; salary = salary;</tt></p></div> </blockquote><p>That won't return anyone on the board of directors, even though you <em>know</em> they have a salary. Furthermore, most would think it's self-evident that <em>p&nbsp;=&nbsp;p</em>, but in three value logic of databases, this is sometimes true and sometimes false. Heck, because of this, the following does not always evaluate correctly, even though we would <em>think</em> it does:</p><blockquote><div><p> <tt>SELECT service_id,<br>&nbsp; &nbsp; CASE WHEN master_brand_id =&nbsp; master_brand_id THEN '='<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WHEN master_brand_id != master_brand_id THEN '!='<br>&nbsp; &nbsp; END AS 'comparison'<br>FROM service</tt></p></div> </blockquote><p>Sure, you say, but you're comparing something to itself. You don't do that in the real world. No? So look at this:</p><blockquote><div><p> <tt>SELECT s.service_id,<br>&nbsp; &nbsp; CASE WHEN m.master_brand_id =&nbsp; s.master_brand_id THEN '='<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WHEN m.master_brand_id != s.master_brand_id THEN '!='<br>&nbsp; &nbsp; END AS 'comparison'<br>FROM service&nbsp; &nbsp; &nbsp; s<br>&nbsp; &nbsp; &nbsp;master_brand m</tt></p></div> </blockquote><p>If the <tt>s.master_brand_id</tt> is allowed to be NULL, than the <tt>comparison</tt> field will always have a NULL value when <tt>s.master_brand_id</tt> is NULL. It's easy to debug in this simple example, but what if that was a subquery? It <em>looks</em> fine, but it all breaks down in the presence of NULL values.</p><p>I didn't start with that example because people would say it's silly, but starting with the "order" example shows how NULLs in databases can return logically incorrect data and the reduction down to the simple <em>p&nbsp;=&nbsp;p</em> case not holding shows why this happens.</p><p>At this point, I can see people saying "yeah, but we already know that about databases." And this is true. It's well-known that certain types of queries can generate NULLs even though there are no NULL values in the database. Regrettably, many people assume the database logic is, well, logical. The <em>p = p</em> failure is a strong rebuttal, but I suppose some people assume that hitting themselves in the head with a hammer is normal.</p><p>If you really want to have some fun, <a href="">read this blog entry about NULL values</a>. In the comments, the author even explains how to deal with NULLs in outer joins, but it requires a relational database (very few databases really are) and that people understand what first normal form is really about. (If you think you know, please define "atomic values" in the comments below).</p><p>I wonder how database design would look today if, instead of 3VL, databases threw an exception when you tried to apply an operator or aggregation ('=', '+', 'SUM', etc.) to NULL values?</p><p>Note: I've discussed <a href="">the problem with NULL values before</a>, but in realizing I had a better real-world example, I thought it would make more sense to readers.</p> Ovid 2009-12-07T15:38:13+00:00 journal