<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><language>en-us</language><copyright>Copyright 2006</copyright><managingEditor>palrich@gmail.com</managingEditor><webMaster>palrich@gmail.com</webMaster><lastBuildDate>Fri, 30 Jul 2010 03:22:11 +0000</lastBuildDate><pubDate>Fri, 30 Jul 2010 03:22:11 +0000</pubDate><ttl>60</ttl><generator>WeirdLooking.com</generator><link>http://www.weirdlooking.com/</link><description>WeirdLooking.com: Michael Barton's Blog</description><title>WeirdLooking.com: Michael Barton's Blog</title><image><url>http://www.weirdlooking.com/images/feed.png</url><title>WeirdLooking.com: Michael Barton's Blog</title><link>http://www.weirdlooking.com/</link></image><item><title>which portable avatar is right for me?</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/which-portable-avatar-is-right-for-me</link><guid>http://www.weirdlooking.com/blog/which-portable-avatar-is-right-for-me</guid><pubDate>Mon, 02 Oct 2006 09:08:46 +0000</pubDate><description>I like the idea of avatars that travel with you, but which of these is the &amp;ldquo;right thing&amp;rdquo;?&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Gravatar&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGravatar) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;Gravatars&lt;/a&gt; are really popular and easy to implement, but it seems like the centralized nature would make it failure-prone and a privacy debacle waiting to happen.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Favatar&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFavatar) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;Favatars&lt;/a&gt; are a cool idea.&amp;nbsp; On the plus side, they&amp;rsquo;d start working right away.&amp;nbsp; On the other hand, I&amp;rsquo;m not sure how many people have their own favicons, and the implementation would be a bit &amp;ldquo;fun&amp;rdquo;.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Pavatar&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPavatar) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;Pavatars&lt;/a&gt; have all the same problems as Favatars, they can just be bigger than 16x16px and aren&amp;rsquo;t tied to the favicon displayed by browsers.</description><category>website</category><category>avatars</category><comments>http://www.weirdlooking.com/blog/which-portable-avatar-is-right-for-me#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/74</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/74</wfw:commentRss><slash:comments>29</slash:comments></item><item><title>using pngcrush in windows</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/using-pngcrush-in-windows</link><guid>http://www.weirdlooking.com/blog/using-pngcrush-in-windows</guid><pubDate>Thu, 31 Aug 2006 10:00:05 +0000</pubDate><description>&lt;div style=&quot;float: right; margin: 2px; padding: 2px; border: solid 1px #555555;&quot;&gt;&lt;img src=&quot;http://www.weirdlooking.com/blog/64/pngcrush.png&quot; alt=&quot;pngcrushery&quot; /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;I pngcrushed this image.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt; &lt;span style=&quot;color: #880000&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Disclaimer: I don&amp;rsquo;t know what I&amp;rsquo;m doing.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As we all know, png images are the best thing that&amp;rsquo;s ever happened.&amp;nbsp; Unfortunately, lots of image editors wantonly save gama and other chunks in them without asking.&amp;nbsp; This can cause pngs to be rendered a different color than elements in the web page they were supposed to match.&amp;nbsp; So I fixed XP to have an option in the context menu for .png files to run them through pngcrush.&amp;nbsp; It&amp;rsquo;s nothing fancy, but it&amp;rsquo;s improved my workflow.&amp;nbsp; And this is how I did it!&lt;br /&gt;&lt;br /&gt;First, you&amp;rsquo;ll want to go get &lt;a href=&quot;http://sourceforge.net/project/showfiles.php?group_id=1689&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fsourceforge.net%2Fproject%2Fshowfiles.php%3Fgroup_id%3D1689) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;pngcrush&lt;/a&gt;.&amp;nbsp; If you manage to navigate you way through sourceforge&amp;rsquo;s download region, you&amp;rsquo;ll wind up with a win32 executable and some other unimportant junk.&amp;nbsp; You should put that executable somewhere safe &amp;#8211; Mine is called C:\pngcrush\pngcrush.exe.&lt;br /&gt;&lt;br /&gt;Next, create a couple of files:&lt;br /&gt;&lt;br /&gt;&lt;cite&gt;C:\pngcrush\pngcrush.bat&lt;/cite&gt;:&lt;blockquote class=&quot;quotation&quot;&gt;&lt;p&gt;&lt;code style=&quot;display: block;&quot; class=&quot;blockocode&quot;&gt;copy %1 %1.bak&lt;br/&gt;C:\pngcrush\pngcrush.exe -rem gAMA -rem cHRM -rem iCCP -rem sRGB -brute -l 9 %1 %TMP%\pngcrush-tmp.png&lt;br/&gt;copy %TMP%\pngcrush-tmp.png %1&lt;br/&gt;del %TMP%\pngcrush-tmp.png&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;cite&gt;pngcrush.reg&lt;/cite&gt;:&lt;blockquote class=&quot;quotation&quot;&gt;&lt;p&gt;&lt;code style=&quot;display: block;&quot; class=&quot;blockocode&quot;&gt;Windows Registry Editor Version 5.00&lt;br/&gt;&lt;br/&gt;[HKEY_CLASSES_ROOT\pngfile\shell\Pngcrush]&lt;br/&gt;@=&quot;&amp;Pngcrush&quot;&lt;br/&gt;&lt;br/&gt;[HKEY_CLASSES_ROOT\pngfile\shell\Pngcrush\command]&lt;br/&gt;@=&quot;\&quot;C:\\pngcrush\\pngcrush.bat\&quot; \&quot;%1\&quot;&quot;&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Obviously you&amp;rsquo;ll have to adjust the paths if you&amp;rsquo;re a sissy and don&amp;rsquo;t save everything in a directory off C:\ the way I do.&amp;nbsp; And if you don&amp;rsquo;t like my pngcrush options, you don&amp;rsquo;t know what you&amp;rsquo;re doing.&amp;nbsp; Anyway, run that .reg file.&amp;nbsp; If successful, you should now have a &amp;ldquo;Pngcrush&amp;rdquo; option when you right-click on .png files!</description><category>website</category><category>png</category><comments>http://www.weirdlooking.com/blog/using-pngcrush-in-windows#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/64</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/64</wfw:commentRss><slash:comments>6</slash:comments></item><item><title>web-based mud client?</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/web-based-mud-client</link><guid>http://www.weirdlooking.com/blog/web-based-mud-client</guid><pubDate>Sun, 26 Mar 2006 06:11:26 +0000</pubDate><description>This blog post about Google&amp;rsquo;s web-based instant messaging is making the rounds:&lt;br /&gt;&lt;a href=&quot;http://alex.dojotoolkit.org/?p=538&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Falex.dojotoolkit.org%2F%3Fp%3D538) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;http://alex.dojotoolkit.org/?p=538&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So here&amp;rsquo;s my thinking&amp;#8230; If I can open up a second port on my &lt;a href=&quot;http://www.divineblood.org/&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fwww.divineblood.org%2F) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;mud&lt;/a&gt; and run a simple HTTP server on it (lots of people have done this already), I can pretty easily hack write_to_descriptor to send information to a persistent HTTP connection.&amp;nbsp; In fact, it&amp;rsquo;ll practically be a regular mud connection except color codes and newlines and stuff will be parsed into their equivalent HTML (fairly straight-forward modification of the color code).&amp;nbsp; And interpret will be called from an HTTP post.&amp;nbsp; Then some work in javascript and I can have a web-based mud client.&lt;br /&gt;&lt;br /&gt;I&amp;rsquo;ll have the first &lt;a href=&quot;http://www.fuckweb2.com/&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fwww.fuckweb2.com%2F) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;Web 2.0&lt;/a&gt; mud.</description><category>computers and internet</category><category>website</category><category>javascript</category><comments>http://www.weirdlooking.com/blog/web-based-mud-client#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/53</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/53</wfw:commentRss><slash:comments>5</slash:comments></item><item><title>so...what's up?</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/so-whats-up</link><guid>http://www.weirdlooking.com/blog/so-whats-up</guid><pubDate>Tue, 07 Feb 2006 22:29:16 +0000</pubDate><description>I&amp;rsquo;ve been pretty busy with work lately, so I haven&amp;rsquo;t had much time to play around (which would lead to posting on here).&amp;nbsp; I&amp;rsquo;m still working my day job, and I spend evenings writing PHP for a startup.&amp;nbsp; I can&amp;rsquo;t talk about that too much (I had to sign an NDA!), but it&amp;rsquo;s challenging and I&amp;rsquo;m working with some interesting people who can also drink more than me.&lt;br /&gt;&lt;br /&gt;I&amp;rsquo;ve gotta renew my domain name soon, which means I&amp;rsquo;ve had this website for almost a year.&amp;nbsp;  Not counting domain registration, I&amp;rsquo;ve actually spent less than $3 on &lt;a href=&quot;http://www.nearlyfreespeech.net/&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fwww.nearlyfreespeech.net%2F) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;hosting&lt;/a&gt;.&amp;nbsp; Not bad!&lt;br /&gt;&lt;br /&gt;So&amp;#8230; what&amp;rsquo;s up with you?</description><category>about me</category><category>website</category><comments>http://www.weirdlooking.com/blog/so-whats-up#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/49</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/49</wfw:commentRss><slash:comments>8</slash:comments></item><item><title>i don't like (comment) spam!</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/i-dont-like-comment-spam</link><guid>http://www.weirdlooking.com/blog/i-dont-like-comment-spam</guid><pubDate>Fri, 23 Dec 2005 06:06:20 +0000</pubDate><description>You know, all of the comment spam is coming from the servers of Web hosting companies.&amp;nbsp; Which makes sense; they rarely monitor or charge for outgoing connections.&amp;nbsp; I assume that &lt;a href=&quot;http://www.weirdlooking.com/blog/4&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fwww.weirdlooking.com%2Fblog%2F4) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;this page&lt;/a&gt; made its way into an automated comment spamming tool or something.&amp;nbsp; I&amp;rsquo;m going to delete most of that spam, I think.&amp;nbsp; Then I can remove the lame rel=&amp;rdquo;nofollow&amp;rdquo;s on comment links.&lt;br /&gt;&lt;br /&gt;As mentioned, I assume that this spam is posted by some sort of automated tool.&amp;nbsp; So, I have put an end to automated posting.&amp;nbsp; How, you ask?&amp;nbsp; I just hid one of those evil Unix timestamps in the form.&amp;nbsp; If you post a comment 30 minutes after that timestamp, it gives you an error (and a preview where you can click Submit again, so it&amp;rsquo;s not evil).&lt;br /&gt;&lt;br /&gt;Yeah, that&amp;rsquo;s easy to circumvent.&amp;nbsp; The form also includes a checksum of the time (generated via fantastic, super-secret cryptographic methods that you&amp;rsquo;ll never figure out, so don&amp;rsquo;t even bother trying).&amp;nbsp; The end result is that stale instances of the form, like those I assume live in a spammer&amp;rsquo;s database, won&amp;rsquo;t work.&lt;br /&gt;&lt;br /&gt;They could still easily download the page and scrape out a valid timestamp and checksum, but I think it&amp;rsquo;s probably enough for now to not be the low-hanging fruit.</description><category>computers and internet</category><category>spam</category><category>website</category><comments>http://www.weirdlooking.com/blog/i-dont-like-comment-spam#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/46</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/46</wfw:commentRss><slash:comments>9</slash:comments></item><item><title>human-readable date differences</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/human-readable-date-differences</link><guid>http://www.weirdlooking.com/blog/human-readable-date-differences</guid><pubDate>Wed, 21 Dec 2005 11:29:32 +0000</pubDate><description>I had an idea today.&amp;nbsp; I wanted to include human-readable ages beside some of the dates on my blog (e.g. &amp;ldquo;1 day, 8 hours ago&amp;rdquo;).&amp;nbsp; I searched around a bit, and all of the solutions I found just divide the difference in seconds by 31536000 to get years and so on.&amp;nbsp; It doesn&amp;rsquo;t take leap years or different-sized months into account.&lt;br /&gt;&lt;br /&gt;Today is December 21, 2005.&amp;nbsp; To me, 2 years, 2 months ago was October 21, 2003.&lt;br /&gt;&lt;br /&gt;It took a while to write.&amp;nbsp; The first version used brute force to get the difference out of &lt;a href=&quot;http://www.php.net/mktime&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fwww.php.net%2Fmktime) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;mktime&lt;/a&gt;.&amp;nbsp; That worked perfectly but was slow.&amp;nbsp; I used it to generate a bunch of test cases, though.&lt;br /&gt;&lt;br /&gt;What I eventually figured out is that you can just subtract the beginning years, months, hours, etc. from the current ones.&amp;nbsp; After that, use borrowing similar to long subtraction to get rid of any negative numbers.&amp;nbsp; Seconds borrow 60 from a minute, hours borrow 24 from a day, days borrow from an array of month lengths.&amp;nbsp; You get the idea.&amp;nbsp; Anyway, here&amp;rsquo;s the code, which I&amp;rsquo;ll post on the &lt;a href=&quot;http://smarty.incutio.com/?page=SmartyPlugins&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fsmarty.incutio.com%2F%3Fpage%3DSmartyPlugins) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;SmartyPlugins wiki&lt;/a&gt; as soon as I figure out how.&lt;br /&gt;&lt;br /&gt;&lt;code style=&quot;display: block;&quot; class=&quot;blockocode&quot;&gt;&amp;lt;?php&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot;color: #00B000&quot;&gt;/**&lt;br/&gt; * Smarty plugin&lt;br/&gt; * -----------------------------------------&lt;br/&gt; * File: &amp;nbsp; &amp;nbsp;modifier.human_age.php&lt;br/&gt; * Type: &amp;nbsp; &amp;nbsp;modifier&lt;br/&gt; * Name: &amp;nbsp; &amp;nbsp;human_age&lt;br/&gt; * Params: &amp;nbsp;from_time &amp;nbsp; &amp;nbsp;unix timestamp (required)&lt;br/&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to_time &amp;nbsp; &amp;nbsp; &amp;nbsp;unix timestamp (default=false (means now))&lt;br/&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strip_zeroes remove units with zero values (&quot;0 days&quot;) (default=true)&lt;br/&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;limit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;limit the number of units returned (default=no limit)&lt;br/&gt; * Author: &amp;nbsp;Michael Barton (http://www.weirdlooking.com/email)&lt;br/&gt; * Purpose: Returns a human-readable difference between two times&lt;br/&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;e.g. &quot;1 day, 8 hours, 48 minutes, 57 seconds&quot;&lt;br/&gt; * Remarks: Correct for leap years and different-sized months.&lt;br/&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Well, my idea of correct. &amp;nbsp;Turns out it's slightly subjective.&lt;br/&gt; *&lt;br/&gt; * @link http://www.weirdlooking.com/blog/45&lt;br/&gt; * -----------------------------------------&lt;br/&gt; */&lt;/span&gt;&lt;br/&gt; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;require_once&lt;/span&gt; $smarty-&gt;_get_plugin_filepath(&lt;span style=&quot;color: #00B000&quot;&gt;'shared'&lt;/span&gt;,&lt;span style=&quot;color: #00B000&quot;&gt;'make_timestamp'&lt;/span&gt;);&lt;br/&gt;&lt;br/&gt; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;function&lt;/span&gt; smarty_modifier_human_age($from_time, $to_time = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;false&lt;/span&gt;, $strip_zeroes = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;true&lt;/span&gt;, $limit = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;false&lt;/span&gt;)&lt;br/&gt; &amp;nbsp;{&lt;br/&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;if&lt;/span&gt; ($to_time === &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;false&lt;/span&gt;)&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;$to_time = time();&lt;br/&gt; &amp;nbsp; &amp;nbsp;$order = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;(&lt;span style=&quot;color: #00B000&quot;&gt;'year'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'mon'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'mday'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'hours'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'minutes'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'seconds'&lt;/span&gt;);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$names = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;(&lt;span style=&quot;color: #00B000&quot;&gt;'year'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'month'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'week'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'day'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'hour'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'minute'&lt;/span&gt;, &lt;span style=&quot;color: #00B000&quot;&gt;'second'&lt;/span&gt;);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$sizes = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;(&lt;span style=&quot;color: #FF0000&quot;&gt;12&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;2&lt;/span&gt;=&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;24&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;60&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;60&lt;/span&gt;);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$month_lengths = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;(&lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;28&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;30&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;30&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;30&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;31&lt;/span&gt;, &lt;span style=&quot;color: #FF0000&quot;&gt;30&lt;/span&gt;);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$from = getdate($from_time);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$to = getdate($to_time);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$delta = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;();&lt;br/&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; ($order &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;as&lt;/span&gt; $unit)&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;$delta[] = $to[$unit] - $from[$unit];&lt;br/&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;for&lt;/span&gt; ($i = &lt;span style=&quot;color: #FF0000&quot;&gt;5&lt;/span&gt;; $i &gt;= &lt;span style=&quot;color: #FF0000&quot;&gt;0&lt;/span&gt;; $i--)&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;if&lt;/span&gt; ($delta[$i] &amp;lt; &lt;span style=&quot;color: #FF0000&quot;&gt;0&lt;/span&gt;)&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$delta[$i-&lt;span style=&quot;color: #FF0000&quot;&gt;1&lt;/span&gt;]--;&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;if&lt;/span&gt; ($i == &lt;span style=&quot;color: #FF0000&quot;&gt;2&lt;/span&gt; &amp;amp;&amp;amp; ($to[&lt;span style=&quot;color: #00B000&quot;&gt;'mon'&lt;/span&gt;] == &lt;span style=&quot;color: #FF0000&quot;&gt;3&lt;/span&gt; &amp;amp;&amp;amp; !($to[&lt;span style=&quot;color: #00B000&quot;&gt;'year'&lt;/span&gt;] % &lt;span style=&quot;color: #FF0000&quot;&gt;4&lt;/span&gt;)))&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$delta[$i] += &lt;span style=&quot;color: #FF0000&quot;&gt;29&lt;/span&gt;; &lt;span style=&quot;color: #00B000&quot;&gt;// fix this before the year 2100!!!&lt;/span&gt;&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;if&lt;/span&gt; ($i == &lt;span style=&quot;color: #FF0000&quot;&gt;2&lt;/span&gt;)&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$delta[$i] += &amp;nbsp;$month_lengths[$to[&lt;span style=&quot;color: #00B000&quot;&gt;'mon'&lt;/span&gt;]-&lt;span style=&quot;color: #FF0000&quot;&gt;1&lt;/span&gt;];&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$delta[$i] += $sizes[$i-&lt;span style=&quot;color: #FF0000&quot;&gt;1&lt;/span&gt;];&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br/&gt; &amp;nbsp; &amp;nbsp;$delta[&lt;span style=&quot;color: #FF0000&quot;&gt;2&lt;/span&gt;] -= ($week = floor($delta[&lt;span style=&quot;color: #FF0000&quot;&gt;2&lt;/span&gt;]/&lt;span style=&quot;color: #FF0000&quot;&gt;7&lt;/span&gt;)) * &lt;span style=&quot;color: #FF0000&quot;&gt;7&lt;/span&gt;;&lt;br/&gt; &amp;nbsp; &amp;nbsp;$delta = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;($delta[&lt;span style=&quot;color: #FF0000&quot;&gt;0&lt;/span&gt;], $delta[&lt;span style=&quot;color: #FF0000&quot;&gt;1&lt;/span&gt;], $week, $delta[&lt;span style=&quot;color: #FF0000&quot;&gt;2&lt;/span&gt;], $delta[&lt;span style=&quot;color: #FF0000&quot;&gt;3&lt;/span&gt;], $delta[&lt;span style=&quot;color: #FF0000&quot;&gt;4&lt;/span&gt;], $delta[&lt;span style=&quot;color: #FF0000&quot;&gt;5&lt;/span&gt;]);&lt;br/&gt; &amp;nbsp; &amp;nbsp;$ret = &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;array&lt;/span&gt;();&lt;br/&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;foreach&lt;/span&gt; ($delta &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;as&lt;/span&gt; $i =&gt; $val)&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;if&lt;/span&gt; (($delta[$i] || !$strip_zeroes) &amp;amp;&amp;amp; ($limit === &lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;false&lt;/span&gt; || sizeof($ret) &amp;lt; $limit))&lt;br/&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$ret[] = $delta[$i].&lt;span style=&quot;color: #00B000&quot;&gt;' '&lt;/span&gt;.$names[$i].($delta[$i] == &lt;span style=&quot;color: #FF0000&quot;&gt;1&lt;/span&gt; ? &lt;span style=&quot;color: #00B000&quot;&gt;''&lt;/span&gt; : &lt;span style=&quot;color: #00B000&quot;&gt;'s'&lt;/span&gt;);&lt;br/&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;return&lt;/span&gt; join(&lt;span style=&quot;color: #00B000&quot;&gt;', '&lt;/span&gt;, $ret);&lt;br/&gt; &amp;nbsp;}&lt;br/&gt;?&gt;&lt;/code&gt;</description><category>computers and internet</category><category>php</category><category>website</category><category>smarty</category><comments>http://www.weirdlooking.com/blog/human-readable-date-differences#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/45</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/45</wfw:commentRss><slash:comments>6</slash:comments></item><item><title>atom enabled-ing</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/atom-enabled-ing</link><guid>http://www.weirdlooking.com/blog/atom-enabled-ing</guid><pubDate>Mon, 19 Dec 2005 07:38:12 +0000</pubDate><description>Does anyone know of an Atom equivalent to &amp;lt;wfw:commentRss&amp;gt; and/or &amp;lt;slash:comments&amp;gt;?&lt;br /&gt;&lt;br /&gt;I have read that this should work for comment threads, but no luck (at least not in &lt;a href=&quot;http://www.rssbandit.org/&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fwww.rssbandit.org%2F) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;my reader&lt;/a&gt;):&lt;br /&gt;&lt;code style=&quot;display: block;&quot; class=&quot;blockocode&quot;&gt;&amp;lt;&lt;span style=&quot;color: #0000B0; font-weight: bold;&quot;&gt;link&lt;/span&gt; &lt;span style=&quot;color: #B00000&quot;&gt;rel&lt;/span&gt;=&lt;span style=&quot;color: #00B000&quot;&gt;&quot;replies&quot;&lt;/span&gt; &lt;span style=&quot;color: #B00000&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: #00B000&quot;&gt;&quot;application/atom+xml&quot;&lt;/span&gt; &lt;span style=&quot;color: #B00000&quot;&gt;href&lt;/span&gt;=&lt;span style=&quot;color: #00B000&quot;&gt;&quot;&quot;&lt;/span&gt; /&amp;gt;&lt;/code&gt;</description><category>computers</category><category>website</category><category>syndication</category><comments>http://www.weirdlooking.com/blog/atom-enabled-ing#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/43</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/43</wfw:commentRss><slash:comments>6</slash:comments></item><item><title>&lt;/school&gt;</title><dc:creator>Michael Barton</dc:creator><link>http://www.weirdlooking.com/blog/school</link><guid>http://www.weirdlooking.com/blog/school</guid><pubDate>Tue, 13 Dec 2005 20:06:33 +0000</pubDate><description>I&amp;rsquo;ll assume you&amp;rsquo;re reading this via RSS, considering how very broken my web page is at the moment.&amp;nbsp; I decided to clean up the markup so I could go all CSS Zen Garden on it.&amp;nbsp; After working on that for a bit, I decided to rewrite everything using &lt;a href=&quot;http://smarty.php.net/&quot; style=&quot;position: relative; padding-left: 8px; zoom: 1;&quot;&gt;&lt;span style=&quot;position: absolute; top: -5px; left: 0px; width: 16px; height: 16px; background: URL(http://www.weirdlooking.com/exticon?http%3A%2F%2Fsmarty.php.net%2F) no-repeat center center; -moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);&quot;&gt;&lt;/span&gt;Smarty templates&lt;/a&gt;.&amp;nbsp; So right now, roughly half of my web page is converted to templates, half of it is using a stylesheet that no longer applies to the markup, half of it has no stylesheet, and half of it never worked anyway (Archives, I&amp;rsquo;m looking in your direction).&amp;nbsp; I&amp;rsquo;ll have time to put it back together now that school&amp;rsquo;s over.&lt;br /&gt;&lt;br /&gt;I guess I should retract all of the bad things I insinuated about my class.&amp;nbsp; Any time I get an A, it couldn&amp;rsquo;t have been &lt;span style=&quot;font-style: italic;&quot;&gt;all&lt;/span&gt; bad.&amp;nbsp; So, school is over.&amp;nbsp; I guess after the holidays I&amp;rsquo;ll have to figure out which way is up.</description><category>website</category><category>school</category><category>my life</category><comments>http://www.weirdlooking.com/blog/school#comments</comments><wfw:comment>http://www.weirdlooking.com/comments/42</wfw:comment><wfw:commentRss>http://www.weirdlooking.com/rss/comments/42</wfw:commentRss><slash:comments>3</slash:comments></item></channel></rss>