<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HM2K.com &#187; Development</title>
	<atom:link href="http://www.hm2k.com/posts/category/dev/feed" rel="self" type="application/rss+xml" />
	<link>http://www.hm2k.com</link>
	<description>The research of an internet entrepreneur and IT consultant</description>
	<lastBuildDate>Wed, 30 Jun 2010 09:29:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting started with Quercus in Google App Engine</title>
		<link>http://www.hm2k.com/posts/getting-started-with-quercus-in-google-app-engine</link>
		<comments>http://www.hm2k.com/posts/getting-started-with-quercus-in-google-app-engine#comments</comments>
		<pubDate>Thu, 15 Apr 2010 12:26:55 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[quercus]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=609</guid>
		<description><![CDATA[Last year an article was written on a blog about how to run PHP on Google App Engine (GAE).
The guide came with a pre-made package to get you started.
However, Quercus has been updated since this was produced.
Unfortunately the official Quercus website has very little detail to help us get started&#8230;
Further research lead me to a [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/10-wordpress-performance-optimisation-tips' rel='bookmark' title='Permanent Link: 10 wordpress performance optimisation tips'>10 wordpress performance optimisation tips</a> <small>I wanted to prepare my wordpress powered blog for an...</small></li>
<li><a href='http://www.hm2k.com/posts/using-your-own-url-as-your-openid-with-wordpress' rel='bookmark' title='Permanent Link: Using Your Own URL as Your OpenID with WordPress'>Using Your Own URL as Your OpenID with WordPress</a> <small>Today I decided to join stackoverflow.com, which requires you to...</small></li>
<li><a href='http://www.hm2k.com/posts/the-google-translate-recursion-bug' rel='bookmark' title='Permanent Link: The Google Translate recursion bug'>The Google Translate recursion bug</a> <small>Recently I found a bug in Google Translate. It&#8217;s not...</small></li>
<li><a href='http://www.hm2k.com/posts/cannot-redeclare-pclziputilpathreduction' rel='bookmark' title='Permanent Link: Cannot redeclare pclziputilpathreduction()'>Cannot redeclare pclziputilpathreduction()</a> <small>I had this issue today, I found that you need...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Last year an article was written on a blog about how to <a href="http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/">run PHP on Google App Engine (GAE)</a>.</p>
<p>The guide came with a pre-made package to get you started.</p>
<p>However, Quercus has been updated since this was produced.</p>
<p><span id="more-609"></span>Unfortunately the <a href="http://quercus.caucho.com/">official Quercus website</a> has very little detail to help us get started&#8230;</p>
<p>Further research lead me to a blog post by the company that makes Quercus entitled: <a href="http://blog.caucho.com/?p=187">Quercus on the Google App Engine</a></p>
<p>It gives a general overview of what is required, but isn&#8217;t really very direct.</p>
<p>I did also find an entry on their wiki for <a href="http://wiki.caucho.com/Quercus_Google_App_Engine">Quercus on Google App Engine</a>, which was more useful.</p>
<p>Here&#8217;s what you need to do:</p>
<ol>
<li>Follow the <a href="http://code.google.com/appengine/docs/java/gettingstarted/creating.html">Google App Engine: Creating a Project getting started guide</a> to create your file structure and the xml files.</li>
<li> Download the <a href="http://caucho.com/download">latest version of Resin</a> (ie: <a href="http://www.caucho.com/download/resin-4.0.6.zip">resin-4.0.6.zip</a>)</li>
<li>From the zip, copy lib/resin.jar to your WEB-INF/lib</li>
<li>Add GoogleQuercusServlet as a standard servlet and any params to web.xml (<a href="http://gist.github.com/367023">example web.xml</a>)</li>
<li>Put your PHP files in your &#8220;war&#8221; directory.</li>
<li>Use the <a href="http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Java">AppEngine Java SDK</a> appcfg to update.</li>
</ol>
<p>If you get this error:</p>
<blockquote><p>java.lang.IllegalStateException: Found a jar file too large to upload: &#8220;&#8230;\WEB-INF\lib\resin.jar&#8221;.  Consider using &#8211;enable_jar_splitting.</p></blockquote>
<p>Using the suggested option fixed this, which looks like this:</p>
<blockquote><p>C:\appengine-java-sdk\bin\appcfg.cmd &#8211;enable_jar_splitting update war</p></blockquote>
<p>That&#8217;s pretty much it to get you started, when you visit your app address, you should be able to call your PHP files.</p>
<p>If you are looking for something a bit more advanced, take a look at these articles that explain how to get WordPress working:</p>
<ul>
<li><a href="http://blog.caucho.com/?p=196">Converting Wordpress for Quercus on Google App Engine</a></li>
<li><a href="http://www.caucho.com/articles/Quercus_on_GAE.pdf">Using Quercus® to Run the WordPress PHP blog on Google App Engine (pdf)</a></li>
</ul>
<p>For additional help I recommend you visit <a href="http://forum.caucho.com/forumdisplay.php?f=5">Caucho&#8217;s Quercus  Forums</a>.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 575px; width: 1px; height: 1px; overflow: hidden;">Using Quercus® to Run the WordPress PHP blog on Google App EngineUsing Quercus® to Run the WordPress PHP blog on Google App Engine</div>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/10-wordpress-performance-optimisation-tips' rel='bookmark' title='Permanent Link: 10 wordpress performance optimisation tips'>10 wordpress performance optimisation tips</a> <small>I wanted to prepare my wordpress powered blog for an...</small></li>
<li><a href='http://www.hm2k.com/posts/using-your-own-url-as-your-openid-with-wordpress' rel='bookmark' title='Permanent Link: Using Your Own URL as Your OpenID with WordPress'>Using Your Own URL as Your OpenID with WordPress</a> <small>Today I decided to join stackoverflow.com, which requires you to...</small></li>
<li><a href='http://www.hm2k.com/posts/the-google-translate-recursion-bug' rel='bookmark' title='Permanent Link: The Google Translate recursion bug'>The Google Translate recursion bug</a> <small>Recently I found a bug in Google Translate. It&#8217;s not...</small></li>
<li><a href='http://www.hm2k.com/posts/cannot-redeclare-pclziputilpathreduction' rel='bookmark' title='Permanent Link: Cannot redeclare pclziputilpathreduction()'>Cannot redeclare pclziputilpathreduction()</a> <small>I had this issue today, I found that you need...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/getting-started-with-quercus-in-google-app-engine/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Universal Currency Converter TCL for Eggdrop</title>
		<link>http://www.hm2k.com/posts/universal-currency-converter-tcl-for-eggdrop</link>
		<comments>http://www.hm2k.com/posts/universal-currency-converter-tcl-for-eggdrop#comments</comments>
		<pubDate>Thu, 25 Feb 2010 14:41:31 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[IRC]]></category>
		<category><![CDATA[converter]]></category>
		<category><![CDATA[currency]]></category>
		<category><![CDATA[eggdrop]]></category>
		<category><![CDATA[TCL]]></category>
		<category><![CDATA[ucc]]></category>
		<category><![CDATA[xe.com]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=602</guid>
		<description><![CDATA[This is a currency converter written in TCL for Eggdrop, which is similar to the ucc.mrc I wrote for mIRC.
I used to use the xeucc.tcl, but that script no longer works and hasn&#8217;t been updated since 2008.
&#62; !ucc 9 usd gbp
&#60;Bot&#62; Could not obtain results from XE.com, sorry!
Further more xeucc.tcl uses the XE.com website to [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/weather-tcl' rel='bookmark' title='Permanent Link: weather.tcl'>weather.tcl</a> <small>Today, after I decided to hang out in #eggtcl on...</small></li>
<li><a href='http://www.hm2k.com/posts/worldtime-tcl' rel='bookmark' title='Permanent Link: worldtime.tcl'>worldtime.tcl</a> <small>Sometimes you need to know the time somewhere else in...</small></li>
<li><a href='http://www.hm2k.com/posts/tinysong-tcl-script-for-eggdrop' rel='bookmark' title='Permanent Link: TinySong TCL script for Eggdrop'>TinySong TCL script for Eggdrop</a> <small>If you&#8217;ve not heard of TinySong, you&#8217;re missing out! TinySong...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is a currency converter written in TCL for Eggdrop, which is similar to the ucc.mrc I wrote for mIRC.</p>
<p>I used to use the <a href="http://members.dandy.net/~fbn/xeucc.tcl.txt">xeucc.tcl</a>, but that script no longer works and hasn&#8217;t been updated since 2008.</p>
<blockquote><p>&gt; !ucc 9 usd gbp<br />
&lt;Bot&gt; Could not obtain results from XE.com, sorry!</p></blockquote>
<p><span id="more-602"></span>Further more xeucc.tcl uses the XE.com website to gather the information, however they don&#8217;t like us doing this, and have since added the following message:</p>
<blockquote><p>WARNING: Automated extraction of rates is prohibited under the Terms of Use.</p></blockquote>
<p>Other scripts such as Incith&#8217;s Exchange also use a website. This one uses Yahoo Finance. The problem is that this website is subject to change at any time without prior notice.</p>
<p>Parsing a website that is subject to change is not always a good idea. Instead what is needed is an API which is easy to parse and extract the data and also unlikely to change formatting.</p>
<p>Although XE.com does have an API, it is not free. This is no good.</p>
<p>I have decided instead to use the <a href="http://developer.yahoo.com/">Yahoo Developer Network</a> Currency Converter API, which is much easier to parse and permits this kind of usage.</p>
<p>There is a choice of two URLs which you can call to get the data:</p>
<blockquote><p><a href="http://finance.yahoo.com/d/quotes.csv?e=.csv&amp;f=sl1d1t1&amp;s=USDGBP=X">http://finance.yahoo.com/d/quotes.csv?e=.csv&amp;f=sl1d1t1&amp;s=USDGBP=X</a></p>
<p><a href="http://download.finance.yahoo.com/d/?f=sl1d1t1&amp;s=USDGBP=X">http://download.finance.yahoo.com/d/?f=sl1d1t1&amp;s=USDGBP=X</a></p></blockquote>
<p>Both examples should provide you with a csv file to download which will contain the currency information.</p>
<p>I have used the second URL in my script.</p>
<p><strong>Usage</strong></p>
<blockquote><p>&gt; .ucc<br />
&lt;Bot&gt; Usage: .ucc &lt;amount&gt; &lt;from&gt; &lt;to&gt;<br />
&gt; .ucc 9 usd gbp<br />
&lt;Bot&gt; HM2K, * UCC: 9 USD is 5.8905 GBP as of 2/25/2010 9:22am</p></blockquote>
<p><strong>Download</strong></p>
<ul>
<li>Download <a href="http://hm2k.googlecode.com/svn/trunk/code/tcl/ucc.tcl">ucc.tcl</a></li>
</ul>
<p>If you like it, or even if you don&#8217;t, please leave a comment below. Thanks.</p>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/weather-tcl' rel='bookmark' title='Permanent Link: weather.tcl'>weather.tcl</a> <small>Today, after I decided to hang out in #eggtcl on...</small></li>
<li><a href='http://www.hm2k.com/posts/worldtime-tcl' rel='bookmark' title='Permanent Link: worldtime.tcl'>worldtime.tcl</a> <small>Sometimes you need to know the time somewhere else in...</small></li>
<li><a href='http://www.hm2k.com/posts/tinysong-tcl-script-for-eggdrop' rel='bookmark' title='Permanent Link: TinySong TCL script for Eggdrop'>TinySong TCL script for Eggdrop</a> <small>If you&#8217;ve not heard of TinySong, you&#8217;re missing out! TinySong...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/universal-currency-converter-tcl-for-eggdrop/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to convert an image to greyscale using PHP</title>
		<link>http://www.hm2k.com/posts/how-to-convert-an-image-to-greyscale-using-php</link>
		<comments>http://www.hm2k.com/posts/how-to-convert-an-image-to-greyscale-using-php#comments</comments>
		<pubDate>Thu, 10 Dec 2009 14:39:30 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[conver]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[gray]]></category>
		<category><![CDATA[grayscale]]></category>
		<category><![CDATA[grey]]></category>
		<category><![CDATA[greyscale]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[imagefilter]]></category>
		<category><![CDATA[IMG_FILTER_GRAYSCALE]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=583</guid>
		<description><![CDATA[I was trying to find a neat way to grey out some &#8220;powered by&#8221; logos for a website I&#8217;m developing.
I remembered reading about this very thing in .net magazine/august 2009 (i191,p100), which said:
&#8220;Sponsor and associate logos can be a challenge for a designer who is making a valiant attempt to create a cohesive website layout. [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/mounting-an-iso-image' rel='bookmark' title='Permanent Link: Mounting an ISO image'>Mounting an ISO image</a> <small>An ISO image usually refers to an archived copy of...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-bulk-convert-wma-to-mp3' rel='bookmark' title='Permanent Link: How to bulk convert WMA to MP3'>How to bulk convert WMA to MP3</a> <small>So you just downloaded an entire album, and it&#8217;s in...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I was trying to find a neat way to grey out some &#8220;powered by&#8221; logos for a website I&#8217;m developing.</p>
<p>I remembered reading about this very thing in <a href="http://en.wikipedia.org/wiki/.net_%28magazine%29">.net magazine</a>/<a href="http://www.badassideas.com/downloads/net191swarren.pdf">august 2009 (i191,p100)</a>, which said:</p>
<blockquote><p><em>&#8220;Sponsor and associate logos can be a challenge for a designer who is making a valiant attempt to create a cohesive website layout. Logos can be contrasting colour schemes and can be displayed at a wide range of different aspect ratios. When faced with this challenge, I recommend greying out the logos and having them appear in their respective colours upon mouse-over. When placing logos next to each other, I’d consider using visual weight versus actual size to determine spacing.&#8221;</em></p>
<p>- <a href="http://badassideas.com/">Samantha Warren @ badassideas.com</a></p></blockquote>
<p>So, sure we&#8217;ve established that it&#8217;s a good idea, the question is how to achieve it&#8230;</p>
<p><span id="more-583"></span>It&#8217;s really quite simple, there&#8217;s two parts:</p>
<ol>
<li>Convert the image to greyscale using PHP.</li>
<li>Write HTML and javascript that will change the image source on mouseover.</li>
</ol>
<p>Before I get started, I need to point out that because I&#8217;m British, I use &#8220;Grey&#8221;, instead of the American &#8220;Gray&#8221;, apart from in the actual code.</p>
<p>I very quickly discovered a number of ways to convert an image from colour to greyscale, however the easiest way appeared to be using the <a href="http://php.net/manual/en/function.imagefilter.php">imagefilter()</a> function with the IMG_FILTER_GRAYSCALE greyscale filter which produced the results I was looking for. I found you can also very <a href="http://www.talkincode.com/add-effects-to-images-using-image-filters-with-php-266.html">easily add all sorts of effects to images using PHP</a>.</p>
<p>I kept it simple and wrote a function that would convert an image from jpeg, gif or png to a png greyscale image. I called it <a href="http://hm2k.googlecode.com/svn/trunk/code/php/functions/imagegray.php">imagegray()</a>.</p>
<p>It&#8217;s very easy to use, you just pass the filename to the function and it will display the image in greyscale. For example:</p>
<blockquote><p>&lt;?php</p>
<p>$i=isset($_REQUEST['i'])?$_REQUEST['i']:&#8221;;<br />
if ($i) { imagegrey($i); }</p>
<p>?&gt;</p></blockquote>
<p>Next, it&#8217;s onto the HTML, which although isn&#8217;t exactly difficult, you may stumble if you&#8217;re unsure&#8230;</p>
<blockquote><p>&lt;img onmouseover=&#8221;this.src=&#8217;image.jpg&#8217;&#8221; onmouseout=&#8221;this.src=&#8217;imagegrey.php?i=image.jpg&#8217;&#8221; src=&#8221;imagegrey.php?i=image.jpg&#8221; alt=&#8221;image&#8221; border=&#8221;0&#8243;&gt;</p></blockquote>
<p>That&#8217;s it, that&#8217;s all there is to it.</p>
<p>If you run a large site, for scalability reasons you may wish to involve caching, but for most small sites, this method is quick and effective.</p>
<p>Enjoy!</p>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/mounting-an-iso-image' rel='bookmark' title='Permanent Link: Mounting an ISO image'>Mounting an ISO image</a> <small>An ISO image usually refers to an archived copy of...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-bulk-convert-wma-to-mp3' rel='bookmark' title='Permanent Link: How to bulk convert WMA to MP3'>How to bulk convert WMA to MP3</a> <small>So you just downloaded an entire album, and it&#8217;s in...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/how-to-convert-an-image-to-greyscale-using-php/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP OpenSRS Client</title>
		<link>http://www.hm2k.com/posts/php-opensrs-client</link>
		<comments>http://www.hm2k.com/posts/php-opensrs-client#comments</comments>
		<pubDate>Wed, 25 Nov 2009 13:42:50 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Domains]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[opensrs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[tucows]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=579</guid>
		<description><![CDATA[This is only a quick message to say that I am now developing the PHP OpenSRS Client project.
OpenSRS-PHP is a PHP-based client class that communicates with the TuCows OpenSRS Domain Name Registry System via an API.
I have just released version 2.8.1 with many long awaited fixes.

Website

Enjoy!


Related posts:Transfering domains from Godaddy.com to TuCows OpenSRS I need [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/transfering-domains-from-godaddycom-to-tucows-opensrs' rel='bookmark' title='Permanent Link: Transfering domains from Godaddy.com to TuCows OpenSRS'>Transfering domains from Godaddy.com to TuCows OpenSRS</a> <small>I need to transfer a bunch of domains from Godaddy...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-setup-tucows-opensrs' rel='bookmark' title='Permanent Link: How to setup Tucows OpenSRS'>How to setup Tucows OpenSRS</a> <small>OpensSRS is a domain reseller system offered by Tucows to...</small></li>
<li><a href='http://www.hm2k.com/posts/ftp-client' rel='bookmark' title='Permanent Link: An FTP client'>An FTP client</a> <small>I have been looking for a decent FTP client for...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-minimize-microsoft-office-outlook-to-the-system-tray' rel='bookmark' title='Permanent Link: How to Minimize Microsoft Office Outlook to the System Tray'>How to Minimize Microsoft Office Outlook to the System Tray</a> <small>Open your registry and find or create the key below....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is only a quick message to say that I am now developing the <em>PHP OpenSRS Client project</em>.</p>
<p>OpenSRS-PHP is a PHP-based client class that communicates with the TuCows OpenSRS Domain Name Registry System via an API.</p>
<p>I have just released version 2.8.1 with many long awaited fixes.</p>
<ul>
<li><a href="http://opensrs-php.sourceforge.net/">Website</a></li>
</ul>
<p>Enjoy!</p>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/transfering-domains-from-godaddycom-to-tucows-opensrs' rel='bookmark' title='Permanent Link: Transfering domains from Godaddy.com to TuCows OpenSRS'>Transfering domains from Godaddy.com to TuCows OpenSRS</a> <small>I need to transfer a bunch of domains from Godaddy...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-setup-tucows-opensrs' rel='bookmark' title='Permanent Link: How to setup Tucows OpenSRS'>How to setup Tucows OpenSRS</a> <small>OpensSRS is a domain reseller system offered by Tucows to...</small></li>
<li><a href='http://www.hm2k.com/posts/ftp-client' rel='bookmark' title='Permanent Link: An FTP client'>An FTP client</a> <small>I have been looking for a decent FTP client for...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-minimize-microsoft-office-outlook-to-the-system-tray' rel='bookmark' title='Permanent Link: How to Minimize Microsoft Office Outlook to the System Tray'>How to Minimize Microsoft Office Outlook to the System Tray</a> <small>Open your registry and find or create the key below....</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/php-opensrs-client/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>worldtime.tcl</title>
		<link>http://www.hm2k.com/posts/worldtime-tcl</link>
		<comments>http://www.hm2k.com/posts/worldtime-tcl#comments</comments>
		<pubDate>Fri, 20 Nov 2009 10:04:23 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[IRC]]></category>
		<category><![CDATA[eggdrop]]></category>
		<category><![CDATA[TCL]]></category>
		<category><![CDATA[timezones]]></category>
		<category><![CDATA[worldtime]]></category>
		<category><![CDATA[zoneinfo]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=573</guid>
		<description><![CDATA[Sometimes you need to know the time somewhere else in the world. I find it useful to get my eggdrop to return the time of another timezone&#8230;

&#62; .tz london
&#60;Bot&#62; HM2K, The time for the london timezone is Fri Feb 13 23:31:30 2009

However, much like my old weather.tcl, I realised that my worldtime.tcl had passed it&#8217;s [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/universal-currency-converter-tcl-for-eggdrop' rel='bookmark' title='Permanent Link: Universal Currency Converter TCL for Eggdrop'>Universal Currency Converter TCL for Eggdrop</a> <small>This is a currency converter written in TCL for Eggdrop,...</small></li>
<li><a href='http://www.hm2k.com/posts/weather-tcl' rel='bookmark' title='Permanent Link: weather.tcl'>weather.tcl</a> <small>Today, after I decided to hang out in #eggtcl on...</small></li>
<li><a href='http://www.hm2k.com/posts/which-is-the-best-operating-system' rel='bookmark' title='Permanent Link: Which is the best operating system?'>Which is the best operating system?</a> <small>I&#8217;ve done my research and i&#8217;ve discovered there&#8217;s only 6...</small></li>
<li><a href='http://www.hm2k.com/posts/eticket' rel='bookmark' title='Permanent Link: eTicket'>eTicket</a> <small>For the past few weeks I have been mostly working...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to know the time somewhere else in the world. I find it useful to get my eggdrop to return the time of another timezone&#8230;</p>
<blockquote>
<pre>&gt; .tz london
&lt;Bot&gt; HM2K, The time for the london timezone is Fri Feb 13 23:31:30 2009</pre>
</blockquote>
<p>However, much like my old <em>weather.tcl</em>, I realised that my <em>worldtime.tcl</em> had passed it&#8217;s sell by date and had now expired.</p>
<p>My old <em>worldtime.tcl</em> which was based on a script by <em>Murf</em> which used <em>worldtimeserver.com</em> to gather it&#8217;s data had stopped working.</p>
<p>It would seem that <em>worldtimeserver.com</em> had changed their markup which meant that it was no longer possible to parse the correct data from the HTML.</p>
<p>Never mind, I thought, there must be a better way, that doesn&#8217;t need to use a third party website, that won&#8217;t stop working.</p>
<p>After all operating systems have worldtime build in without using a website, so how do they do it?</p>
<p>So, I did some investigation&#8230;</p>
<p><span id="more-573"></span></p>
<p><span style="text-decoration: line-through;">I discovered that on Linux based systems (including FreeBSD) the time zone information was stored locally.</span></p>
<blockquote><p><span style="text-decoration: line-through;">/usr/share/zoneinfo/</span></p></blockquote>
<p><span style="text-decoration: line-through;">Using a bit of Google magic, I managed to locate a few pre-made procedures to help me read the time zone information.</span></p>
<ul>
<li><span style="text-decoration: line-through;"><a href="http://alice.wu-wien.ac.at:8000/xowiki/load-timezones.tcl">load-timezones.tcl</a></span>
<ul>
<li><span style="text-decoration: line-through;">get_tz_names</span></li>
<li><span style="text-decoration: line-through;">get_tz_rules</span></li>
</ul>
</li>
</ul>
<p><span style="text-decoration: line-through;">Using these functions I was able to find the right timezone and get the GMT offset which allowed me to work out the time in that timezone using the unix ticks.</span></p>
<p><span style="text-decoration: line-through;">At the moment, because it reads the time zone files that are only available on Linux based systems, it will not work on windrops.</span></p>
<p><span style="text-decoration: line-through;">However, what I may do next time is build a function that saves the timezone information into a database file which can be used on windows systems and will also give the Linux systems a cache file to make it respond quicker.</span></p>
<p><strong>Update: </strong>I decided to stop using the tz database method and replace it with a Google lookup method, which is far more accurate and portable.</p>
<p>So now you&#8217;ll probably want to download it&#8230;</p>
<ul>
<li><a href="http://hm2k.googlecode.com/svn/trunk/code/tcl/worldtime.tcl">Download worldtime.tcl</a></li>
</ul>
<p>Hope it works for you.</p>
<p>Enjoy!</p>
<p>Note: If you find this useful, or have an issue with the script, please add a comment below. Thanks.</p>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/universal-currency-converter-tcl-for-eggdrop' rel='bookmark' title='Permanent Link: Universal Currency Converter TCL for Eggdrop'>Universal Currency Converter TCL for Eggdrop</a> <small>This is a currency converter written in TCL for Eggdrop,...</small></li>
<li><a href='http://www.hm2k.com/posts/weather-tcl' rel='bookmark' title='Permanent Link: weather.tcl'>weather.tcl</a> <small>Today, after I decided to hang out in #eggtcl on...</small></li>
<li><a href='http://www.hm2k.com/posts/which-is-the-best-operating-system' rel='bookmark' title='Permanent Link: Which is the best operating system?'>Which is the best operating system?</a> <small>I&#8217;ve done my research and i&#8217;ve discovered there&#8217;s only 6...</small></li>
<li><a href='http://www.hm2k.com/posts/eticket' rel='bookmark' title='Permanent Link: eTicket'>eTicket</a> <small>For the past few weeks I have been mostly working...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/worldtime-tcl/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Gmail needs an API</title>
		<link>http://www.hm2k.com/posts/gmail-needs-an-api</link>
		<comments>http://www.hm2k.com/posts/gmail-needs-an-api#comments</comments>
		<pubDate>Fri, 13 Nov 2009 16:05:06 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[google mail]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=570</guid>
		<description><![CDATA[Yesterday I spent some time investigating Google Wave. A very interesting new product from Google. Not only that but an interesting protocol.
If you think about it, Google has mostly only used other protocols for communication in the past, now it&#8217;s creating it&#8217;s own. They clearly want to create a completely new protocol that will effectively [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/how-not-to-use-phpmailer' rel='bookmark' title='Permanent Link: How not to use PHPMailer'>How not to use PHPMailer</a> <small>I came across PHPMailer usage the other day on a...</small></li>
<li><a href='http://www.hm2k.com/posts/google-adsense-wont-let-me-in' rel='bookmark' title='Permanent Link: Google AdSense won&#8217;t let me in!'>Google AdSense won&#8217;t let me in!</a> <small>Back in 2004, I signed up my old site &#8220;hm2k.org&#8221;...</small></li>
<li><a href='http://www.hm2k.com/posts/hacked-my-school' rel='bookmark' title='Permanent Link: How I hacked my schools website &#8211; a look into the past'>How I hacked my schools website &#8211; a look into the past</a> <small>When I was about 16 I hacked my schools website,...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-setup-tucows-opensrs' rel='bookmark' title='Permanent Link: How to setup Tucows OpenSRS'>How to setup Tucows OpenSRS</a> <small>OpensSRS is a domain reseller system offered by Tucows to...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Yesterday I spent some time investigating Google Wave. A very interesting new product from Google. Not only that but an interesting protocol.</p>
<p>If you think about it, Google has mostly only used other protocols for communication in the past, now it&#8217;s creating it&#8217;s own. They clearly want to create a completely new protocol that will effectively be the future of these old primitive protocols.</p>
<p>For this to catch on, it will either have to run directly along side smtp and xmmp or layer on top of them.</p>
<p>We&#8217;re going to need a way to pass requests over http to smtp or pop3/imap, and what better way to do it than with gmail?</p>
<p>Sure, but there&#8217;s no API&#8230;</p>
<p><span id="more-570"></span></p>
<p>It&#8217;s argued that all you need to do is roll your own &#8220;api&#8221; or library class to use smtp and imap server provided by Google Mail (gmail) to send and receive emails.</p>
<p>The problem with this is that you&#8217;re forced to hand the app your username and password. Naturally this raises security concerns.</p>
<p>Of course this isn&#8217;t a big problem if you only use your own username and password and manage to store it on your server security.</p>
<p>The problem comes when others want to use their gmail accounts with your web app. They have not choice but to hand over their username and password. What can possibly go wrong?</p>
<ul>
<li>Their username and password gives you FULL access to their account, including account actions such as changing passwords.</li>
</ul>
<p>My proposal would be for an API that allowed you to interface with gmail, in particular to send emails (which has the biggest scope here).</p>
<p>To access the API you could generate an API Key from within gmail that would allow you to interface with gmail, but limited to mailing functions, rather than account settings.</p>
<p>An alternative to this is similar to the &#8220;GoogleCode.com Password&#8221;, used by project members when checking out or committing source code changes, or when using command-line tools to upload files to the project &#8220;Downloads&#8221; tab.</p>
<p>If you could set a &#8220;Google Mail SMTP Password&#8221; or similar, which would only permit you to access the gmail SMTP server, but not gmail itself, this would also allow you to overcome the security issues mentioned above.</p>
<p>However, this alternative wouldn&#8217;t help towards integration with Google Wave as much as an api would.</p>
<p>In summary, to resolve the security issue an API is an option, but for Google Wave integration too, it&#8217;s essentially a must.</p>
<p>I hope someone at Google reads this and agrees with me, for that matter, I hope you or anyone reading this agrees with me.</p>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/how-not-to-use-phpmailer' rel='bookmark' title='Permanent Link: How not to use PHPMailer'>How not to use PHPMailer</a> <small>I came across PHPMailer usage the other day on a...</small></li>
<li><a href='http://www.hm2k.com/posts/google-adsense-wont-let-me-in' rel='bookmark' title='Permanent Link: Google AdSense won&#8217;t let me in!'>Google AdSense won&#8217;t let me in!</a> <small>Back in 2004, I signed up my old site &#8220;hm2k.org&#8221;...</small></li>
<li><a href='http://www.hm2k.com/posts/hacked-my-school' rel='bookmark' title='Permanent Link: How I hacked my schools website &#8211; a look into the past'>How I hacked my schools website &#8211; a look into the past</a> <small>When I was about 16 I hacked my schools website,...</small></li>
<li><a href='http://www.hm2k.com/posts/how-to-setup-tucows-opensrs' rel='bookmark' title='Permanent Link: How to setup Tucows OpenSRS'>How to setup Tucows OpenSRS</a> <small>OpensSRS is a domain reseller system offered by Tucows to...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/gmail-needs-an-api/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ident Spoofing</title>
		<link>http://www.hm2k.com/posts/ident-spoofing</link>
		<comments>http://www.hm2k.com/posts/ident-spoofing#comments</comments>
		<pubDate>Wed, 14 Oct 2009 12:23:01 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[IRC]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[ident]]></category>
		<category><![CDATA[oidentd]]></category>
		<category><![CDATA[rfc1413]]></category>
		<category><![CDATA[spoofing]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=517</guid>
		<description><![CDATA[Today I wrote about Oidentd on Wikipedia. Ident as per RFC 1413 is used for a few different services, in particular IRC. A feature of oidentd that my users find useful is ident spoofing.
Ident is important on IRC as some servers do not allow you to connect unless you have an ident, while others do, [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/configuring-a-freebsd-irc-shell-server' rel='bookmark' title='Permanent Link: Configuring a FreeBSD IRC Shell Server'>Configuring a FreeBSD IRC Shell Server</a> <small>This is a brief guide created to help configure a...</small></li>
<li><a href='http://www.hm2k.com/posts/freebsd-socks-proxy-for-mirc' rel='bookmark' title='Permanent Link: Setting up a FreeBSD socks proxy server for use with mIRC'>Setting up a FreeBSD socks proxy server for use with mIRC</a> <small>I&#8217;m getting fed up with my current IRC BNC software....</small></li>
<li><a href='http://www.hm2k.com/posts/hm2ks-code-repository' rel='bookmark' title='Permanent Link: HM2K&#8217;s code repository'>HM2K&#8217;s code repository</a> <small>HM2K&#8217;s code repository is now open for business! This repository...</small></li>
<li><a href='http://www.hm2k.com/posts/efnet-uk' rel='bookmark' title='Permanent Link: EFnet UK'>EFnet UK</a> <small>On Sunday July 19 2009 Hardy announced on the EFnet...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Today I wrote about <a href="http://en.wikipedia.org/wiki/Oidentd">Oidentd</a> on Wikipedia. <a href="http://en.wikipedia.org/wiki/Ident">Ident</a> as per <a href="http://tools.ietf.org/html/rfc1413">RFC 1413</a> is used for a few different services, in particular <a href="http://en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</a>. A feature of oidentd that my users find useful is ident spoofing.</p>
<p><span id="more-517"></span>Ident is important on IRC as some servers do not allow you to connect unless you have an ident, while others do, you find yourself with a tide (~) prefix before your username. These are sometimes banned. For example:</p>
<blockquote><p>HM2K!HM2K@ROFL.name</p>
<p><em>#This is an example of a real user with a real ident</em></p>
<p>baduser!~asdfg@123.123.123.123</p>
<p><em>#This is an example of a possible exploited system</em></p></blockquote>
<p>Generally the ident server (such as oidentd) will return the user&#8217;s username as the ident when it is requested, however on my servers, I allow some of my users to spoof their ident.</p>
<p>This means they can change their ident to whatever they like, regardless of their username.</p>
<p>To do this, you need to create the <a href="http://linux.die.net/man/5/oidentd.conf"><em>$HOME/.oidentd.conf</em></a> file, with the following content:</p>
<blockquote><p>global { reply &#8216;$ident&#8217;}</p>
<p><em>#Note: Where $ident is, replace with the ident you want.</em></p></blockquote>
<p>I know some users find this a bit difficult or confusing, so I created a script to do it for them.</p>
<ul>
<li><a href="http://hm2k.googlecode.com/svn/trunk/code/shell/setident.sh">setident.sh</a> &#8211; A script used to set your ident</li>
</ul>
<p>It&#8217;s works fine using the sh unix shell on FreeBSD.</p>
<p>If you are on my shell servers, you should be able to take advantage of this using the &#8220;setident&#8221; command.</p>
<p>Enjoy!</p>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/configuring-a-freebsd-irc-shell-server' rel='bookmark' title='Permanent Link: Configuring a FreeBSD IRC Shell Server'>Configuring a FreeBSD IRC Shell Server</a> <small>This is a brief guide created to help configure a...</small></li>
<li><a href='http://www.hm2k.com/posts/freebsd-socks-proxy-for-mirc' rel='bookmark' title='Permanent Link: Setting up a FreeBSD socks proxy server for use with mIRC'>Setting up a FreeBSD socks proxy server for use with mIRC</a> <small>I&#8217;m getting fed up with my current IRC BNC software....</small></li>
<li><a href='http://www.hm2k.com/posts/hm2ks-code-repository' rel='bookmark' title='Permanent Link: HM2K&#8217;s code repository'>HM2K&#8217;s code repository</a> <small>HM2K&#8217;s code repository is now open for business! This repository...</small></li>
<li><a href='http://www.hm2k.com/posts/efnet-uk' rel='bookmark' title='Permanent Link: EFnet UK'>EFnet UK</a> <small>On Sunday July 19 2009 Hardy announced on the EFnet...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/ident-spoofing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>W32Dasm</title>
		<link>http://www.hm2k.com/posts/w32dasm</link>
		<comments>http://www.hm2k.com/posts/w32dasm#comments</comments>
		<pubDate>Tue, 13 Oct 2009 15:55:43 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[disassembler]]></category>
		<category><![CDATA[w32dasm]]></category>
		<category><![CDATA[win32dasm]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=526</guid>
		<description><![CDATA[W32Dasm (or Win32DASM) doesn&#8217;t seem to exist on the map any more, but it&#8217;s still a very useful programmers tool, especially if you like reverse engineering.
W32Dasm is a Windows 32-bit (Win32) disassembler. What it does is display the programs routines in assembly code, which makes it easier for you to trace what the software is [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>W32Dasm (or Win32DASM) doesn&#8217;t seem to exist on the map any more, but it&#8217;s still a very useful programmers tool, especially if you like reverse engineering.</p>
<p>W32Dasm is a Windows 32-bit (Win32) <a href="http://en.wikipedia.org/wiki/Disassembler">disassembler</a>. What it does is display the programs routines in assembly code, which makes it easier for you to trace what the software is doing.</p>
<p>I like to use this software every once in a while, but recently I found there were no decent sources for this software.</p>
<p><span id="more-526"></span>However, I soon located a copy that I had on my computer from a while back, in a directory named &#8220;w32ds893&#8243;.</p>
<p>The help file details a website which appears to be down, but there is an archived version.</p>
<blockquote><p><a href="http://web.archive.org/web/20020203211452/http://www.expage.com/page/w32dasm">http://www.expage.com/page/w32dasm</a></p></blockquote>
<p>This takes you to another now defunct site, which is also archived:</p>
<blockquote><p><a href="http://web.archive.org/web/20020204180925/http://members.home.net/w32dasm/">members.home.net/w32dasm/</a></p></blockquote>
<p>As you can see from that page you can download w32dasm v8.7 as w32ds87.zip, but not the latest version.</p>
<blockquote><p>I&#8217;ve uploaded <a href="http://www.megaupload.com/?d=ZDRI71UF">w32ds893.zip</a> for you. This contains &#8220;<strong>W32DSM89.EXE</strong>&#8220;, which is the latest version.</p></blockquote>
<p>I don&#8217;t know where this was originally sourced from, but I know it works fine.</p>
<p><em>Note: If you have any questions or know of any updates, please feel free to add a comment below. Thanks.</em></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/w32dasm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>cssbase</title>
		<link>http://www.hm2k.com/posts/cssbase</link>
		<comments>http://www.hm2k.com/posts/cssbase#comments</comments>
		<pubDate>Wed, 23 Sep 2009 09:02:23 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[cssbase]]></category>
		<category><![CDATA[efnet]]></category>
		<category><![CDATA[google code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[IRC]]></category>
		<category><![CDATA[nrgetik]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=512</guid>
		<description><![CDATA[Yesterday marks the day that I took over the &#8220;cssbase&#8221; project.
CSSbase is a html and css base framework that has been developed to make web site development quicker and more efficient.
I hope to continue to maintain this project for all to use freely.

The project was started by nrgetik, however he passed away on Sunday June [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Yesterday marks the day that I took over the &#8220;<a href="http://code.google.com/p/cssbase/">cssbase</a>&#8221; project.</p>
<p><em>CSSbase</em> is a html and css base framework that has been developed to make web site development quicker and more efficient.</p>
<p>I hope to continue to maintain this project for all to use freely.</p>
<p><span id="more-512"></span></p>
<p>The project was started by <a href="http://nrgetik.com/">nrgetik</a>, however he <a href="http://www.dogsonacid.com/showthread.php?threadid=634218">passed away</a> on Sunday June 14, 2009. I didn&#8217;t know nrgetik that well on a personal level, but he was considered one of us in the webdev and css communities on EFnet. He was very much an integral part of our community and will be missed.</p>
<p>A while back I decided that I would like to take on this project and maintain it in his memory. I thought it would be best to let a little time pass before I muscled in and took over the project. I felt enough time had passed.</p>
<p>I contacted Google via their Hosting at Google Code Group, I asked the question &#8220;<a href="http://groups.google.com/group/google-code-hosting/browse_thread/thread/4d6061b1c73cbe1b">What do you do if the project owner dies?</a>&#8221; and after a bumpy start I was eventually in touch with a very helpful Google employee, who assisted me with the project transfer.</p>
<p>The project is now in my ownership and I will continue to maintain it in his memory.</p>
<blockquote><p>This is for you good buddy!</p></blockquote>
<p>Please help to test and give useful and helpful feedback to improve it. As nrgetik would have wanted it.</p>
<p>If you like the sound of this project, use it, or would like to get involved, let me know!</p>
<p>Thanks.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/cssbase/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery sucks at browser detection</title>
		<link>http://www.hm2k.com/posts/jquery-sucks-at-browser-detection</link>
		<comments>http://www.hm2k.com/posts/jquery-sucks-at-browser-detection#comments</comments>
		<pubDate>Tue, 22 Sep 2009 16:16:18 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[layout engine]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[sniffer]]></category>
		<category><![CDATA[useragent]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=507</guid>
		<description><![CDATA[This week i&#8217;ve been tweaking a little site I&#8217;ve started called &#8220;ismybrowseruptodate.com&#8220;, which is designed to assist people who don&#8217;t know whether their browser is up-to-date or not.
At first I thought this would be simple, because I knew jQuery had browser detection and had a variable called jQuery.browser.version, which would be very useful for checking [...]


Related posts:<ol><li><a href='http://www.hm2k.com/posts/css-seo' rel='bookmark' title='Permanent Link: Does using CSS affect SEO?'>Does using CSS affect SEO?</a> <small>I get asked this question time and time again. People...</small></li>
<li><a href='http://www.hm2k.com/posts/why-aol-sucks' rel='bookmark' title='Permanent Link: Why AOL sucks'>Why AOL sucks</a> <small> I have a client that is currently on AOL,...</small></li>
<li><a href='http://www.hm2k.com/posts/how-not-to-use-phpmailer' rel='bookmark' title='Permanent Link: How not to use PHPMailer'>How not to use PHPMailer</a> <small>I came across PHPMailer usage the other day on a...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This week i&#8217;ve been tweaking a little site I&#8217;ve started called &#8220;<a href="http://ismybrowseruptodate.com/">ismybrowseruptodate.com</a>&#8220;, which is designed to assist people who don&#8217;t know whether their browser is up-to-date or not.</p>
<p>At first I thought this would be simple, because I knew jQuery had browser detection and had a variable called <a href="http://docs.jquery.com/Utilities/jQuery.browser.version">jQuery.browser.version</a>, which would be very useful for checking the browser version, or so I thought.</p>
<p><span id="more-507"></span>Don&#8217;t get me wrong here, I think jQuery is a fantastic javascript framework and is great at helping you to avoid reinventing the wheel, but it sucks at browser detection!</p>
<p>On closer inspection I see that jQuery is deprecating this variable in place for better ways of <a href="http://xkr.us/js/detect">browser detection</a>, namely by <a href="http://developer.apple.com/internet/webcontent/objectdetection.html">not detecting the browser, but detecting technologies (via objects)</a> instead.</p>
<p>As such, you can already see evidence of the jQuery team <a href="http://www.reddit.com/r/programming/comments/7l2mr/jquery_removes_all_browser_sniffing/">deprecating the browser sniffing</a> by removing references to the jquery.browser variable.</p>
<p>The problem is that even now it still exists in jQuery because it is being used for backwards compatibility and by plugins. It can&#8217;t just be removed, so it must still be maintained.</p>
<p>As we know, jQuery sucks at browser detection because they&#8217;ve been detecting by browser, instead of by technologies all along, so what else is new?</p>
<p>Not long ago Opera Software released the latest version of their <a href="http://www.opera.com/">Opera Browser</a>, which is version 10, however, during trials they came across some issues where some sites would detect the wrong version, forcing Opera to <a href="http://dev.opera.com/articles/view/opera-ua-string-changes/">make changes to Opera&#8217;s user agent string</a>.</p>
<p>Guess what?</p>
<p>jQuery is detecting the wrong version number for Opera. It&#8217;s detecting &#8220;Opera v10&#8243; as &#8220;Opera v9.80&#8243;.</p>
<p>However, in this instance it isn&#8217;t much of a problem because jQuery is moving it&#8217;s dependencies away from browser sniffing to technology detection, and opera made changes to their user agent string to handle it.</p>
<p>So what is the problem?</p>
<p>The problem is that jQuery is not maintained to cope with the changes to the user agent string and that they are getting engine versions confused with browser versions. Let&#8217;s take a look at the <a href="http://dev.jquery.com/export/6582/trunk/jquery/src/core.js">actual core code</a>:</p>
<blockquote><p>(userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) [0,'0'])[1]</p></blockquote>
<p>As you can see it has 4 checks&#8230;</p>
<ul>
<li>rv=Revision of the Gecko &#8220;layout engine&#8221;.</li>
<li>it=Version of the WebKit &#8220;layout engine&#8221;.</li>
<li>ra=Version of Opera, and NOT &#8220;Presto&#8221; it&#8217;s layout engine.</li>
<li>ie=Version of Internet Explorer, but NOT &#8220;Trident&#8221; it&#8217;s layout engine.</li>
</ul>
<p>After that you can see the browser checks it does&#8230;</p>
<blockquote><p>safari: /webkit/.test( userAgent ),<br />
opera: /opera/.test( userAgent ),<br />
msie: /msie/.test( userAgent ) &amp;&amp; !/opera/.test( userAgent ),<br />
mozilla: /mozilla/.test( userAgent ) &amp;&amp; !/(compatible|webkit)/.test( userAgent )</p></blockquote>
<p>As you can see, it lists 4 browsers, some test for the layout engine, some test for the browser name, mozilla is a test for neither and what about Google Chrome?</p>
<p>The problem is that many browsers use the same layout engine, but may result in different version numbers.</p>
<p>So, the question is, are we detecting the <a href="http://en.wikipedia.org/wiki/Web_browser">web browser</a> or the <a href="http://en.wikipedia.org/wiki/Layout_engine">layout engine</a>?</p>
<p>If it&#8217;s browsers, the version match is all wrong and doesn&#8217;t consider the changes made to Opera&#8217;s user agent string; and if it&#8217;s layout engines it&#8217;s detecting the wrong version numbers from the browser rather than the engine.</p>
<p>For jQuery at least, considering there are only about <a href="http://en.wikipedia.org/wiki/List_of_layout_engines">20 notable layout engines</a>, it would make more sense to match those rather than the literally hundreds of browsers, many of which are based on the same layout engine.</p>
<p>So how do we fix this?</p>
<p>It depends what you want to detect, whether it be the browser or the layout engine. The problem is that if you change this now, older code will no longer be compatible, as the problem with version numbers will arise.</p>
<p>I have raised this as a bug <a href="http://dev.jquery.com/ticket/5279">#5279</a> with the jQuery team, but I don&#8217;t expect much to be done about it.</p>
<p>Instead, I have created and am using a better browser sniffer on &#8220;<a href="http://ismybrowseruptodate.com/">ismybrowseruptodate.com</a>&#8221; in javascript, however at the moment it is not open source code. If you are interested, let me know and I will release it as open source, along with the layout engine sniffer and detection I started developing too.</p>
<p>Enjoy!</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 452px; width: 1px; height: 1px;">// Use of jQuery.browser is deprecated.<br />
// It&#8217;s included for backwards compatibility and plugins,<br />
// although they should work to migrate away.<br />
browser: {<br />
version: (/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/.exec(userAgent) || [0,'0'])[1],<br />
safari: /webkit/.test( userAgent ),<br />
opera: /opera/.test( userAgent ),<br />
msie: /msie/.test( userAgent ) &amp;&amp; !/opera/.test( userAgent ),<br />
mozilla: /mozilla/.test( userAgent ) &amp;&amp; !/(compatible|webkit)/.test( userAgent )<br />
}</div>


<p>Related posts:<ol><li><a href='http://www.hm2k.com/posts/css-seo' rel='bookmark' title='Permanent Link: Does using CSS affect SEO?'>Does using CSS affect SEO?</a> <small>I get asked this question time and time again. People...</small></li>
<li><a href='http://www.hm2k.com/posts/why-aol-sucks' rel='bookmark' title='Permanent Link: Why AOL sucks'>Why AOL sucks</a> <small> I have a client that is currently on AOL,...</small></li>
<li><a href='http://www.hm2k.com/posts/how-not-to-use-phpmailer' rel='bookmark' title='Permanent Link: How not to use PHPMailer'>How not to use PHPMailer</a> <small>I came across PHPMailer usage the other day on a...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/jquery-sucks-at-browser-detection/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
