<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Strange Loopiness</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/" />
    <link rel="self" type="application/atom+xml" href="http://www.zedlopez.com/strangeloopiness/atom.xml" />
   <id>tag:www.zedlopez.com,2012:/strangeloopiness//2</id>
    <link rel="service.post" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2" title="Strange Loopiness" />
    <updated>2012-03-06T18:05:02Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.12</generator>
 

<entry>
    <title>pfind</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2012/03/pfind.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3270" title="pfind" />
    <id>tag:www.zedlopez.com,2012:/strangeloopiness//2.3270</id>
    
    <published>2012-03-06T17:42:18Z</published>
    <updated>2012-03-06T18:05:02Z</updated>
    
    <summary>File::Find is a very nifty perl module on CPAN for finding files by whatever criteria and operating on them. Its docs say: See also the script pfind on CPAN for a nice application of this module. which becomes a little...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p><a href="http://search.cpan.org/~flora/perl-5.14.2/lib/File/Find.pm">File::Find</a> is a very nifty perl module on <span class="caps">CPAN </span>for finding files by whatever criteria and operating on them. Its docs say:</p>

<blockquote><p>See also the script pfind on <span class="caps">CPAN </span>for a nice application of this module.</p></blockquote>

<p>which becomes a little cryptic when you see <a href="https://metacpan.org/search?q=pfind">there is no pfind on <span class="caps">CPAN.</span></a> But here's <a href="http://math.berkeley.edu/~ilya/software/tmp/pfind">pfind</a> and it's a pretty nifty tool to have alongside <a href="http://www.betterthangrep.com/">ack</a> for replacing complicated find/grep pipelines.</p>

<p><b><span class="caps">NAME</span></b></p>

<blockquote><p>      pfind - find-or-grep-like utility with Perl syntax</p></blockquote>

<p><b><span class="caps">SYNOPSIS</span></b></p>

<p>To lowercase only the files names of which contain "blah", do</p>

<blockquote><p>        <tt>pfind . /blah/ '$_ = lc'</tt></p></blockquote>

<p>       To lowercase only the files which contain "blah" inside, do</p>

<blockquote><p>   <tt>pfind . "=~ /blah/" '$_ = lc'</tt></p></blockquote>

<p>       To do recursive "grep foo bar*" in <span class="caps">UTF</span>-8 files, do</p>

<blockquote><p>   <tt>pfind -utf8 -alllines . '/^bar/' '=~ /foo/' prt_line</tt></p></blockquote>

<p><b><span class="caps">DESCRIPTION</span></b></p>

<p>       usage:</p>

<blockquote><p>        <tt>pfind [-debug] [-nosubdir] [-bin] [-bak=suffix] [-alllines] [-utf8] [-vars] [-nochdir] [-opts=OPTIONS] [--] startdir rule1 rule2 ...</tt></p></blockquote>

<p>   Rules: filters and actions</p>

<blockquote><p> Rules are perl statements to execute. Statements starting with "-", "/", "$dir =~", "$dir <img src=""," alt="" class="bottom" style="vertical-align:text-bottom" />~", or "!" are considered filters, a file will be discarded unless the statement returns true.</p>

<p>Statements starting with "=~" (possibly negated by prepending "!") are filters applied to the contents of the file.  The rest is executed as is.</p>

<p>Rules are executed in the directory of the file.</p></blockquote>]]>
        
    </content>
</entry>

<entry>
    <title>netselect-if</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2011/08/netselectif.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3259" title="netselect-if" />
    <id>tag:www.zedlopez.com,2011:/strangeloopiness//2.3259</id>
    
    <published>2011-08-06T00:04:13Z</published>
    <updated>2011-08-06T00:06:41Z</updated>
    
    <summary>If you&apos;re like me, you&apos;ve wondered which Interactive Fiction Archive mirror is fastest for you. Wonder no more! #!/usr/bin/env ruby require &apos;open-uri&apos; require &apos;hpricot&apos; doc = Hpricot(open(&quot;http://www.ifarchive.org/&quot;)) mirrors =(doc.search(&quot;div.ArchiveMirrors&quot;)/&quot;a&quot;).map {|a| a[&apos;href&apos;].strip.match(/^[^\/]+\/\/([^\/]+)/)[1]}.reject {|m| m == &quot;mirror.ifarchive.org&quot;}.uniq system(*(%w(netselect -v -s 5) +...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>If you're like me, you've wondered which <a href="http://www.ifarchive.org/">Interactive Fiction Archive mirror</a> is fastest for you. Wonder no more!</p>

<p><tt><br />
#!/usr/bin/env ruby</p>

<p>require 'open-uri'<br />
require 'hpricot'</p>

<p>doc = Hpricot(open("http://www.ifarchive.org/"))<br />
mirrors =(doc.search("div.ArchiveMirrors")/"a").map {|a| a['href'].strip.match(/^[^\/]+\/\/([^\/]+)/)[1]}.reject {|m| m == "mirror.ifarchive.org"}.uniq<br />
system(*(%w(netselect -v -s 5) + mirrors))<br />
</tt></p>]]>
        
    </content>
</entry>

