<?xml version="1.0" encoding="UTF-8"?>

<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Sean Gleeson</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/" />
    <link rel="self" type="application/atom+xml" href="http://www.seangleeson.com/atom.xml" />
    <id>tag:www.seangleeson.com,2010-02-15://4</id>
    <updated>2010-03-07T15:53:38Z</updated>
    <subtitle>Sean Gleeson is an artist, developer, writer, teacher, statesman, and family man in Oklahoma City, Oklahoma.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 5.01</generator>

<entry>
    <title>And now, my blog posts to Twitter</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/03/and-now-my-blog-posts-to-twitter.html" />
    <id>tag:www.seangleeson.com,2010://4.192</id>

    <published>2010-03-07T15:36:20Z</published>
    <updated>2010-03-07T15:53:38Z</updated>

    <summary>I have been very busy, what with my professorial duties, and making the Pet Labour Troll, and building my new house. But today I can at least spend a little time trying to finish coding this blog. To which end,...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="socialnetworks" label="social networks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="twitter" label="Twitter" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>I have been very busy, what with my professorial duties, and making the <a href="http://www.seangleeson.com/2010/02/anna-raccoons-pet-labour-troll-unleashed.html">Pet Labour Troll</a>, and building my new house. But today I can at least spend a little time trying to finish coding this blog. To which end, I have just added some scripting that posts every new entry to <a href="http://twitter.com/seanwgleeson">my Twitter feed</a>. If it works (and it ought to work), there will be a brand new status update as soon as I submit this entry, that says, <strong>&#8220;blogged on seangleeson.com: &#8216;And now, my blog posts to Twitter&#8217;&#8221;</strong> (because that is the title of this entry) along with a shortened URL.</p>

<p>Of course, there are myriad services and plugins already extant that do pretty much exactly the same thing. But just as with <a href="http://www.seangleeson.com/2010/02/writing-a-facebook-app.html">my Facebook app</a>, the hangup there is the &#8220;pretty much&#8221; part. None of them does <em>exactly</em> what I wanted, with the wording I wanted, or my desired algorithm for shortening the text if it exceeds 140 characters. This one is just what I wanted. (Phoebe too, I think.) And using my own script means I can use <a href="http://www.seangleeson.com/2010/02/our-own-url-shortener.html">my own URL shortener</a> as well.</p>

<p>So now, all y&#8217;all who follow my Twitter feed (I believe there were five of you, last I checked) never need to miss a blog post!</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Anna Raccoon&apos;s Pet Labour Troll unleashed</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/anna-raccoons-pet-labour-troll-unleashed.html" />
    <id>tag:www.seangleeson.com,2010://4.187</id>

    <published>2010-02-28T13:22:56Z</published>
    <updated>2010-02-28T14:01:17Z</updated>

    <summary> As I mentioned, an English political blogger, one Anna Raccoon, had commissioned me to make a shiny new British version of my rusty old Autorantic Virtual Moonbat (AVM). The new robot is now built, and I am heartily sorry...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="games" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="facebook" label="Facebook" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="flash" label="Flash" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="games" label="games" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="politics" label="politics" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="twitter" label="Twitter" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<iframe src="http://www.labourtroll.com/c.html?w=440" width="440" height="257" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>As I <a href="http://www.seangleeson.com/2010/02/shipping-the-autorantic-virtual-moonbat-to-britain.html">mentioned</a>, an English political blogger, one <a href="http://www.annaraccoon.com/politics/feeding-your-pet-labour-troll/">Anna Raccoon</a>, had commissioned me to make a shiny new British version of my rusty old Autorantic Virtual Moonbat (AVM). The new robot is now built, and I am heartily sorry to introduce you to the <strong>Pet Labour Troll</strong> (PLT).</p>

<div style="float: left; width: 165px;"><iframe src="http://www.labourtroll.com/s.html" width="150" height="240" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></div>

<p>Just as with the AVM, the PLT comes in both a chat module, which lets you talk to the robot, and a smaller sidebar module, which does not.</p>

<p>And just as with the prior incarnation, the PLT lets anyone put either module on any website with just a line of code.</p>

<p>But the Pet Labour Troll also incorporates many improvements over the old AVM, using technology which was not available back in 2004. The PLT is coded in ActionScript 3 and PHP 5, making it twice as fast. And it has three things the AVM never had: its own domain, its own Facebook page, and its own Twitter feed.</p>

