jtrammell's Journal http://use.perl.org/~jtrammell/journal/ jtrammell'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:36:56+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 jtrammell's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~jtrammell/journal/ Heads Need to be Cracked In! http://use.perl.org/~jtrammell/journal/35407?from=rss I'll admit it. In a moment of high spirits as a grad student, I posted <a href="http://www.theonion.com/content/node/33824">an editorial from The Onion</a> on a website. OK, it was the graduate student website. OK, I was a grad student at Fermilab at the time, so it's sort of a ".gov" website. <br> <br> That was (counts on remaining fingers) ten years ago. And it's <a href="http://www.fnal.gov/orgs/gsa/links/hed.html">STILL THERE</a>. Sorry, Fermilab. You can point the neutrino beam at my house in retaliation. <br> <br> But if you do, I will drive down to Batavia and crack your fool head in. jtrammell 2008-01-16T22:27:13+00:00 journal .ini file folding in Vim http://use.perl.org/~jtrammell/journal/34147?from=rss Create file "~/.vim/after/syntax/dosini.vim" containing this line:<blockquote><div><p> <tt>syn region dosiniSection start="^\[" end="\(\n*\[\)\@=" fold</tt></p></div> </blockquote><p>and voila!</p> jtrammell 2007-08-18T12:52:09+00:00 journal Technorati seal of approval http://use.perl.org/~jtrammell/journal/33932?from=rss I claim this blog in the name of the King. <a href="http://technorati.com/claim/7qp5esebr2">Technorati Profile</a> <a href="http://technorati.com/claim/ea8sudw8e">Technorati Profile</a> jtrammell 2007-07-31T15:49:29+00:00 journal MORE HORROR http://use.perl.org/~jtrammell/journal/33704?from=rss Also seen today, from the same author:<blockquote><div><p> <tt>sub deliver_emails_for_products_and_section_types_for_users_that_have_not_already_r<nobr>e<wbr></nobr> ceived_email {<br>...<br>}</tt></p></div> </blockquote><p>(any errant spaces in that sub name were inserted by slashcode...)</p> jtrammell 2007-07-05T20:58:40+00:00 journal THE HORROR http://use.perl.org/~jtrammell/journal/33701?from=rss Found lurking in the codebase:<blockquote><div><p> <tt>sub get_time_stamp_in_format_yyyy_mm_dd_hh_mi_ss {<br>&nbsp; &nbsp; my $time_val&nbsp; &nbsp; = $_[0];<br>&nbsp; &nbsp; my $err_msg_ref = $_[1];<br> <br>&nbsp; &nbsp; my $date;<br>&nbsp; &nbsp; my $day;<br>&nbsp; &nbsp; my $fatal_msg;<br>&nbsp; &nbsp; my $file;<br>&nbsp; &nbsp; my $hasargs;<br>&nbsp; &nbsp; my $hour;<br>&nbsp; &nbsp; my $line;<br>&nbsp; &nbsp; my $min;<br>&nbsp; &nbsp; my $mon;<br>&nbsp; &nbsp; my $msg;<br>&nbsp; &nbsp; my $pack;<br>&nbsp; &nbsp; my $ref;<br>&nbsp; &nbsp; my $sec;<br>&nbsp; &nbsp; my $subname;<br>&nbsp; &nbsp; my $subroutine_name;<br>&nbsp; &nbsp; my @time_attrs;<br>&nbsp; &nbsp; my $time_str;<br>&nbsp; &nbsp; my $want_array;<br>&nbsp; &nbsp; my $year;<br> <br>&nbsp; &nbsp; $want_array = wantarray;<br> <br>&nbsp; &nbsp; $subroutine_name = 'get_time_stamp_in_format_yyyy_mm_dd_hh_mi_ss';<br> <br>&nbsp; &nbsp; if (ref $err_msg_ref eq 'SCALAR') {<br>&nbsp; &nbsp; &nbsp; &nbsp; $$err_msg_ref = undef;<br>&nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; $err_msg_ref = undef;<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; if (! defined $want_array) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if ($err_msg_ref) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ($pack, $file, $line, $subname, $hasargs) = caller 1;<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $msg = $pack.'::'.$subname.' ('.$line.') : The method '.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(PACKAGE_NAME).'::'.$subroutine_name.' called in '.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'void context.&nbsp; It makes no sense to call this '.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'method in void context.';<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $$err_msg_ref = $msg;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; return;<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; if (! defined $time_val) {<br>&nbsp; &nbsp; &nbsp; &nbsp; $time_val = time;<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; eval {<br>&nbsp; &nbsp; &nbsp; &nbsp; @time_attrs = localtime $time_val;<br>&nbsp; &nbsp; };<br> <br>&nbsp; &nbsp; $fatal_msg = $@;<br> <br>&nbsp; &nbsp; if ($fatal_msg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if ($err_msg_ref) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $$err_msg_ref = $fatal_msg;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; if ($want_array) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return ();<br>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return undef;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; } elsif (!@time_attrs) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if ($err_msg_ref) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ($pack, $file, $line, $subname, $hasargs) = caller 0;<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $msg = $pack.'::'.$subname.' ('.$line.') : Call to localtime '.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'failed to retrieve the second, minute, hour, day, '.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'month, and year given the value '.$time_val.'.';<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $$err_msg_ref = $msg;<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($want_array) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return ();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return undef;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; $sec&nbsp; = $time_attrs[0];<br>&nbsp; &nbsp; $min&nbsp; = $time_attrs[1];<br>&nbsp; &nbsp; $hour = $time_attrs[2];<br>&nbsp; &nbsp; $day&nbsp; = $time_attrs[3];<br>&nbsp; &nbsp; $mon&nbsp; = $time_attrs[4];<br>&nbsp; &nbsp; $year = $time_attrs[5];<br> <br>&nbsp; &nbsp; $mon++;<br>&nbsp; &nbsp; $year += 1900;<br> <br>&nbsp; &nbsp; foreach $ref (\$sec, \$min, \$hour, \$day, \$mon) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if (($$ref &gt;= 0) &amp;&amp; ($$ref &lt; 10)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $$ref = '0'.$$ref;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; $date&nbsp; &nbsp; &nbsp;= $year.'-'.$mon.'-'.$day;<br>&nbsp; &nbsp; $time_str = $hour.':'.$min.':'.$sec;<br> <br>&nbsp; &nbsp; if ($want_array) {<br>&nbsp; &nbsp; &nbsp; &nbsp; return ($date, $time_str);<br>&nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; return $date;<br>&nbsp; &nbsp; }<br>}</tt></p></div> </blockquote><p>Mommy!</p> jtrammell 2007-07-05T17:31:14+00:00 journal "question" ne "doubt" http://use.perl.org/~jtrammell/journal/33573?from=rss A little clarification for those who use "doubt" and "question" (as nouns) interchangeably:<blockquote><div><p> <i>Question:</i> an interrogative expression often used to test knowledge; an interrogative sentence or clause</p></div> </blockquote><blockquote><div><p> <i>Doubt:</i> uncertainty of belief or opinion that often interferes with decision-making; a deliberate suspension of judgment</p></div> </blockquote><p> OK, Thanks!</p> jtrammell 2007-06-21T16:26:03+00:00 journal Round &amp; round http://use.perl.org/~jtrammell/journal/33215?from=rss Witnessed recently: <ul> <li>The English language is imprecise!</li> <li>Therefore it is a waste of my time to try to speak carefully and precisely!</li> <li>Everyone is confused by what I am saying!</li> <li>See, I told you the English language is imprecise!</li> </ul><p> Repeat <i>ad nauseam</i>.</p> jtrammell 2007-05-08T12:03:41+00:00 journal Literally http://use.perl.org/~jtrammell/journal/32507?from=rss You know you're in for a ride when your <a href="http://www.cs.wisc.edu/~dbbook/">textbook</a> starts with a howler like this:<blockquote><div><p> <i>The amount of information available to us is literally exploding,<nobr> <wbr></nobr>...</i></p></div> </blockquote><p> This abysmal textbook is literally giving me a headache.</p> jtrammell 2007-02-26T03:49:20+00:00 journal Finally attained divinity http://use.perl.org/~jtrammell/journal/31981?from=rss <p>For the most part I've been treated well by "Joy of Cooking", but until tonight their divinity recipe (pages 731-2 in my paperback edition) has eluded me. Mom used to make it every year for Christmas, and I haven't had it since a loooong time ago.</p><p>After a little experimenting I was able to adapt the JOC recipe into something that made divinity like Mom used to make. Here goes.</p><p> <b>Divinity</b> </p><p> Materials </p><ul> <li>2 egg whites, room temperature</li> <li>1/2 cup light corn syrup (e.g. Karo)</li> <li>1/2 cup water</li> <li>2 cups sugar</li> <li>candy thermometer</li> <li>lidded pan suitable for use with candy thermometer (diameter of pan is less than length of thermometer, so that if the thermometer falls, you don't have to fish it out of boiling sugar)</li> <li>heavy mixer + 2.5-quart bowl to go with it</li> <li>waxed paper on heat-resistant surface (cooling rack, cutting board, etc.)</li> </ul><p> Instructions </p><ol> <li>Bring the corn syrup + water to a boil in the pan. Cover the mixture while doing so.</li> <li>Add the sugar; turn the heat down slightly (on my stove, this is from "High" to about "7.5").</li> <li>Agitate the pan until the sugar dissolves. I don't know if this is necessary, but I find it enjoyable.<nobr> <wbr></nobr>:-) No need to stir the sugar after this.</li> <li>Stick the candy thermometer in the mixture. (Some people suggest preheating the thermometer in a pan of hot water. I've done this, but I'm not sure how important it is.) You're going to heat the sugar to <a href="http://www.google.com/search?q=270+F+in+C">270 Fahrenheit</a>, but first you have to whip the egg whites.</li> <li>Beat the egg whites until firm. This only takes a minute, and you should have plenty of time to do this while the sugar is heating.</li> <li>When the sugar hits <a href="http://www.google.com/search?q=270+F+in+C">270 Fahrenheit</a>, take it off the heat, and pour it into the egg whites slowly, while beating.</li> <li>Beat the divinity mixture until it's firm enough to stand on its own in little dollops. This may take a while, and is the most interesting part of the process. If you watch carefully, you can see the divinity go through at least one "phase change" where its gloss changes dramatically.</li> <li>Put dollops on waxed paper. Dollops will be pretty hot at first, but not too hot to touch with bare fingers. I get about 3 dozen dollops consistently from this recipe.</li> </ol><p> Nutrition </p><ul> <li>2 cups sugar: 1550 calories</li> <li>2 egg whites: 34 calories</li> <li>1/2 cup corn syrup: 450 calories</li> </ul><p> So we're talking about 60 calories per item here.</p> jtrammell 2006-12-21T04:34:41+00:00 journal Election judging http://use.perl.org/~jtrammell/journal/30677?from=rss <p>I am very psyched to be chosen to be an election judge again this year, and proud of my state and county for using a decent (i.e. hand-recountable paper trail) ballot system. None of this electronic ballot malarkey. I'll be working the primary and general elections, and we just had training this week.</p><p>One addition this year (due to HAVA) is the new AutoMARK machine, which makes ballot marking more accessible. It has braille, audio, touchscreen with magnify/high-contrast, and "puff" interfaces for those with limited mobility. I'll probably use it to mark up my own ballot just so I get a chance to play with it.</p><p>One thing I really enjoy about being a judge is that I get to meet a lot of the people who live in my neighborhood. We had something like 90% voter turnout last year, so I had at least an opportunity to talk to most of the adults (any many of the kids) in my area.</p> jtrammell 2006-08-17T20:44:11+00:00 journal Bianca's Pesto http://use.perl.org/~jtrammell/journal/30518?from=rss Bianca's Pesto<blockquote><div><p>Ingredients: </p><ul> <li>basil leaves, about 4 cups</li> <li>salt, 1/4 tsp.</li> <li>virgin olive oil, about 1 cup</li> <li>1 clove garlic</li> <li>1/2 cup parmesan, grated</li> <li>1/4 cup pine nuts</li> </ul><p> Wash and dry the basil leaves. Pack them firmly in the food processor. Add ingredients. Cream until stiff. <br> <br> 1 batch yields about 2 cups of pesto, or about 8 servings if you like it like I do. <br> <br> Eat fresh pesto promptly. If you need to store it for more than a couple of days, freeze it; add a thin layer of olive oil to the top of the pesto to minimize freezer burn.</p></div> </blockquote> jtrammell 2006-08-03T02:20:14+00:00 journal Regex for UTF-8 octets (from perlunicode) http://use.perl.org/~jtrammell/journal/30499?from=rss From "perldoc perlunicode":<blockquote><div><p> <tt>Code Points&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1st Byte&nbsp; 2nd Byte&nbsp; 3rd Byte&nbsp; 4th Byte<br> <br>U+0000..U+007F&nbsp; &nbsp; &nbsp; &nbsp;00..7F<br>U+0080..U+07FF&nbsp; &nbsp; &nbsp; &nbsp;C2..DF&nbsp; &nbsp; 80..BF<br>U+0800..U+0FFF&nbsp; &nbsp; &nbsp; &nbsp;E0&nbsp; &nbsp; &nbsp; &nbsp; A0..BF&nbsp; &nbsp; 80..BF<br>U+1000..U+CFFF&nbsp; &nbsp; &nbsp; &nbsp;E1..EC&nbsp; &nbsp; 80..BF&nbsp; &nbsp; 80..BF<br>U+D000..U+D7FF&nbsp; &nbsp; &nbsp; &nbsp;ED&nbsp; &nbsp; &nbsp; &nbsp; 80..9F&nbsp; &nbsp; 80..BF<br>U+D800..U+DFFF&nbsp; &nbsp; &nbsp; &nbsp;******* ill-formed *******<br>U+E000..U+FFFF&nbsp; &nbsp; &nbsp; &nbsp;EE..EF&nbsp; &nbsp; 80..BF&nbsp; &nbsp; 80..BF<br>U+10000..U+3FFFF&nbsp; &nbsp; &nbsp; F0&nbsp; &nbsp; &nbsp; &nbsp; 90..BF&nbsp; &nbsp; 80..BF&nbsp; &nbsp; 80..BF<br>U+40000..U+FFFFF&nbsp; &nbsp; &nbsp; F1..F3&nbsp; &nbsp; 80..BF&nbsp; &nbsp; 80..BF&nbsp; &nbsp; 80..BF<br>U+100000..U+10FFFF&nbsp; &nbsp; &nbsp;F4&nbsp; &nbsp; &nbsp; &nbsp; 80..8F&nbsp; &nbsp; 80..BF&nbsp; &nbsp; 80..BF</tt></p></div> </blockquote><p>And the equivalent regex:</p><blockquote><div><p> <tt>qr{<br>&nbsp; &nbsp; &nbsp; &nbsp; (?:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [\x00-\x7f]&nbsp; #&nbsp; &nbsp;U+0000<nobr> <wbr></nobr>.. U+007F<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [\xc2-\xdf] [\x80-\xbf]&nbsp; #&nbsp; &nbsp;U+0080<nobr> <wbr></nobr>.. U+07FF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\xe0 [\xa0-\xbf] [\x80-\xbf]&nbsp; #&nbsp; &nbsp;U+0800<nobr> <wbr></nobr>.. U+0FFF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [\xe1-\xec] [\x80-\xbf] [\x80-\xbf]&nbsp; #&nbsp; &nbsp;U+1000<nobr> <wbr></nobr>.. U+CFFF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\xed [\x80-\x9f] [\x80-\xbf]&nbsp; #&nbsp; &nbsp;U+D000<nobr> <wbr></nobr>.. U+D7FF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [\xee-\xef] [\x80-\xbf] [\x80-\xbf]&nbsp; #&nbsp; &nbsp;U+E000<nobr> <wbr></nobr>.. U+FFFF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf]&nbsp; #&nbsp; U+10000<nobr> <wbr></nobr>.. U+3FFFF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf]&nbsp; #&nbsp; U+40000<nobr> <wbr></nobr>.. U+FFFFF<br>&nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf]&nbsp; # U+100000<nobr> <wbr></nobr>.. U+10FFFF<br>&nbsp; &nbsp; &nbsp; &nbsp; )<br>}x;</tt></p></div> </blockquote><p>This has proven useful as I search for errant Latin-1 characters embedded in some files.</p> jtrammell 2006-08-01T16:04:32+00:00 journal