<entry>
    <title>Things I learned</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2011/08/things_i_learned.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3258" title="Things I learned" />
    <id>tag:www.zedlopez.com,2011:/strangeloopiness//2.3258</id>
    
    <published>2011-08-05T15:39:51Z</published>
    <updated>2011-08-05T16:48:42Z</updated>
    
    <summary><![CDATA[Perl's DateTime module can (usually) figure out the local timezone on its own. Don't know why I didn't know this -- it's right there in the docs. our $App::LocalTZ = DateTime::TimeZone-&gt;new( name =&gt; 'local' ); ... # then everywhere else...]]></summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>Perl's <a href="http://search.cpan.org/~drolsky/DateTime-0.70/">DateTime</a> module can (usually) figure out the local timezone on its own. Don't know why I didn't know this -- it's right there in the docs.</p>

<p><tt><br />
      our $App::LocalTZ = DateTime::TimeZone-&gt;new( name =&gt; 'local' );</p>

<p>      ... # then everywhere else</p>

<p>      my $dt = DateTime-&gt;new( ..., time_zone =&gt; $App::LocalTZ );<br />
</tt></p>

<p>It's straightforward to <a href="http://www.tipcache.com/tip/Convert_a_static_library_%28.a%29_to_a_shared_object_%28.so%29_12.html">convert a static library to a shared one</a></p>

<p><tt>ar -x mylib.a<br />
gcc -shared *.o -o mylib.so</tt></p>

<p><a href="http://www.wagner.pp.ru/~vitus/software/catdoc/">catdoc</a> converts doc and rtf files to text, and, so far in my brief acquaintance with it, does so better than antiword and unrtf. And it comes with xls2csv and catppt as well.</p>

<p><a href="http://www.enricozini.org/2010/debian/axi-cache/">axi-cache</a> is a lot more useful than apt-cache for searching through debian package info. It's part of  <a href="http://www.enricozini.org/sw/apt-xapian-index/">apt-xapian-index</a> which uses <a href="http://xapian.org/">Xapian</a> to index the data. </p>]]>
        
    </content>
</entry>

<entry>
    <title>Status bar datestamps made easy</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2011/08/status_bar_datestamps_made_eas.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3257" title="Status bar datestamps made easy" />
    <id>tag:www.zedlopez.com,2011:/strangeloopiness//2.3257</id>
    
    <published>2011-08-04T14:38:10Z</published>
    <updated>2011-08-05T15:37:21Z</updated>
    
    <summary>Suppose you want to represent the days of the week with one character each. MTWTFSS Oops, two ambiguities in a domain of just seven. Tuesday and Thursday may begin with the same letter, but not the same sound, so we...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>Suppose you want to represent the days of the week with one character each. </p>

<p><span class="caps">MTWTFSS </span></p>

<p>Oops, two ambiguities in a domain of just seven. Tuesday and Thursday may begin with the same letter, but not the same sound, so we can just throw in the <span class="caps">IPA </span>for the voiceless dental fricative, one of the sounds represented in English by the digraph /th/.</p>

<p><span class="caps">MTW</span>θFSS</p>

<p>But we still have to disambiguate Saturday and Sunday. <span class="caps">OK,</span> Sun is for Sunday -- what could be more clear?</p>

<p><span class="caps">MTW</span>θFS☼</p>

<p>That's the Unicode "white sun with rays". It's a little hard to distinguish from a snowflake or a squashed bug at regular text sizes. But if you tend toward light text on a dark background, like me, the "black sun with rays" works better. </p>

<p><span class="caps">MTW</span>θFS☀</p>

<p><a href="http://www.uncannyxmen.net/db/issues/showfaq.asp?fldAuto=135">Black Sun</a> was also an X-Men miniseries. <a href="http://wildstormresource.wetpaint.com/page/Black+Sun#fbid=rg4Y_2TWfW7">Black Sun</a> was also a Wildstorm character. Now that Wildstorm is being rolled into the DC Universe, there could be a Black Sun <a href="http://dc.wikia.com/wiki/Lightray">with</a> <a href="http://en.wikipedia.org/wiki/Ray_(comics)">rays</a> series.</p>

<p>But a <a href="http://en.wikipedia.org/wiki/Sun-Eater">sun-eater</a> is cooler.</p>

<p>I seem to have digressed. Anyway, there's a perfectly good alternative symbol for the Sun lying around, the alchemical symbol.</p>

<p><span class="caps">MTW</span>θFS☉</p>

<p>But if we're going alchemical, why should Saturday get the S? Saturn's got its own alchemical symbol.</p>

<p><span class="caps">MTW</span>θF♄☉</p>

<p>And Saturn's not the only one. Just look at the days of the week.</p>

<p>Moon day<br />
Tyr's day<br />
Wotan's day<br />
Thor's day<br />
Freya's day<br />
Saturn's day<br />
Sun day</p>

<p>In the <a href="http://en.wikipedia.org/wiki/Interpretatio_germanica">interpretatio germanica,</a> Tyr is Mars; Wotan is Mercury; Freya is Venus; Thor is... well, Thor is Hercules, but Thor's Day is Jupiter's day. So now we have:</p>

<p>☽♂☿♃♀♄☉</p>

<p>I expect <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html">strftime</a> to support this any day now. In the meantime, this convenient Perl one-liner breaks it down.</p>



<tt>perl -e binmode STDOUT,":utf8";print chr((0,0x263D,0x2642,0x263F,0x2643,0x2640,0x2644,0x2609)[(localtime(time))[6]])'
</tt>]]>
        
    </content>