<p>The domain, <a href="http://www.labourtroll.com/">labourtroll.com</a>, has all the instructions for embedding the robot on your own website.</p>

<p>The <a href="http://www.facebook.com/pages/Anna-Raccoons-Pet-Labour-Troll/378118609744">Facebook page</a> posts rants from the troll at random intervals, and the troll will reply to any posts written on its &#8220;wall.&#8221; After its first day of operation, the page has garnered 29 fans on Facebook. I expect this number to go higher.</p>

<p>And the Twitter page, at <a href="http://twitter.com/labourtroll">twitter.com/labourtroll</a>, has its own feed of random ranting as well.</p>

<p>I&#8217;m sure you will join me in extending our British cousins our sincere sympathy, as they come to know the horror that is the Pet Labour Troll.</p>

<div style="clear: both;"></div>
]]>
        

    </content>
</entry>

<entry>
    <title>Shipping the Autorantic Virtual Moonbat to Britain</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/shipping-the-autorantic-virtual-moonbat-to-britain.html" />
    <id>tag:www.seangleeson.com,2010://4.183</id>

    <published>2010-02-21T21:32:29Z</published>
    <updated>2010-02-21T21:57:37Z</updated>

    <summary> Way back in 2004, I invented a humorous Flash application named the Autorantic Virtual Moonbat. It was a chatty hate-filled robot who generated random nonsensical leftist rants, such as &#8220;Chimpy McBushitler STOLE the ELECTION by outsourcing transgendered polar bears!!!&#8221;...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="programming" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="politics" label="politics" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p><img alt="Shipping the Autorantic Virtual Moonbat to Britain" title="Shipping the Autorantic Virtual Moonbat to Britain" width="450" height="375" border="0" src="http://i.gleeson.us/sg/2010/avm_shipping_crate.jpg" /></p>

<p>Way back in 2004, I invented a humorous Flash application named the <a href="http://sean.gleeson.us/2004/11/27/new_mini_moonbat_fits_in_your_sidebar">Autorantic Virtual Moonbat</a>. It was a chatty hate-filled robot who generated random nonsensical leftist rants, such as <em>&#8220;Chimpy McBushitler STOLE the ELECTION by outsourcing transgendered polar bears!!!&#8221;</em> Perhaps you saw it. It wasn&#8217;t just on my blog, it was on hundreds of others as well, because I let anyone who wanted it embed it. It was very clever and funny, because it aped the style of excitable liberal writers so well.</p>

<p>And then, well, time passed. It still works, but I stopped updating its knowledgebase years ago. The poor dumb thing still thinks George Bush is running the world, and that global warming is a credible theory. Well, okay, so do other liberals, but my larger point is, I was pretty much done with it. And yet I still believe it can have a successful career in politics. That&#8217;s why I&#8217;m sending it to the United Kingdom.</p>

<p>An English political blogger contacted me, asking if the AVM could be reprogrammed as a crazy British leftist, rather than the American sort, in time for the upcoming <a href="http://en.wikipedia.org/wiki/United_Kingdom_general_election,_2010">U.K. general election</a> in 2010. I answered in the affirmative, and so soon the device will have a new home &#8212; and a new name! &#8212; and a whole new list of enemies to hate. I will certainly keep you abreast of details as they are made final.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>The limitations of our private URL shortener</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/the-limitations-of-our-private-url-shortener.html" />
    <id>tag:www.seangleeson.com,2010://4.178</id>

    <published>2010-02-16T23:34:05Z</published>
    <updated>2010-02-17T00:47:28Z</updated>

    <summary>Yesterday, I wrote about our new private URL shortener at u.gleeson.us. In the subsequent comments to that post, I explained more about how it works. But there are fascinating theoretical implications revolving around the whole topic. For instance, just how...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="programming" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="math" label="math" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>Yesterday, I <a href="http://www.seangleeson.com/2010/02/our-own-url-shortener.html">wrote about</a> our new private URL shortener at <strong>u.gleeson.us</strong>. In the subsequent comments to that post, I explained more about how it works. But there are fascinating theoretical implications revolving around the whole topic. For instance, just how many URLs can this application hold before it runs out of room?</p>

