<?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>habdas.org</title>
	<atom:link href="http://www.habdas.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.habdas.org</link>
	<description>The technical blog of Josh Habdas</description>
	<lastBuildDate>Thu, 02 Sep 2010 02:06:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Running Android on the HTC HD2 Leo</title>
		<link>http://www.habdas.org/2010/08/21/running-android-on-htc-hd2-leo/</link>
		<comments>http://www.habdas.org/2010/08/21/running-android-on-htc-hd2-leo/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 06:48:15 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Mobile Computing]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[modding]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=1302</guid>
		<description><![CDATA[After spending the last few weeks on the HD2 Android Development forums at XDA I learned how to coerce my T-Mobile HTC HD2 into running Android. As of today I&#8217;ve got Android Froyo running with few issues and reasonable battery life. In this post I&#8217;ll explain how how you can run Android on your HD2 [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1319" class="wp-caption alignright" style="width: 310px"><a href="http://www.habdas.org/wp-content/uploads/2010/08/100_1698.jpg"><img class="size-medium wp-image-1319 " title="HD2 running Android Froyo" src="http://www.habdas.org/wp-content/uploads/2010/08/100_1698-300x199.jpg" alt="" width="300" height="199" /></a><p class="wp-caption-text">HD2 running Darkstone Froyo 2.1</p></div>
<p>After spending the last few weeks on the <a href="http://forum.xda-developers.com/forumdisplay.php?f=735">HD2 Android Development forums</a> at XDA I learned how to coerce my <span style="white-space: nowrap;">T-Mobile</span> HTC HD2 into running Android. As of today I&#8217;ve got Android Froyo running with few issues and reasonable battery life. In this post I&#8217;ll explain how how you can run Android on your HD2 Leo.</p>
<p><span id="more-1302"></span></p>
<blockquote style="font-size:1.2em"><p>Before starting this tutorial, you can try out Android on the HD2 by skipping ahead to <a href="#install-android">install Android</a>.</p></blockquote>
<p><strong>First, flash the boot loader.</strong> Doing so will allow you to replace windows mobile with custom roms better suited for running Android. I&#8217;ve flashed two HD2&#8242;s with Cotulla&#8217;s <a href="http://www.xda-developers.com/windows-mobile/hspl3-released-for-hd2/">HSPL3</a> boot loader and haven&#8217;t had any issues.</p>
<p>With the new boot loader installed, <strong>flash the windows rom</strong>. Find a good replacement rom that will load Android quickly and run it stably. Roms I&#8217;ve found worked well with the HD2 Android builds are Miri and Chucky ROMs. Check <a href="http://forum.xda-developers.com/forumdisplay.php?f=534">XDA</a> and <a href="http://htcpedia.com/">htcpedia</a> for custom roms.</p>
<p>Next <strong>reformat the SD card</strong>. Don&#8217;t forget to back-up your data first.</p>
<p><a name="install-android"></a>With a fresh file system on the SD card you&#8217;re ready to <strong>install Android</strong>. Download and install any of the recent HD2 Android builds from <a href="http://forum.xda-developers.com/forumdisplay.php?f=735">the forums on XDA</a> and you should be all set. My favorite builds right now are the near-stock Froyo builds created by darkstone.</p>
<p>Once you&#8217;ve got Android installed, <strong>make running it easier</strong>. <a href="http://forum.xda-developers.com/showthread.php?t=737001">Exceller Multiple Build Loader</a> provides a nice interface for booting into Windows or Android automatically after the phone powers on. There is also support for booting into Ubuntu, if you&#8217;re into that sort of thing.</p>
<p><strong>Govern Android battery consumption.</strong> SetCPU can be used to manage clock speeds, making it easy to reduce power consumption. It can be downloaded from the Market at a cost, or <a href="http://forum.xda-developers.com/showthread.php?t=505419">here for free</a>. (Note: Free version requires <a href="http://developer.android.com/guide/developing/tools/adb.html">adb</a> to install.) Try setting a &#8220;Screen Off&#8221; profile that limits the CPU usage to 245 max to prevent much of the battery drain associated with sleep mode.</p>
<p>If you experience issues in the Android OS, <strong>try upgrading the radio</strong>. Though something I overlooked at first, upgrading the radio seems to have helped me prevent <abbr title="Sleep of Death">SoD</abbr> from occurring as often. Grab a new radio from the forums at XDA.</p>
<p>With enough tweaking your phone should be running Android issue-free all day with acceptable battery life. If not, keep messing with it. Try downloading a different Android rom or swapping in a newer <a href="http://oe.netripper.com/files/htcleo_autobuild/">Linux kernel image</a> (zImage) to find the one that works best with your build. Learn from experience by checking out others&#8217; reply signatures on the <a href="http://forum.xda-developers.com/forumdisplay.php?f=735">forums on xda</a> and <a href="http://htcpedia.com/forum/forumdisplay.php?f=141">htcpedia</a>.</p>
<p>Here&#8217;s my current setup:</p>
<p><strong>Device:</strong> TMOUS HTC HD2<br />
<strong> Boot Loader:</strong> CotullaHSPL (SPL-2.08-HSPL)<br />
<strong> WinMo Rom:</strong> ChuckyROM-23134-Tabtastic-TMOUS.Aug.30<br />
<strong> Radio:</strong> 2.12.50.02.2<br />
<strong> Android build:</strong> darkstone HD2Froyo V2.1<br />
<strong> Launcher:</strong> EBL2.0d_PlusUbuntu</p>
<p>Happy modding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2010/08/21/running-android-on-htc-hd2-leo/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MSIE 4095 Selector Limit</title>
		<link>http://www.habdas.org/2010/05/30/msie-4095-selector-limit/</link>
		<comments>http://www.habdas.org/2010/05/30/msie-4095-selector-limit/#comments</comments>
		<pubDate>Sun, 30 May 2010 17:50:31 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browser compatibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[debugging tools]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=1250</guid>
		<description><![CDATA[Web applications concatenate CSS files to improve performance, which can result in large numbers of style rules in a single file. Enter the 4095 selector limitation for IE browsers. An IE bug whereby the browser will only apply style for the first 4095 selectors declared per file. Impacted browsers include IE6, IE7, IE8 and IE9. [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="font-weight: normal; font-size: 13px;">Web applications concatenate CSS files to improve performance, which can result in large numbers of style rules in a single file. </span><span style="font-weight: normal; font-size: 13px;">Enter the <a href="http://marc.baffl.co.uk/browser_bugs/css-selector-limit/">4095 selector limitation for IE browsers</a>. An IE bug whereby the browser will only apply style for the first 4095 selectors declared per file. Impacted browsers include IE6, IE7, IE8 and IE9.</span></h3>
<p><span style="font-weight: normal; font-size: 13px;"><span id="more-1250"></span></span></p>
<h3>Identification</h3>
<h3><span style="font-weight: normal; font-size: 13px;">Look for IE-only display issues (outside the norm) when CSS files contain many style rules. Rules near the bottom of the stylesheet will not be applied. </span><span style="font-weight: normal; font-size: 13px;">The issue can be confirmed with the IE dev toolbar. To do so use dev toolbar to save off the CSS file downloaded from the web server, and then scroll to the bottom of the CSS tab in the toolbar (assumes IE8 dev tools). Compare the last style rule displayed in the tab with the last rule in the actual file itself. If they do not match, and the CSS is valid, the limit has been reached.</span></h3>
<h3>Solution</h3>
<p>Reduce the number of CSS selectors per file to a number less than 4096. Several approaches for doing so include:</p>
<ul>
<li>Refactoring existing CSS</li>
<li>Splitting the CSS payload into multiple files</li>
<li>Reevaluating current browser support strategy (wink, wink)</li>
</ul>
<p>If the stylesheet under scrutiny contains IE-only hacks interspersed with standards compliant CSS, consider moving the hacks into a separate file and using <a href="http://www.quirksmode.org/css/condcom.html">Conditional Comments</a> to pull them in. Otherwise, the best option may be to split the CSS payload into multiple files–resulting in an extra HTTP request for all browsers, not just IE. Reevaluating browser support is another option, but probably not feasible for large-scale applications.</p>
<p>Regardless of which approach is taken, something will need to be done for IE once the per-file limit is reached. Though 4095 selectors ought to be enough for anybody&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2010/05/30/msie-4095-selector-limit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anatomy of a Google 302 Redirect Hijack</title>
		<link>http://www.habdas.org/2009/10/18/google-302-redirect-hijack/</link>
		<comments>http://www.habdas.org/2009/10/18/google-302-redirect-hijack/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 00:48:07 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Digital Security]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[proxies]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[social engineering]]></category>
		<category><![CDATA[user agent]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=921</guid>
		<description><![CDATA[Recently while Googling &#8220;Olla de Carne&#8221; (Costa Rican beef stew) my browser was hijacked after taking a search results link. Rather than receiving a list of ingredients, the link redirected the browser to a bogus antivirus site that mimicked Windows and faked an integrated Explorer virus scan (see screenshot below or watch the video). After a few [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-weight: normal; font-size: 13px;">Recently while Googling &#8220;Olla de Carne&#8221; (Costa Rican beef stew) my browser was <a href="http://en.wikipedia.org/wiki/Page_hijacking">hijacked</a> after taking a search results link. Rather than receiving a list of ingredients, the link redirected the browser to a bogus antivirus site that mimicked Windows and faked an integrated Explorer virus scan (see screenshot below or <a class="youtube" href="http://www.youtube.com/v/gnZSOMdp9oI">watch the video</a>).</span></p>
<p><span style="font-weight: normal; font-size: 13px;"><span id="more-921"></span></span></p>
<div id="attachment_1017" class="wp-caption alignright" style="width: 310px"><a class="youtube" href="http://www.youtube.com/v/gnZSOMdp9oI"><img class="size-medium wp-image-1017" title="Fake Scan" src="http://www.habdas.org/wp-content/uploads/2009/10/totalscam-fauxdialog-300x248.png" alt="Fake virus scan running in Google Chrome" width="300" height="248" /></a><p class="wp-caption-text">Fake virus scan running in Google Chrome</p></div>
<p>After a few seconds on the page the following occurred:</p>
<ul>
<li>Result page successfully hijacked and a faux Windows Explorer interface loaded.</li>
<li>A fake virus scan ran in the look-alike Explorer window, conveniently uncovering trojans and other malware.</li>
<li>Alerts, dialogs and phony windows displayed in an attempt to execute a little <a href="http://en.wikipedia.org/wiki/Social_engineering_(security)">social engineering</a>.</li>
</ul>
<p>After attempting to interact with the document the following occurred:</p>
<ul>
<li>A potentially threatening program file download initiated if you clicked on anything in the page.</li>
<li>Additional warning dialog and pop-up window displayed on attempting to unload the page (e.g. hit the back button).</li>
<li>Intermittently, the Google Chrome 3.0 back-button and tab [x] icon stopped functioning as expected.</li>
</ul>
<p>The last point was of particular interest at first, as it is not like modern browsers to allow websites to modify browser functionality. But after some additional research, it was clear the hijack was more complex than a page titled with search engine optimization in mind. This article will study the hijacking in some technical detail, discuss the <a href="http://en.wikipedia.org/wiki/Black_hat_SEO">black hat SEO</a> likely used to get the rogue application listed on Google and how the app was able modify the expected functionality of browser controls in Chrome 3.0.</p>
<h3>The bait and switch</h3>
<p>How does activating a seemingly innocuous (and tasty) link from Google land someone on a potentially dangerous page? 302. <a href="http://en.wikipedia.org/wiki/HTTP_302">HTTP 302</a> that is.</p>
<p>After locating the offending link on Google, I used a client-side proxy to trap the HTTP headers for a play-by-play review:</p>
<pre>GET http://woodstockfolkmusic.com/bftwe/tiijy/carne.php HTTP/1.1
HTTP/1.1 302 Found
GET http://goodstats1.net/in.cgi?2 HTTP/1.1
HTTP/1.1 302 Found
GET http://sunstats1.net/in.cgi?default HTTP/1.1
HTTP/1.1 302 Found
GET http://sunstats1.net/redirect3/ HTTP/1.1
HTTP/1.1 302 Found
GET http://bookletantcars.cn/?pid=283s01&amp;sid=2a15a0 HTTP/1.1
HTTP/1.1 302 Found
GET http://wwwantispyware10.com/scan1/?pid=283s1&amp;engine=%3D3W59jDuNTIuMTUxLjE1MyZ0aW1lPTEyNTE2NYcMOAkN HTTP/1.1
HTTP/1.1 200 OK</pre>
<p>Stepping through the sequence we can see the initial GET request followed by a 302 redirect response. Several redirects later and the browser successfully arrives at destination malware, beef stew long forgotten.</p>
<h3>Black hat inside</h3>
<p>The next thing I tried was to analyze the <a href="http://www.habdas.org/wp-content/uploads/2009/10/carne.php">source of the PHP file</a> cataloged by Google, which was not difficult for two reasons:</p>
<ol>
<li>Directory listing was enabled on the web server, and</li>
<li>Navigating directly to the PHP file caused the page to load without redirect.</li>
</ol>
<p>The PHP file was stowed away on <a href="http://woodstockfolkmusic.com/">woodstockfolkmusic.com</a> (which appears to be a legitimate folk music site based out of Illinois) along with some 300 similar PHP files, covering a range of topics from Alba to Wisconsin. The files found contained mostly deprecated HTML markup (remember the &lt;marquee&gt; tag anyone?) and no PHP script or META tags. The files were <a href="http://en.wikipedia.org/wiki/Keyword_stuffing">stuffed with hundreds of keywords</a>, a form of <a href="http://en.wikipedia.org/wiki/Spamdexing">spamdexing</a> I thought was no longer practiced. Nevertheless the result still appeared on Google, possibly with a little help from <a href="http://en.wikipedia.org/wiki/Cloaking">cloaking</a>.</p>
<h3>Engage the cloaking device</h3>
<p>Curious as to why the PHP files (with no PHP script or META tags, mind you) would redirect links coming from Google, but not when loaded directly, I again pulled up a client-side proxy for closer investigation. Below are the results of several slightly modified HTTP requests for the file initially requested by Google. Each request contains a modified Referer <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">request-header field</a>.</p>
<p><strong>First request</strong><br />
Hacked the Referer field to point to the Google domain.</p>
<pre>GET http://woodstockfolkmusic.com/bftwe/tiijy/carne.php HTTP/1.1
Host: www.google.com
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0 Paros/3.2.13
Referer: http://www.google.com/
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3</pre>
<p><strong>First response</strong><br />
Hijack successful; browser redirected to bogus antivirus page.</p>
<pre>HTTP/1.1 200 OK
Date: Sun, 18 Oct 2009 22:33:31 GMT
Server: Apache
X-Powered-By: PHP/5.2.8
Connection: close
Content-Type: text/html</pre>
<p><strong>Second request</strong><br />
Hacked the Referer field to a domain other than Google.</p>
<pre>GET http://woodstockfolkmusic.com/bftwe/tiijy/carne.php HTTP/1.1
Host: woodstockfolkmusic.com
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0 Paros/3.2.13
Referer: http://www.habdas.org/
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3</pre>
<p><strong>Second response</strong><br />
No hijack; browser sent directly to indexed page.</p>
<pre>HTTP/1.1 200 OK
Date: Sun, 18 Oct 2009 22:31:36 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.6
X-Powered-By: PHP/5.2.6
Content-Type: text/html</pre>
<p><strong>Additional testing</strong><br />
Additional testing revealed page redirection would occur only when the Referer field was included in the HTTP request header, and only when the field value contained certain phrases. Two phrases found to trigger the hijack include &#8220;google&#8221; and &#8220;yahoo&#8221; (case insensitive) while other likely phrases such as &#8220;bing&#8221;, &#8220;msn&#8221;, &#8220;aol&#8221; and &#8220;ask&#8221; did not.</p>
<p><strong>Note:</strong> I am I not currently aware if Yahoo is susceptible this particular brand of page hijacking. If you&#8217;ve seen it on Yahoo or know of any examples, please comment and let us know.</p>
<p>Testing for the presence of phrases &#8220;Googlebot&#8221;, &#8220;googlebot&#8221; or &#8220;google&#8221; and &#8220;bot&#8221; (separated) all resulted in the 302 redirects, which leaves some of the following possibilities:</p>
<ul>
<li>The 302 redirect (likely of the .htaccess kind found in the <a href="http://blog.javacoolsoftware.com/2008/12/anti-virus-2009-search-engine-redirect-hacks/">Antivirus 2009 approach</a>) was turned on after the page was indexed.</li>
<li>The web crawler that originally accessed the page did not pass the phrases &#8220;google&#8221; or &#8220;yahoo&#8221; in the Referer [<em>sic</em>] field in the HTTP request header.</li>
</ul>
<p>Monitoring over a several day period landed the browser on some of the following domains, each with their own similar virus scan or some derivation:</p>
<ul>
<li>wwwantispyware10.com</li>
<li>topantimalwarescan7.com</li>
<li>top-antispyware-scan8.com</li>
<li>computer-protection11.com</li>
<li>webprosecurity.com</li>
<li>guardpconline.com</li>
</ul>
<h3>The Chrome 3.0 Browser Button Issue</h3>
<p>The Chrome button issues are happening on and off. Some of the changes in behavior I have witnessed using Chrome v3.0.195.27 (Win):</p>
<ul>
<li>Browser unable to navigate backwards in history;</li>
<li>Navigation backwards in history only after several tries; and</li>
<li>Tab hangs and cannot be closed, and Windows clocks, until the pop-up notification window is closed.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/10/18/google-302-redirect-hijack/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Analyzing User Agent Strings</title>
		<link>http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/</link>
		<comments>http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 02:28:23 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[user agent]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=710</guid>
		<description><![CDATA[The user agent string, a piece of data transmitted in the HTTP header during a web request, contains information valuable in determining browser type and often basic system information. Example user agent string sent from a web browser during an HTTP request: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5 [...]]]></description>
			<content:encoded><![CDATA[<p>The user agent string, a piece of data transmitted in the HTTP header during a web request, contains information valuable in determining browser type and often basic system information.</p>
<p><strong>Example user agent string sent from a web browser during an HTTP request:</strong><br />
<code>Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5</code></p>
<p>The above example, for instance, provides information such as browser and browser version, user locale (language), OS, system architecture and the layout engine used. When authoring documents for the Web, information from the user agent string can be valuable in determining how best to mark-up documents.</p>
<p>Getting the information is easy.</p>
<p><span id="more-710"></span></p>
<h3>Collecting user agent strings</h3>
<p>Two methods for accessing the user agent string include:</p>
<ol>
<li>From the HTTP request header&#8217;s User-Agent field; and</li>
<li>Using DOM and JavaScript.</li>
</ol>
<h4>Reading from the User-Agent field</h4>
<p>A benefit of using the HTTP header to gather data is simplicity of design.</p>
<p>HTTP request header showing the User-Agent field (in bold):</p>
<p><code>GET / HTTP/1.1<br />
Host: livehttpheaders.mozdev.org<br />
<strong>User-Agent:</strong> Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5<br />
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<br />
Accept-Language: en-us,en;q=0.5<br />
Accept-Encoding: gzip,deflate<br />
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />
Keep-Alive: 300<br />
Connection: keep-alive</code></p>
<p>Using the HTTP header the user agent is transmitted directly to the HTTP server on page request, making it possible for servers to output the user agent string to a log file for later analysis. The user agent string alone provides enough information  to implement on websites valuable browser support strategies such as <a href="http://developer.yahoo.com/yui/articles/gbs/">graded browser support</a>.</p>
<h4>User agent retrieval using DOM and JavaScript</h4>
<p>Using DOM and JavaScript, on the other hand, add additional development complexity, but provide more detailed and valuable analytic data, in addition to the user agent string alone. Tools like <a href="http://en.wikipedia.org/wiki/Urchin_(software)">Urchin</a> (now Google Analytics) utilize JavaScript and the DOM to gather analytic data about visitors.</p>
<p>Bookmark the following link to create a bookmarklet that will retrieve the user agent from a browser: <code><a onclick="alert(navigator.userAgent); return false; pageTracker._trackPageview('/click/link/analyzing-user-agent-strings'); " href="#">javascript:alert(navigator.userAgent)</a></code>.</p>
<p>Regardless of the collection approach used, methods for extracting data from the string remain similar.</p>
<h3>Data extraction methods</h3>
<p>Once the user agent string(s) are collected, data extraction may take place. Two methods for reading and extracting information from the user agent string include brute force and pattern recognition:</p>
<ul>
<li>Under the <strong>brute force</strong> approach the user agent string is compared programmatically to a database of known strings. Though it offers a relatively simple implementation, the brute force approach can be difficult to maintain and becomes increasingly inefficient as comparison data sets grow larger.</li>
<li>Thanks to <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</a> and preceding RFCs, and de facto standards for formatting user agent strings, another method known as <strong>pattern recognition</strong> is possible. Using pattern recognition the user agent string is broken into its component pieces and heuristics applied to gather information. Though more complex to implement than the brute force approach, pattern recognition does not suffer from the same problems in efficiency and maintainability in the long-run.</li>
</ul>
<p>Due to its drawbacks in the application of extracting data form user agent strings, the brute force approach will not be discussed further in this article.</p>
<h4>Pattern recognition on the user agent string</h4>
<p>Check out <a href="http://www.texsoft.it/index.php?c=software&amp;m=sw.php.useragent&amp;l=it">Identify User Agent by string format recognition</a> for an example of user agent pattern recognition. Though a little outdated, the article provides additional depth, in addition to some useful programming techniques and lax copyright restrictions.</p>
<h3>User agent spoofing</h3>
<p>Impersonating browsers and mobile devices is simple with Firefox. Just download <a href="https://addons.mozilla.org/en-US/firefox/addon/59">User Agent Switcher</a> plug-in and put it to the test at <a href="http://www.useragentstring.com/">useragentstring.com</a>. See <a href="http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/">Web Development and Debugging Tools</a> for a list of tools useful for front end development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/07/22/analyzing-user-agent-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Better Lightbox</title>
		<link>http://www.habdas.org/2009/03/29/building-a-better-lightbox/</link>
		<comments>http://www.habdas.org/2009/03/29/building-a-better-lightbox/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 22:17:02 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[best practice]]></category>
		<category><![CDATA[focus management]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Lightbox]]></category>
		<category><![CDATA[UI design]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=375</guid>
		<description><![CDATA[Though modal dialogs are not a new concept in UI design, the number of homegrown Lightbox clones appearing on the Web since major JavaScript libraries like Prototype and jQuery hit the scene has been staggering. Unfortunately, many of the clones developed leave some key usability considerations unaddressed, and struggle with common problems in accessibility. Some key [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1127" class="wp-caption alignright" style="width: 310px"><span class="colorbox"><img class="size-medium wp-image-1127 " title="Lightview Modal Dialog" src="http://www.habdas.org/wp-content/uploads/2009/03/lightview1-300x246.png" alt="Screenshot of a Lightview modal dialog" width="300" height="246" /></span><p class="wp-caption-text">Screenshot of a Lightview modal dialog</p></div>
<p>Though modal dialogs are not a new concept in UI design, the number of homegrown <a href="http://planetozh.com/projects/lightbox-clones/">Lightbox clones</a> appearing on the Web since major JavaScript libraries like Prototype and jQuery hit the scene has been staggering. Unfortunately, many of the clones developed leave some key usability considerations unaddressed, and struggle with common problems in accessibility.  Some key usability features that should be considered during creation of a Web-based modal dialog include (1) manage focus and allow tab navigation (2) disable elements outside the modal dialog (3) give users an out and (4) provide graceful error recovery.</p>
<p><span id="more-375"></span></p>
<h3>Manage focus and allow tab navigation</h3>
<p>Guide the user experience by managing focusable page elements using JavaScript.</p>
<ul>
<li>Tabbing should allow the user to navigate back to the browser&#8217;s location bar and other tabbable toolbars.</li>
<li>When the modal dialog is shown, the user should not be able to tab to document content outside the dialog content area.</li>
<li>When the dialog is hidden, focus should be restored to the initial element used to activate the modal dialog, the original tab ordering should be restored and the user should no longer be able to tab to content inside the modal dialog.</li>
</ul>
<h3>Disable elements outside the dialog</h3>
<p>Guide user interaction with page elements outside of the modal dialog and keep focus in the lightbox window.</p>
<ul>
<li>Display a translucent overlay above the page while the dialog is shown, giving the perception of modality while maintaining frame of reference to existing page content.</li>
<li>Prevent interaction with elements outside the modal dialog using script to do the following:
<ul>
<li>Save and then temporarily set a new tab order for all applicable elements;</li>
<li>Save and then temporarily set the disabled flag on all applicable elements; and</li>
<li>Save and then temporarily update applicable hyperlink click handlers to return false.</li>
</ul>
</li>
</ul>
<h3>Give users an easy way out</h3>
<p>Give users the ability to exit unwanted modal dialogs without thinking much about it.</p>
<ul>
<li>Use a graphical [x] link the user can click to initiate the hide method. In addition, consider using the graphic as a background image for a text-based link (e.g. &#8220;Close&#8221;) to help improve comprehensibility slightly for both sighted and non-sighted users while maintaining application scalability with a single link implementation.</li>
<li>While the dialog is displayed, listen for the [Esc] key. If it is pressed, exit the modal dialog and restore the previous display state.</li>
<li>If the Lightbox was activated by the user, make the close link the next focusable element in the tab order.</li>
</ul>
<h3>Provide graceful error recovery</h3>
<p>Script display methods (e.g. hide/show) should listen for script errors and, upon error, close the modal dialog and restore previous settings–including any previously focused element. Utilize the try/catch block to make it happen, but beware that suppressed errors increases debugging complexity.</p>
<h3>Related articles</h3>
<p>See also Roger Johansson&#8217;s <a href="http://www.456bereastreet.com/archive/200910/lightboxes_and_keyboard_accessibility/">Lightboxes and keyboard accessibility</a> for additional considerations in improving Lightbox usability, with a focus on keyboard accessibility.</p>
<h3>Recommended scripts</h3>
<ul>
<li><a href="http://colorpowered.com/colorbox/">ColorBox</a> — A light-weight, customizable lightbox plugin for jQuery</li>
<li><a href="http://www.nickstakenburg.com/projects/lightview/">Lightview</a> — Lightview was built to change the way you overlay content on a website</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/03/29/building-a-better-lightbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web Development and Debugging Tools</title>
		<link>http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/</link>
		<comments>http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 14:37:21 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browser compatibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[debugging tools]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[proxies]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=234</guid>
		<description><![CDATA[Following is a  list of cross-browser/platform web development and debugging tools useful for client-side developers. Depending on the application, one or all of these tools can be valuable in completing work on a website front-end. Tools for Firefox Build for standards. Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you [...]]]></description>
			<content:encoded><![CDATA[<p>Following is a  list of cross-browser/platform web development and debugging tools useful for client-side developers. Depending on the application, one or all of these tools can be valuable in completing work on a website front-end.</p>
<p><span id="more-234"></span></p>
<h3>Tools for Firefox</h3>
<p>Build for standards.</p>
<div id="attachment_1295" class="wp-caption alignright" style="width: 303px"><a href="http://www.habdas.org/wp-content/uploads/2009/01/firebug-logo.png"><img class="size-full wp-image-1295" title="Firebug Logo" src="http://www.habdas.org/wp-content/uploads/2009/01/firebug-logo.png" alt="Product Logo" width="293" height="89" /></a><p class="wp-caption-text">Firebug &gt; *</p></div>
<ul>
<li><a href="http://getfirebug.com/">Firebug</a> integrates with Firefox to put a wealth of development tools at your fingertips while you browse.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/249">HTML Validator</a> is a Mozilla extension that adds HTML validation inside Firefox and Mozilla.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer</a> adds a menu and a toolbar with various web developer tools.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1419">IE Tab</a>, an extension from Taiwan, embeds Internet Explorer in a Mozilla/Firefox tab.</li>
<li><a href="http://www.colorzilla.com/">ColorZilla</a> provides Advanced Eyedropper, Color Picker, Palette Viewer and other colorful goodies for your Firefox.</li>
<li><a href="http://developer.yahoo.com/yslow/">YSlow</a> analyzes web pages and tells you why they&#8217;re slow.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/6647">HttpFox</a> monitors and analyzes all incoming and outgoing HTTP traffic between the browser and the web servers.</li>
<li><a href="http://davemartorana.com/multifirefox/">MultiFirefox </a>is a small launcher utility that allows you to run multiple versions of Firefox side-by-side.</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/59">User Agent Switcher</a> to spoof user agent strings for browser support testing.</li>
<li><a href="http://www.google.com/toolbar/">Google Toolbar</a> to visualize Page Rank.</li>
</ul>
<h3>Tools for Internet Explorer</h3>
<p>Ensure application compatibility.</p>
<ul>
<li><a href="http://www.microsoft.com/downloadS/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&amp;displaylang=en">Internet Explorer Developer Toolbar</a> provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages. It also allows for the inspection of the MSIE-specific CSS passed in through the use of <a href="http://msdn.microsoft.com/en-us/library/ms537512.aspx">Conditional Comments</a>.</li>
<li>A look-alike is just that, not the real thing. Here are the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&amp;displaylang=en">Internet Explorer Application Compatibility VPC Images,</a> made available by Microsoft for use in testing browser compatibility with MSIE.</li>
</ul>
<h3>Other tools</h3>
<p>Polish it to a bright shine.</p>
<ul>
<li><a href="http://seleniumhq.org/projects/ide/">Selenium IDE</a> for automated testing, helping unlock the potential for test-driven development in the UI layer.</li>
<li><a href="http://www.parosproxy.org/">Paros</a> is a simplistic proxy tool that allows you to trap raw HTTP request and response headers for analysis and testing.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2009/01/10/useful-web-development-and-debugging-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password Protection with PassKeeper</title>
		<link>http://www.habdas.org/2008/12/30/password-protection-with-passkeeper/</link>
		<comments>http://www.habdas.org/2008/12/30/password-protection-with-passkeeper/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 05:01:06 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Data Management]]></category>
		<category><![CDATA[Digital Security]]></category>
		<category><![CDATA[data privacy]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[password manager]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[usb flash drive]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=194</guid>
		<description><![CDATA[After recently losing a USB flash drive with all my passwords, I was grateful for the precaution I took by storing all my password data using Brad Greenlee’s PassKeeper password manager. PassKeeper is a Windows utility that allows you to keep a list of accounts with usernames, passwords, and notes. This list is stored encrypted. [...]]]></description>
			<content:encoded><![CDATA[<p>After recently losing a USB flash drive with all my passwords, I was grateful for the precaution I took by storing all my password data using Brad Greenlee’s PassKeeper password manager.</p>
<blockquote style="font-size: 1.2em;"><p><a title="PassKeeper" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.passkeeper.com');" href="http://www.passkeeper.com/"><span style="font-weight: normal;">PassKeeper</span></a><span style="font-weight: normal;"> is a Windows utility that allows you to keep a list of accounts with usernames, passwords, and notes. This list is stored encrypted.</span></p></blockquote>
<p>The utility is freeware and has been available for public download since the mid-90’s. Data are encrypted using the 56-bit <a title="DES cipher" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" href="http://en.wikipedia.org/wiki/Data_Encryption_Standard">DES</a> cipher and stored in an DAT file in the application’s root directory. The size of the application (189 kilobytes) and the data file (~400 bytes/entry) are lightweight and can easily be carried around on any USB flash drive.</p>
<p><span id="more-194"></span></p>
<div id="attachment_272" class="wp-caption alignleft" style="width: 337px"><img class="size-full wp-image-272" title="PassKeeper" src="http://www.habdas.org/wp-content/uploads/2008/12/passkeeper.png" alt="Image of PassKeeper running under Windows Vista" width="327" height="236" /><p class="wp-caption-text">Image of PassKeeper running under Windows Vista</p></div>
<p>The application’s user interface (pictured left) is straight-forward and easy to use, and the system-oriented UI design has become more visually appealing as Windows has evolved.</p>
<p>One thing that hasn&#8217;t evolved, however, is the utility’s application icon. The application icon (not pictured) has looked outdated since about Windows 98. But fixing the blemish is easy enough. Just create a Windows Shortcut and use a different icon. The imageres.dll located in %windir%\system32\ in Windows Vista contains a decent-looking padlock icon that can be used if desired.</p>
<p>With a little practice, the entire utility can be navigated using only the keyboard, and passwords can be quickly copied from PassKeeper and pasted into online forms and desktop applications without the use of a mouse. Coincidentally, the copy/paste behavior may help enhance security by masking password keystrokes from key loggers.</p>
<p>Over time, one noticeable drawback of using PassKeeper is that it does not provide a built-in password generator. Another is that passwords copied to the clipboard are not automatically cleared after a set amount of time, requiring the user to do so by some other means—if at all. There is also a bug with account names using certain special characters, though in my ten years using the utility I only saw it once. According to program readme.txt on <a href="http://www.passkeeper.com">www.passkeeper.com</a> the utility is limited to 128 entries, but offers a simple workaround for the limitation.</p>
<p>Overall, PassKeeper is a straight-forward, easy-to-use utility for managing and securing personal passwords and account data. And though it&#8217;s starting to show its age, it continues run stably as Windows evolves. If you decide to use PassKeeper and carry around password data on a USB flash drive, the 56-bit encryption used should buy most users plenty of time to change any sensitive passwords should the device be lost.</p>
<h3>Other password managers worth checking out</h3>
<ul>
<li><a style="color: #551a8b;" onmousedown="return clk(this.href,'','','res','1','&amp;sig2=okBwLzSvdqW1m49pmkxraA')" href="http://keepass.info/">KeePass Password Safe</a> — A free open source password manager, which helps you to manage your passwords in a secure way.</li>
<li><a href="http://www.keepassx.org/">KeePassX</a> — Platform-independent port of KeePass Password Safe that works on Windows, Mac and Linux to name a few. Compatible with existing KeePass password databases.</li>
<li><a href="http://www.keepassdroid.com/">KeePassDroid</a> — A port of the KeePass Password Safe for the Android platform.</li>
</ul>
<h3>Password managers to pass up</h3>
<p><a title="RoboForm" href="http://www.roboform.com/">RoboForm</a> — Though it has a version specifically for use with USB flash drives, RoboForm is reliant on a web browser to function; it is not suitable for managing desktop application passwords and may not function in all browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2008/12/30/password-protection-with-passkeeper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Relocate Missing Files in iTunes</title>
		<link>http://www.habdas.org/2008/12/15/itunes-fix-for-manually-moving-files/</link>
		<comments>http://www.habdas.org/2008/12/15/itunes-fix-for-manually-moving-files/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 03:13:57 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Data Management]]></category>
		<category><![CDATA[file management]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[mp4]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.habdas.org/?p=128</guid>
		<description><![CDATA[iTunes users opting not to allow the program to automatically keep their folders organized (the default setting) may be well aware that iTunes does not respond well after changing locations of or renaming files. In fact, any change in the file name or path renders the item inaccessible from within iTunes. To make matters worse, there&#8217;s no [...]]]></description>
			<content:encoded><![CDATA[<p>iTunes users opting not to allow the program to automatically keep their folders organized (the default setting) may be well aware that iTunes does not respond well after changing locations of or renaming files. In fact, any change in the file name or path renders the item inaccessible from within iTunes. To make matters worse, there&#8217;s no easy way to have iTunes relocate files moved. iTunes prompts the user to relocate missing files but only one at a time with a dialog that says:</p>
<blockquote style="font-size: 1.2em;"><p>The song|movie &#8220;name&#8221; could not be used because the original file could not be found. Would you like to locate it?</p></blockquote>
<p>Not so useful when a lot of files are moved at once. But if a directory containing hundreds of files needs to be moved, to a larger hard drive for example, locating files individually becomes too much work.</p>
<p><span id="more-128"></span></p>
<p>Of course, there&#8217;s always the &#8220;fresh start&#8221; approach. Just delete everything and start over&#8230; A good idea if iTunes ratings, playlists and play counts are not considered important keepsake. But to users who spend a good deal of time carefully tweaking song ratings and organizing playlists, scrapping their information and starting fresh may not be a desirable approach.</p>
<p>Thankfully there&#8217;s an easy workaround for the problem. A sane alternative to relocating files one at a time (like when you move hundreds or thousands of files). The workaround straightforward and reversible. And useful whenever moving many files together.</p>
<p>Applying it will allow users to move files around in bulk, while still hanging onto most of the iTunes metadata they have likely grown fond of.</p>
<p><strong>Note:</strong>Some less significant meta information, such as <em>Last Played</em> time, is lost during the process. </p>
<h3>Addressing the problem</h3>
<p>Here are step-by-step instructions for updating the Library XML  and recreate the iTunes Library to enable file relocation when iTunes files are manually organized.</p>
<p><strong>Backup iTunes Music Library</strong></p>
<p>Before you move your files, do the following:</p>
<ol>
<li>Close iTunes for now.</li>
<li>Create copies of the following:
<ul>
<li>(2x) <strong>Library XML</strong> (iTunes Music Library.xml)</li>
<li>(1x) <strong>Library ITL</strong> (iTunes Library.itl)<br />
Vista users can find the Library XML at C:\Users\<strong>&lt;Username&gt;</strong>\Music\iTunes<br />
Mac users can find the Library XML at /Users/<strong>&lt;Username&gt;</strong>/Music/iTunes</li>
</ul>
</li>
</ol>
<p><strong>Relocate iTunes files as necessary</strong></p>
<p>Before moving files note the following two necessary pieces of information:</p>
<ol>
<li>The path where the files were previously stored (e.g. D:\Downloads\Music)</li>
<li>The path where the files will end up (e.g. E:\Music\Archive)</li>
</ol>
<p><strong>Hack the Library XML and delete the Library ITL</strong></p>
<p>After your files are moved, complete the following steps to implement the fix.<br />
<strong>Tip: </strong>Do not open iTunes during this process.</p>
<ol>
<li>Open one of the Library XML copies created.</li>
<li>Perform a Find/Replace using the following inputs:<br />
<strong>Find:</strong><em> </em>Path where files were moved from<br />
<strong>Replace:</strong> Path where files were moved to</li>
<li>Save and close the document, noting which file contains the modifications.</li>
<li>Delete the existing Library ITL.</li>
</ol>
<p><strong>Restart iTunes</strong></p>
<p>Once the Library ITL has been deleted, restart iTunes. The application will open with a blank library; custom playlists, music and other items will be gone. To recover the data do the following:</p>
<ol>
<li>Import the modified copy of the Library XML.<br />
In iTunes 8 and 9, choose<strong> File &gt; Library &gt; Import Playlist…</strong></li>
<li>Navigate to and <strong>Open</strong> the modified Library XML.</li>
<li>iTunes will then import the file contents into the blank library.</li>
<li>Wait for the import to complete.</li>
</ol>
<p>iTunes may display a dialog if any files cannot be located during the import process. The dialog can occur as a result of improper changes to the Library XML, or because the Library XML already contained references to files previously moved or renamed.</p>
<h3>Wrapping up</h3>
<p>Once the updated playlist is imported into iTunes lost songs and other media should be restored though there will be some duplicate playlists. Before deleting the extra playlists confirm the changes are working as expected. Once satisfied, delete the duplicates in the Library and enjoy your hard work. You&#8217;ve earned it.</p>
<p><strong>If something goes wrong</strong></p>
<p>If something goes wrong during the process, or if the results are not as expected, the original Library can be restored from the backup files created. To do so, close iTunes and copy the backup Library ITL and XML back to their original locations (overwrite existing files, if prompted) and restart iTunes to restore the previous Library.</p>
<p><strong>Additional resources</strong></p>
<p><a href="http://support.apple.com/kb/HT1451">Apple Support KB Article HT1451: How to re-create your iTunes library</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.habdas.org/2008/12/15/itunes-fix-for-manually-moving-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