</entry>

<entry>
    <title>New netbook. But mostly Windows-bashing.</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2011/08/new_netbook_but_mostly_windows.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3256" title="New netbook. But mostly Windows-bashing." />
    <id>tag:www.zedlopez.com,2011:/strangeloopiness//2.3256</id>
    
    <published>2011-08-03T14:08:07Z</published>
    <updated>2011-08-03T20:38:40Z</updated>
    
    <summary>I finally bought a netbook, an Asus EEE PC 1015PEM-PU17. Purportedly, there should be EEE PCs available with Linux, but I don&apos;t see those actually for sale, so I ended up paying the Microsoft tax and receiving it with Windows...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>I finally bought a netbook, an <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16834220816">Asus <span class="caps">EEE</span> PC 1015PEM-PU17.</a> Purportedly, <a href="http://www.technostarry.com/linux/new-asus-eee-pcs-to-come-preloaded-with-ubuntu-linux/">there should be <span class="caps">EEE</span> PCs available with Linux</a>, but I don't see those actually for sale, so I ended up paying the Microsoft tax and receiving it with Windows 7.</p>

<p>I decided to leave it there, both because it's a useful <a href="http://oldsite.debianhelp.org/book/export/html/1116">beard</a> (no one's going to suspect you're concerned with security if your machine boots into Windows), and because it would be difficult or impossible (it didn't come with OS CDs) to restore it after the fact, which I might want to do to resell it. Some people would actually want it that way. Takes all kinds to make a world.</p>

<p>So I planned to do the minimally intrusive thing and install Linux to the 100+ GB empty D: drive it was set up with. But I wasn't sure whether Windows would end up confused if I simply reformatted that out from under it, so I wanted to delete the partition within Windows. Which meant interacting with it.</p>

<p>This was my first experience with Windows 7. I never used Vista, and I'd heard a lot of good things about 7. From my brief and shallow interaction with it, I couldn't see much difference from <span class="caps">XP.</span> You're <i>still</i> not prompted to make a separate admin account from your ordinary user account. That was a bad call ten years ago, and it's a bad call now. I tried to figure out how to delete the partition, and I could find a couple of places to get at info about the drives, but no luck, so I resorted, of course, to Googling.</p>

<p><a href="http://www.sevenforums.com/tutorials/2668-partition-volume-delete.html">Start Menu -&gt; Control Panel -&gt; All Items View -&gt; Administrative Tools -&gt; Computer Management -&gt; Storage -&gt; Disk Management.</a> Mmm, can't you just <i>smell</i> the discoverability? The intuitiveness? I'm not suggesting that this is <i>harder</i> than it would be in Linux, of course, where you'd also need to google to find that you wanted <a href="http://www.gnu.org/s/parted/">parted.</a> But once things are so complicated you're resorting to web searching to figure out how to do what you want, I'm hard-pressed to see how navigating through 7 levels of interface is any easier, either. Sure does involve more pointing and clicking, though -- gotta give it that.</p>