<p>Before answering such a question, one must first define precisely what &#8220;running out of room&#8221; might mean, but as you&#8217;ll see, by any definition, the number of URLs we can shorten is&#8230; rather a lot.</p>
]]>
        <![CDATA[<p>Here are the facts. The URLs are all stored in a MySQL database table with two fields: &#8216;id&#8217; and &#8216;url&#8217;. The &#8216;url&#8217; field holds the text of the URL and the &#8216;id&#8217; field is a unique integer to identify each one. The &#8220;shortened&#8221; URLs are really just references to those ID numbers. They all take the form of</p>

<p>http://u.gleeson.us/[#]</p>

<p>where <code>[#]</code> stands for the ID number. But the shortened URLs aren&#8217;t decimal numbers. They are written in a custom base-52 numbering system, so each place can have 52 distinct values. Here are the 52 characters this system uses (in order, from 0 to 51):</p>

<pre><code>23456789-bcdfghjklmnpqrstv
wxyz_BCDFGHJKLMNPQRSTVWXYZ
</code></pre>

<p>So, in this system, the character &#8216;2&#8217; is really 0, the &#8216;Z&#8217; is 51, and all the others are the values between: the &#8216;k&#8217; is 16, the &#8216;G&#8217; is 35, and so forth. So the shortened URL</p>

<pre><code>http://u.gleeson.us/G
</code></pre>

<p>would really be a reference to the URL with ID number 35 in our database. (We don&#8217;t have that many yet, so don&#8217;t try it.) We could theoretically encode 52 URLs without even needing a second digit, but in practice, it&#8217;s really only 51, because the ID numbers in the database start at 1, not 0.</p>

<p>Of course, there&#8217;s no reason to limit ourselves to just one digit, but there must be <em>some</em> number of digits that we don&#8217;t want to exceed, and that number will be the key to answering the question of how many URLs we can hold before we&#8217;re full. The formula is</p>

<pre><code>Q = 52 ^ D - 1
</code></pre>

<p>or, the maximum quantity <code>Q</code> equals 52 raised to the power of the number of digits <code>D</code>, minus one. As we&#8217;ve seen, when <code>D</code> = 1, <code>Q</code> = 51. But <code>Q</code> grows exponentially as you add digits.</p>

<pre><code>2 digits =&gt; 2,703 URLs
3 digits =&gt; 140,607 URLs
4 digits =&gt; 7,311,615 URLs
</code></pre>

<p>So we already exceeded (by far) the number of URLs that Phoebe and I could ever possibly need to shorten, and the system is nowhere near full. There&#8217;s no theoretical or practical reason to stop at four digits. The lowest &#8220;limit&#8221; I can rationalize is 5 digits, because that would make a URL of 25 characters (the first 20 characters are used for the &#8220;<code>http://u.gleeson.us/</code>&#8221; part), and 25 seems like a pretty good cutoff point. (For instance, Twitter automatically truncates URLs longer than 25 characters.)</p>

<p>So, this will be my answer to the question, how many URLs can u.gleeson.us hold before it runs out of room? It&#8217;s at least 52 to the fifth power minus one, or <strong>380,204,031</strong>. I doubt that we will ever reach this limit, but even if we do, I can always build us a new shortener at a different URL.</p>
]]>
    </content>
</entry>

<entry>
    <title>Our own URL shortener</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/our-own-url-shortener.html" />
    <id>tag:www.seangleeson.com,2010://4.174</id>

    <published>2010-02-15T23:45:46Z</published>
    <updated>2010-02-16T00:13:08Z</updated>

    <summary>This morning, Phoebe and I were talking about stuff, as we are wont to do from time to time, and the topic of URL shortening came up. You know, those services like tinyurl.com and bit.ly that take a really long...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="programming" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="web" label="Web" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>This morning, Phoebe and I were talking about stuff, as we are wont to do from time to time, and the topic of <a href="http://en.wikipedia.org/wiki/URL_shortening">URL shortening</a> came up. You know, those services like <a href="http://tinyurl.com/">tinyurl.com</a> and <a href="http://bit.ly/">bit.ly</a> that take a really long URL and convert it to a much shorter one. It&#8217;s handy for pasting URLs into emails, or tweets, or other spaces where an overly long URL doesn&#8217;t fit.</p>

<p>On the other hand, these services do have their drawbacks. For one thing, they are not guaranteed to be permanent; if they go out of business, your links might die along with them. For another, they are used so often by spammers for sneaky redirects that users might be wary of clicking on one of their generated links. Some websites even ban all tinyurl links from their sites, and with good reason.</p>

<p>But, we realized, these problems wouldn&#8217;t exist if <em>we had our own URL shortener!</em> And so today I built us one. We now have <strong>u.gleeson.us</strong>, a URL shortener that we own, and that only Phoebe and I can use. So now I can take really horribly long URLs like this&#8230;</p>

<pre><code>http://www.amazon.com/gp/product/1596062266?ie=UTF8
&amp;tag=gleesonus-20&amp;linkCode=as2&amp;camp=1789
&amp;creative=390957&amp;creativeASIN=1596062266
</code></pre>

<p>..and instantly convert them to short ones, like this&#8230;</p>

<p><a href="http://u.gleeson.us/6">u.gleeson.us/6</a></p>

<p>By the way, that link &#8212; both of them, really &#8212; goes to an excellent anthology by Jack Vance, one of my all-time favorite authors. Just in case you were curious, but not curious enough to click.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Chitika and AdSense and House Ads and Celebrity Lingerie</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/chitika-adsense-celebrity-lingerie.html" />
    <id>tag:www.seangleeson.com,2010://4.170</id>

    <published>2010-02-14T20:01:43Z</published>
    <updated>2010-02-15T01:48:07Z</updated>

    <summary>I&#8217;ve got some extra-fancy code serving ads on this blog. Which ads you see on the page depend on how you got to the page. If you arrived here from a major search engine (e.g., Google, Yahoo, Bing) in the...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>I&#8217;ve got some extra-fancy code serving ads on this blog. Which ads you see on the page depend on how you got to the page. If you arrived here from a major search engine (e.g., Google, Yahoo, Bing) in the United States or Canada, you are seeing ads by <a href="http://chitika.com/publishers.php?refid=SeanGleeson">Chitika</a>. (I keep wanting to call them &#8220;Chikita,&#8221; like chiquita, but it&#8217;s Chitika.)</p>

<p><a href="http://chitika.com/publishers.php?refid=SeanGleeson">Chitika</a> is pretty neat; their ads only show up for search-engine-referred traffic, and not for any other traffic. So, for instance, someone who got here via a Google search for &#8220;celebrity lingerie&#8221; would see some Chitika ads all about celebrity lingerie. But the folks who just came here because they like the blog, or followed a link from somewhere else, will never see any Chitika ads at all. I like that.</p>

<p>For all the pageloads that don&#8217;t get the Chitika treatment, I&#8217;ve got a <a href="http://www.google.com/adsense/">Google AdSense</a> ad in the sidebar. The last time I used AdSense was quite a few years ago, so I thought surely it must be vastly improved by now: better controls and filters, easier interface. But no, it&#8217;s pretty much how I remembered it.</p>

<p>I do like how AdSense text ads can be customized to blend tastefully with my site&#8217;s design, but I wish there were some better ways to control which ads I will allow. (Yes, I can block ads from any URL I don&#8217;t like, but wouldn&#8217;t it be so much better to block ads for products or services I don&#8217;t want to advertise?)</p>

<p>And finally, for those occasions when AdSense doesn&#8217;t have any relevant ads to display, I fill the sidebar spot with my own house ads, such as for games I have made, or websites I like. These won&#8217;t show very often, so I&#8217;ll show you a couple now. These two are for games I made:</p>

<p><a  title="Dashabooja -- it's like poker, but with ten hands." href="http://www.gleeson.us/dashabooja/"><img alt="Dashabooja -- it's like poker, but with ten hands." width="120" height="240" src="http://i.gleeson.us/houseads/dashabooja_120x240.png" border="0" style="margin: 10px 0px;" /></a>  <a  title="Wichita Faro -- The authentic card game of the Old West." href="http://www.gleeson.us/faro/"><img alt="Wichita Faro -- The authentic card game of the Old West." width="120" height="240" src="http://i.gleeson.us/houseads/faro_120x240.png" border="0" style="margin: 10px 0px;" /></a></p>

<p>And these three are for games by my bestest friends at Pixelatrix Games:</p>

<p><a title="Haven -- Solve the mystery of the haunted asylum." href="http://pixelatrixgames.com/games/haven-the-hospital/"><img alt="Haven -- Solve the mystery of the haunted asylum." width="120" height="240" src="http://i.gleeson.us/houseads/haven_120x240.png" border="0" style="margin: 10px 0px;" /></a>  <a title="House -- You can get in, but can you get out?" href="http://pixelatrixgames.com/games/house/"><img alt="House -- You can get in, but can you get out?" width="120" height="240" src="http://i.gleeson.us/houseads/house_game_120x240.png" border="0" style="margin: 10px 0px;" /></a>  <a title="Shipwrecked -- An adventure in the jungle." href="http://pixelatrixgames.com/games/shipwrecked/"><img alt="Shipwrecked -- An adventure in the jungle." width="120" height="240" src="http://i.gleeson.us/houseads/shipwrecked_120x240.png" border="0" style="margin: 10px 0px;" /></a></p>
]]>
        

    </content>
