<?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>gooli.org</title>
	<atom:link href="http://www.gooli.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gooli.org/blog</link>
	<description>on software development and related issues</description>
	<lastBuildDate>Mon, 28 Feb 2011 07:05:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gvim 7.2 with Python 2.5/2.6 support Windows binaries</title>
		<link>http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/</link>
		<comments>http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 03:33:28 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/?p=165</guid>
		<description><![CDATA[Using the excellent instructions at ShowMeDo Jack Atkinson, I built a version of both Gvim and Vim for Windows with support for Python 2.5 and for Python 2.6.
Python 2.4: Support is already built-in in Gvim 7.2
Python 2.5: Install Gvim 7.2 and replace vim.exe and gvim.exe with the files in gvim72python25.zip
Python 2.6: Install Gvim 7.2 and [...]]]></description>
			<content:encoded><![CDATA[<p>Using the excellent instructions at <a href="http://showmedo.com/videos/video?name=1850000&amp;fromSeriesID=185">ShowMeDo</a> Jack Atkinson, I built a version of both Gvim and Vim for Windows with support for Python 2.5 and for Python 2.6.</p>
<p><strong>Python 2.4</strong>: Support is already built-in in Gvim 7.2</p>
<p><strong>Python 2.5</strong>: Install <a href="http://www.vim.org/download.php#pc">Gvim 7.2</a> and replace vim.exe and gvim.exe with the files in <a href="/tools/vim/gvim72python25.zip">gvim72python25.zip</a></p>
<p><strong>Python 2.6</strong>: Install <a href="http://www.vim.org/download.php#pc">Gvim 7.2</a> and replace vim.exe and gvim.exe with the files in <a href="/tools/vim/gvim72python26.zip">gvim72python26.zip</a></p>
<p><strong>Python 3.1</strong>: I wasn&#8217;t able to build Gvim 7.2 with Python 3.1 (most probably due to the backwards incompatible changes in Python 3)</p>
<p>To determine what version of Python your Gvim installation supports use the following command in Gvim:</p>
<p><code>python import sys; print sys.version</code></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/&amp;title=Gvim+7.2+with+Python+2.5%2F2.6+support+Windows+binaries" title="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to Del.icio.us" alt="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/&amp;title=Gvim+7.2+with+Python+2.5%2F2.6+support+Windows+binaries" title="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to digg" alt="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/" title="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to Technorati" alt="Add 'Gvim 7.2 with Python 2.5/2.6 support Windows binaries' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Digital reading</title>
		<link>http://www.gooli.org/blog/digital-reading/</link>
		<comments>http://www.gooli.org/blog/digital-reading/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 22:53:14 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/?p=163</guid>
		<description><![CDATA[I haven&#8217;t written here in quite a while and was going to keep it that way, but an interesting post caught my eye today about eBook readers. I started writing a comment and as it often happens, discovered I had way too much to say. Hope I won&#8217;t bore you to tears.
I&#8217;ve been a  long [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t written here in quite a while and was going to keep it that way, but an <a href="http://www.usabilitypost.com/2009/01/14/why-we-still-use-paper/">interesting post</a> caught my eye today about <a href="http://wiki.mobileread.com/wiki/E-book_Reader_Matrix">eBook readers</a>. I started writing a comment and as it often happens, discovered I had way too much to say. Hope I won&#8217;t bore you to tears.</p>
<p>I&#8217;ve been a  long time proponent of digital reading. I started out with a (slightly darker) gray on (a slightly <img class="alignright" style="margin: 5px; float: right;" src="http://www.dansdata.com/images/palmiiix/palm320.jpg" alt="Palm III" width="182" height="198" />Plighter) gray display of an old  Palm III. I read the entire <a href="http://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy">Hitchhiker&#8217;s Guide to the Galaxy</a> series (which I incidentally didn&#8217;t like very much) on that device straining my eyes to see the badly drawn fonts. When the old PDA broke, I moved on to a Palm Tungsten T3 and have been reading books on it since using the wonderful <a href="http://www.plkr.org/">Plucker</a> software. I read about a hundred books over the last 4 years, almost all of which were in digital format on and I enjoyed every minute of it. Most of the time when I&#8217;m reading I forget I&#8217;m holding a digital device in my hands and not a real book, except that I find it&#8217;s much more convenient to hold the PDA. The first thing I noticed about digital reading is that I could hold the device and turn pages using just one hand. I was taking the train to work at the time, which was so crammed I had to stand most of the way. I found that I could stand on the train squeezed between odd smelling passengers, hold on to a pole with one hand and hold the PDA in the other comfortably reading and turning pages with my thumb. Paper backs on the other hand, I can&#8217;t even figure out how to hold properly with both hands. If you open a <img class="alignleft" style="margin: 5px; float: left;" src="http://www.mulliner.org/images/palmtt3.jpg" alt="Palm Tungsten T3" width="166" height="201" />paperback all the way, you ruin the book with an ugly crease on the back of the cover. If you don&#8217;t, you have to awkwardly hold it half open sticking your thumb in the middle and struggle to read the inner part of the pages. Perhaps I&#8217;m overly modern in my approach, but I fail to see the sentiment in holding, owning and reading paperbacks printed on the cheapest recycled grayish paper with the cheapest possible ink in a font that&#8217;s either too small or too large, but is never the right size. In modern terms, I&#8217;d say the user interface of the common paperback leaves much to be desired. Note, I&#8217;m not talking about a rare edition of a classic whose pages were manually arranged with love and caring. I&#8217;m talking about those pulp fiction books we all read and forget about a day later which are printed at a factory somewhere in China and shipped in containers for us to read. There&#8217;s no sentimental value in most of those books either in form or content and we don&#8217;t read most of them more than once.</p>
<p>I believe the psychological aspects of holding a book, smelling it (ew!) and turning its pages will last at <img class="alignright" style="margin: 5px; float: right;" src="http://www.geekalerts.com/u/kindle.jpg" alt="Amazon Kindle" width="186" height="191" />most a single generation once a proper technology is available. One of the things I like best about reading from a PDA is the immediate access to more information about what I&#8217;m reading. Even when I read something as simple as a Vince Flynn thriller I sometimes use a dictionary or turn to Wikipedia for some more info on a term, a place or a person. This is one thing Amazon got right with their Kindle &#8211; it&#8217;s always online and you have full access to Wikipedia, a dictionary and other internet resources. The experience of reading a book is so much richer when you can instantly find out more about what you are reading. This is even more important for scientific or professional books. The ability to directly jump to a cited source and read the original material the author based her claims on is quite amazing as I imagine you know from reading stuff on the web. The feeling is only enhanced by the ability to do that while in bed or sprawled on a sofa.</p>
<p>A final point that came to me while writing this is that the digitization of books can help books evolve into a different non-linear media. The result might be similar to the hypertext we see on the web, but perhaps more akin to the <a href="http://en.wikipedia.org/wiki/Dungeons_&amp;_Dragons">Dungeons and Dragons</a> books that were common in the early nineties. In those books you could choose the storyline by jumping to some page in the book according to the author&#8217;s instructions. Perhaps the <a href="http://en.wikipedia.org/wiki/Interactive_fiction">Interactive Fiction</a> style of games will return with a vengeance and allow us to be more active participants in the books we read.<br />
<img class="alignleft" style="margin: 5px; float: left;" src="http://www.simonwallfisch.org/images/gramophon.gif" alt="Vynil" width="180" height="219" /><br />
I don&#8217;t believe paper books will disappear and be completely replaced by digital books. After all, the TV hasn&#8217;t completely replaced the radio and CDs and MP3 players haven&#8217;t replaced vinyl records. However, when new technology emerges, the old ones usually mutate and find the niche they serve best. After all, people watch TV at home but still prefer the radio when they are driving. They listen to old jazz records on vinyl, but take their MP3 player when they jog (which might be a bit inconvenient carrying a record player). In a similar manner, paper books and digital books will coexist each finding its niche. Meanwhile, I&#8217;ll be ordering myself a brand new Sony PRS-700 and hoping that somebody ports a dictionary program and a Wikipedia browser to it so I&#8217;ll be able to enjoy a truly enhanced digital reading experience.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/digital-reading/&amp;title=Digital+reading" title="Add 'Digital reading' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Digital reading' to Del.icio.us" alt="Add 'Digital reading' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/digital-reading/&amp;title=Digital+reading" title="Add 'Digital reading' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Digital reading' to digg" alt="Add 'Digital reading' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/digital-reading/" title="Add 'Digital reading' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Digital reading' to Technorati" alt="Add 'Digital reading' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/digital-reading/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Unicode and permalinks</title>
		<link>http://www.gooli.org/blog/unicode-and-permalinks/</link>
		<comments>http://www.gooli.org/blog/unicode-and-permalinks/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 08:11:38 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Testuff]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/?p=155</guid>
		<description><![CDATA[Working on integrating of automation scripts with Testuff, I&#8217;ve encountered an interesting Unicode-related issue I&#8217;d like to share.
The integration allows for an automated testing script to report the results of its run to the Testuff server. In order for the results to be grouped, displayed and summarized correctly, the automation script needs to tell the [...]]]></description>
			<content:encoded><![CDATA[<p>Working on integrating of automation scripts with <a href="http://www.testuff.com/">Testuff</a>, I&#8217;ve encountered an interesting Unicode-related issue I&#8217;d like to share.</p>
<p>The integration allows for an automated testing script to report the results of its run to the Testuff server. In order for the results to be grouped, displayed and summarized correctly, the automation script needs to tell the server which test it ran, and whether the test has passed or failed. A long discussion emerged on what the best way to uniquely identify tests.</p>
<p>After quite a bit of back and forth, we&#8217;ve settled on <a href="http://en.wikipedia.org/wiki/Permalink">permalinks</a>, those more-or-less-readable URLs that are in common use in blogs. The idea of a permalink is to take the title (of a blog post or a test) and replace any characters that aren&#8217;t numbers or letters with an underscore or a hyphen. Using this simple scheme, &#8220;Unicode and permalinks&#8221; becomes &#8220;unicode-and-permalinks&#8221;, which is quite suitable for use in a URL.</p>
<p>The implementation is a simple regular expression:</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;"><span style="color: #ff7700;font-weight:bold;">def</span> to_permalink<span style="color: black;">&#40;</span><span style="color: #dc143c;">string</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;[^a-zA-Z0-9]+&quot;</span>, <span style="color: #483d8b;">&quot;_&quot;</span>, <span style="color: #dc143c;">string</span><span style="color: black;">&#41;</span>.<span style="color: black;">lower</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div>
<p>While this code works perfectly for the English language, it doesn&#8217;t work at all if <em>string</em> is a Unicode string containing something in Hebrew, Russian or Polish &#8211; language that some of our customers use. And so, I set out to write code that will essentially behave like the regular expression above, but will work for letters and numbers in all the languages of the world.</p>
<p>Fortunately the Unicode standard includes a rarely used classification of characters into various categories. For each given character we can find out whether it is an uppercase letter, a lowercase letter, and number, a punctuation mark and so on. Surprisingly, Python includes a module called <a href="http://docs.python.org/lib/module-unicodedata.html">unicodedata</a> that contains all that information. The function <em>category</em> accepts a character and returns a string that tells us <a href="http://www.unicode.org/Public/4.1.0/ucd/UCD.html#General_Category_Values">what the character is</a>: &#8220;Lu&#8221; denotes an uppercase letter, &#8220;Nd&#8221; denotes a decimal digit, etc.</p>
<p>All that remains to be done is go over the characters in the title, keep the letters and numbers, and replace all the other characters with a dash or an underscore. The regular expression at the end replaces any sequence of underscores into a single underscore to make the resulting URLs even nicer to look at.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;"><span style="color: #ff7700;font-weight:bold;">def</span> to_permalink<span style="color: black;">&#40;</span>s<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;<br />
&nbsp; &nbsp; Converts sequences of characters that aren&#8217;t letters or numbers<br />
&nbsp; &nbsp; to a single underscore to achieve wikpedia like unicode URLs.<br />
&nbsp; &nbsp; &quot;</span><span style="color: #483d8b;">&quot;&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">unicodedata</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> conv<span style="color: black;">&#40;</span>c<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">unicodedata</span>.<span style="color: black;">category</span><span style="color: black;">&#40;</span>c<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;L&quot;</span>, <span style="color: #483d8b;">&quot;N&quot;</span><span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> c<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;_&quot;</span><br />
&nbsp; &nbsp; s2 = <span style="color: #483d8b;">&quot;&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>conv<span style="color: black;">&#40;</span>c<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> c <span style="color: #ff7700;font-weight:bold;">in</span> s<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;_+&quot;</span>, <span style="color: #483d8b;">&quot;_&quot;</span>, s2<span style="color: black;">&#41;</span></div>
<p><em>[Update]</em> Or, as Almad correctly pointed out, you could just use the <em>re</em> module support for Unicode and be done with it in two lines, which kind of takes the air out of this post.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;"><span style="color: #ff7700;font-weight:bold;">def</span> to_permalink<span style="color: black;">&#40;</span>s<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\W</span>+&quot;</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">UNICODE</span><span style="color: black;">&#41;</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;_&quot;</span>, s<span style="color: black;">&#41;</span></div>
<p>There&#8217;s one other thing to consider when dealing with Unicode permalinks. If you&#8217;re a native speaker of a language other than English, you&#8217;ve probably seen URLs that in your own language in Wikipedia.</p>
<p><a href="http://gooli.org/blog/wp-content/uploads/2008/09/hebrew-url.png"><img class="alignnone size-medium wp-image-156" title="hebrew-url" src="http://gooli.org/blog/wp-content/uploads/2008/09/hebrew-url-300x23.png" alt="" width="300" height="23" /></a></p>
<p><a href="http://gooli.org/blog/wp-content/uploads/2008/09/russian-url.png"><img class="alignnone size-medium wp-image-157" title="russian-url" src="http://gooli.org/blog/wp-content/uploads/2008/09/russian-url-300x23.png" alt="" width="300" height="23" /></a></p>
<p>From the looks of it, URLs can include characters in any language. Right?</p>
<p>Wrong.</p>
<p><a href="http://tools.ietf.org/html/rfc3986">RFC3986</a> defines the syntax for URLs (actually URIs, but that&#8217;s a moot point) explicitly and states which characters are allowed in a URL. This includes <a href="http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_in_a_URI">little more than English letters and numbers</a> from the lower half of the <a href="http://www.asciitable.com/">ASCII chart</a>.</p>
<p>If you look at the headers your browser passes when you access such a URL, you&#8217;ll see that it encodes all the characters with percent encoding, so neither the browser nor the web server is violating the standard. This is what the server saw when I navigated to the main Hebrew page of Wikipedia:</p>
<pre>GET /wiki/%D7%A2%D7%9E%D7%95%D7%93_%D7%A8%D7%90%D7%A9%D7%99 HTTP/1.1
Host: he.wikipedia.org</pre>
<p>In order to understand what this percent encoding means, you need to know a <a href="http://www.joelonsoftware.com/articles/Unicode.html">bit about Unicode</a>. Basically, the Unicode URL is encoded in UTF8 and each byte of the UTF8-encoded string is encoded using percent encoding. The browser apparently recognized this specific encoding scheme (which isn&#8217;t documented anywhere I could fine) and displays nice internationalized URLs for the user.</p>
<p>If you want to support such URLs in your server, you&#8217;ll probably need to write some code to translate the percent-encoded URLs into their actual Unicode representation.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/unicode-and-permalinks/&amp;title=Unicode+and+permalinks" title="Add 'Unicode and permalinks' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Unicode and permalinks' to Del.icio.us" alt="Add 'Unicode and permalinks' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/unicode-and-permalinks/&amp;title=Unicode+and+permalinks" title="Add 'Unicode and permalinks' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Unicode and permalinks' to digg" alt="Add 'Unicode and permalinks' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/unicode-and-permalinks/" title="Add 'Unicode and permalinks' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Unicode and permalinks' to Technorati" alt="Add 'Unicode and permalinks' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/unicode-and-permalinks/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Solution for Edimax router BR-6204WG being slow</title>
		<link>http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/</link>
		<comments>http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 08:55:13 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/</guid>
		<description><![CDATA[This message is for anybody who has recently bought the aforementioned router and is experiencing a slow connection and many timeouts. This affects the routers that have the 1.57 version of the firmware installed.
To check the firmware version, go to http://192.168.2.1 (that&#8217;s the IP of the router in its default configuration) and click Status Info [...]]]></description>
			<content:encoded><![CDATA[<p>This message is for anybody who has recently bought the aforementioned router and is experiencing a slow connection and many timeouts. This affects the routers that have the 1.57 version of the firmware installed.</p>
<p>To check the firmware version, go to <a href="http://192.168.2.1" target="_blank">http://192.168.2.1</a> (that&#8217;s the IP of the router in its default configuration) and click <span style="font-style: italic;">Status Info</span> at the top of the page that appears. The firmware version is written under <span style="font-style: italic;">Runtime Code Version</span>.</p>
<p><img style="max-width: 800px;" src="http://gooli.org/blog/wp-content/uploads/2008/08/edimax.png" alt="" /></p>
<p>The 1.57 version apparently has a bug, which did not exist in previous versions and has been fixed in newer ones. The latest official firmware release is 1.51, and can be found at the <a href="http://www.edimax.com/en/support_detail.php?pd_id=11&amp;pl1_id=1">Edimax site</a>. I&#8217;ve also found a 1.58 version on an Israeli&#8217;s dealer&#8217;s site <a href="http://www.pikok.co.il/Tmicha.asp">here</a>.</p>
<p>Direct link to 1.51 (edimax.com): <a href="http://www.edimax.com/images/Image/Firmware/Wireless/Router/BR-6204Wg/BR6204Wg_1.51.zip">BR6204Wg_1.51.zip</a> (unzip it before upgrading)<br />
Direct link to 1.58 (pikok.co.il): <a href="http://pikok.co.il/cam/EdiEngBR6204Wg_1.58.bin">EdiEngBR6204Wg_1.58.bin</a></p>
<p>I&#8217;ve tested both 1.51 and 1.58, and they both fix the problem.</p>
<p>Upgrading the firmware is actually quite easy.</p>
<p>Go to <a href="http://192.168.2.1">http://192.168.2.1</a>, select <span style="font-style: italic;">System Tools</span> at the top, then <span style="font-style: italic;">Firmware Upgrade</span> on the left and follow the instructions on the screen.</p>
<p><img style="max-width: 800px;" src="http://gooli.org/blog/wp-content/uploads/2008/08/edimax-firmware.png" alt="" /></p>
<p>Hope this helps somebody someday.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/&amp;title=Solution+for+Edimax+router+BR-6204WG+being+slow" title="Add 'Solution for Edimax router BR-6204WG being slow' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Solution for Edimax router BR-6204WG being slow' to Del.icio.us" alt="Add 'Solution for Edimax router BR-6204WG being slow' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/&amp;title=Solution+for+Edimax+router+BR-6204WG+being+slow" title="Add 'Solution for Edimax router BR-6204WG being slow' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Solution for Edimax router BR-6204WG being slow' to digg" alt="Add 'Solution for Edimax router BR-6204WG being slow' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/" title="Add 'Solution for Edimax router BR-6204WG being slow' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Solution for Edimax router BR-6204WG being slow' to Technorati" alt="Add 'Solution for Edimax router BR-6204WG being slow' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/solution-for-edimax-router-br-6204wg-being-slow/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Disable scroll wheel clicking in Firefox</title>
		<link>http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/</link>
		<comments>http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 07:47:01 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/</guid>
		<description><![CDATA[I have one of those Microsoft mice here at work and its wheel is quite
light to the touch. It is so light in fact, that I often click it while
scrolling. By default, clicking the scroll wheel in Firefox puts it
into scrolling mode, showing this icon:

Now when you move the mouse up and down, the page [...]]]></description>
			<content:encoded><![CDATA[<p>I have one of those Microsoft mice here at work and its wheel is quite<br />
light to the touch. It is so light in fact, that I often click it while<br />
scrolling. By default, clicking the scroll wheel in Firefox puts it<br />
into scrolling mode, showing this icon:<br />
<img style="max-width: 800px;" src="http://gooli.org/blog/wp-content/uploads/2008/08/scrolling-icon.png" alt="" /><br />
Now when you move the mouse up and down, the page will scroll.</p>
<p>That is so annoying!</p>
<p>It took me over 20 minutes of Googling to find how to disable that feature, so I&#8217;m documenting it here.</p>
<p>The option that controls it in Firefox is Tools &gt; Options &gt; Advanced &gt; General &gt; Browsing &gt; Use autoscrolling.</p>
<p><img style="max-width: 800px;" src="http://gooli.org/blog/wp-content/uploads/2008/08/firefox-options.png" alt="" /></p>
<p>Apparently &#8220;auto scrolling&#8221; is the name of this obscure feature, which is now forever disabled on all my machines.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/&amp;title=Disable+scroll+wheel+clicking+in+Firefox" title="Add 'Disable scroll wheel clicking in Firefox' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Disable scroll wheel clicking in Firefox' to Del.icio.us" alt="Add 'Disable scroll wheel clicking in Firefox' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/&amp;title=Disable+scroll+wheel+clicking+in+Firefox" title="Add 'Disable scroll wheel clicking in Firefox' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Disable scroll wheel clicking in Firefox' to digg" alt="Add 'Disable scroll wheel clicking in Firefox' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/" title="Add 'Disable scroll wheel clicking in Firefox' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Disable scroll wheel clicking in Firefox' to Technorati" alt="Add 'Disable scroll wheel clicking in Firefox' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/disable-scroll-wheel-clicking-in-firefox/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Accessing SVN revision via a browser</title>
		<link>http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/</link>
		<comments>http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 08:17:56 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/</guid>
		<description><![CDATA[Most people who use Subversion know that you can access the repository with your browser to get a readonly interface that you can use to take a cursory look at the files in there.
This is how the Python repository looks like via http://svn.python.org/projects/python:

It says Revision 65620 at the top and I&#8217;ve always wondered if you [...]]]></description>
			<content:encoded><![CDATA[<p>Most people who use Subversion know that you can access the repository with your browser to get a readonly interface that you can use to take a cursory look at the files in there.</p>
<p>This is how the Python repository looks like via <a href="http://svn.python.org/projects/%21svn/bc/5000/python">http://svn.python.org/projects/python</a>:</p>
<p><img style="max-width: 800px;" src="http://gooli.org/blog/wp-content/uploads/2008/08/python-svn.png" /></p>
<p>It says <span style="font-style: italic;">Revision 65620</span> at the top and I&#8217;ve always wondered if you could access another revision in the same simple way. Turns out <a href="http://yuji.wordpress.com/2008/07/08/svn-access-specific-revision-from-web-browser/">there is a way</a>.</p>
<p>All you need to do is add <span style="font-weight: bold;">!svn/bc/REVISION</span> to the URL:</p>
<p><a href="http://svn.python.org/projects/%21svn/bc/5000/python">http://svn.python.org/projects/<span style="font-weight: bold;">!svn/bc/5000</span>/python</a> shows revision 5000 of the Python Subversion repository.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/&amp;title=Accessing+SVN+revision+via+a+browser" title="Add 'Accessing SVN revision via a browser' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Accessing SVN revision via a browser' to Del.icio.us" alt="Add 'Accessing SVN revision via a browser' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/&amp;title=Accessing+SVN+revision+via+a+browser" title="Add 'Accessing SVN revision via a browser' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Accessing SVN revision via a browser' to digg" alt="Add 'Accessing SVN revision via a browser' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/" title="Add 'Accessing SVN revision via a browser' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Accessing SVN revision via a browser' to Technorati" alt="Add 'Accessing SVN revision via a browser' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/accessing-svn-revision-via-a-browser/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wrong keyboard layout</title>
		<link>http://www.gooli.org/blog/wrong-keyboard-layout/</link>
		<comments>http://www.gooli.org/blog/wrong-keyboard-layout/#comments</comments>
		<pubDate>Mon, 26 May 2008 08:16:44 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/wrong-keyboard-layout/</guid>
		<description><![CDATA[How many times have you typed an entire URL looking at your keyboard only to lift your eyes and see that you&#8217;ve used the wrong keyboard layout? How many times have you typed your email into some obscure form on the internet only to find that you&#8217;ve typed some unintelligible gibberish in Hebrew, Russian or [...]]]></description>
			<content:encoded><![CDATA[<p>How many times have you typed an entire URL looking at your keyboard only to lift your eyes and see that you&#8217;ve used the wrong keyboard layout? How many times have you typed your email into some obscure form on the internet only to find that you&#8217;ve typed some unintelligible gibberish in Hebrew, Russian or Farsi?</p>
<p>Well, no more! <a href="http://www.gooli.org/blog/" target="_blank">Recaps</a>, that tiny utility that lets you switch your keyboard layout using the almost forgotten <span style="font-weight: bold">Capslock</span> key, can now fix text you&#8217;ve typed with the wrong language selected. Just hit <span style="font-weight: bold">Ctrl-Capslock</span> as soon as you discover your mistake and the text will be replaced with what you actually intended to type. I&#8217;ve only tested it with Hebrew and Russian, the languages I personally use on a regular basis, but it should work with any language supported by Windows. Let me know if it doesn&#8217;t.</p>
<p><a href="http://technorati.com/tag/layout" class="performancingtags" rel="tag"></a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/wrong-keyboard-layout/&amp;title=Wrong+keyboard+layout" title="Add 'Wrong keyboard layout' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Wrong keyboard layout' to Del.icio.us" alt="Add 'Wrong keyboard layout' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/wrong-keyboard-layout/&amp;title=Wrong+keyboard+layout" title="Add 'Wrong keyboard layout' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Wrong keyboard layout' to digg" alt="Add 'Wrong keyboard layout' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/wrong-keyboard-layout/" title="Add 'Wrong keyboard layout' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Wrong keyboard layout' to Technorati" alt="Add 'Wrong keyboard layout' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/wrong-keyboard-layout/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Digging into Python&#8217;s PYC files</title>
		<link>http://www.gooli.org/blog/digging-into-pythons-pyc-files/</link>
		<comments>http://www.gooli.org/blog/digging-into-pythons-pyc-files/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 12:20:23 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Testuff]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/digging-into-pythons-pyc-files/</guid>
		<description><![CDATA[One of the first things we needed to do when we started working on Testuff, was to figure out how are we going to update the installed desktop clients. This is one of those problems that seems to usually fall under the NIH syndrome, and like many others before me, I invented my own scheme. [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first things we needed to do when we started working on <a href="http://www.testuff.com">Testuff</a>, was to figure out how are we going to update the installed desktop clients. This is one of those problems that seems to usually fall under the <a href="http://en.wikipedia.org/wiki/Not_Invented_Here">NIH</a> syndrome, and like many others before me, I invented my own scheme. The gist of it is a <a href="http://download.testuff.com/release/version.xml">version.xml</a> file that sits alongside the setup file for the newest release and looks something like this:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;update-info version="0.8.0[1212]"&gt;
    &lt;update file="TestuffSetup.exe" from-version="all"/&gt;
    &lt;update file="TestuffUpdate.exe" from-version="0.7.1[1110]"/&gt;
    &lt;md5hashes&gt;
        &lt;file md5="3a23dd6eff6fd6c1d0fbfcbfb0d57221" path="async.pyc"/&gt;
        &lt;file md5="0d1ea490a18c65cec7ba8715b5ea9e69" path="atexit.pyc"/&gt;
        &lt;file md5="166723a4330a98b573119326fc689322" path="base64.pyc"/&gt;
        &lt;file md5="01c1bda049936de570ed922424c057a8" path="BeautifulSoup.pyc"/&gt;
    &lt;/md5hashes&gt;
&lt;/update-info&gt;</pre>
<p>When the Testuff client launches, it gets the version.xml file from the server and compares its version to the version attribute of the <em>update-info</em> tag. If the client&#8217;s version is wrong, it checks the <em>update</em> tags to see which update it should download and install. We generate two separate setup files &#8211; one to update the most recent version to the new one called and another to update all the other (older) versions.</p>
<p>Aside from the info about which version of the client should use which update file, version.xml also contains the MD5 hashes for each file in the distribution. That might seem like a lot of wasted space and time, but it&#8217;s actually there for a very good reason. When our setup building script is creating <em>TestuffUpdate.exe</em>, it too downloads version.xml from our server. It then tries to determine which files have changed or have been added since the last version by comparing the MD5 hashes in version.xml to the the hashes of the actual files that have been generated by the build. Any file that is different is added to the update so we can be sure we haven&#8217;t missed any essential component in the update.</p>
<p>Recently I discovered that our update files are much larger than they should be. We release a new version with just a couple of fixes in a single module, and the size of the update is half the size of the full install. As it turned out, that most of the PYC files were marked as changed and added to the update. That didn&#8217;t seem right, especially for things like threading.pyc, which is a Python module that shouldn&#8217;t change unless you upgrade to a different version of Python, which we didn&#8217;t (still stuck at 2.4.4 I&#8217;m afraid). That got me curious enough to go digging in the, apparently undocumented, binary structure of the PYC files.</p>
<blockquote><p>This module contains functions that can read and write Python values in a binary  format. The format is specific to Python, but independent of machine  architecture issues (e.g., you can write a Python value to a file on a PC,  transport the file to a Sun, and read it back there). <strong>Details of the format are  undocumented on purpose</strong>; it may change between Python versions (although it  rarely does).</p></blockquote>
<p>The first thing I did was compare the two threading.pyc files &#8211; the one from the current distribution and the one just generated by the build script. The result showed there was difference in only two bytes:</p>
<pre>D:GooliDevTempcompare&gt;fc /b threading-old.pyc threading-new.pyc
Comparing files threading-old.pyc and threading-new.pyc
00000004: 6E CE
00000005: F7 6A</pre>
<p>Only two bytes differ, and they are right at the beginning of the file? That looks suspiciously like a version or a timestamp in the file header. Since the PYC file structure is undocumented, I went looking for the details in Python&#8217;s source code, but the answer was actually closer to home &#8211; in the <a href="http://docs.python.org/lib/compiler.html">compiler</a> package. A file called pycodegen.py in Python\Lib\compiler contains the following code:</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;"><span style="color: #ff7700;font-weight:bold;">def</span> getPycHeader<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; mtime = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">getmtime</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">filename</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; mtime = <span style="color: #dc143c;">struct</span>.<span style="color: black;">pack</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;&amp;lt;i&#8217;</span>, mtime<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">MAGIC</span> + mtime</div>
<p>So, the PYC header file contains a magic number that identifies the Python release and the modification time of the original source file as the number of seconds since the epoch. That shouldn&#8217;t be a problem &#8211; the threading module hasn&#8217;t changed and should have the same timestamp. But as we&#8217;ve seen, the PYC files were different. How can that be?</p>
<p>Acting on a hunch, I wrote a short script to read the header from the PYC file and print the embedded date:</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">struct</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> timedef print_internal_date<span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>filename, <span style="color: #483d8b;">&quot;rb&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; data = f.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; mtime = <span style="color: #dc143c;">struct</span>.<span style="color: black;">unpack</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&amp;lt;i&quot;</span>, data<span style="color: black;">&#91;</span><span style="color: #ff4500;">4</span>:<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #dc143c;">time</span>.<span style="color: black;">asctime</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">time</span>.<span style="color: black;">gmtime</span><span style="color: black;">&#40;</span>mtime<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>print_internal_date<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;threading-old.pyc&quot;</span><span style="color: black;">&#41;</span><br />
print_internal_date<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;threading-new.pyc&quot;</span><span style="color: black;">&#41;</span></div>
<p>Which printed the following results:</p>
<pre>Mon Mar 13 22:51:26 2006
Mon Mar 13 12:51:26 2006</pre>
<p>Notice anything odd about them? They are <em>exactly</em> 10 hours apart. At first I thought I might actually be looking at two different versions of threading.py, but the chances of two edits being exactly 10 hours apart right down to the second is practically non-existent. It had to be something with time zones. I live and work in Israel, which is at GMT+2:00. The default timezone for Windows is Pacific time, which is GMT-8:00. Exactly 10 hours apart. However, no matter how I tweak the Regional Settings on my computer, all the PYC files I generate here have the same timestamp. Perhaps it has to do with the timezone you have set when you install Python. If I ever find out, I&#8217;ll let you know.</p>
<p>But that wasn&#8217;t the point of this post. The point was to figure out what PYC files look inside and we did that, at least in part &#8211; they start with a magic number that is different for each Python version (check out the comments in <a href="http://svn.python.org/view/python/tags/r244/Python/import.c?rev=52384&amp;view=markup">import.c</a>), and they have an embedded timestamp of the source code they got generated from after that. The rest is generated by the marshal module and can be read by it to get the code objects and the global data in the module.</p>
<p>Another thing to be learned from this is that we really should always build the Testuff client on the same machine, which is why I&#8217;m heading to the office right now to burn a copy of the VMWare image I created with everything needed to build Testuff. We got a new version with a couple of important fixes to our Mantis support to release today.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/digging-into-pythons-pyc-files/&amp;title=Digging+into+Python%26%238217%3Bs+PYC+files" title="Add 'Digging into Python&#8217;s PYC files' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Digging into Python&#8217;s PYC files' to Del.icio.us" alt="Add 'Digging into Python&#8217;s PYC files' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/digging-into-pythons-pyc-files/&amp;title=Digging+into+Python%26%238217%3Bs+PYC+files" title="Add 'Digging into Python&#8217;s PYC files' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Digging into Python&#8217;s PYC files' to digg" alt="Add 'Digging into Python&#8217;s PYC files' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/digging-into-pythons-pyc-files/" title="Add 'Digging into Python&#8217;s PYC files' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Digging into Python&#8217;s PYC files' to Technorati" alt="Add 'Digging into Python&#8217;s PYC files' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/digging-into-pythons-pyc-files/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A very simple Win+R enhancement</title>
		<link>http://www.gooli.org/blog/a-very-simple-winr-enhancement/</link>
		<comments>http://www.gooli.org/blog/a-very-simple-winr-enhancement/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 11:26:47 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/a-very-simple-winr-enhancement/</guid>
		<description><![CDATA[I use the Win+R combination to run almost all the applications I use. Hit Win+R, type firefox, and Firefox runs. Hit Win+R, type winword, and Word starts. Hit Win+R&#8230;, well you get the idea.
The Run dialog is great to quickly access applications you use, but it&#8217;s only usable for programs that put their folder in [...]]]></description>
			<content:encoded><![CDATA[<p>I use the Win+R combination to run almost all the applications I use. Hit Win+R, type firefox, and Firefox runs. Hit Win+R, type winword, and Word starts. Hit Win+R&#8230;, well you get the idea.</p>
<p>The Run dialog is great to quickly access applications you use, but it&#8217;s only usable for programs that put their folder in the PATH environment variable, which not all programs do. I&#8217;ve been adding programs I liked to the PATH for years when a friend of mine showed me a neat trick. You create a folder called Shortcuts somewhere (say C:\Shortcuts) and put it <em>at the start</em> of your PATH environment variable and then create shortcuts to your favorite programs in that folder. All those shortcuts are now available to you via using Win+R. A nice bonus is the fact that you can name the shortcuts any way you like. I usually have a www.lnk file pointing to Firefox, note.lnk pointing to Notepad and word.lnk pointing to Word.</p>
<p>There&#8217;s only one thing missing here to make this trick into an fully featured program launcher. We need a way to quickly create shortcuts to programs, preferably by right-clicking on them in Windows Explorer. You can do that without installing anything using a couple of obscure Windows features &#8211; the <a href="http://support.microsoft.com/kb/310270">Send To</a> menu in the right-click menu of each file and the fact that Windows can run *.vbs files with VBScript code in it using something called <a href="http://en.wikipedia.org/wiki/Windows_Script_Host">WSH</a>.</p>
<p>Here&#8217;s the source of a script that creates a link to whichever was passed to it in the command line (executable, folder, etc.).</p>
<div class="ch_code_container" style="font-family: monospace;height:300px;">SHORTCUTS_PATH = <span style="color: #ff0000;">&quot;C:\Shortcuts&quot;</span></p>
<p><span style="color: #b1b100;">If</span> WScript.<span style="color: #66cc66;">Arguments</span>.<span style="color: #b1b100;">Count</span> &lt; <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">Then</span><br />
&nbsp; &nbsp; WScript.<span style="color: #66cc66;">Echo</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Missing parameters&quot;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #b1b100;">Else</span><br />
&nbsp; &nbsp; <span style="color: #808080;">&#8216; create shorcut name</span><br />
&nbsp; &nbsp; commandPath = WScript.<span style="color: #66cc66;">Arguments</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; dot = <span style="color: #b1b100;">InStrRev</span><span style="color: #66cc66;">&#40;</span>commandPath, <span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">If</span> dot = <span style="color: #cc66cc;">0</span> <span style="color: #b1b100;">Then</span> dot = <span style="color: #b1b100;">Len</span><span style="color: #66cc66;">&#40;</span>commandPath<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; slash = <span style="color: #b1b100;">InStrRev</span><span style="color: #66cc66;">&#40;</span>commandPath, <span style="color: #ff0000;">&quot;\&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">If</span> slash = <span style="color: #cc66cc;">0</span> <span style="color: #b1b100;">Then</span> slash = <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp; commandDir = <span style="color: #b1b100;">Mid</span><span style="color: #66cc66;">&#40;</span>commandPath, <span style="color: #cc66cc;">1</span>, slash<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; shortcutName = <span style="color: #b1b100;">Mid</span><span style="color: #66cc66;">&#40;</span>commandPath, slash<span style="color: #cc66cc;">+1</span>, dot-slash<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#41;</span></p>
<p>&nbsp; &nbsp; <span style="color: #808080;">&#8216; ask for shortcut name</span><br />
&nbsp; &nbsp; shortcutName = <span style="color: #b1b100;">InputBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Enter shortcut name&quot;</span>, <span style="color: #ff0000;">&quot;Shortcut&quot;</span>, shortcutName<span style="color: #66cc66;">&#41;</span></p>
<p>&nbsp; &nbsp; <span style="color: #808080;">&#8216; create shortcut</span><br />
&nbsp; &nbsp; shortcutPath = SHORTCUTS_PATH &amp; <span style="color: #ff0000;">&quot;\&quot;</span> &amp; shortcutName &amp; <span style="color: #ff0000;">&quot;.lnk&quot;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">Set</span> WshShell = WScript.<span style="color: #b1b100;">CreateObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;WScript.Shell&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">Set</span> oShellLink = WshShell.<span style="color: #66cc66;">CreateShortcut</span><span style="color: #66cc66;">&#40;</span>shortcutPath<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; oShellLink.<span style="color: #66cc66;">TargetPath</span> = commandPath<br />
&nbsp; &nbsp; oShellLink.<span style="color: #66cc66;">WindowStyle</span> = <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp; oShellLink.<span style="color: #66cc66;">IconLocation</span> = commandPath &amp; <span style="color: #ff0000;">&quot;, 0&quot;</span><br />
&nbsp; &nbsp; oShellLink.<span style="color: #66cc66;">WorkingDirectory</span> = commandDir<br />
&nbsp; &nbsp; oShellLink.<span style="color: #66cc66;">Save</span><br />
<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span></div>
<p>The Send To menu is actually a folder located at C:\Documents and Settings\&lt;YourUser&gt;\SendTo. This folder contains links to various programs and you can add shortcuts to your own programs there. When you right-click a file, and choose one of the Send To items, the corresponding program is called, and given the name of the file you right-clicked as a command line parameter. So, if you put a link to the script above in the Send To folder, you&#8217;ll be able to easily create links in the C:\Shortcuts folder.</p>
<p>In case you lost me somewhere along the way, and in case I ever need to set this up myself again, here are the instructions to set things up:</p>
<ol>
<li>Create C:\Shortcuts</li>
<li>Create C:\Shortcuts\create_shortcut.vbs and paste the above code into it.</li>
<li>Add C:\Shortcuts <em>to the start</em> of your PATH environment variable (Win+Pause &gt; Advanced &gt; Environment Variables).</li>
<li>Hit Win+R, type sendto, hit Enter. That should get you to your Send To folder.</li>
<li>Create a shortcut here to C:\Shortcuts\create_shortcut.vbs and call it Shortcuts.</li>
</ol>
<p>To add a program to the launcher:</p>
<ol>
<li>Right click a program or a folder (you can do it even on programs in your Start Menu).</li>
<li>Send To &gt; Shortcuts.</li>
<li>In the dialog change the shortcut name to something short and catchy.</li>
<li>Test it : Hit Win+R, type the shortcut name and hit Enter.</li>
</ol>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/a-very-simple-winr-enhancement/&amp;title=A+very+simple+Win%2BR+enhancement" title="Add 'A very simple Win+R enhancement' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'A very simple Win+R enhancement' to Del.icio.us" alt="Add 'A very simple Win+R enhancement' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/a-very-simple-winr-enhancement/&amp;title=A+very+simple+Win%2BR+enhancement" title="Add 'A very simple Win+R enhancement' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'A very simple Win+R enhancement' to digg" alt="Add 'A very simple Win+R enhancement' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/a-very-simple-winr-enhancement/" title="Add 'A very simple Win+R enhancement' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'A very simple Win+R enhancement' to Technorati" alt="Add 'A very simple Win+R enhancement' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/a-very-simple-winr-enhancement/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Right to left (BiDi) support in Firefox</title>
		<link>http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/</link>
		<comments>http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 15:46:12 +0000</pubDate>
		<dc:creator>gooli</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/</guid>
		<description><![CDATA[Whenever I install Firefox on a new computer, I find myself hitting Ctrl-Shift-X to switch the text box direction to now avail. Unfortunately the way to turn this option on is quite hidden.
You have to navigate to about:config, type bidi in the filter box, and double click the line that says bidi.browser.ui. That will set [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever I install Firefox on a new computer, I find myself hitting Ctrl-Shift-X to switch the text box direction to now avail. Unfortunately the way to turn this option on is quite hidden.</p>
<p>You have to navigate to <a href="about:config">about:config</a>, type <em>bidi</em> in the filter box, and double click the line that says <em>bidi.browser.ui</em>. That will set its value to <em>true</em>. All you have to do now is restart Firefox and the View-&gt;Switch Page Direction and Edit-&gt;Switch Text Direction menu items will be added along with the Ctrl-Shift-X shortcut.</p>
<p>Hope this helps some poor soul someday.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/&amp;title=Right+to+left+%28BiDi%29+support+in+Firefox" title="Add 'Right to left (BiDi) support in Firefox' to Del.icio.us"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/delicious.png" title="Add 'Right to left (BiDi) support in Firefox' to Del.icio.us" alt="Add 'Right to left (BiDi) support in Firefox' to Del.icio.us" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/&amp;title=Right+to+left+%28BiDi%29+support+in+Firefox" title="Add 'Right to left (BiDi) support in Firefox' to digg"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/digg.png" title="Add 'Right to left (BiDi) support in Firefox' to digg" alt="Add 'Right to left (BiDi) support in Firefox' to digg" /></a>
<a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/" title="Add 'Right to left (BiDi) support in Firefox' to Technorati"><img src="http://gooli.org/blog/wp-content/plugins/social_bookmarks/technorati.png" title="Add 'Right to left (BiDi) support in Firefox' to Technorati" alt="Add 'Right to left (BiDi) support in Firefox' to Technorati" /></a>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.gooli.org/blog/right-to-left-bidi-support-in-firefox-3/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