<p>I did the web-searching in <span class="caps">MSIE.</span> Had a wonderful Windows moment in which it immediately prompted me for whether I wanted the Bing bar. I said no. Another box popped up saying the Bing Bar wanted to run some software. Did I want to let it? I said no. Back to the first box. You see, you have to say <i>yes</i> to the second box to let it run software (which is actually an uninstall program, but you're not told that) in order to effect your no to the first box.</p>

<p>Meanwhile, there were things popping up all over the place with Trend Micro this and Asus Warrantee that. These aren't directly Windows' fault, but they are of a piece with the software ecosystem of irritation that has grown around Windows. I made the mistake of walking away from the computer and lying down on the couch, and nearly as soon as the kitty had settled on my chest, <i>it started playing annoying music.</i> The default screensaver was some sort of instructional/advertisement video.</p>

<p>As usual, I wondered how people could live this way.</p>

<p>So I deleted the partition and installed Ubuntu 11.04. I thought I'd try another Debian Unstable derivative, but I shopped around and really didn't see that anything else offered a comparably attractive combo of currency, stability, and support. Maybe tomorrow I'll dist-upgrade to the <a href="https://wiki.ubuntu.com/OneiricReleaseSchedule">11.10 Alpha 3.</a></p>

<p>And then I spent several hours installing software and in a couple of important cases, like for my <a href="http://www.nongnu.org/ratpoison/">window manager</a> and <a href="http://software.schmorp.de/pkg/rxvt-unicode.html">terminal emulator</a>, downloading the source so I could have the latest versions compiled with exactly the options I wanted, and generally did a lot of things that would leave most people wondering <a href="http://tldp.org/LDP/LG/issue45/orr.html">how I could live that way.</a></p>

<p>But absolutely nothing pops up.</p>

<p>Not even when the battery runs dry.</p>

<p>Yeah, I need to do something about that one.</p>

<p><b>Updated:</b> Lest I mislead anyone, the defaults for most of the Linux installations in this modern world already take care of laptop battery warnings without thought or effort on the user's part. It's because of my extreme customization that I'll need to do something myself.</p>]]>
        
    </content>
</entry>

<entry>
    <title>RequestPolicy: web security the right way</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2011/06/requestpolicy_web_security_the.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3252" title="RequestPolicy: web security the right way" />
    <id>tag:www.zedlopez.com,2011:/strangeloopiness//2.3252</id>
    
    <published>2011-06-24T16:18:58Z</published>
    <updated>2011-06-24T16:33:46Z</updated>
    
    <summary>Firefox remains my primary web browser of choice, principally because of the privacy extensions available, the most important of which are Cookie Monster and NoScript. But I&apos;ve been frustrated by their limitations -- I don&apos;t want to just blacklist and...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>Firefox remains my primary web browser of choice, principally because of the privacy extensions available, the most important of which are Cookie Monster and NoScript. But I've been frustrated by their limitations -- I don't want to just blacklist and whitelist, but to <i>conditionally</i> allow select 3rd party cookies to be set and scripts to be run depending on what the page is and what the 3rd party is. I want to be able to say that for paypal.com, requests to paypalobjects.com should be treated the same as paypal.com without globally whitelisting paypalobjects.com.</p>

<p>So I'm mortified it took me so long to find out about <a href="https://addons.mozilla.org/en-US/firefox/addon/requestpolicy/">RequestPolicy</a>, which simply denies cross-site requests in general unless they're allowed, and supports allowing them on a per site basis.</p>

<p>It doesn't do everything I'd like; I'd like a lot more granularity, which would require a more complex interface than its author is going for. But it's better than anything I've seen.</p>

<p>And it's weird for me to realize that blocking cookies becomes scarcely relevant with third-party requests denied by default. What I really wanted to avoid was advertising sites or javascript library providers being able to build a picture of my browsing history. Now I have to wonder if I even need Cookie Monster at all.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Fun with PDFs</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2011/02/fun_with_pdfs.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3235" title="Fun with PDFs" />
    <id>tag:www.zedlopez.com,2011:/strangeloopiness//2.3235</id>
    
    <published>2011-02-08T15:15:32Z</published>
    <updated>2011-03-10T00:08:07Z</updated>
    
    <summary>I&apos;ve bought some role-playing game PDFs in recent weeks. A bunch of them are formatted for 6&quot;&#215;9&quot; pages (in part inspired by optimizing for iPads.) But I don&apos;t have a tablet, or a large reader, and printing out pages that...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>I've bought some role-playing game <span class="caps">PDF</span>s in recent weeks. A bunch of them are formatted for 6"&#215;9" pages (in part inspired by optimizing for iPads.) But I don't have a tablet, or a large reader, and printing out pages that small on letter-size pages would be a big waste.</p>

<p>This is why <a href="http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/pdfjam/">pdfjam</a> is my new best friend.</p>

<p>First, I examine the <span class="caps">PDF </span>to see which pages I want to keep, skipping any ads and often the covers or license text. Depending on the layout, it might be important to maintain what's recto and verso, but here I don't.</p>

<p><tt>pdfjam  sotc-electronic-edition-regular-20060914 '3,5-419'</tt></p>

<p>I have <tt>paper=letterpaper</tt> in my <tt>/etc/pdfjam.conf</tt>, so this automatically converts to letter size.</p>

<p>This leaves me with those pages in sotc-electronic-edition-regular-20060914-3,5-419-pdfjam.pdf. pdfjam and its sibling, pdfnup, are nicely predictable in this regard.</p>

<p>Now I'll put them two to a page, scaling up the size a little.</p>

<p><tt>pdfnup sotc-electronic-edition-regular-20060914-3,5-419-pdfjam.pdf --nup 2&#215;1 --scale  1.1</tt></p>

<p>This leaves me with a ginormous white river in the middle of the page. pdfnup offers various cropping and moving options, but I don't see that you can move left pages a little to the right and right pages a little to the lift, which would be ideal for me.</p>

<p>Last up is rotating the pages to portrait orientation.</p>

<p><tt>pdf90 sotc-electronic-edition-regular-20060914-3,5-419-pdfjam-nup.pdf</tt></p>

<p>My new next-best-friend is <a href="http://sourceforge.net/projects/g-manual-duplex/">gnome-manual-duplex</a>. But I don't want to just dump the whole thing to the printer, because any mistakes (like the printer grabbing two sheets at once) would ruin the rest of the stack. So I break it up. (Obviously, it's important to start on an odd page and finish on an even page.)</p>

<p><tt>pdfjam sotc-electronic-edition-regular-20060914-3,5-419-pdfjam-nup-rotated90.pdf 5-52 -o out.pdf</tt></p>

<p>I've symlinked <tt>/usr/local/bin/duplex</tt> to <tt>/usr/bin/gnome-manual-duplex</tt>, so:</p>

<p><tt>duplex out.pdf</tt></p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 10.04 disappointment</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/11/ubuntu_1004_disappointment.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3230" title="Ubuntu 10.04 disappointment" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3230</id>
    
    <published>2010-11-10T15:37:42Z</published>
    <updated>2010-11-10T19:57:51Z</updated>
    
    <summary>This weekend I brought Pocahontas&apos; computer up to Ubuntu Lucid. Yes, there&apos;s a more recent version, but the other machines in the house are Lucid; I didn&apos;t see anything compelling in Maverick; I figured Maverick&apos;s younger and the kinks were...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>This weekend I brought Pocahontas' computer up to Ubuntu Lucid. Yes, there's a more recent version, but the other machines in the house are Lucid; I didn't see anything compelling in Maverick; I figured Maverick's younger and the kinks were likely to have been worked out of Lucid; it's a long-term-support release, so if I feel lazy and there are no compelling reasons to upgrade, I can go without for up to three years.</p>