</entry>

<entry>
    <title>Writing a Facebook app</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/writing-a-facebook-app.html" />
    <id>tag:www.seangleeson.com,2010://4.169</id>

    <published>2010-02-14T03:51:21Z</published>
    <updated>2010-02-14T23:22:37Z</updated>

    <summary>Over the past week, I have been learning how to write a Facebook application, so I could make our blogs post links on Facebook automatically every time we write a new entry. I noticed that there were services that did...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="facebook" label="Facebook" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>Over the past week, I have been learning how to write a Facebook application, so I could make our blogs post links on Facebook automatically every time we write a new entry. I noticed that there were services that did this already (such as <a href="http://www.networkedblogs.com/">Networked Blogs</a> and <a href="http://www.ping.fm/">Ping.fm</a>), but none of the ones I found did exactly what I wanted, so I wrote my own. That&#8217;s just how I roll.</p>

<p>I had to read a lot of the <a href="http://wiki.developers.facebook.com/index.php/Main_Page">Facebook Developers Documentation</a> to get their API specs, especially the <a href="http://wiki.developers.facebook.com/index.php/FBML">FBML language</a> reference.</p>

<p>I&#8217;ve tested the code, and it works, but I haven&#8217;t actually gone live with the actual automatic posting yet. That will happen tomorrow.</p>

