<?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>Thu, 25 Feb 2010 22:02:20 +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>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[<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, but 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>
]]></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, but 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>
]]></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[<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>
]]></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>
]]></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[<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>
]]></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>
]]></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[<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 weather.tcl, I realised that my worldtime.tcl had passed it&#8217;s sell by date and had now expired.</p>
<p>My old worldtime.tcl which was based on a script by Murf which used worldtimeserver.com to gather it&#8217;s data had stopped working.</p>
<p>It would seem that worldtimeserver.com 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>I discovered that on Linux based systems (including FreeBSD) the time zone information was stored locally.</p>
<blockquote><p>/usr/share/zoneinfo/</p></blockquote>
<p>Using a bit of Google magic, I managed to locate a few pre-made procedures to help me read the time zone information.</p>
<ul>
<li><a href="http://alice.wu-wien.ac.at:8000/xowiki/load-timezones.tcl">load-timezones.tcl</a>
<ul>
<li>get_tz_names</li>
<li>get_tz_rules</li>
</ul>
</li>
</ul>
<p>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.</p>
<p>At the moment, because it reads the time zone files that are only available on Linux based systems, it will not work on windrops.</p>
<p>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.</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>
]]></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 weather.tcl, I realised that my worldtime.tcl had passed it&#8217;s sell by date and had now expired.</p>
<p>My old worldtime.tcl which was based on a script by Murf which used worldtimeserver.com to gather it&#8217;s data had stopped working.</p>
<p>It would seem that worldtimeserver.com 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>I discovered that on Linux based systems (including FreeBSD) the time zone information was stored locally.</p>
<blockquote><p>/usr/share/zoneinfo/</p></blockquote>
<p>Using a bit of Google magic, I managed to locate a few pre-made procedures to help me read the time zone information.</p>
<ul>
<li><a href="http://alice.wu-wien.ac.at:8000/xowiki/load-timezones.tcl">load-timezones.tcl</a>
<ul>
<li>get_tz_names</li>
<li>get_tz_rules</li>
</ul>
</li>
</ul>
<p>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.</p>
<p>At the moment, because it reads the time zone files that are only available on Linux based systems, it will not work on windrops.</p>
<p>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.</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>
]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/worldtime-tcl/feed</wfw:commentRss>
		<slash:comments>3</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[<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>
]]></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>
]]></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[<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>
]]></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>
]]></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[<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>
]]></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>
]]></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[<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>
]]></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>
]]></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[<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>
]]></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>
]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/jquery-sucks-at-browser-detection/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lame Botnet</title>
		<link>http://www.hm2k.com/posts/lame-botnet</link>
		<comments>http://www.hm2k.com/posts/lame-botnet#comments</comments>
		<pubDate>Fri, 04 Sep 2009 11:23:25 +0000</pubDate>
		<dc:creator>hm2k</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[IRC]]></category>
		<category><![CDATA[botnet]]></category>
		<category><![CDATA[efnet]]></category>
		<category><![CDATA[eggdrop]]></category>
		<category><![CDATA[harry.tcl]]></category>
		<category><![CDATA[lame]]></category>
		<category><![CDATA[TCL]]></category>

		<guid isPermaLink="false">http://www.hm2k.com/?p=491</guid>
		<description><![CDATA[<p>Yes, my botnet is pretty lame, but it&#8217;s also kinda cool. I&#8217;m not talking about anything bad though.</p>
<p>My botnet is an <a href="http://en.wikipedia.org/wiki/Eggdrop">eggdrop</a> botnet that I use on the <a href="http://www.efnet.org/">EFnet</a> <a href="http://en.wikipedia.org/wiki/IRC">IRC</a> network and it runs a script I called &#8220;lame&#8221;.</p>
<p><span id="more-491"></span></p>
<p>The script my botnet uses written in <a href="http://www.tcl.tk/">tcl</a> was originally created by unknownd, but has since stopped development.</p>
<p>I know that he stopped development because not only did I speak to him before he quit IRC, but <a href="http://web.archive.org/web/*/http://unknownd.daer.net/">all</a> <a href="http://web.archive.org/web/*/http://home.no.net/unknownd/">his</a> <a href="http://web.archive.org/web/*/www.unknownd.net">sites</a> are no longer available.</p>
<blockquote><p>UnKnownD &#8211; unknownd@dialdown.the.switch.uten.net parted #serialz on October 3 2001 2:24:31pm</p></blockquote>
<p>The script was originally called &#8220;<a href="http://www.google.com/search?q=harry.tcl">harry.tcl</a>&#8220;, but it had a <a href="http://forum.egghelp.org/viewtopic.php?p=80267">few bugs</a>, so I decided to fix them and call it lame.</p>
<p>Don&#8217;t get me wrong, it&#8217;s a fantastic script, but what I had was pretty lame, as it was just a hacked up version of someone else&#8217;s script but I only used it for my own personal botnet, so it didn&#8217;t really matter.</p>
<p>However, I now realise that it is actually better than the original <em>harry.tcl</em> because of the bugs I have fixed and the tweaks I added.</p>
<p>A few people over the years have shown a little interest in my botnet script, so I think it&#8217;s about time that I released it.</p>
<p><em>So where do I get the goodies?</em></p>
<p>I&#8217;ve setup a project hosting on Google Code as &#8220;<a href="http://lamebotnet.googlecode.com/">lamebotnet</a>&#8220;.</p>
<p>There&#8217;s no &#8220;release&#8221; as such yet, but you can get the files you need <a href="http://lamebotnet.googlecode.com/svn/trunk/">here</a>, you only need to really follow the instructions in the<a href="http://lamebotnet.googlecode.com/svn/trunk/readme.txt"> readme</a> file.</p>
<p>Don&#8217;t forget to configure your &#8220;<a href="http://lamebotnet.googlecode.com/svn/trunk/botnet">botnet</a>&#8221; file, otherwise your bots won&#8217;t know where to connect.</p>
<p>I am aware that by releasing the script I may make myself more vulnerable to exploitation and people may <a href="http://code.google.com/p/lamebotnet/issues/list">point out issues or bugs</a> I wasn&#8217;t aware of, but hey, I&#8217;m all for improvement and look forward to fixing them.</p>
<p>Of course, this is assuming there even are any issues, there may not be, I&#8217;ve run this since about 2001 and had no major issues yet, so my hopes are pretty high.</p>
<p>Enjoy!</p>
<p><em>PS. Think of your own naming scheme for your botnet, I&#8217;m already using the muppets!</em></p>
]]></description>
			<content:encoded><![CDATA[<p>Yes, my botnet is pretty lame, but it&#8217;s also kinda cool. I&#8217;m not talking about anything bad though.</p>
<p>My botnet is an <a href="http://en.wikipedia.org/wiki/Eggdrop">eggdrop</a> botnet that I use on the <a href="http://www.efnet.org/">EFnet</a> <a href="http://en.wikipedia.org/wiki/IRC">IRC</a> network and it runs a script I called &#8220;lame&#8221;.</p>
<p><span id="more-491"></span></p>
<p>The script my botnet uses written in <a href="http://www.tcl.tk/">tcl</a> was originally created by unknownd, but has since stopped development.</p>
<p>I know that he stopped development because not only did I speak to him before he quit IRC, but <a href="http://web.archive.org/web/*/http://unknownd.daer.net/">all</a> <a href="http://web.archive.org/web/*/http://home.no.net/unknownd/">his</a> <a href="http://web.archive.org/web/*/www.unknownd.net">sites</a> are no longer available.</p>
<blockquote><p>UnKnownD &#8211; unknownd@dialdown.the.switch.uten.net parted #serialz on October 3 2001 2:24:31pm</p></blockquote>
<p>The script was originally called &#8220;<a href="http://www.google.com/search?q=harry.tcl">harry.tcl</a>&#8220;, but it had a <a href="http://forum.egghelp.org/viewtopic.php?p=80267">few bugs</a>, so I decided to fix them and call it lame.</p>
<p>Don&#8217;t get me wrong, it&#8217;s a fantastic script, but what I had was pretty lame, as it was just a hacked up version of someone else&#8217;s script but I only used it for my own personal botnet, so it didn&#8217;t really matter.</p>
<p>However, I now realise that it is actually better than the original <em>harry.tcl</em> because of the bugs I have fixed and the tweaks I added.</p>
<p>A few people over the years have shown a little interest in my botnet script, so I think it&#8217;s about time that I released it.</p>
<p><em>So where do I get the goodies?</em></p>
<p>I&#8217;ve setup a project hosting on Google Code as &#8220;<a href="http://lamebotnet.googlecode.com/">lamebotnet</a>&#8220;.</p>
<p>There&#8217;s no &#8220;release&#8221; as such yet, but you can get the files you need <a href="http://lamebotnet.googlecode.com/svn/trunk/">here</a>, you only need to really follow the instructions in the<a href="http://lamebotnet.googlecode.com/svn/trunk/readme.txt"> readme</a> file.</p>
<p>Don&#8217;t forget to configure your &#8220;<a href="http://lamebotnet.googlecode.com/svn/trunk/botnet">botnet</a>&#8221; file, otherwise your bots won&#8217;t know where to connect.</p>
<p>I am aware that by releasing the script I may make myself more vulnerable to exploitation and people may <a href="http://code.google.com/p/lamebotnet/issues/list">point out issues or bugs</a> I wasn&#8217;t aware of, but hey, I&#8217;m all for improvement and look forward to fixing them.</p>
<p>Of course, this is assuming there even are any issues, there may not be, I&#8217;ve run this since about 2001 and had no major issues yet, so my hopes are pretty high.</p>
<p>Enjoy!</p>
<p><em>PS. Think of your own naming scheme for your botnet, I&#8217;m already using the muppets!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hm2k.com/posts/lame-botnet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