<p>It's the first machine I've installed with ubuntu-desktop -- the others were lovingly hand-crafted starting from command-line-only installations. So it was my first time encountering the things people have been complaining about. Ugly default desktop background -- easily changed. Window icons on the left -- easily changed. Ubuntu One in the main menu -- easily changed.</p>

<p>But it's also the first time I installed it on a machine with an Intel graphics chipset. And every few seconds <a href="http://ubuntuforums.org/showthread.php?t=1496344">the screen flickered black.</a> And lots of people are having this problem and have been having it for months. And it's not fixed. People are giving up and using Maverick, or Maverick's kernel, or Karmic's kernel.</p>

<p>According to the threads on the subject, changing boot options fixed it for some people. I tried a couple of the suggestions and they didn't work. Switching from a <span class="caps">DVI </span>cable to a <span class="caps">VGA </span>cable worked and, in practice, I don't see any quality degradation, so I guess I'll live with it.</p>

<p>I'm not interested in a lot of the things Canonical's been pursuing, but have continued to be an Ubuntu user because it's been a good way to get an up-to-date, supported Debian derivative that just works.</p>

<p>But if you take away the just works part, then, well, I may be looking elsewhere next time I'm looking to upgrade.</p>]]>
        
    </content>
</entry>

<entry>
    <title>mplayer for realvideo in Firefox</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/08/mplayer_for_realvideo_in_firef.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3226" title="mplayer for realvideo in Firefox" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3226</id>
    
    <published>2010-08-02T14:06:23Z</published>
    <updated>2010-08-02T20:23:33Z</updated>
    
    <summary>I recently had to test web delivery of a RealVideo file. This solution is crude and not robust. But it was quick (and it had to be quick to justify hacking my own vs. actually installing Realplayer in some environment.)...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>I recently had to test web delivery of a RealVideo file. This solution is crude and not robust. But it was quick (and it had to be quick to justify hacking my own vs. actually installing Realplayer in some environment.)</p>

<p>Dumped this in /usr/local/bin/realplayer:</p>



<pre>#!/bin/bash
cd /tmp
wget $1
mplayer `cat $1`</pre>



<p>I stopped Firefox, and in mimeTypes.rdf in my firefox profile (and this seems needlessly convoluted):</p>

<p>Within <tt>&lt;RDF:Seq&gt;</tt>, I added:</p>

<p><tt>&lt;RDF:li <span class="caps">RDF</span>:resource="urn:mimetype:video/vnd.rn-realvideo"/&gt;</tt></p>

<p>Within the root element, &lt;RDF:RDF&gt;, I added: </p>

<p><tt><br />
  &lt;RDF:Description <span class="caps">RDF</span>:about="urn:mimetype:video/vnd.rn-realvideo"<br />
                   NC:value="video/vnd.rn-realvideo"<br />
                   NC:editable="true"<br />
                   NC:fileExtensions="ram"<br />
                   NC:description=""&gt;<br />
    &lt;NC:handlerProp <span class="caps">RDF</span>:resource="urn:mimetype:handler:video/vnd.rn-realvideo"/&gt;<br />
  &lt;/RDF:Description&gt;<br />
  &lt;RDF:Description <span class="caps">RDF</span>:about="urn:mimetype:handler:video/vnd.rn-realvideo"<br />
                   NC:alwaysAsk="false"<br />
                   NC:saveToDisk="false"<br />
                   NC:useSystemDefault="false"<br />
                   NC:handleInternal="false"&gt;<br />
    &lt;NC:externalApplication <span class="caps">RDF</span>:resource="urn:mimetype:externalApplication:video/vnd.rn-realvideo"/&gt;<br />
  &lt;/RDF:Description&gt;<br />
  &lt;RDF:Description <span class="caps">RDF</span>:about="urn:mimetype:externalApplication:video/vnd.rn-realvideo"<br />
                   NC:path="/usr/local/bin/realplayer"<br />
                   NC:prettyName="realplayer" /&gt;<br />
</tt></p>

<p>Restart Firefox, presto, mplayer is working as my realvideo player.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Escape from the shell</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/07/escape_from_the_shell.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3224" title="Escape from the shell" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3224</id>
    
    <published>2010-07-27T13:56:48Z</published>
    <updated>2010-07-27T17:58:45Z</updated>
    
    <summary>Perl&apos;s exec, system, and fork functions all let one execute system commands, and they all do it by driving a POSIX exec system call so they don&apos;t invoke a shell. But Perl&apos;s backtick operator (aka the qx quotelike operator), the...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>Perl's exec, system, and fork functions all let one execute system commands, and they all do it by driving a <span class="caps">POSIX </span>exec system call so they don't invoke a shell. But Perl's backtick operator (aka the qx quotelike operator), the easiest way to capture output from a command, invokes a shell, so the arguments to the command need to be shell-escaped.</p>

<p> <a href="http://search.cpan.org/~mschilli/Sysadm-Install-0.35/lib/Sysadm/Install.pm">Sysadm::Install</a> has quote and qquote functions that do a good job of this, but it's easy enough to avoid needing shell escaping.</p>



