stu42j's Journal http://use.perl.org/~stu42j/journal/ stu42j's use Perl Journal 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:38:39+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 stu42j's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~stu42j/journal/ From user to contributor http://use.perl.org/~stu42j/journal/39501?from=rss <p>Almost a year ago, I found a bug (er, inconsistency?) in CGI.pm while working on a project with <a href="http://saj.thecommune.net/mt4/2007/11/paired-multiselects-with-optgr.html">scrolling lists and optgroups</a>. There was a simple workaround but I submitted <a href="https://rt.cpan.org/Ticket/Display.html?id=30097">a bug report</a> anyway and then sort of forgot about it.</p><p>A few weeks ago, <a href="http://mark.stosberg.com/blog/2009/08/almost-100-cgipm-bugs-closed-help-with-the-50-still-open.html">MARKSTOS</a> updated the ticket asking for an automated test. This happened to come in on a weekend when I had a little free time so I went ahead and submitted a couple of patches, adding some tests as well as a simple code fix. Well, last week my patches were accepted and I now officially have code in CGI.pm!</p><p>This experience has given me a little bump of encouragement to finally start contributing more. Today I got my <a href="http://search.cpan.org/~sjohnston/">PAUSE ID</a>. I mostly plan on contributing to existing modules but I wanted to have my ID ready in case I ever write something worth sharing or find a module that needs adopting.</p><p>Earlier this week, I was reading through the <a href="http://search.cpan.org/perldoc?CHI">CHI</a> docs, a module I hope to use soon, and I noticed a couple of minor errors in the POD. I also noticed that the module was on GitHub so I figured why not fork it and fix it!</p> stu42j 2009-08-21T03:42:59+00:00 journal What not to do in a job interview http://use.perl.org/~stu42j/journal/37183?from=rss <p>All this talk about job <a href="http://use.perl.org/~rjbs/journal/37173">application</a>/<a href="http://use.perl.org/~Mr.+Muskrat/journal/37174">interview</a> tips has reminded me of my favorite personal interview horror story.</p><p>I was invited to a telephone interview for a job with Yahoo in California. I wasn't really interested in moving to CA but I figured what the heck. How could I say no to Yahoo, right?</p><p>The programming part of the job turned out to be mostly in PHP which I didn't realize at first. I don't really have a good opinion of PHP but my experience with it has been limited and based on free internet code, not enterprise systems.</p><p>So, when prompted if I had any questions, I tried to say that I was curious about how Yahoo has used PHP in a positive, efficient way and what aspects of the language they feel makes it best suited for their environment. I guess what I actually said sounded to the interviewer more like "PHP sux and you are stupid for using it."</p><p>Unfortunately, I didn't get much of a response and needless to say, I didn't get the job (or even a free trip to CA).</p> stu42j 2008-08-14T17:07:47+00:00 journal Curse of the Double Equals http://use.perl.org/~stu42j/journal/36412?from=rss <p>Every beginner programmer (of C-style languages) has to learn to deal with '=' (assignment) vs. '==' (comparison). Using <code>=</code> in an <code>if</code> clause is probably one of the most common early mistakes.</p><p>I'd like to think that I'm past that stage of my programming experience. However, about once a year I'll waste a couple of hours debugging to eventually notice the missing <code>=</code>.</p><p>I was working on some Javascript today and I had the feeling something was wrong with that <code>if</code> but my brain kept telling me to change the <code>=</code> to <code>eq</code>. Must be the jet lag from Ireland. Yeah, the jet lag. That's it, that's the ticket.</p> stu42j 2008-05-14T02:07:41+00:00 journal use.perl problems http://use.perl.org/~stu42j/journal/35523?from=rss <p>Is it just me or has use.perl.org been real flaky lately? Seems like the connection times out about half the time.</p> stu42j 2008-01-30T16:39:04+00:00 journal Must have (recent) Perl books? http://use.perl.org/~stu42j/journal/34241?from=rss <p>Tuesday night dfw-pm is having a technical meeting hosted at NerdBooks in Richardson. I am planning to take advantage of the opportunity to pick up a copy of Perl Testing. I have also been trying to decide if I need a copy of PBP. I currently have the misfortune of working on a SOAP project which I am having trouble wrapping my brain around so perhaps I should go ahead and get Programming Web Services with Perl (does it have much that is not free online?).</p><p>Any other recommendations for must-have Perl books, particularly those recently published? I already have Perl Hacks. Shameless plugs and non-Perl books also allowed.</p> stu42j 2007-08-27T23:31:40+00:00 journal TIMTOWTDI-NAOTAG http://use.perl.org/~stu42j/journal/34236?from=rss <p>There Is More Than One Way To Do It - Not All Of Them Are Good.</p><p>Some legacy code that I am working on, frequently uses this "interesting" idiom for getting the first element of an array.</p><blockquote><div><p> <tt>my @array = some_function();<br> &nbsp; <br>my $i = 0;<br>foreach my $hash (@array) {<br>&nbsp; $i++;<br>&nbsp; $var = $hash-&gt;{somekey};<br>&nbsp; last;<br>}</tt></p></div> </blockquote><p>I am particularly puzzled by the unused $i.</p> stu42j 2007-08-27T18:49:15+00:00 journal One disadvantage of using Perl... http://use.perl.org/~stu42j/journal/34119?from=rss No <a href="http://xkcd.com/303/">compiling downtime</a>. stu42j 2007-08-15T18:17:41+00:00 journal Perldoc Search Suggestions http://use.perl.org/~stu42j/journal/33477?from=rss <p>In my daily programming, I frequently search the <a href="perldoc.perl.org">perldocs</a> from the Firefox search box (even though a Perl Pocket Reference sits on my desk). When you start typing a search query for Google you get suggestions on what you might be typing. This is often useful and occasionally amusing.</p><p>Wouldn't it be nice if you could get suggestions when searching perldoc too? It turns out to be pretty <a href="http://developer.mozilla.org/en/docs/Supporting_search_suggestions_in_search_plugins">easy to setup</a>. To get started, I took the functions list and pushed it into an SQLite db. Then wrote a short script to output the required JSON.</p><p>You can install the end result from <a href="http://mycroft.mozdev.org/developer/devlist.html?email=saj@thecommune.net">Mycroft</a>. I'm not sure it is particularly helpful but it was an interesting little diversion.</p> stu42j 2007-06-08T20:32:23+00:00 journal Delayed String Interpolation (aka, always check the FAQ) http://use.perl.org/~stu42j/journal/33395?from=rss <p>I was trying to fix some code today that was attempting to do delayed string interpolation. Something like:</p><blockquote><div><p> <tt>$str = 'Foo: $foo';&nbsp; # Actually defined in a config file.<br>$foo = 'bar';&nbsp; #<nobr> <wbr></nobr>...later<br> &nbsp; <br>print eval("\$str"), "\n";</tt></p></div> </blockquote><p>Except that just gives you:</p><blockquote><div><p> <tt>Foo: $foo</tt></p></div> </blockquote><p>My first thought was to check the FAQ but then, no, I think I've seen something like this in the eval doc. No, that's not helpful. Oops, gotta catch the bus...</p><p>Then I figure I'd take a shot at it before bed. I give Google a try but the closest hits are on Ruby. After an a-ha moment I came up with this:</p><blockquote><div><p> <tt>print eval(qq{"$str"}), "\n";</tt></p></div> </blockquote><p>Which works. But then as I start writing this post, I figure I'd better check the FAQ before I sound like an idiot. Yes, it is <a href="http://perldoc.perl.org/perlfaq4.html#How-can-I-expand-variables-in-text-strings%3F">in the FAQ</a> although my solution seems much simpler. Am I overlooking any problems with my solution?</p><p>Here's what the FAQ suggests:</p><blockquote><div><p> <tt>eval { $text =~ s/(\$\w+)/$1/eeg };<br>die if $@;</tt></p></div> </blockquote> stu42j 2007-06-01T03:25:09+00:00 journal Plagger - Personal Planet http://use.perl.org/~stu42j/journal/32988?from=rss <p>I've been experimenting with <a href="http://plagger.org/">Plagger</a> for creating a <a href="http://saj.thecommune.net/">personal planet</a> sort of thing. It works pretty well. It seems very flexible but it is hard to figure out how to really take advantage of all the options and "plugability". For example, I wanted to change the title of some of the individual feeds. Eventually I figured out that if you use the explicit method of defining a feed, rather than the typical url only shortcut, you can specify the title. Like this:</p><blockquote><div><p> <tt> - url: http://rss.whatever...<br>&nbsp; title: This is a title</tt></p></div> </blockquote><p>I'm also finding that even though lots of sites give you feeds, they are not always very good. Netflix gives you feeds of the DVDs you are watching but rather than giving you a pubdate tag, they put the date in the description. Now I'll have to see if I can use Plagger to fix it.</p> stu42j 2007-04-14T03:10:27+00:00 journal Vox.com - Security? http://use.perl.org/~stu42j/journal/32986?from=rss <p>I just signed up on Vox.com to use for a personal blog. I picked Vox because my impression was that it is MySpace done right. Six Apart+Danga have been around for a while, they know what they are doing. Plus they like Perl (and some Perl folks seem to like them).</p><p>So, after I sign up, I get a welcome email with my password, the one that I entered (not a random system generated thing), right there in the plain text of the email. WTF?</p><p>Ok, so it is just a blog, not a bank or something but sheesh! Mailman does the same thing but at least it warns you about it.</p><p>Am I overreacting or should I look elsewhere for my personal blogging needs?</p><p>Update: I also used tried the "forgot password" function and it again emailed my password in plain text. This means that they are either storing the passwords with two-way encryption (unlikely) or simply plain text. This is bad on top of bad. Storing passwords as a salted hash is not hard and pretty much standard best-practice security!</p> stu42j 2007-04-13T18:25:18+00:00 journal #perl on Freenode http://use.perl.org/~stu42j/journal/32821?from=rss <p>After reading somian's <a href="http://use.perl.org/~somian/journal/27238">journal entry</a> on the #perl channel on Freenode, I decided to check it out.</p><p>The discussion at the moment includes Jewish lesbians vs. vampire cowboys and emacs vs. vi.</p><p>I've decided not to repeat the discussion on Randal's autographing policies.</p> stu42j 2007-03-28T14:54:27+00:00 journal Oh what fun! http://use.perl.org/~stu42j/journal/32609?from=rss <p>The Boss sends me an email today detailing my next project. He starts out by saying, "you should have some fun with it. Be creative!"</p><p>What's this exciting new project!? Generating error messages. Tedious? yes. Fun? no. Creative? Does he want me to write the messages in <a href="http://search.cpan.org/~dconway/Coy-0.05/lib/Coy.pm">haiku</a>?</p> stu42j 2007-03-07T18:34:41+00:00 journal