<p>UPDATE: Yep, totally works. Now I can do other stuff.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Ice Cream for Breakfast Day</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/ice-cream-for-breakfast-day.html" />
    <id>tag:www.seangleeson.com,2010://4.157</id>

    <published>2010-02-06T15:51:24Z</published>
    <updated>2010-02-14T17:36:40Z</updated>

    <summary>Today, being the first Saturday of February, is Ice Cream for Breakfast Day. (I couldn&#8217;t find some official I.C.f.B.D. site to link to, so this is a link to a Google search.) * I have three quarts of Breyer&#8217;s Neapolitan...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="events" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="food" label="food" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="holidays" label="holidays" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>Today, being the first Saturday of February, is <a href="http://www.google.com/search?q=ice+cream+for+breakfast+day">Ice Cream for Breakfast Day</a>. (I couldn&#8217;t find some official I.C.f.B.D. site to link to, so this is a link to a Google search.) *</p>

<p>I have three quarts of Breyer&#8217;s Neapolitan for the kids, and a pint of Starbuck&#8217;s coffee ice cream for me and Phoebe.</p>

<p>*UPDATE: Phoebe tells me that the <a href="http://www.itzahckret.com/icecreamforbreakfast.html">itzahckret page</a> really is the &#8220;official&#8221; I.C.f.B.D. site. So, now we know.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>True Comment Number plugin for MT5</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/true-comment-number-plugin-for-mt5.html" />
    <id>tag:www.seangleeson.com,2010://4.153</id>

    <published>2010-02-03T15:32:54Z</published>
    <updated>2010-02-04T06:15:47Z</updated>

    <summary>A new plugin for Movable Type 5, TrueCommentNumber returns the actual order number of comments when they are paginated by AJAX.</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mt5" label="MT5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>Yesterday, in addition to making my <a href="http://www.seangleeson.com/2010/02/mt5-comment-pagination-fix.html">PHP workaround</a>, I also wrote a Movable Type plugin I call &#8220;True Comment Number.&#8221; If you look at an entry on this blog that has comments, you&#8217;ll notice that I number them, starting with &#8220;1&#8221; for the first comment, and going up from there. This numbering was not working properly with paginated comments, so that&#8217;s why I wrote True Comment Number.</p>

<p>Anyone who wants my plugin may download <a href="http://i.gleeson.us/plugins/TrueCommentNumber.zip">TrueCommentNumber.zip</a> and use it.</p>
]]>
        <![CDATA[<p><strong>What is it?</strong></p>

<p>The True Comment Number plugin adds a new Template Tag, <code>&lt;$mt:TrueCommentNumber$&gt;</code> to Movable Type. This tag can replace the <code>&lt;$mt:CommentOrderNumber$&gt;</code> tag in the context of comment pagination.</p>

<p><code>&lt;$mt:CommentOrderNumber$&gt;</code> is a good tag for numbering your comments in a list. It starts with &#8220;1&#8221; and keeps adding 1 for each comment. But the problem with <code>&lt;$mt:CommentOrderNumber$&gt;</code> is, it starts with &#8220;1&#8221; even when it should be starting from a higher number. Say you clicked on the &#8220;newer comments&#8221; link to see comments 51 - 100, then you would think the first comment would be numbered &#8220;51.&#8221; But <code>&lt;$mt:CommentOrderNumber$&gt;</code> would number it &#8220;1,&#8221; because it does not take the offset (<em>i.e.</em>, the 50 comments being skipped) into consideration.</p>

<p>That&#8217;s where <code>&lt;$mt:TrueCommentNumber$&gt;</code> comes in. If you are looking at comments 51 - 100, it will start at &#8220;51.&#8221; If you are looking at comments 2801-3000, it will start at &#8220;2801.&#8221; It will always give you the true order number of the comment.</p>

<p><strong>What does it do, exactly?</strong></p>

<p>The <code>&lt;$mt:TrueCommentNumber$&gt;</code> tag works almost exactly like the existing <code>&lt;$mt:CommentOrderNumber$&gt;</code> tag. In fact, for regular publishing, it will return exactly whatever <code>&lt;$mt:CommentOrderNumber$&gt;</code> would have returned. No difference at all. Except that if it is in the context of a batch of comments that have been retrieved by an an AJAX script, it will add the &#8220;offset&#8221; value to the comment number.</p>

<p><strong>How do you use it?</strong></p>

<p>You can use it in your &#8220;Comment Detail&#8221; template if you want comments numbered. For a very stripped-down example&#8230;</p>

<pre><code>&lt;div id="comment-&lt;$mt:CommentID$&gt;" class="comment"&gt;
    &lt;span class="comment-number"&gt;
        #&lt;$mt:TrueCommentNumber$&gt;:
    &lt;/span&gt;
    &lt;div class="comment-content"&gt;
        &lt;$mt:CommentBody$&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p><strong>Does it work?</strong></p>

<p>It works for me, on Movable Type version 5. I have not tested it on any other versions, and make no warranties of any kind. If you want to modify it in any way, go right ahead.</p>

<p>Have fun!</p>
]]>
    </content>