<pre>
sub command {
  my ($command, $dontchomp) = @_;
  $dontchomp //= 0;
  open(my $ph, qq{$command|}) or die &quot;Can't fork $command: $!&quot;;
  my $raw = do { local $/ = &lt;$ph&gt; };
  close($ph) or die &quot;$command returned error: $! $?&quot;;
  chomp $raw unless $dontchomp;
  return wantarray ? split &quot;\n&quot;, $raw : $raw;
}
</pre>



<p>Note that you pass the whole command line as one string, arguments and all. The default behavior is to chomp the command output, which differs from the native backtick behavior; you can pass a true value for the second arg, $dontchomp, if you don't want it.</p>

<p>Reading all the output into a scalar is suitable for things with modest amounts of output (like the situtations in which you would have been using a backtick.) If you were processing a lot of output, you'd want to open the pipehandle and iterate on &lt;$ph&gt; yourself.</p>

<p>The reason I went down this rabbit-hole is wanting to get info from ratpoison so I could write some window management scripts. When you pass ratpoison a command with its -c option, it expects the whole command as one string. So we do have to worry about quote-escaping that string, like so:</p>



<pre>
sub rp {
  local $_ = &quot;@_&quot;;
  s/&quot;/\\&quot;/g;
  return command(qq{ratpoison -c &quot;$_&quot;});
}
</pre>



<p>The way this is written, you can pass your arguments as a string or as a list, to taste.</p>



<pre>
rp(&quot;windows %c %t %n&quot;);
rp(&quot;windows&quot;, &quot;%c&quot;, &quot;%t&quot;, &quot;%n&quot;);
</pre>



<p>Ratpoison lets you pass it multiple commands at once, and this rp routine doesn't, but that's usually what you want when you're getting info out of it.</p>]]>
        
    </content>
</entry>

<entry>
    <title>CPAN handling</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/06/cpan_handling.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3218" title="CPAN handling" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3218</id>
    
    <published>2010-06-21T14:11:05Z</published>
    <updated>2010-06-21T17:17:57Z</updated>
    
    <summary><![CDATA[Later the same week I was having problems building a Python package, I rounded out my fun by having problems building a Perl package. I learned that &lt;prefix&gt;/perl/&lt;version&gt;/Config.pm includes the various flags and settings that your perl was built with,...]]></summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>Later the same week I was having <a href="http://www.zedlopez.com/strangeloopiness/2010/06/not_an_ez_setup.html">problems building a Python package,</a> I rounded out my fun by having problems building a Perl package.</p>

