<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Zero Flag</title>
	<atom:link href="http://zeroflag.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://zeroflag.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sat, 26 Apr 2008 20:57:46 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='zeroflag.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b5b15f2674c5265cc8d61e8e2fabb8a7?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>The Zero Flag</title>
		<link>http://zeroflag.wordpress.com</link>
	</image>
			<item>
		<title>Troubleshooting AIM/ICQ connectivity issues</title>
		<link>http://zeroflag.wordpress.com/2008/04/26/troubleshooting-aimicq-connectivity-issues/</link>
		<comments>http://zeroflag.wordpress.com/2008/04/26/troubleshooting-aimicq-connectivity-issues/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 20:57:46 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/?p=45</guid>
		<description><![CDATA[Lately I&#8217;ve been having connectivity issues on both AIM and ICQ. (I couldn&#8217;t remember the last time I was actually logged on.) If you don&#8217;t care about the debugging story, skip to the conclusions below.

Since Miranda doesn&#8217;t really log anything (and if it does, correct me in a comment!) I ran Wireshark to figure out [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=45&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Lately I&#8217;ve been having connectivity issues on both AIM and ICQ. (I couldn&#8217;t remember the last time I was actually logged on.) If you don&#8217;t care about the debugging story, skip to the conclusions below.</p>
<p><span id="more-45"></span></p>
<p>Since <a href="http://www.miranda-im.org/">Miranda</a> doesn&#8217;t really log anything (and if it does, correct me in a comment!) I ran <a href="http://www.wireshark.org/">Wireshark</a> to figure out what&#8217;s wrong.</p>
<p>The first thing I saw is the server accepting my connection (10 seconds after the first SYN), sending me the first AIM packet, and 12 seconds later forcefully dropping the connection (RST). Look at the timestamps:</p>
<p><a href="http://zeroflag.files.wordpress.com/2008/04/aim1.png"><img class="aligncenter size-medium wp-image-46" src="http://zeroflag.files.wordpress.com/2008/04/aim1.png?w=300&#038;h=45" alt="" width="300" height="45" /></a></p>
<p>Thinking I was simply dealing with a really laggy server, I asked <a href="http://crog.wordpress.com/">Eli</a> to check what server he&#8217;s connected to (by running <em>netstat -an | find &#8220;5190&#8243;</em>). He gave me two servers, and trying them revealed they don&#8217;t even answer my SYN packets. (It worked just fine for him.)</p>
<p><a href="http://zeroflag.files.wordpress.com/2008/04/aim2.png"><img class="aligncenter size-medium wp-image-47" src="http://zeroflag.files.wordpress.com/2008/04/aim2.png?w=300&#038;h=34" alt="" width="300" height="34" /></a></p>
<p>There are three possible reasons:<br />
1. The router (due to misconfigured NAT or port forwarding?) or modem is blocking outbound connections to port 5190.<br />
2. My ISP is blocking my traffic to the AIM server.<br />
3. The AIM server&#8217;s firewall is rejecting my IP address.</p>
<p>1 is unlikely, but just to check, I had Eli run a Python socket server on port 5190, and tried to connect to it &#8211; it worked.<br />
2 is unlikely, and there&#8217;s nothing much I can do to check it.</p>
<p>3 is possible though. To test this theory, I rebooted my modem to change IP address.<br />
On my first try, I stayed within the same subnet (89.138.0.0/16) and got the same result.<br />
On my second try, I moved to a different subnet (85.250.0.0/16) and this time, I got a different result:</p>
<p><a href="http://zeroflag.files.wordpress.com/2008/04/aim3.png"><img class="aligncenter size-medium wp-image-48" src="http://zeroflag.files.wordpress.com/2008/04/aim3.png?w=300&#038;h=32" alt="" width="300" height="32" /></a></p>
<p>Like in the first attempt, the server is accepting my connection and answering it, but forcefully disconnecting soon (and this time very quickly, so lag is out of the question).<br />
This proves that the previous subnet I was on is blocked on the server&#8217;s side, probably with a firewall such as iptables. But what&#8217;s wrong now?</p>
<p>I remembered that the server IPs I got from Eli were on a completely different subnet than the one my ISP&#8217;s DNS server had returned. This leads to the theory of nazi load balancing &#8211; only certain ISPs can connect to certain AIM servers, and those ISP&#8217;s DNS servers are configured accordingly.</p>
<p>Indeed, returning the client configuration to the default &#8220;login.oscar.aol.com&#8221; solved the problem and I finally managed to connect to both AIM and ICQ.</p>
<h2><strong>Conclusions</strong></h2>
<p>1. If you&#8217;re unable to connect, perhaps your subnet is banned by the server. Get on a different subnet and try again.<br />
2. Don&#8217;t connect to a specific server, because AIM&#8217;s load balancing scheme (assuming that&#8217;s what it is) might reject you. Just connect to the default &#8220;login.oscar.aol.com&#8221; (or &#8220;login.messaging.aol.com&#8221;).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=45&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2008/04/26/troubleshooting-aimicq-connectivity-issues/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>

		<media:content url="http://zeroflag.files.wordpress.com/2008/04/aim1.png?w=300" medium="image" />

		<media:content url="http://zeroflag.files.wordpress.com/2008/04/aim2.png?w=300" medium="image" />

		<media:content url="http://zeroflag.files.wordpress.com/2008/04/aim3.png?w=300" medium="image" />
	</item>
		<item>
		<title>What to do?</title>
		<link>http://zeroflag.wordpress.com/2008/03/22/what-to-do/</link>
		<comments>http://zeroflag.wordpress.com/2008/03/22/what-to-do/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 02:24:22 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2008/03/22/what-to-do/</guid>
		<description><![CDATA[Okay, the reason I haven&#8217;t posted in a long while is that it&#8217;s incredibly inconvenient.
Any suggestions on how to make WordPress friendlier, or on which is the best code-blogging platform?
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=44&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Okay, the reason I haven&#8217;t posted in a long while is that it&#8217;s <a href="http://zeroflag.wordpress.com/2007/05/03/void-hexdumpconst-void-buf-size_t-size/">incredibly inconvenient</a>.</p>
<p>Any suggestions on how to make WordPress friendlier, or on which is the best code-blogging platform?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=44&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2008/03/22/what-to-do/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>How to create a big FAT32 partition</title>
		<link>http://zeroflag.wordpress.com/2007/10/04/how-to-create-a-big-fat32-partition/</link>
		<comments>http://zeroflag.wordpress.com/2007/10/04/how-to-create-a-big-fat32-partition/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 23:39:25 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/10/04/how-to-create-a-big-fat32-partition/</guid>
		<description><![CDATA[(Well, this is at least one way to do it&#8230; I&#8217;m sure there are easier and faster ways.)
Windows XP and up doesn&#8217;t let you create a FAT32 partition that&#8217;s bigger than 32GB. It can handle them, but not create them.
One obvious way to do it, is&#8230; use Linux.

Install Linux in VMware. I used Slackware 12.0 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=43&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>(Well, this is at least <em>one</em> way to do it&#8230; I&#8217;m sure there are easier and faster ways.)</p>
<p>Windows XP and up doesn&#8217;t let you create a FAT32 partition that&#8217;s bigger than 32GB. It can handle them, but not create them.<br />
One obvious way to do it, is&#8230; use Linux.</p>
<ol>
<li>Install Linux in <a href="http://www.vmware.com">VMware</a>. I used <a href="http://www.slackware.com">Slackware 12.0</a> on VMware Workstation 5.5.5.</li>
<li>Add a physical hard disk that uses the disk you&#8217;d like to partition. To figure out the exact disk number (i.e. PhysicalDisk5), use diskmgmt.msc.</li>
<li>If you don&#8217;t have patience to figure out how to make SCSI work in Linux (as I didn&#8217;t), change the disk to an IDE disk:
<ul>
<li>Close VMware and edit the .vmx and .vmdk files manually (with Notepad or any other editor).</li>
<li>In the .vmx file, remove the line <strong>scsi0.present = &#8220;TRUE&#8221;</strong></li>
<li>In the .vmx file, change any occurrence of <strong>scsi0:0</strong> to <strong>ide1:1</strong> (this will make the disk IDE Secondary Slave &#8211; make sure you have a Secondary Master).</li>
<li>In the .vmdk file, change the line <strong>ddb.adapterType = &#8220;lsilogic&#8221;</strong> to <strong>ddb.adapterType = &#8220;ide&#8221;</strong></li>
</ul>
</li>
<li>Boot into Linux and login as root.</li>
<li>Run <strong>fdisk /dev/hdd</strong> (this assumes your HD is IDE Secondary Slave; otherwise, use the correct device name).</li>
<li>Press <strong>p</strong> to list partitions; delete them all by repeatedly using <strong>d</strong>; create one partition spanning the whole disk by pressing <strong>n</strong> and using the default for each question.</li>
<li>Change the type to FAT32 by pressing <strong>t</strong>, and for the partition type hex code, enter <strong>c</strong></li>
<li>Make sure you did nothing wrong, and press <strong>w</strong> to write the partition table to the disk. This is irreversible!</li>
<li>Back in the root prompt, format the new FAT32 partition by using: <strong>mkdosfs -F 32 /dev/hdd1</strong></li>
</ol>
<p>That&#8217;s it &#8211; you now have a big FAT32 partition. Make sure you don&#8217;t mount it in both Windows and Linux at the same time, because they <strong>won&#8217;t</strong> be sync&#8217;ed. (To unmount in Windows, choose &#8220;Change Drive Letter and Paths&#8221; in diskmgmt.msc, and remove all drive letters and NTFS mount points.)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/43/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/43/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=43&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/10/04/how-to-create-a-big-fat32-partition/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Save&#8221; and &#8220;Save As&#8221; don&#8217;t do the same thing in Microsoft&#8217;s &#8220;Orca&#8221;</title>
		<link>http://zeroflag.wordpress.com/2007/08/04/save-and-save-as-dont-do-the-same-thing-in-microsofts-orca/</link>
		<comments>http://zeroflag.wordpress.com/2007/08/04/save-and-save-as-dont-do-the-same-thing-in-microsofts-orca/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 23:23:33 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Bad practices]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/08/04/save-and-save-as-dont-do-the-same-thing-in-microsofts-orca/</guid>
		<description><![CDATA[&#8220;Orca&#8221; is an editor for MSI files that comes with the Microsoft Windows Installer SDK.
Some program wouldn&#8217;t install on my system, claiming it can&#8217;t run on &#8220;Server&#8221; editions of Windows.I edited the MSI file with Orca to remove the offending condition. I used File -&#62; Save As to save the edited MSI under a different [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=42&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#8220;Orca&#8221; is an editor for MSI files that comes with the Microsoft Windows Installer SDK.</p>
<p>Some program wouldn&#8217;t install on my system, claiming it can&#8217;t run on &#8220;Server&#8221; editions of Windows.<br />I edited the MSI file with Orca to remove the offending condition. I used File -&gt; Save As to save the edited MSI under a different filename.</p>
<p>When I ran the installer again, it skipped the &#8220;Bad Windows edition&#8221; message, and instead gave me a worse error: &#8220;Error 2356&#8243;.<br />Digging in the SDK revealed the matching error message: &#8220;Could not locate cabinet in stream: [2].&#8221;</p>
<p>After a while of searching for the possible cause, I uncovered this in the Orca help, under &#8220;Special Considerations when editing Databases&#8221;:</p>
<blockquote><p><b>Embedded Streams and Storages</b><br />When a database is saved using the Save As… or Save Transformed As… command, embedded binary streams (such as embedded cabinet files) are not saved to the new database unless they are part of a data row. Embedded sub-storages (nested install files) are never saved to the new database.</p></blockquote>
<p>The solution? Make a renamed copy of the original MSI, edit with Orca, and save using File -&gt; Save.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=42&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/08/04/save-and-save-as-dont-do-the-same-thing-in-microsofts-orca/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>crc32 in Python</title>
		<link>http://zeroflag.wordpress.com/2007/07/10/crc32-in-python/</link>
		<comments>http://zeroflag.wordpress.com/2007/07/10/crc32-in-python/#comments</comments>
		<pubDate>Tue, 10 Jul 2007 18:23:16 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/07/10/crc32-in-python/</guid>
		<description><![CDATA[from zlib import crc32
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=41&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre><b>from</b> zlib <b>import</b> crc32</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=41&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/07/10/crc32-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>In debug and log messages, put the data at the end, not the middle.</title>
		<link>http://zeroflag.wordpress.com/2007/05/27/in-debug-and-log-messages-put-the-data-at-the-end-not-the-middle/</link>
		<comments>http://zeroflag.wordpress.com/2007/05/27/in-debug-and-log-messages-put-the-data-at-the-end-not-the-middle/#comments</comments>
		<pubDate>Sun, 27 May 2007 11:15:48 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Bad practices]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/05/27/in-debug-and-log-messages-put-the-data-at-the-end-not-the-middle/</guid>
		<description><![CDATA[In messages where a big string may be inserted, prefer &#8220;something something %s&#8221; over &#8220;something %s something&#8221;.
Example:
In this example, %s is a long hex-string representing an array&#8217;s contents.
Bad:
[DECODE] [DEBUG] Was passed array &#8216;%s&#8217; for processing
Good:
[DECODE] [DEBUG] Was passed array for processing: &#8216;%s&#8217;
Best:
[DECODE] [DEBUG] Function myDecodeFunc called with myArray = &#8216;%s&#8217;
      [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=37&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In messages where a big string may be inserted, prefer &#8220;something something %s&#8221; over &#8220;something %s something&#8221;.</p>
<p>Example:<br />
In this example, %s is a long hex-string representing an array&#8217;s contents.</p>
<p>Bad:</p>
<p><strong>[DECODE] [DEBUG] Was passed array &#8216;%s&#8217; for processing</strong></p>
<p>Good:</p>
<p><strong>[DECODE] [DEBUG] Was passed array for processing: &#8216;%s&#8217;</strong></p>
<p>Best:</p>
<p><strong>[DECODE] [DEBUG] Function myDecodeFunc called with myArray = &#8216;%s&#8217;</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=37&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/05/27/in-debug-and-log-messages-put-the-data-at-the-end-not-the-middle/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows features you didn&#8217;t know existed: start /b and start /priority</title>
		<link>http://zeroflag.wordpress.com/2007/05/12/start-command/</link>
		<comments>http://zeroflag.wordpress.com/2007/05/12/start-command/#comments</comments>
		<pubDate>Sat, 12 May 2007 13:47:42 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/05/12/start-command/</guid>
		<description><![CDATA[In popular Unix/Linux shells, there is an option to start a process in the &#8220;background&#8221; by (i.e. in bash) typing &#8220;./something &#38;&#8220;, or pressing Ctrl-Z and then &#8220;bg&#8220;. The process then prints its output to stdout as usual, but the bash runs in the foreground and receives console stdin.
In Windows, something similar (much less powerful [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=36&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In popular Unix/Linux shells, there is an option to start a process in the &#8220;background&#8221; by (i.e. in <strong>bash</strong>) typing &#8220;<em>./something &amp;</em>&#8220;, or pressing Ctrl-Z and then &#8220;<em>bg</em>&#8220;. The process then prints its output to stdout as usual, but the bash runs in the foreground and receives console stdin.</p>
<p>In Windows, something similar (much less powerful than the bash &#8220;jobs&#8221;, though) can be done by doing: <strong>start /b something</strong></p>
<p><span id="more-36"></span>This runs the process in the background, and its output is printed to your stdout, even though cmd continues running immediately and receives your stdin. (If the process tries to read from stdin, weird things happen that I can&#8217;t explain.)</p>
<p>If you do &#8220;<strong>start something</strong>&#8221; without the &#8220;/b&#8221; switch, the process runs in another window, which closes when it exits.</p>
<p>Another switch for &#8220;<strong>start</strong>&#8221; is /<em>priority</em>, where <em>priority</em> is the name of a process priority. This can be combined with /b to give you:</p>
<p align="center"><strong>start /b /realtime pslist</strong></p>
<p>to get a pslist output that runs in realtime priority.</p>
<p>Important note about this: You may think this is unnecessary if your cmd already runs in high priority, because the priority will carry on to the child process by default anyway, right?</p>
<p>Wrong! Here is the relevant excerpt from the documentation of the <strong>CreateProcess</strong> function:</p>
<blockquote><dl>
<dt><em>dwCreationFlags</em>  </dt>
<dd>[in] Flags that control the priority class and the creation of the process.  For a list of values, see <u>Process Creation  Flags</u>.This parameter also controls the new process&#8217;s priority class, which is used  to determine the scheduling priorities of the process&#8217;s threads. For a list of  values, see <u><strong>GetPriorityClass</strong></u>. If none  of the priority class flags is specified, the priority class defaults to  NORMAL_PRIORITY_CLASS unless the priority class of the creating process is  IDLE_PRIORITY_CLASS or BELOW_NORMAL_PRIORITY_CLASS. In this case, the child  process receives the default priority class of the calling process. </dd>
</dl>
</blockquote>
<p>Well, that was news to me, anyway.</p>
<p>I really recommend reading <strong>start /?</strong> and <strong>cmd /?</strong>, to catch up with the other cool features you didn&#8217;t know about.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=36&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/05/12/start-command/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>Python: Why to assign functions&#8217; return values to dummy variables</title>
		<link>http://zeroflag.wordpress.com/2007/05/12/python-why-to-assign-functions-return-values-to-dummy-variables/</link>
		<comments>http://zeroflag.wordpress.com/2007/05/12/python-why-to-assign-functions-return-values-to-dummy-variables/#comments</comments>
		<pubDate>Sat, 12 May 2007 01:10:51 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/05/12/python-why-to-assign-functions-return-values-to-dummy-variables/</guid>
		<description><![CDATA[In response to Kototama&#8217;s comment in the previous post:
There is a need, when running directly under the interpreter (code placed in the global namespace, not inside a function or method), to assign the return value of any function to a dummy variable.
This is because when you enter an expression that has a value (other than [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=35&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In response to Kototama&#8217;s comment in <a href="http://zeroflag.wordpress.com/2007/05/05/python-tricks-press-enter-to-exit-on-unhandled-exception/">the previous post</a>:</p>
<p>There is a need, when running directly under the interpreter (code placed in the global namespace, not inside a function or method), to assign the return value of any function to a dummy variable.</p>
<p><span id="more-35"></span>This is because when you enter an expression that has a value (other than <code>None</code>) in the interpreter, the value&#8217;s representation (&#8220;repr&#8221;) is printed to standard output.<br />
Example (standard output given in blue):</p>
<p><code>&gt;&gt;&gt; def add_num(mylist):<br />
&nbsp;&nbsp;&nbsp;&nbsp;num = max(mylist) + 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;mylist.append(num)<br />
&nbsp;&nbsp;&nbsp;&nbsp;return num<br />
&nbsp;<br />
&gt;&gt;&gt; mylist = [0]<br />
&gt;&gt;&gt; mylist<br />
<font color="blue"><strong>[0]</strong></font><br />
&gt;&gt;&gt; add_num(mylist)<br />
<font color="blue"><strong>1</strong></font><br />
&gt;&gt;&gt; mylist<br />
<font color="blue"><strong>[0, 1]</strong></font></code></p>
<p>That&#8217;s nice, but eventually we&#8217;ll do something like this, without giving it much thought:</p>
<p><code>&gt;&gt;&gt; for i in xrange(10):<br />
&nbsp;&nbsp;&nbsp;&nbsp;add_num(mylist)<br />
&nbsp;<br />
<font color="blue"><strong>2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9<br />
10<br />
11</strong></font></code></p>
<p>Eh?! We didn&#8217;t want those to be printed at all. Where did they come from?<br />
&#8220;for&#8221; loop or not, the <code>add_num</code> calls were still directly in the global namespace and not inside a function or method, so the value of the expression was printed.</p>
<p>What I usually do to solve this is to put the code in a <code>main()</code> function and simply calling it in the global namespace.<br />
But in the example I gave in that post, I had to specifically modify code outside <code>main()</code>, hence the need to assign to a dummy variable, to avoid having an expression with a value (unlike C, in Python an assignment is not an expression).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=35&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/05/12/python-why-to-assign-functions-return-values-to-dummy-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
		<item>
		<title>data: URI</title>
		<link>http://zeroflag.wordpress.com/2007/05/11/data-uri/</link>
		<comments>http://zeroflag.wordpress.com/2007/05/11/data-uri/#comments</comments>
		<pubDate>Fri, 11 May 2007 13:25:48 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[Web programming]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/05/11/data-uri/</guid>
		<description><![CDATA[(None of this works in IE &#8211; use Firefox.)
The data: URI is a type of URI that contains the data that is returned, in the URI itself.

Basic usage: (Paste these into the Firefox address bar!)
data:text/plain,Hello world!
data:text/html,&#60;a href=&#34;http://www.google.com&#34;&#62;Google it up&#60;/a&#62;
data:image/png;base64,R0lGODlhEAAQAIAAAP///wAAACwAAAAAEAAQAAACH4RvoauIzNyBSyYaLMDZcv15HAaSIlWiJ5Sya/RWVgEAOw==

You can also have things longer than what fits in URL in an HTML &#8220;src&#8221; attribute, which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=32&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>(None of this works in IE &#8211; use Firefox.)</p>
<p>The <a href="http://en.wikipedia.org/wiki/Data:_URI_scheme" title="URI">data: URI</a> is a type of URI that contains the data that is returned, in the URI itself.<br />
<span id="more-32"></span><br />
Basic usage: (Paste these into the Firefox address bar!)<br />
<code>data:text/plain,Hello world!<br />
data:text/html,&lt;a href=&quot;http://www.google.com&quot;&gt;Google it up&lt;/a&gt;<br />
data:image/png;base64,R0lGODlhEAAQAIAAAP///wAAACwAAAAAEAAQAAACH4RvoauIzNyBSyYaLMDZcv15HAaSIlWiJ5Sya/RWVgEAOw==</code></p>
<p><img src='http://zeroflag.files.wordpress.com/2007/05/datauri.png' alt='datauri.png' /></p>
<p>You can also have things longer than what fits in URL in an HTML &#8220;src&#8221; attribute, which requires a URI; for instance, you can embed images in your HTML without having a separate file, like this:</p>
<p><code><strong><font color="red">&lt;img src=&quot;data:image/png;base64,</font></strong><br />
iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAIAAACzY+a1AAAAAXNSR0IArs4c6QAAAARnQU1BAACx<br />
jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABglJREFU<br />
eF7tnethnDAQhJO2riDqoRqauWIcHuJ5IO1I4jwbxr8cexG782n0gnP+/vz8/NGXawV6hPpyrcAf<br />
19kr+WEQlQreFRBC7wTlQvcEhVAI/SvgvgLNhULoXgH3BciFQuheAfcFyIVC6F4B9wXIhULoXgH3<br />
BciFQuheAfcFyIVC6F4B9wXIhULoXgH3BciFQuheAfcFyIVC6F4B9wXIhULoXgH3BciFQuheAfcF<br />
yIVC6F4B9wXIhULoXgH3BciFQuheAfcFyIVC6F4B9wXIhULoXgH3BciFQuheAfcFyIVC6F4B9wXI<br />
hULoXgH3BciFQuheAfcFyIVC6F6BqYB3+xr+rOyrfYfv+n80nYvi5MIJYNO+V5KBXdcUQOyaoUsU<br />
NGDuPkI4SNW1E8H+u2Yj+/pjs54bRwshpFph8OzCaRDtR9OAs8REow1LGrDWJBfu5sIR3zQGluov<br />
hNY+SBsnhLRorIkJoVUp2jghpEVjTUwIrUrRxgkhLRprYv8zwuUoxC7GvFOzXhGNW0/Q0P+pCUrj<br />
v0XYFwYJse7aau6StxQt6awnqPZO5BLhUGhU6D7AItipTCXXnjWYQ9Ga/Hw2EFxes/OdlFLtdGZI<br />
e8n1tAcmCSd6eJ6BI41iFPvom1nYHb6LrIVwOR4OPfCzw+4YZ2Vb3sLHbRGK77alfPpUC+FysLie<br />
Eu/1qqF/jTaKKGb1vLsvqoQwNUiOvd06lVzWPLZyw2i2W6Pe0P69ECsgHARI0Uktz3a/v17/pZop<br />
0Gq7BPFFsRShbaEYNeEqXnjSc90fzts5LAAPu71U71qxO6VYhrBrbAKN4sRD58EstSspfo4Xdeq+<br />
OxWY+ouXliA0v1sy4UkMT5bpcv9U/R6Zbhys70k4HyFwTmZCOL1EFud8P8IBoG1kGXmgR3SH+CpM<br />
sxECBMMbfgllurZpUgzPEdaaCy2dqIrodRvJRgidlaTnwnFQTvrQZudMhUADZt6l/mUlCE9HkdOR<br />
8HKeC/vJeVadVVzOeg4FW+bLPI2SvSev2W9clY1weQH6CPKU4dUaIaxD94er1zPiXUsNy9b2GzSy<br />
7lGA8OR+17vEKqPUTVa55dwui0bWRbURhhfbP3OpoVONNo6ZIQZElnC7+yxrAeRuVp41EcY3+uX6<br />
l7fwoQrWZGQjvKyKr9bdwwDVNJc93MrrJK4Y4WZFb9i7l5w+QmtgiySgJVJH+dPDmssKbUeRlrwP<br />
McUIkXuWVFFy7WmOqAHDZ9eu603M1MkegCi5jf0qwv7GV9uFRP59/SUG/mh9PpEFT1diOcQJDtNo<br />
u/3UVC6wz+u+jXCkCJxgDRlXH0HjxzkRrDGE166eV+M3HUz8AsJ6/S+vpUwHJp617Dl958Wnqf4H<br />
IswDn7hqs++tPein8hXClEKm3y8Eq6+60rcXwrRG6YiwPcEWuelmbRGPRmhfX8RXVPPs+nqlnpbZ<br />
oGBRj0Y4rnbTm5XUg+Z1O1HlJBgD+PjljHWDE5vithvC32D4bBdOBOdtYsSPMYTbGXB5oJl5hIE6<br />
8PGbiong5kX7sy3jCDaC8GC80B/Sw3MOrdNrnuzCcOhlOSv6hb2CGfGDEQ5YXm27/cBcjgvNUt8V<br />
+FyE8yFK2C+8uy78Da8zqeXCuzpgSbvLYnSavSLD6eJNy5BbklLetc91YZ5ehFcJISEULCUhxPQi<br />
jBZCQihYSkKI6UUYLYSEULCUhBDTizBaCAmhYCkJIaYXYbQQEkLBUhJCTC/CaCEkhIKlJISYXoTR<br />
QkgIBUtJCDG9CKOFkBAKlpIQYnoRRgshIRQsJSHE9CKMFkJCKFhKQojpRRgthIRQsJSEENOLMFoI<br />
CaFgKQkhphdhtBASQsFSEkJML8JoISSEgqUkhJhehNFCSAgFS0kIMb0Io4WQEAqWkhBiehFGCyEh<br />
FCwlIcT0IowWQkIoWEpCiOlFGC2EhFCwlIQQ04swWggJoWApCSGmF2G0EBJCwVISQkwvwmghJISC<br />
pSSEmF6E0UJICAVLSQgxvQijhZAQCpaSEGJ6EUYLISEULCUhxPQijBZCQihYSkKI6UUYLYSEULCU<br />
/gHuR+GZdKXjSgAAAABJRU5ErkJggg==<strong><font color="red">&quot; /&gt;</font></strong></code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=32&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/05/11/data-uri/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>

		<media:content url="http://zeroflag.files.wordpress.com/2007/05/datauri.png" medium="image">
			<media:title type="html">datauri.png</media:title>
		</media:content>
	</item>
		<item>
		<title>RealtimeCmd &#8211; hotkey for running cmd.exe in realtime priority</title>
		<link>http://zeroflag.wordpress.com/2007/05/05/realtimecmd-hotkey-for-running-cmdexe-in-realtime-priority/</link>
		<comments>http://zeroflag.wordpress.com/2007/05/05/realtimecmd-hotkey-for-running-cmdexe-in-realtime-priority/#comments</comments>
		<pubDate>Sat, 05 May 2007 20:28:53 +0000</pubDate>
		<dc:creator>Yoni</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://zeroflag.wordpress.com/2007/05/05/realtimecmd-hotkey-for-running-cmdexe-in-realtime-priority/</guid>
		<description><![CDATA[Sometimes your system hangs because some process enters a busy-loop that does evil things, like allocating huge amounts of memory and causing the swapfile manager to make Windows crawl. In those cases it would be nice to have something that runs in high priority that can kill the offending process. Microsoft addressed this by running [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=31&subd=zeroflag&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Sometimes your system hangs because some process enters a busy-loop that does evil things, like allocating huge amounts of memory and causing the swapfile manager to make Windows crawl. In those cases it would be nice to have something that runs in high priority that can kill the offending process. Microsoft addressed this by running winlogon.exe and taskmgr.exe in &#8220;High&#8221; priority, but that&#8217;s just not enough&#8230;</p>
<p><span id="more-31"></span></p>
<p>RealtimeCmd is a simple program that runs in &#8220;Realtime&#8221; process priority, idle thread priority (thus lower than any other realtime process, but higher than any non-realtime process) and waits for the hotkey Ctrl-Shift-Alt-WinKey-C <font color="red">(*)</font> (use both hands!). When the hotkey happens, it spawns cmd.exe, in realtime process priority.</p>
<p align="center"><strong><a href="http://yoni.valhallalegends.com/stuff/RealtimeCmd-src.zip">Source code</a> ; <a href="http://yoni.valhallalegends.com/stuff/RealtimeCmd-exe.zip">Compiled exe</a></strong></p>
<p><strong>Important note</strong>: Due to the behavior of the CreateProcess function, programs you run in cmd normally will have Normal priority class. To get them to have Realtime priority class, use the &#8220;start&#8221; command, i.e.: &#8220;start /realtime pskill iexplore&#8221; instead of just &#8220;pskill iexplore&#8221;.</p>
<p>Now I&#8217;ll explain how to install it as a Windows service, using the <a href="http://www.microsoft.com/windows/reskits/" title="Windows Resource Kits">Windows Resource Kit</a> tools instsrv.exe and srvany.exe. (These don&#8217;t come with Windows &#8211; you have to install the resource kit tools from the Windows CD or from the web.)</p>
<hr />
<pre style="color:#000000;">
<strong><font color="blue">C:&#92;Misc&gt;instsrv RealtimeCmd </font><font color="red">[...]
    [...] </font><font color="blue">&quot;C:&#92;Program Files&#92;Windows Resource Kits&#92;Tools&#92;srvany.exe&quot;</font></strong>

The service was successfuly added!

Make sure that you go into the Control Panel and use
the Services applet to change the Account Name and
Password that this newly installed service will use
for its Security Context.

<strong><font color="blue">C:&#92;Misc&gt;reg add </font><font color="red">[...]
    [...] </font><font color="blue">HKLM&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd&#92;Parameters </font><font color="red">[...]
    [...] </font><font color="blue">/v Application /d C:&#92;Misc&#92;Tools&#92;RealtimeCmd.exe</font></strong>
The operation completed successfully.

<strong><font color="blue">C:&#92;Misc&gt;reg add HKLM&#92;System&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd </font><font color="red">[...]
    [...] </font><font color="blue">/v Type /t REG_DWORD /d 0x110</font></strong>
Value Type exists, overwrite(Yes/No)? y
The operation completed successfully.

<strong><font color="blue">C:&#92;Misc&gt;reg query </font><font color="red">[...]
    [...] </font><font color="blue">HKLM&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd</font></strong>

HKEY_LOCAL_MACHINE&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd
    Type    REG_DWORD    0x110
    Start    REG_DWORD    0x2
    ErrorControl    REG_DWORD    0x1
    ImagePath    REG_EXPAND_SZ    C:&#92;Program Files&#92;Windows Resource Kits&#92;Tools&#92;srvany.exe
    DisplayName    REG_SZ    RealtimeCmd
    ObjectName    REG_SZ    LocalSystem

HKEY_LOCAL_MACHINE&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd&#92;Parameters
HKEY_LOCAL_MACHINE&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd&#92;Security

<strong><font color="blue">C:&#92;Misc&gt;reg query </font><font color="red">[...]
    [...] </font><font color="blue">HKLM&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd&#92;Parameters</font></strong>

HKEY_LOCAL_MACHINE&#92;SYSTEM&#92;CurrentControlSet&#92;Services&#92;RealtimeCmd&#92;Parameters
    Application    REG_SZ    C:&#92;Misc&#92;Tools&#92;RealtimeCmd.exe
</pre>
<hr />
<p><font color="red">(*)</font> I was going to use <a href="http://www.homestarrunner.com/sbemail169.html" title="Strong Bad Email - from work">Esc+Ctrl+Tab+Alt+Both Shifts+Num Lock+~</a>, but it was already taken.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeroflag.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeroflag.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeroflag.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeroflag.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeroflag.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeroflag.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeroflag.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeroflag.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeroflag.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeroflag.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeroflag.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeroflag.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeroflag.wordpress.com&blog=1047529&post=31&subd=zeroflag&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://zeroflag.wordpress.com/2007/05/05/realtimecmd-hotkey-for-running-cmdexe-in-realtime-priority/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3fe95c1b11e6169813ecf5d6b21c7f61?s=96&#38;d=identicon" medium="image">
			<media:title type="html">yoni</media:title>
		</media:content>
	</item>
	</channel>
</rss>