</entry>

<entry>
    <title>MT5 comment pagination fix</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/02/mt5-comment-pagination-fix.html" />
    <id>tag:www.seangleeson.com,2010://4.152</id>

    <published>2010-02-03T00:56:29Z</published>
    <updated>2010-02-03T15:55:40Z</updated>

    <summary>I just fixed a couple more Movable Type things. I reckon I must have the only working copy of MT5 in the whole world. Today I did a number of fixes to the new-fangled comment pagination feature. Comment pagination is...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mt5" label="MT5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>I just fixed a couple more Movable Type things. I reckon I must have the only working copy of MT5 in the whole world. Today I did a number of fixes to the new-fangled comment pagination feature.</p>

<p>Comment pagination is pretty cool. We&#8217;ve all been to blog pages with hundreds and hundreds of comments, and seen how such a huge page can clobber your browser. But the Movable Type comment pagination lets you only show a limited number of the most recent comments on your page, then uses AJAX to navigate to newer or older comments, without reloading the whole page.</p>

<p>The only problem was, it didn&#8217;t work. There were two or three problems I had to track down and fix. First of all, my blog (at seangleeson.com) is on a different domain from my MT installation (at mt5.gleeson.us).  But the comment pagination script relies on an XMLHttpRequest, and as we all know, <em>cross-domain XMLHttpRequests are illegal!</em> The blog page was requesting a batch of comments from mt5.gleeson.us/mt-comments.cgi, and getting denied.</p>

