djberg96's Friends' Journals
http://use.perl.org/~djberg96/journal/friends/
djberg96's Friends' use Perl Journalsen-ususe Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners.2012-01-25T01:59:04+00:00pudgepudge@perl.orgTechnologyhourly11970-01-01T00:00+00:00djberg96's Friends' Journalshttp://use.perl.org/images/topics/useperl.gif
http://use.perl.org/~djberg96/journal/friends/
use Perl; Shutting Down Indefinitely
http://use.perl.org/~pudge/journal/40525?from=rss
<p>See <a href="http://use.perl.org/article.pl?sid=10/09/08/2053239">here</a>.</p>pudge2010-09-08T22:07:47+00:00useperluse Perl;
http://use.perl.org/~pudge/journal/40493?from=rss
<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="http://use.perl.org/">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="http://pudge.net/glob/2010/08/use-perl.html"><pudge/*></a>.</p>pudge2010-08-11T23:34:11+00:00journalMatt Trout, aka mst, is insane
http://use.perl.org/~pudge/journal/40492?from=rss
<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="http://www.trout.me.uk/">mst</a> bans me and tells me to not come back.</p><p>What's up with him being such an irrational dick?</p>pudge2010-08-11T16:41:54+00:00journalSummary of Celtics vs. Lakers NBA Finals History
http://use.perl.org/~pudge/journal/40370?from=rss
<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="http://pudge.net/glob/2010/05/summary-of-celtics-vs-lakers-nba-finals-history.html"><pudge/*></a>.</p>pudge2010-05-30T05:25:50+00:00journalUnique
http://use.perl.org/~pudge/journal/40329?from=rss
<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="http://pudge.net/glob/2010/04/unique.html"><pudge/*></a>.</p>pudge2010-04-26T17:45:28+00:00journalMy Slashroulette Videos
http://use.perl.org/~pudge/journal/40290?from=rss
<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="http://www.youtube.com/watch?v=qHwz6sG37_Q">video 1</a>, <a href="http://www.youtube.com/watch?v=IQYgAxVo050">video 2</a>, <a href="http://www.youtube.com/watch?v=IlJBlObJnJY">video 3</a>, <a href="http://www.youtube.com/watch?v=GWxewYtRc48">video 4</a>, <a href="http://www.youtube.com/watch?v=TkVisbPXHVo">video 5</a>.</p><p>Cross-posted on <a href="http://pudge.net/glob/2010/04/my-slashroulette-videos.html"><pudge/*></a>.</p>pudge2010-04-02T05:15:16+00:00journalGone
http://use.perl.org/~Ovid/journal/40243?from=rss
<p>Like many others, I'm no longer posting here very much. You'll find my new technical journal at <a href="http://blogs.perl.org/users/ovid/">blogs.perl.org</a>. It's much shinier.</p><p> <a href="http://siteanalytics.compete.com/use.perl.org/">As you can see, use.perl visits have been dropping for a while</a> (blogs.perl.org is too new to show up on that search) and the <a href="http://use.perl.org/">front page of use.perl has been sadly neglected</a>. As for blogs.perl.org, after an initial rough start, <a href="http://blogs.perl.org/users/adam_kennedy/2009/12/migrating-from-useperlorg-to-blogsperlorg.html">plenty</a> <a href="http://blogs.perl.org/users/thefinalcut/2009/12/first-post-on-the-shiny-new-onion.html">of</a> <a href="http://blogs.perl.org/users/limbicregion/2009/11/goodbye-useperlorg-hello-blogsperlorg.html">people</a> are switching over and are very happy with the shiny.</p><p>I have fond memories of use.perl.org, but it's just too old and out-of-date. Come on over to our new platform and look around. Plus, <a href="http://github.com/davorg/blogs.perl.org/issues">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="http://www.sixapart.com/">SixApart</a>.)</p>Ovid2010-03-14T08:02:43+00:00journalMy Netgear Router is Dumber Than It Thinks It Is
http://use.perl.org/~pudge/journal/40163?from=rss
<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, 10.0.1.1, 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="http://pudge.net/glob/2010/02/my-netgear-router-is-dumber-than-it-thinks-it-is.html"><pudge/*></a>.</p>pudge2010-02-07T02:09:27+00:00journalTest::Class::Most
http://use.perl.org/~Ovid/journal/40148?from=rss
<a href="http://blogs.perl.org/users/ovid/2010/01/-package-sometestclass.html">Test::Class::Most</a>.Ovid2010-01-31T19:25:10+00:00journalFranchise Tag Whiners
http://use.perl.org/~pudge/journal/40146?from=rss
<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>pudge2010-01-30T18:52:27+00:00journalTesting with PostgreSQL
http://use.perl.org/~Ovid/journal/40145?from=rss
<p>My new personal project has a PostgreSQL database. <a href="http://blogs.perl.org/users/ovid/2010/01/testing-postgresql.html">Here's how I'm handling testing</a>.</p>Ovid2010-01-30T16:22:57+00:00journalah, dreams...
http://use.perl.org/~Matts/journal/40130?from=rss
<p>I just woke from a dream where it was rjbs' birthday and we got him an onion cake. Only the person who made the cake misunderstood, and instead of a cake shaped like an onion he cooked it WITH onions in it.</p><p>Bizarro.</p>Matts2010-01-26T10:31:17+00:00journalTime::Piece test failures on Win32
http://use.perl.org/~Matts/journal/40129?from=rss
<p>Can someone with Time::Piece test failures on Win32 please contact me offlist? I have a proposed patch I'd like to test, but no Win32 perl to test it on.</p>Matts2010-01-25T23:23:53+00:00journalRoles without Moose?
http://use.perl.org/~Ovid/journal/40127?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2010/01/roles-without-moose.html">Milliseconds are important</a>.</p>Ovid2010-01-25T14:04:31+00:00journalUnless what?
http://use.perl.org/~Ovid/journal/40103?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2010/01/unless-what.html">Unless what?</a> </p>Ovid2010-01-15T11:47:53+00:00journalDear Recruiters
http://use.perl.org/~Ovid/journal/40100?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2010/01/dear-recruiters.html">Dear Recruiters</a> </p>Ovid2010-01-13T13:06:11+00:00journalMoving 32-bit Intel Perl to Mac OS X 10.6
http://use.perl.org/~pudge/journal/40097?from=rss
<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/Config_heavy.pl 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="http://pudge.net/glob/2010/01/moving-32bit-intel-perl-to-mac-os-x-106.html"><pudge/*></a>.</p>pudge2010-01-12T17:39:58+00:00journalNext QA Hackathon -- What Do You Need?
http://use.perl.org/~Ovid/journal/40093?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2010/01/next-qa-hackathon----what-do-you-need.html">Read about the next QA Hackathon</a>.</p>Ovid2010-01-12T11:37:14+00:00journalMost Popular Testing Modules - January 2010
http://use.perl.org/~Ovid/journal/40086?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2010/01/most-popular-testing-modules---january-2010.html">Most popular testing modules as of January 2010</a> </p>Ovid2010-01-07T21:46:46+00:00journalWarning compiling perl stuff on Snow Leopard
http://use.perl.org/~Matts/journal/40075?from=rss
<p>I've searched but can't find any reference to this...</p><p>Compiling IO::KQueue on Snow Leopard I get the following warning:</p><blockquote><div><p> <tt>KQueue.xs: In function 'XS_IO__KQueue_kevent':<br>KQueue.xs:71: warning: format not a string literal and no format arguments</tt></p></div> </blockquote><p>Yet that line is just:</p><blockquote><div><p> <tt> Newxz(ke, max_events, struct kevent);</tt></p></div> </blockquote><p>Which seems to me pretty standard perl, and no format strings involved (though Newxz expands quite a few macros).</p>Matts2010-01-04T22:13:57+00:00journalCool Things in Perl 6: Subsets
http://use.perl.org/~Ovid/journal/40072?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2010/01/cool-things-in-perl-6.html">They're going to be a lot of fun</a>.</p>Ovid2010-01-04T13:11:31+00:00journalPerl 6 Config::INI parser on github
http://use.perl.org/~Ovid/journal/40060?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2009/12/perl-6-configini-on-github.html">Details here</a>.</p>Ovid2009-12-30T17:48:47+00:00journalImprove My Perl 6!
http://use.perl.org/~Ovid/journal/40051?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2009/12/improve-my-perl-6.html">Collaborative filtering (user recommendations) in Perl 6</a>.</p>Ovid2009-12-24T11:29:45+00:00journalGitpan languages
http://use.perl.org/~Ovid/journal/40036?from=rss
<p>What? You didn't know that <a href="http://blogs.perl.org/users/ovid/2009/12/gitpan-languages.html">SOAP::Lite was written in Visual Basic</a>?</p>Ovid2009-12-18T14:15:32+00:00journalAtom Feed Help
http://use.perl.org/~Ovid/journal/40029?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2009/12/atom-feed-help.html">Atom feed help requested</a> </p>Ovid2009-12-17T10:40:35+00:00journalMySQL and Oracle
http://use.perl.org/~Ovid/journal/40020?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2009/12/mysql-and-oracle.html">MySQL and Oracle</a>. (Despite teething pains, blogs.perl.org is holding up quite well on the new server)</p>Ovid2009-12-14T12:56:02+00:00journalWhat's In A Name?
http://use.perl.org/~Ovid/journal/40012?from=rss
<p> <a href="http://blogs.perl.org/users/ovid/2009/12/whats-in-a-name.html">The actual entry is at blogs.perl.org</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="http://github.com/davorg/blogs.perl.org">The templates are on github</a> along with <a href="http://github.com/davorg/blogs.perl.org/issues">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="http://blogs.perl.org/users/dave_cross/2009/12/what-can-we-improve.html">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>Ovid2009-12-12T12:24:54+00:00journalRegex Captures in Debugger
http://use.perl.org/~Ovid/journal/39990?from=rss
<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 perl5db.pl 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): 1<br> DB<1> ($foo) = ('abcd' =~<nobr> <wbr></nobr>/(bc)/)<br> <br> DB<2> x $1<br>0 undef<br> DB<3> x $foo<br>0 '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> DB<6> 'abcd' =~<nobr> <wbr></nobr>/(bc)/ && print $1<br>bc</tt></p></div> </blockquote>Ovid2009-12-08T14:02:43+00:00journalThe Implications of the Bug
http://use.perl.org/~Ovid/journal/39986?from=rss
<p> <a href="http://use.perl.org/~mscolly/">mscolly</a> correctly identified <a href="http://use.perl.org/~Ovid/journal/39985">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 first_name,<br> last_name,<br> order_date,<br> SUM(price) AS total -- what if there's no price?<br>FROM customer<br>LEFT JOIN orders ON customer.id = orders.customer_id<br>LEFT JOIN order_item ON orders.id = order_item.order_id<br>GROUP BY first_name, last_name, order_date<br>HAVING total < 15 -- what does NULL < 15 evalute to?<br>ORDER 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 £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 £15" is significantly different in meaning than "customers who spent less than £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 employee<br>WHERE salary > 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 employee<br>WHERE 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 = 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> CASE WHEN master_brand_id = master_brand_id THEN '='<br> WHEN master_brand_id != master_brand_id THEN '!='<br> 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> CASE WHEN m.master_brand_id = s.master_brand_id THEN '='<br> WHEN m.master_brand_id != s.master_brand_id THEN '!='<br> END AS 'comparison'<br>FROM service s<br> 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 = 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="http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/">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="http://use.perl.org/~Ovid/journal/27927">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>Ovid2009-12-07T15:38:13+00:00journalFind the bug (sql)
http://use.perl.org/~Ovid/journal/39985?from=rss
<p> <strong>Update</strong>: You can ignore the <tt>order_date</tt> below. It's a red herring and I probably should have left it out, but I had liked the fact that by putting it in the query, I added more complexity, thus making the real bug more difficult to spot.</p><p>Assume you're a diligent programmer. You've designed your database carefully. Foreign constraints are correct, you have no null columns and you've kept a nice, simple design. Now your boss wants you to provide a list of all customers who've spent less than £15 on your Web site because you want to offer them a special promotion. Here's the SQL you've written:</p><blockquote><div><p> <tt>SELECT first_name,<br> last_name,<br> order_date,<br> SUM(price) AS total<br>FROM customer<br>LEFT JOIN orders ON customer.id = orders.customer_id<br>LEFT JOIN order_item ON orders.id = order_item.order_id<br>GROUP BY first_name, last_name, order_date<br>HAVING total < 15<br>ORDER BY order_date ASC;</tt></p></div> </blockquote><p>The two left joins are there because a customer may never have placed an order before. Heck, they may have started an order but not added any items to it. The 'having' statement is required because you generally can't use aggregates in where clauses.</p><p>You run the SQL and hand-check the results very carefully. Choosing a random sampling of customers returned, you verify that none of them have spent more than £15 on your site. Nonetheless, you have a bug. What is it? What are the implications of the bug?</p>Ovid2009-12-07T07:43:40+00:00journal