<?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>Kami Kode</title>
	<atom:link href="http://kamikode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kamikode.wordpress.com</link>
	<description>kami.isCoding() == true;</description>
	<lastBuildDate>Mon, 26 Oct 2009 02:12:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='kamikode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Kami Kode</title>
		<link>http://kamikode.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kamikode.wordpress.com/osd.xml" title="Kami Kode" />
	<atom:link rel='hub' href='http://kamikode.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Helpful software</title>
		<link>http://kamikode.wordpress.com/2009/10/25/helpful-software/</link>
		<comments>http://kamikode.wordpress.com/2009/10/25/helpful-software/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 02:12:34 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=119</guid>
		<description><![CDATA[Again, not coding stuff (I&#8217;ve been sick so I&#8217;ve been sleeping a little more than normal, I think..), but a couple different somewhat related programs I&#8217;ve found helpful. Virtual Box: my Linux install on my USB keeps having errors for one reason or another (literally, I&#8217;ve reinstalled it 5-6 times), and it has stopped working [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=119&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Again, not coding stuff (I&#8217;ve been sick so I&#8217;ve been sleeping a little more than normal, I think..), but a couple different somewhat related programs I&#8217;ve found helpful.</p>
<p><a href="http://www.virtualbox.org/">Virtual Box</a>: my Linux install on my USB keeps having errors for one reason or another (literally, I&#8217;ve reinstalled it 5-6 times), and it has stopped working from the CD as well. So this allows you to install other operating systems on a virtual computer.</p>
<p><a href="http://virtuawin.sourceforge.net/">VirtuaWin</a>: one of the things I did like about Linux was the multiple desktops &#8211; this allows you to have that on Windows. So if you&#8217;re coding one project, you can have all the windows associated with that open on one desktop, have games and stuff open on another, some other project open on another, etc&#8230; I have it set up with 4 desktops (most of the time I don&#8217;t need more than 2 or 3), but you can have a whole bunch.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=119&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/25/helpful-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>States Dropdown</title>
		<link>http://kamikode.wordpress.com/2009/10/22/states-dropdown/</link>
		<comments>http://kamikode.wordpress.com/2009/10/22/states-dropdown/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 12:01:47 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[HTML / CSS]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=116</guid>
		<description><![CDATA[No learning here, just something that I seem to end up copy-pasting a lot, so I&#8217;ll be able to find it easily here.. (And it&#8217;d be easy to do a find-replace all of &#8216;asp:ListItem&#8217; to &#8216;option&#8217; if it&#8217;s going to be used in an html page rather than an asp/aspx page. Also, the required field [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=116&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>No learning here, just something that I seem to end up copy-pasting a lot, so I&#8217;ll be able to find it easily here.. (And it&#8217;d be easy to do a find-replace all of &#8216;asp:ListItem&#8217; to &#8216;option&#8217; if it&#8217;s going to be used in an html page rather than an asp/aspx page. Also, the required field validator would need to be taken out; that&#8217;s only if you want it to be required for a state to be selected, before the form can be submitted.)</p>
<p><code style="text-align:left;">&lt;asp:RequiredFieldValidator ControlToValidate="ddState" ID="Neko" runat="server" ErrorMessage="RequiredFieldValidator" Text="*" SetFocusOnError="true" /&gt;<br />
State:<br />
&lt;asp:DropDownList ID="ddState" runat="server"&gt;<br />
 &nbsp; &lt;asp:ListItem Selected="True" value=""&gt;Choose A State&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="AL"&gt;Alabama&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="AK"&gt;Alaska&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="AZ"&gt;Arizona&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="AR"&gt;Arkansas&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="CA"&gt;California&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="CO"&gt;Colorado&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="CT"&gt;Connecticut&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="DE"&gt;Delaware&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="DC"&gt;District of Columbia&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="FL"&gt;Florida&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="GA"&gt;Georgia&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="HI"&gt;Hawaii&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="ID"&gt;Idaho&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="IL"&gt;Illinois&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="IN"&gt;Indiana&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="IA"&gt;Iowa&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="KS"&gt;Kansas&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="KY"&gt;Kentucky&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="LA"&gt;Lousiana&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="ME"&gt;Maine&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MD"&gt;Maryland&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MA"&gt;Massachusetts&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MI"&gt;Michigan&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MN"&gt;Minnesota&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MS"&gt;Mississippi&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MO"&gt;Missouri&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="MT"&gt;Montana&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NE"&gt;Nebraska&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NV"&gt;Nevada&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NH"&gt;New Hampshire&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NJ"&gt;New Jersey&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NM"&gt;New Mexico&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NY"&gt;New York&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="NC"&gt;North Carolina&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="ND"&gt;North Dakota&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="OH"&gt;Ohio&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="OK"&gt;Oklahoma&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="OR"&gt;Oregon&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="PA"&gt;Pennsylvania&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="RI"&gt;Rhode Island&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="SC"&gt;South Carolina&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="SD"&gt;South Dakota&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="TN"&gt;Tennessee&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="TX"&gt;Texas&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="UT"&gt;Utah&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="VT"&gt;Vermont&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="VA"&gt;Virginia&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="WA"&gt;Washington&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="WV"&gt;West Virginia&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="WI"&gt;Wisconsin&lt;/asp:ListItem&gt;<br />
 &nbsp; &lt;asp:ListItem value="WY"&gt;Wyoming&lt;/asp:ListItem&gt;<br />
&lt;/asp:DropDownList&gt;<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=116&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/22/states-dropdown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>Find if a number is a power of two: Part 2</title>
		<link>http://kamikode.wordpress.com/2009/10/21/find-if-a-number-is-a-power-of-two-part-2/</link>
		<comments>http://kamikode.wordpress.com/2009/10/21/find-if-a-number-is-a-power-of-two-part-2/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 22:52:36 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++ (CPP)]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=107</guid>
		<description><![CDATA[My 1GB USB has 0 bytes left so Linux cannot boot from it; I have to reinstall Linux from the Live CD again&#8230; yaaay&#8230; &#60;/sarcasm&#62; Anyways, so I looked up the solution to how to find using only bitwise operators, if a number is a power of two. This site led me to another site [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=107&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My 1GB USB has 0 bytes left so Linux cannot boot from it; I have to reinstall Linux from the Live CD again&#8230; yaaay&#8230; &lt;/sarcasm&gt; Anyways, so I looked up the solution to how to find using only bitwise operators, if a number is a power of two. <a href="http://stackoverflow.com/questions/1053582/how-does-this-bitwise-operation-check-for-a-power-of-2">This site</a> led me to <a href="http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/">another site</a> with 10 different ways to check if an integer is a power of two; the one I need is a slight modification of the 9th way:</p>
<p><code style="text-align:left;">int isPowerOfTwo (unsigned int x) {<br />
 &nbsp; return ((x != 0) &amp;&amp; !(x &amp; (x - 1)));<br />
}<br />
</code></p>
<p>I couldn&#8217;t use exactly this, because of only being allowed these operators: &amp; | ^ ! + &gt;&gt; &lt;&lt; ~. So&#8230;here (I&#8217;ve broken the parts into separate variables so it doesn&#8217;t break onto multiple lines for one line of code, and also so I can use a few less parentheses to make sure the operations happen in the right order):</p>
<p><code style="text-align:left;">int isPowerOfTwo (int x) {<br />
 &nbsp; int a = !( (x&gt;&gt;31) &amp; 1 );<br />
 &nbsp; int b = !(!x);<br />
 &nbsp; int c = !( x &amp; ( x + ((((((FF&lt;&lt;8)+FF)&lt;&lt;8)+FF)&lt;&lt;8)+FF) ) );<br />
 &nbsp; return ( a &amp; b &amp; c );<br />
}</code></p>
<p>a will return 0 if x is less than 0.<br />
b will return 0 if x is 0. (Using ! twice makes 0 return 0 and anything else return 1.)<br />
c&#8217;s explanation I just pasted from the website&#8230;since it sums it up nicely.<br />
*Note: ( x + ((((((FF&lt;&lt;8)+FF)&lt;&lt;8)+FF)&lt;&lt;8)+FF) ) is using two&#8217;s complement to subtract one from x since we couldn&#8217;t use -.</p>
<hr />
!(x &amp; (x-1)) is true when x is a power of two and false when x is not. Let’s see why.</p>
<p>Let n be the position of the leftmost 1 bit if x. If x is a power of two, its lone 1 bit is in position n. This means x – 1 has a 0 in position n. To see why, recall how binary subtraction works. When subtracting 1 from x, the borrow propagates all the way to position n; bit n becomes 0 and all lower bits become 1. Now, since x has no 1 bits in common with x – 1, x &amp; (x – 1) is 0, and !(x &amp; (x – 1)) is true.</p>
<p>Here are some examples (I’ll use 8-bit unsigned integers to keep things manageable):</p>
<p>Decrement and Compare, when x is a power of two:<br />
x / x – 1 / x &amp; (x – 1)<br />
00000001 00000000 00000000<br />
00000100 00000011 00000000<br />
00010000 00001111 00000000</p>
<p>If x is not a power of two, x – 1 has a 1 in position n. This is because the borrow will not propagate to position n. Subtraction borrows from the lowest 1 bit, which by virtue of x not being a power of two, is before position n. The lowest 1 bit is like a firewall that prevents the borrow from reaching position n. Since x and x – 1 have at least one 1 bit in common — at position n — x &amp; (x – 1) is non-zero, and !(x &amp; (x – 1)) is false.</p>
<p>Here are some examples:<br />
Decrement and Compare, when x is a NOT power of two:<br />
x / x – 1 / x &amp; (x – 1)<br />
00000011 00000010 00000010<br />
00000110 00000101 00000100<br />
00001011 00001010 00001010<br />
00011100 00011011 00011000</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=107&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/21/find-if-a-number-is-a-power-of-two-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>Find if a number is a power of two</title>
		<link>http://kamikode.wordpress.com/2009/10/21/find-if-a-number-is-a-power-of-two/</link>
		<comments>http://kamikode.wordpress.com/2009/10/21/find-if-a-number-is-a-power-of-two/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 13:04:34 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++ (CPP)]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=102</guid>
		<description><![CDATA[I took a midterm today, for one of my programming classes, and realized what I could have given as at least a partial answer to one of the questions a few minutes too late. And so, I have a need to write it down in full somewhere. The question was, how to find if a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=102&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I took a midterm today, for one of my programming classes, and realized what I could have given as at least a partial answer to one of the questions a few minutes too late. And so, I have a need to write it down in full somewhere.</p>
<p>The question was, how to find if a number is a power of two, using only bitwise operators, and no more than 40; and without any constants larger than 8 bits. (We could use &amp; | ^ ! + &gt;&gt; &lt;&lt; ~) *Note: negative numbers were considered excluded, and so should return 0. Only positive numbers that were powers of two should return 1.</p>
<p><code style="text-align:left;">isPowerOfTwo(int x) {<br />
 &nbsp; int y = 31 - (x &gt;&gt; 1);<br />
 &nbsp; return ( ((x&lt;&lt;y) &gt;&gt; 31) &amp; 1);<br />
}</code><br />
I am still not sure exactly where to go with this. Bummer, because earlier I thought it would be the solution, but only when I typed it out now did I see the problem with it&#8230; Instead, it seems to return if the bit at the specified power of two is a 0 or a 1? I&#8217;m not sure exactly, and I&#8217;m supposed to be writing an essay, not writing code, so I can&#8217;t take the time to figure out what it does or the correct solution right now. It is bugging me&#8230;</p>
<p>*Random other side thought: I had to include the &#8220;CPP&#8221; in the C++ category, because apparently WordPress does not recognize a difference between &#8220;C++&#8221; and &#8220;C&#8221; as the category name; and it thought I was trying to add the same category twice. It probably normally doesn&#8217;t make a difference, but there are instances where code is not compatible between C and C++, and well&#8230;that&#8217;s not even getting into C#.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=102&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/21/find-if-a-number-is-a-power-of-two/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>Happy birthday Peeky :)</title>
		<link>http://kamikode.wordpress.com/2009/10/20/happy-birthday-peeky/</link>
		<comments>http://kamikode.wordpress.com/2009/10/20/happy-birthday-peeky/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 09:41:13 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=100</guid>
		<description><![CDATA[Just want to say happy birthday to my little guinea pig&#8230; She&#8217;s not physically with us any more, but I keep her spirit with me. :)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=100&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just want to say happy birthday to my little guinea pig&#8230;</p>
<p>She&#8217;s not physically with us any more, but I keep her spirit with me. :)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=100&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/20/happy-birthday-peeky/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>GDB Debugger</title>
		<link>http://kamikode.wordpress.com/2009/10/19/gdb-debugger/</link>
		<comments>http://kamikode.wordpress.com/2009/10/19/gdb-debugger/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 13:45:51 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=83</guid>
		<description><![CDATA[I&#8217;m not really sure where this belongs. GDB is a Linux debugger but I&#8217;m using it to step through assembly code of a program I don&#8217;t have the source code for, as a homework assignment, to find secret phrases hidden in the code&#8230; (This is an edited-for-nice-formatting copy-paste of GDB-commands-x86-64.txt because it&#8217;s been extremely helpful, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=83&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not really sure where this belongs. GDB is a Linux debugger but I&#8217;m using it to step through assembly code of a program I don&#8217;t have the source code for, as a homework assignment, to find secret phrases hidden in the code&#8230; (This is an edited-for-nice-formatting copy-paste of <a href="http://csapp.cs.cmu.edu/public/docs/GDB-commands-x86-64.txt">GDB-commands-x86-64.txt</a> because it&#8217;s been extremely helpful, and in case it ever gets taken down.)</p>
<hr />
Summary of GDB commands for x86-64 Systems<br />
<code style="text-align:left;">Command -------- Effect</code><br />
Starting and stopping<br />
<code style="text-align:left;">quit ---------- Exit gdb<br />
run ----------- Run your program<br />
run [args] ---- Run your program using the specific command-line arguments</code></p>
<p>Breakpoints<br />
<code style="text-align:left;">break sum --------- Set breakpoint at the entry to function sum<br />
break *0x80483c3 -- Set breakpoint at address 0x80483c3<br />
delete 1 ---------- Delete breakpoint 1 (gdb numbers each breakpoint you create)<br />
delete ------------ Delete all breakpoints<br />
until 3 ----------- Continue executing until the program hits breakpoint 3</code></p>
<p>Execution<br />
<code style="text-align:left;">stepi ------- Execute one instruction<br />
stepi 4 ----- Execute four instructions<br />
nexti ------- Like stepi, but proceed proceed through function calls without stopping<br />
continue ---- Resume execution until the next breakpoint<br />
finish ------ Resume execution until current function returns</code></p>
<p>Examining code<br />
<code style="text-align:left;">disas ------------ Disassemble current function<br />
disas sum -------- Disassemble function sum<br />
disas 0x80483b7 -- Disassemble function around 0x80483b7<br />
disas 0x80483b7 0x80483c7 - Disassemble code within specified address range<br />
-<br />
print /x $rip ---- Print program counter in hex<br />
print /d $rip ---- Print program counter in decimal<br />
print /t $rip ---- Print program counter in binary<br />
-<br />
call sum(1, 2) --- Call sum(1,2) and print return value</code></p>
<p>Examining data<br />
<code style="text-align:left;">print /d $rax -------------- Print contents of %rax in decimal<br />
print /x $rax -------------- Print contents of %rax in hex<br />
print /t $rax -------------- Print contents of %rax in binary<br />
print 0x100 ---------------- Print decimal representation of 0x100<br />
print /x 555 --------------- Print hex representation of 555<br />
print /x ($rsp+8) ---------- Print (contents of %rsp) + 8 in hex<br />
print *(int *) 0xbffff890 -- Print integer at address 0xbffff890<br />
print *(int *) ($rsp+8) ---- Print integer at address %rsp + 8<br />
print (char *) 0xbfff890 --- Examine a string stored at 0xbffff890<br />
print /d (int)$rax --------- Print contents of %rax in decimal after sign-extending lower 32-bits.*</code>*You need this to print 32-bit, negative numbers stored in the lower 32 bits of %rax. For example, if the lower 32-bits of %rax store 0xffffffff, you will see:<br />
(gdb) print $rax<br />
$1 = 4294967295<br />
(gdb) print (int)$rax<br />
$2 = -1<br />
(gdb)</p>
<p>Examining Data (continued)<br />
<code style="text-align:left;">x/w 0xbffff890 ------- Examine (4-byte) word starting at address 0xbffff890<br />
x/w $rsp ------------- Examine (4-byte) word starting at address in $rsp<br />
x/wd $rsp ------------ Examine (4-byte) word starting at address in $rsp. Print in decimal<br />
x/2w $rsp ------------ Examine two (4-byte) words starting at address in $rsp<br />
x/2wd $rsp ----------- Examine two (4-byte) words starting at address in $rsp. Print in decimal<br />
x/g $rsp ------------- Examine (8-byte) word starting at address in $rsp.<br />
x/gd $rsp ------------ Examine (8-byte) word starting at address in $rsp. Print in decimal<br />
x/a $rsp ------------- Examine address in $rsp. Print as offset from previous global symbol.<br />
-<br />
x/s 0xbffff890 ------- Examine a string stored at 0xbffff890<br />
-<br />
x/20b sum ------------ Examine first 20 opcode bytes of function sum<br />
x/10i sum ------------ Examine first 10 instructions of function sum</code><br />
Note: the format string for the `x&#8217; command has the general form x/[NUM][SIZE][FORMAT] where:<br />
 * NUM  = number of objects to display<br />
 * SIZE = size of each object (b=byte, h=half-word, w=word, g=giant (quad-word))<br />
 * FORMAT = how to display each object (d=decimal, x=hex, o=octal, etc.)<br />
If you don&#8217;t specify SIZE or FORMAT, either a default value, or the last value you specified in a previous `print&#8217; or `x&#8217; command is used.</p>
<p>Useful information<br />
<code style="text-align:left;">info frame ---------- Print available information about current stack frame<br />
info registers ------ Print values in all registers<br />
display /FMT EXPR --- Print expression EXPR using format FMT ever time GDB stops<br />
undisplay ----------- Turn off display mode<br />
help ---------------- Get information about gdb</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=83&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/19/gdb-debugger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>Substring</title>
		<link>http://kamikode.wordpress.com/2009/10/18/substring/</link>
		<comments>http://kamikode.wordpress.com/2009/10/18/substring/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 04:43:57 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Linux Shell Script]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=63</guid>
		<description><![CDATA[$kami="I am awesome." $neko=${kami:0:4} # $neko == "I am"<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=63&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code style="text-align:left;">$kami="I am awesome."<br />
$neko=${kami:0:4}<br />
# $neko == "I am"</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=63&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/18/substring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>While loop</title>
		<link>http://kamikode.wordpress.com/2009/10/18/while-loop/</link>
		<comments>http://kamikode.wordpress.com/2009/10/18/while-loop/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 04:40:26 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Linux Shell Script]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=61</guid>
		<description><![CDATA[Self explanatory, I think. while condition do &#160; # statements done To have a &#8220;do while&#8221; loop: while True do &#160; # statements &#160; if [ condition ] &#160; &#160; break done<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=61&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Self explanatory, I think.<br />
<code style="text-align:left;">while condition<br />
do<br />
 &nbsp; # statements<br />
done</code></p>
<p>To have a &#8220;do while&#8221; loop:<br />
<code style="text-align:left;">while True<br />
do<br />
 &nbsp; # statements<br />
 &nbsp; if [ condition ]<br />
 &nbsp; &nbsp; break<br />
done</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=61&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/18/while-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>Case statement (esac)</title>
		<link>http://kamikode.wordpress.com/2009/10/18/case-statement-esac/</link>
		<comments>http://kamikode.wordpress.com/2009/10/18/case-statement-esac/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 04:36:42 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Linux Shell Script]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=58</guid>
		<description><![CDATA[Everything between 0) and the first ;; gets run if variable==0 (so if there were no ;;, it would continue running the statements after 1), similar to C++ if break is not there). The default condition if none of the others match is *). case $variable in &#160; 0) &#160; &#160; &#160; # statements &#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=58&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Everything between 0) and the first ;; gets run if variable==0 (so if there were no ;;, it would continue running the statements after 1), similar to C++ if break is not there). The default condition if none of the others match is *).</p>
<p><code style="text-align:left;">case $variable in<br />
 &nbsp; 0)<br />
 &nbsp; &nbsp; &nbsp; # statements<br />
 &nbsp; ;;<br />
 &nbsp; 1)<br />
 &nbsp; &nbsp; &nbsp; # statements<br />
 &nbsp; ;;<br />
 &nbsp; *)<br />
 &nbsp; &nbsp; &nbsp; # statements<br />
 &nbsp; ;;<br />
esac</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=58&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/18/case-statement-esac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
		<item>
		<title>Debugging</title>
		<link>http://kamikode.wordpress.com/2009/10/18/debugging/</link>
		<comments>http://kamikode.wordpress.com/2009/10/18/debugging/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 04:31:34 +0000</pubDate>
		<dc:creator>kamisaibou</dc:creator>
				<category><![CDATA[Linux Shell Script]]></category>

		<guid isPermaLink="false">http://kamikode.wordpress.com/?p=56</guid>
		<description><![CDATA[This goes in the script file. set -x<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=56&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This goes in the script file.</p>
<p><code style="text-align:left;">set -x</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kamikode.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kamikode.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kamikode.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kamikode.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kamikode.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kamikode.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kamikode.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kamikode.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kamikode.wordpress.com&amp;blog=9931825&amp;post=56&amp;subd=kamikode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kamikode.wordpress.com/2009/10/18/debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72f89ed74bef9dc171abe1bb2592e205?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamisaibou</media:title>
		</media:content>
	</item>
	</channel>
</rss>