<p>I fixed this problem by putting a very simple PHP script at seangleeson.com/commentlisting.php. All this script does is act as a go-between, a middleman. It gets the request from the blog page, passes it along to the MT script, gets an answer from the MT script, and passes it back to the blog page. So now the blog has a legal place to send its XMLHttpRequest.</p>
]]>
        <![CDATA[<p>Here is the code of commentlisting.php:</p>

<pre><code>&lt;?php
$R = 'void(0);';
$E = $_GET['e'];
$L = ($_GET['l'] ? $_GET['l'] : '50');
$O = ($_GET['o'] ? $_GET['o'] : '0');
if ($E) {
    ob_start();
    $U = "http://mt5.gleeson.us/mt-comments.cgi?";
    $U .= "__mode=comment_listing&amp;direction=ascend";
    $U .= "&amp;entry_id=".$E."&amp;limit=".$L."&amp;offset=".$O;
    $C = curl_init();
    curl_setopt($C, CURLOPT_URL, $U);
    curl_exec($C);
    curl_close($C);
    $R = ob_get_clean();
}
header('Last-Modified: '.gmdate(DATE_RFC1123, time() - 6));
header('Expires: '.gmdate(DATE_RFC1123, time() + 6));
header('Accept-Ranges: bytes');
header('Content-Length: '.strlen($R));
header('Content-Type: text/javascript; charset=utf-8');
echo $R;
?&gt;
</code></pre>

<p>And once that was in place, all I had to do was edit the JavaScript, to send its requests to commentlisting.php instead of mt-comments.cgi, thusly:</p>

<pre><code>jsonUrl = [
    "&lt;$mt:BlogURL$&gt;commentlisting.php?e=",
    entryID,
    "&amp;l=",
    commentsPerPage,
    "&amp;o=",
    _getCommentOffset()
 ].join('');
</code></pre>

<p>And then it worked. Well, it worked after I wrote my <a href="http://www.seangleeson.com/2010/02/true-comment-number-plugin-for-mt5.html">True Comment Number plugin</a>.</p>
]]>
    </content>
</entry>

<entry>
    <title>MT5 lastn comments bug hack</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/01/mt5-lastn-comments-bug-hack.html" />
    <id>tag:www.seangleeson.com,2010://4.151</id>

    <published>2010-02-01T05:35:25Z</published>
    <updated>2010-02-04T06:19:28Z</updated>

    <summary>In which Sean once again hacks the MT5 source code, to fix the lastn comments bug.</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mt5" label="MT5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>Once again, I have had to hack Movable Type&#8217;s Perl source code to fix an error they made. The &lt;mt:Comments&gt; tag that loops through the comments takes an argument &#8220;lastn&#8221; which is supposed to tell it how many of the most recent comments to retrieve. But instead of retrieving the n <em>most recent</em> comments, MT was retrieving the n <em>oldest</em> comments! Exactly the opposite of what it was supposed to do!</p>

<p>This bug <a href="http://forums.movabletype.org/2009/12/mtcomments-lastn-not-working-properly-after-432-upgrade.html">has been known to the MT community</a> for quite awhile. Apparently, it cropped up in version 4.3, and here we are in version 5 and it&#8217;s still there! I didn&#8217;t see anyone with any good hacks to fix it, so I figured this one out myself. I do dislike hacking the source code (I have <a href="http://www.seangleeson.com/2010/01/mt5-configuration-across-domains.html">said this before</a>), but when you gotta, you gotta.</p>
]]>
        <![CDATA[<p>I added a single line of Perl code to</p>

<p><strong>/lib/MT/Template/Tags/Comment.pm</strong></p>

<p>at around line 301. This hack fixed the problem:</p>

<pre><code>if ($so) {
    $args{'direction'} = $so;
} else {
    $args{'direction'} = 'descend';
}

## Added this line to fix bug:
$args{'direction'} = 'descend';

my $cmts = $e-&gt;comments(\%terms, \%args);
my $offset = $args-&gt;{offset} || 0;
...
</code></pre>

<p>Sorry if these techie posts bore you. They bore me. But I have to blog them, if only to remember everything I did. I have to re-do all of my hacks if I update the software.</p>
]]>
    </content>
</entry>

<entry>
    <title>Designing the theme</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/01/designing-the-theme.html" />
    <id>tag:www.seangleeson.com,2010://4.148</id>

    <published>2010-01-29T03:53:46Z</published>
    <updated>2010-01-29T16:40:59Z</updated>

    <summary>I am working hard at designing the MT5 theme for seangleeson.com. Mostly this entails editing templates for all the page elements, and writing CSS code. Yes, I do realize that I have broken a lot of stuff. Most of the...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mt5" label="MT5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>I am working hard at designing the MT5 theme for seangleeson.com. Mostly this entails editing templates for all the page elements, and writing CSS code.</p>

