<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>the ender.com blog</title>
        <link>http://www.ender.com/</link>
        <description>lamp, ajax, linux, iphone, and other fun things</description>
        <language>en</language>
        <copyright>Copyright 2008</copyright>
        <lastBuildDate>Mon, 14 Jul 2008 23:18:24 -0600</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Slacker</title>
            <description><![CDATA[<p>I'm aware I haven't posted much. That said, I'm hoping to have an app I've been working on for the GAE (Google App Engine) done shortly, and will post some impressions about the GAE, and Python. (Wait, do I need a new category?) </p>

<p>After that, now that Apple has opened the developer floodgates, it's time to put in some time with my Cocoa for MacOSX book, iphone dev docs, etc, and do some iphone work. I enjoy my own iphone way too much to not develop something for it. Yay open platform! I did a small app for PalmOS ages ago, never even distributed it, but just had to to do it because I loved my palm and there was a decent gcc-based toolchain.</p>

<p>I am planning to upgrade to 3g, despite battery concerns. If necessary, I will disable the 3g except when I expect to be using lots of data. I never had an issue with call quality, and don't talk enough (<100m a month on average) to care. Maybe I can figure out a way to make that hotkeyed in some way. (I'd like to have a handful of settings toggles available when you double-click home when locked, like the ipod controls)</p>

<p>I grabbed a <a href='http://svenontech.com/reviews/?p=74'>mybat external battery</a> for the iphone. We'll see how that works, but tucked in my laptop bag, hopefully that will be serviceable in the clutch when battery is low and a recharge opportunity is not coming.</p>]]></description>
            <link>http://www.ender.com/2008/07/slacker.html</link>
            <guid>http://www.ender.com/2008/07/slacker.html</guid>
            
            
            <pubDate>Mon, 14 Jul 2008 23:18:24 -0600</pubDate>
        </item>
        
        <item>
            <title>Xen and the Art of Virtualization</title>
            <description><![CDATA[<p>I have historically had several servers at <a href='http://www.layeredtech.com'>Layered Tech</a>. They recently raised their prices, and the prices for several friends who have hosted servers there. The majority of our use is low volume, experimental sorts of things, and so we decided to go in together on a larger box that we could virtualize.</p>

<p>Enter <a href='http://www.voxel.net'>Voxel</a>, who offer a $199/mo dedicated server that includes:</p>

<ul>
<li>4 GB RAM</li>
<li>Quad XEON 2Ghz</li>
<li>320GB SATA disk (which are growing more standard among these providers, but a lot of options are still IDE</li>
<li><b>SSH-accessible serial console access included</b></li>
</ul>

<p>That last one is a serious nod to their foresight and a judo chop to other providers. Layered Tech overs a KVM solution as a $30 or $35/day rental. Voxel automatically includes it.</p>

<p>Anyhow, with this beefy box, we set about setting up Xen. Voxel's support was admirable when my initial xen install broke the serial console access. It turned out my /etc/grub.conf needed a change:</p>

<blockquote class='code'>
title CentOS (2.6.18-53.1.21.el5xen)
        root (hd0,0)
        kernel /xen.gz-2.6.18-53.1.21.el5 <b>com1=9600,8n1</b>
        module /vmlinuz-2.6.18-53.1.21.el5xen ro root=LABEL=/ console=tty0 console=ttyS0,9600 panic=100
        module /initrd-2.6.18-53.1.21.el5xen.img
</blockquote>

<p>(Change in bold)</p>

<p>Without the com1= line, it defaulted to 38400.</p>

<p>Anyhow, with that done, I got to work actually setting up Xen virtual server instances. The host box (aka the Dom0) is CentOS, and so the "easy" install should be another instance of virtualized CentOS, although any variant should be usable. I tried to use virt-install, but it failed miserably.</p>

<p>First, I had issues with networking. Even when I resolved those, halfway through anaconda installing packages, the system crashed.</p>

<p>Ultimately, I settled on doing it manually using this guide to <a href='http://wiki.centos.org/HowTos/Xen/InstallingCentOSDomU'>installing CentOS DomUs on a CentOS Dom0</a>.</p>

<p>Caveats for me included the fact that my bridge was <b>virbr0</b> instead of <b>xenbr0</b>. I <b>have</b> a <b>xenbr0</b>, it just wasn't the correct bridge for RFC1918 going out...</p>

<p>Anyhow, aside from the networking problems, that went fairly smoothly. (Although the top of the guide has you selecting from i386 or x86_64, and the kickstart config just says i386, so I had to restart to correct that, since I was doing the x86_64 install.</p>

<p>Still on the agenda: getting a real IP address. Voxel offered a reasonable extra 8 IPs for $4/mo, and we'd like to ensure each VPS has its own IP address, not 192.168 addresses that translate.</p>

<p>Still, this has been a pretty fun thing so far. I've heard that Xen is what Amazon is using to provide AWS, and I've been learning a lot of new linux tools (like brctl; I'd never had a reason to do linux bridging prior to now, even though I've done it plenty with networking devices).</p>]]></description>
            <link>http://www.ender.com/2008/06/xen-and-the-art-of-virtualizat.html</link>
            <guid>http://www.ender.com/2008/06/xen-and-the-art-of-virtualizat.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">LAMP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
            <pubDate>Thu, 19 Jun 2008 19:10:44 -0600</pubDate>
        </item>
        
        <item>
            <title>jQuery 1.2.6</title>
            <description><![CDATA[<p>A couple weeks ago, the jQuery team released jquery 1.2.6.</p>

<p><a href='http://jquery.com'>jQuery</a> is <s>the write-once, run-anywhere</s> a new type of javascript library.</p>

<p>It's incredibly full of win. Favorite things in 1.2.6:</p>

<ul>
<li><b>Still small</b> (minified+gzipped, 15k)</li>
<li><b>Dimensions plugin</b> - I can see why. Dimensions was a godsend, providing totally important calls like $.position() and $.innerHeight() and whatnot. Indispensible.</li>
<li><b>makeArray</b> - <i>jQuery's internal .makeArray() method now converts any array-like object into a new array. Additionally it wraps all other objects as an array and returns the resulting set.</i>  This one is so wild, it will require further digestion, but there are plenty of possibilities</li>
</ul>

<p>I'm working on a brief introductions to jQuery I will post to go over a bunch of basic techniques; things that go a tiny bit beyond the jquery.com documentation usage.</p>]]></description>
            <link>http://www.ender.com/2008/06/jquery-126.html</link>
            <guid>http://www.ender.com/2008/06/jquery-126.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">AJAX</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Javascript</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">jQuery</category>
            
            
            <pubDate>Tue, 10 Jun 2008 00:17:54 -0600</pubDate>
        </item>
        
        <item>
            <title>jquery, the jquery form plugin, and detecting an ajax submit</title>
            <description><![CDATA[<p>When you send a request via $.ajax, $.get, or $.post in jquery, you can test for the HTTP_X_REQUESTED_WITH header, looking for a value of 'XMLHttpRequest', a la:</p>

<blockquote class='code'>
function isajax() {
  return ((!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) && 
    $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
}

</blockquote>

<p>But what happens when you're using the <a href='http://www.malsup.com/jquery/form/'>jQuery Form plugin</a>? Normally, things work fine. Below the cut for a serious caveat!</p>]]></description>
            <link>http://www.ender.com/2008/04/jquery-the-jquery-form-plugin.html</link>
            <guid>http://www.ender.com/2008/04/jquery-the-jquery-form-plugin.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">AJAX</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Javascript</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">LAMP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">jQuery</category>
            
            
            <pubDate>Tue, 08 Apr 2008 21:44:46 -0600</pubDate>
        </item>
        
        <item>
            <title>Event bubbling in Javascript</title>
            <description><![CDATA[<p>Today I had the opportunity to play with event bubbling and applying generic event handlers. Quick overview on handling them (with jquery!) and which events cannot be cancelled.</p>]]></description>
            <link>http://www.ender.com/2008/04/event-bubbling-in-javascript.html</link>
            <guid>http://www.ender.com/2008/04/event-bubbling-in-javascript.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">AJAX</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Javascript</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">LAMP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web 2.0</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">jQuery</category>
            
            
            <pubDate>Thu, 03 Apr 2008 20:55:54 -0600</pubDate>
        </item>
        
        <item>
            <title>Put this in your toolbox</title>
            <description><![CDATA[<p>I'm going to admit to not having used this yet. But having used a lot other solutions (most recently pear Safe_HTML with additional pre/post-processing), this is a breath of fresh air: <a href="http://htmlpurifier.org/">HTML Purifier</a></p>]]></description>
            <link>http://www.ender.com/2008/03/put-this-in-your-toolbox.html</link>
            <guid>http://www.ender.com/2008/03/put-this-in-your-toolbox.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">LAMP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
            
            
            <pubDate>Thu, 20 Mar 2008 11:11:14 -0600</pubDate>
        </item>
        
        <item>
            <title>Hello again, Hello World</title>
            <description><![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="hw.jpg" src="http://www.ender.com/photos/hw.jpg" width="644" height="776" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></span></p>

<p>Any programmer has done this one a thousand times. But this one is more fun than I remember this being before.</p>]]></description>
            <link>http://www.ender.com/2008/03/hello-again-hello-world.html</link>
            <guid>http://www.ender.com/2008/03/hello-again-hello-world.html</guid>
            
            
            <pubDate>Mon, 10 Mar 2008 22:05:42 -0600</pubDate>
        </item>
        
        <item>
            <title>MT 4.1</title>
            <description><![CDATA[<p>So, I've upgraded to Moveable Type 4.1, and I'm forcing commenters to use on the of the web login services (typekey, oid, etc). If that doesn't cut down on the spammers, then it's time to drop the hammer and put in an anti-spam plugin. But at least now that I am upgraded, getting such a plugin will be easier.</p>]]></description>
            <link>http://www.ender.com/2008/03/mt-41.html</link>
            <guid>http://www.ender.com/2008/03/mt-41.html</guid>
            
            
            <pubDate>Sat, 08 Mar 2008 21:50:23 -0600</pubDate>
        </item>
        
        <item>
            <title>MySQL Update Evaluation Gotcha</title>
            <description><![CDATA[<p>If you use MySQL, note this:</p>

<div style='background-color: #202020'><blockquote><pre>

<p>mysql> create database test;<br />
Query OK, 1 row affected (0.01 sec)</p>

<p>mysql> use test;<br />
Database changed<br />
mysql> create table foo (<br />
    -> x int,<br />
    -> y int<br />
    -> );<br />
Query OK, 0 rows affected (0.00 sec)</p>

<p>mysql> insert into foo values (1, 2);<br />
Query OK, 1 row affected (0.00 sec)</p>

<p>mysql> select * from foo;<br />
+------+------+<br />
| x    | y    |<br />
+------+------+<br />
|    1 |    2 |<br />
+------+------+<br />
1 row in set (0.00 sec)</p>

<p>mysql> update foo set x=5,y=10,x=x+y;<br />
Query OK, 1 row affected (0.00 sec)<br />
Rows matched: 1  Changed: 1  <b>Warnings: 0</b></p>

<p>mysql> select * from foo;<br />
+------+------+<br />
| x    | y    |<br />
+------+------+<br />
|   15 |   10 |<br />
+------+------+<br />
1 row in set (0.00 sec)</p>

<p>mysql><br />
</pre></blockquote></div></p>

<p>I bolded the part that bothers me. No warnings. Double-updating the same value in the same row in the same statement throws no warnings (never mind errors!).  I haven't checked the ANSI standard to see if this is mentioned, but it sure is worth noting.</p>]]></description>
            <link>http://www.ender.com/2007/08/mysql-update-evaluation-gotcha.html</link>
            <guid>http://www.ender.com/2007/08/mysql-update-evaluation-gotcha.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">LAMP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">MySQL</category>
            
            
            <pubDate>Mon, 13 Aug 2007 18:45:21 -0600</pubDate>
        </item>
        
        <item>
            <title>using procmail and MIME::Parser to extract iphone photo attachments</title>
            <description><![CDATA[<p>I have an iPhone. I'm finding myself very prone to snapping photos now, whereas before I was completely unlikely to tote a camera. I also discovered that Movable Type works just fine on the iPhone, I even posted an entry on my <a href='http://matt.mattwallace.net'>personal blog</a> from it while we were at the ice cream place.</p>

<p>But you know what? I want to put up a photo I just blogged. But transferring a photo via anything but email is a pain. Enter perl. I whipped up a perl script to receive iphone photo email, piped via procmail, and save the photo attachment to a path, then email back the phone address with the filename it used. Just make sure you set the path in the script to somewhere down from your DocumentRoot, and then you can immediately reference the photo with an img tag.</p>

<p>Now I can photoblog directly from the phone, which is pretty fun.</p>

<p>Requires<br />
sendmail (for the outbound msg, but I bet you could adapt any other mail program)<br />
perl<br />
MIME::Parser<br />
procmail</p>

<p>Here's the relevent part of my procmail entry (note that photoblog is an alias that goes to my user account via /etc/aliases):</p>

<div style='background-color: #202020'>
<blockquote><pre>
:0H
* ^TO.*photoblog@ender.com
|/home/matt/iphotoparse.pl
</pre></blockquote>
</div>

<p>And the code, which you can get here: <a href='http://www.ender.com/~matt/iphotoparse.pl.txt'>iphotoparse.pl</a></p>

<p>Happy photoblogging from the phone.<br />
</p>]]></description>
            <link>http://www.ender.com/2007/08/using-procmail-and-mimeparser.html</link>
            <guid>http://www.ender.com/2007/08/using-procmail-and-mimeparser.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Cool</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web 2.0</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone</category>
            
            
            <pubDate>Sat, 11 Aug 2007 18:48:00 -0600</pubDate>
        </item>
        
        <item>
            <title>iPhone, glorious iPhone</title>
            <description><![CDATA[<p>i has a iphone?</p>

<p>It's true. I'm one of the converted. (Fallen?)</p>

<p>I definitely like it so far, although I was unimpressed with battery the first day. It really should be engineered to survive one day of hard use. I was charging it until late last night. I watched youtube from it in bed for about 30 minutes, had a total of 14 hrs of standby, and then about 6 or so hours of use (mostly as an ipod, small bit of phone). It died while I was talking to my wife en route home.</p>

<p>Rumor has it that bluetooth, and the "prompt" wlan networks features both suck up a lot of bandwidth, so I may try to keep those off when possible. (I'm going to turn bluetooth off while driving, damnit, but I don't really need it otherwise).</p>]]></description>
            <link>http://www.ender.com/2007/08/iphone-glorious-iphone.html</link>
            <guid>http://www.ender.com/2007/08/iphone-glorious-iphone.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone</category>
            
            
            <pubDate>Sat, 04 Aug 2007 00:53:40 -0600</pubDate>
        </item>
        
        <item>
            <title>dojo.lang.hitch</title>
            <description><![CDATA[<p>A few weeks ago, I was wrestling with one of those things that I used to consider a major pain with javascript: meshing objects and event handling.</p>

<p>Let's say you have some code. Sloppy, but demonstrative:</p>

<blockquote><font face='courier'>

<p>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;script lanugage='Javascript' src='dojo/dojo.js'&gt;&lt;/script&gt;<br />
&lt;script&gt;<br />
dojo.require("dojo.lang.*");<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;div id='output' name='output'&gt;&lt;/div&gt;<br />
&lt;script language='Javascript'&gt;<br />
function foo() {<br />
  var x;<br />
  var y;<br />
  this.go = function() {document.getElementById('output').innerHTML += 'this.x is ' + this.x + '&lt;br /&gt;';}<br />
}<br />
var fooz = new foo;<br />
fooz.x = 5;<br />
document.getElementById('output').innerHTML += 'fooz.x is ' + fooz.x + '&lt;br /&gt;';<br />
<b>setTimeout(fooz.go, 300);</b><br />
&lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</font></blockquote></p>

<p>What happens when you run it?</p>

<blockquote>
fooz.x is 5
this.x is undefined
</blockquote>

<p>Javascript objects do not stay instantiated when passed into setTimeout. setTimeout() is unavoidable, but I often find that when implementing behaviors which need objects, you're forced into one of two nasty choices:</p>

<ul><li>Give everything an id, and pass that id into setTimeout in order to maintain some sort of scope</li>
<li>Watch everything lose context when passing through setTimeout</li>
</ul>

<p>Not pretty choices.</p>

<p>But dojo.hang.hitch() solves that problem, gloriously. dojo.lang.hitch lets you attach a function to run IN THE SCOPE of an object.</p>

<p>Let's change the code above:</p>

<blockquote><font face='courier'>

<p>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;script lanugage='Javascript' src='dojo/dojo.js'&gt;&lt;/script&gt;<br />
&lt;script&gt;<br />
dojo.require("dojo.lang.*");<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;div id='output' name='output'&gt;&lt;/div&gt;<br />
&lt;script language='Javascript'&gt;<br />
function foo() {<br />
  var x;<br />
  var y;<br />
  this.go = function() {document.getElementById('output').innerHTML += 'this.x is ' + this.x + '&lt;br /&gt;';}<br />
}<br />
var fooz = new foo;<br />
fooz.x = 5;<br />
document.getElementById('output').innerHTML += 'fooz.x is ' + fooz.x + '&lt;br /&gt;';<br />
<b>setTimeout(dojo.lang.hitch(fooz, fooz.go), 300);</b><br />
&lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</font><br />
</blockquote></p>

<p>Output now:</p>

<p>fooz.x is 5<br />
this.x is 5</p>

<p>Beautiful.</p>

<p>What's great is that this lets you run events on things without IDs. I dynamically instantiate a lot of elements in the DOM with document.createElement, and there's often no NEED to assign an id except for issues like this; handling events. Now, with DOJO's hitching, you can deal with your objects while preserving context through setTimeout calls.</p>

<p>Dojo is filled with gems.</p>

<p>Check out the <a href='http://dojotoolkit.org/'>Dojo Homepage</a> and this little <a href='http://developer.iamalpha.com/dojo-intro'>into to dojo</a> isn't bad either.</p>]]></description>
            <link>http://www.ender.com/2007/08/dojolanghitch.html</link>
            <guid>http://www.ender.com/2007/08/dojolanghitch.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">AJAX</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Javascript</category>
            
            
            <pubDate>Sat, 04 Aug 2007 00:05:58 -0600</pubDate>
        </item>
        
        <item>
            <title>Time for some tech and blogging</title>
            <description><![CDATA[<p>It's time to get some blogging going on. Yes, it's been a while. Up on the list of tech projects that need some lovin:</p>

<p>(1) Automated invoicing for monthly payees<br />
(2) UPS automatic price acquisition through their api</p>

<p>Longer term I'm tempted to fiddle with some sort of turbo scaffolding system. I've played a few, like cakephp, but was left wanting. I also want to dig into dojo a bit more, and possibly see what 0.9 has been adding; I like 0.4, but some things I've seen (e.g., drag n drop) are lacking (like with dnd, it uses a nasty black bar for the drop targeting rather than dynamic element repositioning).</p>]]></description>
            <link>http://www.ender.com/2007/07/time-for-some-tech-and-bloggin.html</link>
            <guid>http://www.ender.com/2007/07/time-for-some-tech-and-bloggin.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Notes</category>
            
            
            <pubDate>Fri, 06 Jul 2007 01:38:53 -0600</pubDate>
        </item>
        
        <item>
            <title>You have been pwned by a grue</title>
            <description><![CDATA[<p><b>Welcome to Text-Only Counterstrike</b></p>

<p>You are in a dark, outdoor map.<br />
<b>&gt;</b> GO NORTH<br />
<a href='http://xkcd.com/c91.html'>You have been pwned by a grue.</a></p>]]></description>
            <link>http://www.ender.com/2006/09/you-have-been-pwned-by-a-grue.html</link>
            <guid>http://www.ender.com/2006/09/you-have-been-pwned-by-a-grue.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Cool</category>
            
            
            <pubDate>Mon, 04 Sep 2006 02:56:13 -0600</pubDate>
        </item>
        
        <item>
            <title>Gotta love &apos;em</title>
            <description><![CDATA[<p>Cool nerds.</p>

<p><b>Jeff Bezos</b></p>

<p>Such an alpha nerd. He's rumored to be a crazed idea guy who can brainstorm up innovation the way most people decide what to have for lunch. The Taco Bell commercials, the bizarre business branches of Amazon, they all just add to the mystique. I just wish he'd fight harder for patent reform.</p>

<p><b>Mark Cuban</b></p>

<p>You just have to love <a href='http://www.blogmaverick.com'>Mark Cuban</a>. Fired for closing a sale, relentless entrepreneuer, funds the EFF, looking for disruptive tech all the time... he's awesome. And his irreverent personality is the clincher. More fines than anyone in NBA history? Check. Anything he can't do? I'll leave that box blank.</p>

<p><b>Richard Branson</b></p>

<p>You just gotta love it. Self made mania, with little tentacles in so many diverse industries, you have to wonder if his prowess just comes from a deal with the devil. Music, transportation, cell phones, health clubs... this guy is awesome.</p>

<p><b>Janus Friis, Niklas Zennstrom</b></p>

<p>First, you make Kazaa. Then, because you can't buy the particular small country you wanted, you make Skype. After pocketing 2.4B from that, you're still thinking: what next? So you start making a P2P TV app. THYS? Bad. Ass. They're like a more commercialized version of Justin Frankel, on crack.</p>]]></description>
            <link>http://www.ender.com/2006/08/gotta-love-em.html</link>
            <guid>http://www.ender.com/2006/08/gotta-love-em.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Cool</category>
            
            
            <pubDate>Wed, 30 Aug 2006 01:54:05 -0600</pubDate>
        </item>
        
    </channel>
</rss>