<p>I learned that &lt;prefix&gt;/perl/&lt;version&gt;/Config.pm includes the various flags and settings that your perl was built with, and can be your guide to how to build things to play nice with your Perl instance. (<a href="http://search.cpan.org/~dagolden/Module-Build-0.3607/lib/Module/Build.pm">Module::Build</a> tries to do this automagically, but it wasn't working with the idiosyncrasies of the environment I was working with.)</p>]]>
        
    </content>
</entry>

<entry>
    <title>Not an ez_setup</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/06/not_an_ez_setup.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3216" title="Not an ez_setup" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3216</id>
    
    <published>2010-06-09T13:51:02Z</published>
    <updated>2010-06-09T17:08:17Z</updated>
    
    <summary>I was trying to build a Python module yesterday, but python setup.py build insisted on including several compiler options that the compiler immediately balked at, returning an error. This is despite that the instance of Python I was using was...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>I was trying to build a Python module yesterday, but <br />
<tt><br />
python setup.py build<br />
</tt><br />
insisted on including several compiler options that the compiler immediately balked at, returning an error. This is despite that the instance of Python I was using was freshly compiled with the same environment, so shouldn't have any mistaken notions of how things should be built.</p>

<p>setup.py went: </p>


<pre>
if os.name == &quot;posix&quot;:
    from setup_posix import get_config
else: # assume windows
    from setup_windows import get_config

metadata, options = get_config()
# other assignments to metadata
setup(**metadata)
</pre>



<p>so I just used pprint to look at options: </p>



<pre>
import pprint
pp = pprint.PrettyPrinter(indent=2)
metadata, options = get_config()
pp.pprint(options)
</pre>



<p>I saw that the unwanted compiler options were coming from <tt>options['extra_compile_args']</tt> so I set that to the null list, and now I could build it.</p>

<p>Also, I got to find out that the 3 year old release version of mod_python 3.3.1 has a <a href="https://issues.apache.org/jira/browse/MODPYTHON-249">bug</a> that causes compilation errors on some platforms (including mine, Solaris 2.10.)</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ratpoison titlechanged hook</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/05/a_tiny_patchhttpgitsavannahgnu.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3214" title="Ratpoison titlechanged hook" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3214</id>
    
    <published>2010-05-19T14:23:55Z</published>
    <updated>2010-05-19T18:22:46Z</updated>
    
    <summary>A tiny patch I wrote was just committed to the ratpoison git repository. It adds a hook called &quot;titlechanged&quot; that allows you to configure actions to be taken when the current window&apos;s title is changed. My patch included a one-line...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>A <a href="http://git.savannah.gnu.org/cgit/ratpoison.git/commit/?id=c48f75e86aea05a8b09a9e52eebe202ac2e84c3c">tiny patch</a> I wrote was just committed to the <a href="http://www.nongnu.org/ratpoison/">ratpoison</a> git repository. It adds a <a href="http://www.nongnu.org/ratpoison/doc/Hooks.html">hook</a> called "titlechanged" that allows you to configure actions to be taken when the current window's title is changed.</p>

<p>My patch included a one-line description of the hook in the manual. It's accurate enough, but by itself it remains one of those things that would leave you thinking "OK, so I <em>can</em> do this, but why would I want to?" </p>

<p>So this entry is my explanation of why you might want to.</p>

<p>One of the points of ratpoison is that it just draws windows, with no titlebar or other window decoration (save for an optional border.) Most of the time, I find this to be a feature -- the titlebar rarely adds anything useful, so it's usually wasted space. But I sometimes found it to be a bug when using a web browser, when the window title is whatever's the contents of the current tab's title tag, info that isn't necessarily duplicated elsewhere and occasionally has value.</p>

<p>At some point, I toyed with a greasemonkey script that would reproduce the title in the body of the html in some distinctive style, but it was a pain. It took a while, but eventually I struck upon my current course and realized just how easy it would be to add the necessary support to ratpoison. (I programmed in C for five years in my first job out of college, but that was a long time ago, and I wouldn't claim to be a C programmer today. But the ratpoison source is so clean and clear, the patch was straightforward.) And it's a relief to know I'll never want to cobble together an application-specific workaround again.</p>

<p>How I'm using it relies on <a href="http://distanz.ch/inotail/">inotail</a> and <a href="http://sites.google.com/site/gotmor/dzen">dzen</a> (compiled from source for xft support, which the Ubuntu Lucid package doesn't have.)</p>

<p>In my .xsession, I have:</p>

<p><tt><br />
[ -f /tmp/left ] &amp;&amp; rm /tmp/left<br />
[ -f /tmp/right ] &amp;&amp; rm /tmp/right<br />
touch /tmp/left<br />
touch /tmp/right<br />
killall dzen2<br />
inotail -f /tmp/left|dzen2 -x 0 -w 400 -ta l -fg "#1F1F1F" -bg "#CFCFD7" -fn "Consolas-11" &amp;<br />
inotail -f /tmp/right|dzen2 -x 400 -w 1280 -ta r -fg "#1F1F1F" -bg "#CFCFD7" -fn "Consolas-11" &amp;<br />
/usr/local/bin/status.pl &amp;<br />
ratpoison<br />
</tt></p>

<p>In my .ratpoisonrc, I have:</p>

<p><tt><br />
set padding 0 16 0 0 <br />
addhook switchwin exec ratpoison -c "info %t" &gt; /tmp/right<br />
addhook switchframe exec ratpoison -c "info %t" &gt; /tmp/right<br />
addhook deletewindow exec ratpoison -c "info %t" &gt; /tmp/right<br />
addhook titlechanged exec ratpoison -c "info %t" &gt; /tmp/right<br />
</tt></p>

<p>"set padding" leaves 16 pixels at the top of the screen for the dzen2 bar, suitable for 1 line of Consolas-11. The hooks update /tmp/right whenever a potentially title-changing event occurs. (I was tempted to fire the titlechanged hooks in ratpoison as a side effect of the other hooks, but no other hook in ratpoison chains in that fashion, and I chose not to.) </p>

<p>Meanwhile, /usr/local/bin/status.pl writes to /tmp/left to update the left 400 pixels with the time and current <span class="caps">CPU </span>temp.</p>

<p><tt><br />
#!/usr/bin/perl<br />
my $font="Consolas-11";<br />
my $fg="#1F1F1F";<br />
my $bg="#CFCFD7";</p>

<p>while (1) {<br />
  open(KID_TO_WRITE, "&gt;/tmp/left") or die "couldn't open /tmp/left: $!";<br />
  my ($sec, $min, $hour) = localtime(time);<br />
  my $time = sprintf "%02d:%02d", $hour, $min;</p>

<p>  my @sensors = split "\n", `sensors`;<br />
  my ($systemp, $core0, $core1);<br />
  for (@sensors) {<br />
    /^Core 0/ &amp;&amp; do  { /(\d+\.\d+)/; $core0 = sprintf "%2.0f", $1; };<br />
    /^Core 1/ &amp;&amp; do  { /(\d+\.\d+)/; $core1 = sprintf "%2.0f", $1; };<br />
  }<br />
  print <span class="caps">KID</span>_TO_WRITE "$time ", (join "/", $core0, $core1), "\n";<br />
  sleep 15;<br />
  close <span class="caps">KID</span>_TO_WRITE;<br />
}<br />
</tt></p>

<p>I'm not using dual monitors at the moment. This setup would need some revision for that case; I'd probably want different dzen bars per screen (and I'd assign something to a switchscreen hook in ratpoison.) And the static width of the dzen bars wouldn't do the right thing with screen rotation, something I'll address at some point.</p>]]>
        
    </content>
</entry>

<entry>
    <title>What I tell you three times is true</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/05/what_i_tell_you_three_times_is.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3212" title="What I tell you three times is true" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3212</id>
    
    <published>2010-05-17T20:02:01Z</published>
    <updated>2010-05-17T20:34:07Z</updated>
    
    <summary>Two science fiction novels I love pay tribute to The Hunting of the Snark with turning points in which computers allow otherwise unauthorized behavior when the user tells it something three times. (I&apos;m not mentioning which novels, because it&apos;s a...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>Two science fiction novels I love pay tribute to <a href="http://www.literature.org/authors/carroll-lewis/the-hunting-of-the-snark/chapter-01.html">The Hunting of the Snark</a> with turning points in which computers allow otherwise unauthorized behavior when the user tells it something three times. (I'm not mentioning which novels, because it's a major spoiler for one of them.)</p>

<p>They have inspired this utterly brilliant idea:</p>

<p>Set up some pre- and post-processing of command lines in your shell so that it has a history of return codes as well as a history of the command lines themselves.</p>

<p>If a given command is identical to the two previous commands entered, and the two previous commands exited with identical non-zero return codes, automatically escalate privilege to root.</p>

<p>What could go wrong?</p>]]>
        
    </content>
</entry>

<entry>
    <title>Why I almost left Ubuntu</title>
    <link rel="alternate" type="text/html" href="http://www.zedlopez.com/strangeloopiness/2010/05/why_i_almost_left_ubuntu.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.mememachinego.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=2/entry_id=3210" title="Why I almost left Ubuntu" />
    <id>tag:www.zedlopez.com,2010:/strangeloopiness//2.3210</id>
    
    <published>2010-05-05T14:11:17Z</published>
    <updated>2010-05-05T18:52:17Z</updated>
    
    <summary>It&apos;s hard to believe, but I&apos;ve been using Ubuntu for about 6 years now. I&apos;d been using Gentoo beforehand; I&apos;ve come to like the Debian packaging system, repositories whose intra-operability had been extensively tested (at least after release...), but with...</summary>
    <author>
        <name>Zed</name>
        
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.zedlopez.com/strangeloopiness/">
        <![CDATA[<p>It's hard to believe, but I've been using Ubuntu for about 6 years now. I'd been using Gentoo beforehand; I've come to like the Debian packaging system, repositories whose intra-operability had been extensively tested (at least after release...), but with the regular release schedule putting a reasonable bound on getting recent versions of apps. And Pocahontas is happy with her Ubuntu (Gnome) desktop, and it's convenient to have all the machines in the house on the same <span class="caps">OS.</span></p>

<p>But I don't have any use for Gnome, or <span class="caps">KDE, </span>or desktop environments in general. I start with a command-line system, install X, build ratpoison from source (with a patch of my own), build rxvt-unicode from source (because even Lucid's package is one release behind, missing the crucial letterspace adjustment feature), build dzen2 from source (for xft support)... in short, I was acting more like an Arch Linux user. And I was often finding the Arch wiki and forums more helpful than Ubuntu's, given how often the latter's advice was desktop environment-centric. I figured why fight it? I'd give a distro more or less aimed at compulsive customizers a go.</p>

<p>So I did. I have a draft blog entry lying around talking about it, which was mostly positive. But I gave up due to a fatal flaw that I suspected (and am now confident) wasn't Arch's fault. <a href="https://bugzilla.redhat.com/show_bug.cgi?id=537708">This bug</a> in which mode_switch is intermittently locked may be common to all instances of Xorg's Xserver &gt;= 1.7. Harmless for the majority who've never Xmodmapped a mode_switch key into existence or mapped a keyboard layout that relied on it. But if you have, it makes your system unusable. At first I'd thought my keyboard was dirty and sticking, but it persisted with a new keyboard.</p>

<p>I wasn't willing to unlearn my custom keyboard layout, and didn't want to learn how to do it in <span class="caps">XKB </span>having found that a frustrating exercise when I'd looked into it before, so I thought I'd install the Ubuntu Lucid pre-release (I think it was the last Alpha.) My latest machine didn't have a CD drive, so I was installing with a <span class="caps">USB</span> CD drive. And after starting, the installer complained it couldn't find the CD drive, would I like to provide a driver on floppy? This was when I remembered I'd had the same problem with Karmic. So, like I did then, I started with Jaunty, planning to dist-upgrade for there. Which I did. But whether it was due to my manually configured <span class="caps">LVM</span>/crypto configuration or an Alpha bug, the two dist-upgrades left me with a system that froze on the Ubuntu boot screen.</p>

<p>Screw it, thought I, and I downloaded and burned a Debian Squeeze installer. There wasn't a heck of a lot of distance between Ubuntu and Debian the way I did it, anyway.</p>

<p>That was when I found out that whatever the problem was with the <span class="caps">USB</span> CD driver, it was something Ubuntu inherited from Debian.</p>

<p>Screw it, thought I, and ripped the one <span class="caps">SATA DVD </span>drive in the house out of its machine and installed it in mine (my current machine has a Zotac Ion mini-ITX motherboard with no <span class="caps">IDE </span>headers.) I started over with Lucid.</p>

<p>Shortly thereafter, I encountered the same X issue. So I had to break down and learn how to map my keyboard in <span class="caps">XKB.</span> If mode_switch and xmodmap are so marginal that a problem of those magnitude can stand, it's probably time to throw in the towel and get with the modern technique.</p>

<p>So after all of that, I'm back on Ubuntu, with no reason I couldn't switch back to Arch, except that all my tolerance for installing OSes has been used up for some months to come.</p>]]>
        
    </content>
</entry>

</feed> 