<p>Yes, I do realize that I have broken a lot of stuff. Most of the links you see on this page don&#8217;t really work yet. But I am getting all of that working real soon!</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Swell 3D is on MT5 now</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/01/swell-3d-is-on-mt5-now.html" />
    <id>tag:www.seangleeson.com,2010://4.144</id>

    <published>2010-01-27T06:02:27Z</published>
    <updated>2010-01-27T06:07:01Z</updated>

    <summary>I just finished migrating swell3d.com to the Movable Type 5 installation. Now I will start working on this blog&#8217;s theme. Oh, and the nice people at Technorati wanted me to put the string 8EKGUHTYM4AA into a post, so this one&#8217;s...</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mt5" label="MT5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>I just finished migrating <a href="http://www.swell3d.com/">swell3d.com</a> to the Movable Type 5 installation. Now I will start working on this blog&#8217;s theme.</p>

<p>Oh, and the nice people at Technorati wanted me to put the string 8EKGUHTYM4AA into a post, so this one&#8217;s for you.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>MT5 configuration across domains</title>
    <link rel="alternate" type="text/html" href="http://www.seangleeson.com/2010/01/mt5-configuration-across-domains.html" />
    <id>tag:www.seangleeson.com,2010://4.10</id>

    <published>2010-01-25T02:21:57Z</published>
    <updated>2010-02-15T02:00:06Z</updated>

    <summary>In which Sean ends his years-long blogging hiatus, and talks about the unexplainable decision by the makers of MT5 to disable blogs with their own domains.</summary>
    <author>
        <name>Sean Gleeson</name>
        <uri>http://www.seangleeson.com/</uri>
    </author>
    
        <category term="metablog" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mt5" label="MT5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.seangleeson.com/">
        <![CDATA[<p>Hi. I haven&#8217;t blogged in a few years. Good to see you all again.</p>

<p>I&#8217;ve just installed the brand-spanking-new Movable Type 5, to run <a href="http://www.seangleeson.com/">seangleeson.com</a> and <a href="http://www.feebeeglee.com/">feebeeglee.com</a>. I shall be spending quite a bit of time creating style sheets and templates for our new family of blogs in the upcoming weeks, and blogging about any issues or insights which occur. Then, I will work on migrating the slumbering swell3d.com to this MT5 installation, and possibly even merging in our old WordPress blogs (at blog.gleeson.us, sean.gleeson.us, phoebe.gleeson.us, and homeschool.gleeson.us). I also want to start a Web development blog at mr.gleeson.us. So this is the first step of a long journey.</p>

<p>But here is something about MT5, which has caused problems right from the beginning: why the devil don&#8217;t they want me to have blogs on multiple domains? As recently as MT4, you could put a blog at one domain (like feebeeglee.com), and another at another domain (like seangleeson.com) and and have them aggregated at a third domain (like <a href="http://www.gleeson.us/">gleeson.us</a>), the way I am doing. But the new MT5 has dispensed with this very helpful ability.</p>
]]>
        <![CDATA[<p>Now, blogs cannot stand alone; they have to be a part of a &#8220;website,&#8221; which acts as an aggregator and receptacle for non-blog content. That&#8217;s okay with me, but for some screwy reason, every &#8220;blog&#8221; must be a subdomain or directory of its &#8220;website&#8221; parent&#8217;s domain! For instance, if the &#8220;website&#8221; is at www.mysite.com, MT5 insists that its blogs must be at www.mysite.com/blog1/ and www.mysite.com/blog2/ (or &#8212; even worse &#8212; at blog1.www.mysite.com and blog2.www.mysite.com), but not simply at blog1.com and blog2.com.</p>

<p>Why can&#8217;t a blog have its own unique domain? There is certainly no technical reason for this restriction. I know this because I just spent a day hacking MT5&#8217;s Perl code to get it to work, and it caused no technical problems, it works like a dream.</p>

<p>The actual code hack didn&#8217;t take a whole day, in fact it&#8217;s just one extra line of code in the Blog.pm module in the MT lib.</p>

<pre><code>sub site_url {
    my $blog = shift;
    # This next line is the one I added:
    return $blog-&gt;raw_site_url;
    ...
</code></pre>

<p>But before I did that, I spent an unfruitful day trying to write a plugin that would do the same thing. I don&#8217;t like hacking source code, because it makes updating so cumbersome. So a plugin would definitely have been the preferable solution. But when one attempt after another to modify the Blog object with a plugin failed, I finally gave up and just hacked away at the source. It felt good.</p>

<p>What I really hope is that the very next release of MT corrects this problem and allows cross-domain blogs. Because now I will have to hack every MT update until they fix it.</p>
]]>
    </content>
</entry>

</feed>

