<?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>Thu, 20 Mar 2008 11:11:14 -0600</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/?v=4.1</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

      
      <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>LAMP</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>
         <category></category>
         <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>
         <category></category>
         <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>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></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>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>AJAX</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>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>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>Cool</category>
         <pubDate>Wed, 30 Aug 2006 01:54:05 -0600</pubDate>
      </item>
      
      <item>
         <title>Learning PHP?</title>
         <description><![CDATA[<p>I currently write php code for a living. I'm the author of an e-commerce package... it's second gen, and it's good, but I'm about to begin work on the third gen. Something marvelous. Something I want to be so good that it owns the market. I'm not sure if I want it to be OSS or not, or maybe mixed somehow, but I want it to rock. I'm thinking I'd like to release it OSS but with some paid-for plugins. My 2nd gen code was OSS for a while, before I realized I didn't have time to keep up with the "free support" that was wanted and I wasn't real proud of the issue the code had. I sort of revamped it and have been toying with commercial release, but I really want to do it over again. Yes, this will be my 3rd from-scratch e-commerce store implementation, but my skills have grown by leaps and bounds and I think I can produce something truly remarkable now. I have the experience both as a coder and with people USING the software. Anyhow, my 2nd gen stuff netted me some consulting work which has kept me busy as I advanced my 2nd gen code.</p>

<p>So I'm often asked by people who know what I do: how do I learn? If you have technical experience, particularly some sort of formal software engineering/CS training, then you should head straight for this book: <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&amp;tag=lastblogstand-20&amp;camp=1789&amp;creative=9325&amp;path=http://www.amazon.com/gp/product/0672325616?v=glance%26n=283155%26n=507846%26s=books%26v=glance">Advanced PHP Programming</a><img src="http://www.assoc-amazon.com/e/ir?t=lastblogstand-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> by George Schlossnagle. It's a fantastic book, but you need some chops before you can absorb it all. Since my own background with "real" code is straight C, not OO languages, it's new exposure for me. I've toyed with Java a smidge, but never written anything of import. But this book is fantastic. It's not for learning basics or syntax, but for someone with programming experience, it is truly a pithy PHP Bible of sorts, and I highly recommend it if you want to write professional PHP code. Schlossnagle is impressive in that he eschews evangelizing any particular philosophy. He covers OO techniques, but admits that they simply add excessive complexity in many cases, for example; many PHP evangelists seem to think that nothing should be implemented in a non-OO fashion.</p>

<p>In any event, the book is excellent.</p>]]></description>
         <link>http://www.ender.com/2005/11/learning_php.html</link>
         <guid>http://www.ender.com/2005/11/learning_php.html</guid>
         <category>PHP</category>
         <pubDate>Mon, 21 Nov 2005 19:17:09 -0600</pubDate>
      </item>
      
      <item>
         <title>A book you should read</title>
         <description><![CDATA[<p>Scott Adams has a very interesting book out. This isn't exactly breaking news, but I've discovered it, and since there's an ebook version, there's no reason to not check it out. Try:<br />
<br /><br /><br />
<a href='http://www.andrewsmcmeel.com/godsdebris/'>God's Debris</a>, or, if you're not into e-books, just buy it:<br />
<br /><br /><br />
<iframe src="http://rcm.amazon.com/e/cm?t=lastblogstand-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=as1&amp;amp;asins=0740747878&amp;amp;=1&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;lc1=0000ff&amp;amp;bc1=000000&amp;amp;bg1=ffffff&amp;amp;f=ifr" style="120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe><br />
<br /><br /><br />
And if you like it, you can also pick up it's fictional sequel:<br />
<br /><br /><br />
<iframe src="http://rcm.amazon.com/e/cm?t=lastblogstand-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=as1&amp;amp;asins=0740747886&amp;amp;=1&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;lc1=0000ff&amp;amp;bc1=000000&amp;amp;bg1=ffffff&amp;amp;f=ifr" style="120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>]]></description>
         <link>http://www.ender.com/2005/11/a_book_you_should_read.html</link>
         <guid>http://www.ender.com/2005/11/a_book_you_should_read.html</guid>
         <category></category>
         <pubDate>Sat, 19 Nov 2005 10:57:08 -0600</pubDate>
      </item>
      
      <item>
         <title>Installing your own CA authority to force client authentication</title>
         <description>I wrestled a while today with client authentication with CA Certs. Setting up a CA and signing certs with a CA is a little trickier than doing cert self-signing. Here&apos;s some details.</description>
         <link>http://www.ender.com/2005/11/installing_your_own_ca_authori.html</link>
         <guid>http://www.ender.com/2005/11/installing_your_own_ca_authori.html</guid>
         <category>LAMP</category>
         <pubDate>Fri, 18 Nov 2005 17:20:00 -0600</pubDate>
      </item>
      
      <item>
         <title>A PHP bug... and a conversion</title>
         <description><![CDATA[<p>I've been trying out different pieces of blogging software. I think I'm going to stick with MT. So this post is sort of... irrelevant to that. Although it's still a bug with trans-sids in PHP. Still, for posterity, I'm moving this and other blog entries from the old block in.</p>]]></description>
         <link>http://www.ender.com/2005/11/a_php_bug_and_a_conversion.html</link>
         <guid>http://www.ender.com/2005/11/a_php_bug_and_a_conversion.html</guid>
         <category>PHP</category>
         <pubDate>Fri, 18 Nov 2005 01:00:00 -0600</pubDate>
      </item>
      
   </channel>
</rss>
