<?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 website of Lei Chen</title>
	<atom:link href="http://hide1713.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hide1713.wordpress.com</link>
	<description>Sunshine and rain of a developer</description>
	<lastBuildDate>Mon, 04 Jul 2011 18:52:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hide1713.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The website of Lei Chen</title>
		<link>http://hide1713.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hide1713.wordpress.com/osd.xml" title="The website of Lei Chen" />
	<atom:link rel='hub' href='http://hide1713.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Emacs Function Key Binding in GNU Screen with input-decode-map</title>
		<link>http://hide1713.wordpress.com/2011/07/04/emacs-function-key-binding-in-gnu-screen-with-input-decode-map/</link>
		<comments>http://hide1713.wordpress.com/2011/07/04/emacs-function-key-binding-in-gnu-screen-with-input-decode-map/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 18:45:46 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=471</guid>
		<description><![CDATA[Problem: When you run Emacs in text mode or in a GNU screen, some of the function key bindings are not working.  For example. &#60;S-f4&#62; will just print &#8220;;2S&#8221; on the screen instead of running command that binds to Shift f4.  Some of the key binding such as Ctrl-arrow/Meta-arrow keys can be mapped correctly by [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=471&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Problem:</h2>
<p>When you run Emacs in text mode or in a GNU screen, some of the function key bindings are not working.  For example. &lt;S-f4&gt; will just print &#8220;;2S&#8221; on the screen instead of running command that binds to Shift f4.  Some of the key binding such as Ctrl-arrow/Meta-arrow keys can be mapped correctly by setting the term info to xterm256, etc. However, a general solution is available to map any key code to where it should be.</p>
<h2>Solution:</h2>
<p>According to the manual, you can define keys in input-decode-map</p>
<p><a href="http://www.gnu.org/software/emacs/manual/html_node/viper/Key-Bindings.html">http://www.gnu.org/software/emacs/manual/html_node/viper/Key-Bindings.html</a></p>
<p><strong>Don&#8217;t copy the code. You need to type it in your .emacs file.</strong></p>
<pre>(define-key input-decode-map  "^[O1;2S" (kbd "&lt;S-f4&gt;")) ; bind shift-f4
(define-key input-decode-map  "^[O1;5S" (kbd "&lt;C-f4&gt;")) ; bind ctrl-f4
(global-set-key (kbd "&lt;C-f4&gt;") 'previous-line)
(global-set-key (kbd "&lt;S-f4&gt;") 'next-line)</pre>
<p>To get the key code for S-f4, press C-q and S-f4. You will see something like <span style="color:#ff0000;">^[</span>O1;2S pops out in your emacs buffer. Bind the key code to the key name and you can use it anywhere now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/471/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/471/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/471/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/471/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/471/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/471/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/471/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/471/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=471&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2011/07/04/emacs-function-key-binding-in-gnu-screen-with-input-decode-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>How to save GNU screen scroll buffer</title>
		<link>http://hide1713.wordpress.com/2011/02/27/how-to-save-gnu-screen-scroll-buffer/</link>
		<comments>http://hide1713.wordpress.com/2011/02/27/how-to-save-gnu-screen-scroll-buffer/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 06:00:33 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=468</guid>
		<description><![CDATA[If you use gnu screen, I am sure this tip will be useful someday. If you ran some programs for hours and want to dump the whole scroll buffer to a file. Here&#8217;s how: Ctrl-a :hardcopy -h dump_file. Note: the dump_file might have many empty line at the beginning, you might need to scroll down [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=468&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you use gnu screen, I am sure this tip will be useful someday. If you ran some programs for hours and want to dump the whole scroll buffer to a file. Here&#8217;s how:</p>
<p><span style="color:#ff0000;"><strong>Ctrl-a :hardcopy -h dump_file.</strong></span></p>
<p><strong>Note: the dump_file might have many empty line at the beginning, you might need to scroll down a little bit to see the content.</strong></p>
<h2>Do NOT use the Ctrl-a [ copy buffer for super big block, screen might die!</h2>
<p>From <strong>screen user manual:</strong></p>
<blockquote>
<h3>18.1 hardcopy</h3>
<p><a name="index-h-231"></a><a name="index-C_002dh-232"></a></p></blockquote>
<div>
<blockquote><p>— Command: <strong>hardcopy</strong> [<var>-h</var>] [<var>file</var>]<var><a name="index-hardcopy-233"></a></var></p></blockquote>
<blockquote><p>(<kbd>C-a h</kbd>, <kbd>C-a C-h</kbd>)<br />
Writes out the currently displayed image to the file <var>file</var>, or, if no filename is specified, to hardcopy.<var>n</var> in the default directory, where <var>n</var> is the number of the current window.  This either appends or overwrites the file if it exists, as determined by the <code>hardcopy_append</code> command.  If the option <code>-h</code> is specified, dump also the contents of the scrollback buffer.</p></blockquote>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/468/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=468&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2011/02/27/how-to-save-gnu-screen-scroll-buffer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>100 Things To Do Before Leo Die</title>
		<link>http://hide1713.wordpress.com/2010/05/08/100-things-to-do-before-leo-die/</link>
		<comments>http://hide1713.wordpress.com/2010/05/08/100-things-to-do-before-leo-die/#comments</comments>
		<pubDate>Sat, 08 May 2010 05:04:23 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=451</guid>
		<description><![CDATA[Skydive 100% test coverage for a middle size project complete a project with TDD visit the tomb of Alan Turing swim with sharks become a pilot lead a great project that has huge impact write my operating system write my device driver attend a public film audition write a book get a bs degree in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=451&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<ol>
<li>Skydive</li>
<li>100% test coverage for a middle size project</li>
<li>complete a project with TDD</li>
<li>visit the tomb of Alan Turing</li>
<li>swim with sharks</li>
<li>become a pilot</li>
<li>lead a great project that has huge impact</li>
<li>write my operating system</li>
<li>write my device driver</li>
<li>attend a public film audition</li>
<li>write a book</li>
<li><span style="text-decoration:line-through;">get a bs degree in computer science</span></li>
<li><span style="text-decoration:line-through;">get a ms degree in computer science</span></li>
<li>design a commercial game and make money from it</li>
<li>write a patch for python lib</li>
<li>speak in a major conference</li>
<li>be in a daft punk live show</li>
<li>be in a justice live show</li>
<li>visit wolfenstein</li>
<li>live in jail for few weeks</li>
<li>contribute to ubuntu community</li>
<li>contribute to kernel community</li>
<li>meet a lovely girl and fall in love with her</li>
<li>study statistics</li>
<li>study DJ software</li>
<li>create another human</li>
<li>teach my kids programming</li>
<li>get a mustang or 370z</li>
<li>get a Audi R8 or same class car</li>
<li>get a small plane</li>
<li>drive my car in Nürburgring</li>
<li>get married</li>
<li>somebody ask me for autograph</li>
<li>build my Linux distribution</li>
<li>work in a project that could affect millions people&#8217;s life</li>
<li>invent something and apply for patent</li>
<li>build an elementary somewhere in China</li>
<li>improve gmail</li>
<li>work in a game company</li>
<li>become the vice president of a major company</li>
<li><del>visit Las Vagas</del></li>
<li>get drunk, for real</li>
<li><del>meet Larry Page when he is still alive</del></li>
<li>visit Hide&#8217;s museum in Japan</li>
<li>become a mentor and guide some students</li>
<li>make a documentary film</li>
<li>draw many elephants</li>
<li>play computer game with my kids</li>
<li>fire guns</li>
<li>develop a software for mobile device</li>
<li>attend cooking school</li>
<li>on a TV show or news</li>
<li><del>200 miles per hour on the ground</del></li>
<li>20000 meters from earth</li>
<li>win a chess game against another good player</li>
<li>build a personal website</li>
<li>draw animal cartoons</li>
<li>still life painting</li>
<li>fight for justice</li>
<li>create Wikipedia pages</li>
<li>start up a company</li>
<li>work in a restaurant and learn how to run a restaurant</li>
<li>own a Bar</li>
<li>survive a deadly disease or accident</li>
<li>find true love</li>
<li>donate blood</li>
<li>climb a huge snow mountain</li>
<li>act in a film</li>
<li>visit NASA</li>
<li>kill pigs</li>
<li>get some really decent clothing</li>
<li>sleep for a whole day</li>
<li>finish a very difficult rock climbing track</li>
<li>translate a book</li>
<li>over 1000 friends on facebook</li>
<li>get tased by a police officer</li>
<li>double my income in 3 years</li>
<li>triple my income in 5 years</li>
<li>own a nice house</li>
<li>live in a ghetto</li>
<li>crack a software</li>
<li>hack a website and get root privilege</li>
<li>no spelling error in a long mail</li>
<li>find a information collection system that fits me best</li>
<li>find a time management system that fits me best</li>
<li>work extremely efficient for a day</li>
<li>keep writing code for 24 hours</li>
<li>learn to play a music instrument</li>
<li>work in the same company for 5 years</li>
<li>take a one-year vacation</li>
<li>teach my grad child programming</li>
<li>draw a naked woman</li>
<li>fly in a balloon</li>
<li>beg on street</li>
<li>find a remote place without using GPS</li>
<li>convert somebody to atheist</li>
<li>convince some girls that astrology is not for real</li>
<li>play soccer in an amateur league</li>
<li>dance in a dance club</li>
<li>build a nice system for blood simulation and human organs simulation</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/451/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=451&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2010/05/08/100-things-to-do-before-leo-die/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>CPU Instruction Speed Benchmark (1999 &#8211; 2010)</title>
		<link>http://hide1713.wordpress.com/2010/02/23/speed-comparison-between-1999-and-2010-cpu/</link>
		<comments>http://hide1713.wordpress.com/2010/02/23/speed-comparison-between-1999-and-2010-cpu/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 23:58:22 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=431</guid>
		<description><![CDATA[I&#8217;ve been reading the Programming Pearls for the last few weeks. It is a very interesting and inspirational book. In the appendix, I found a small C speed benchmark program. I changed the source code (casting the pointer to right type) so that it runs on my 64 bit system. The test results is surprising [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=431&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading the <a href="http://www.amazon.com/Programming-Pearls-2nd-Jon-Bentley/dp/0201657880/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1268858567&amp;sr=8-1"><span style="color:#ff0000;">Programming Pearls</span> </a> for the last few weeks. It is a very interesting and inspirational book. In the appendix, I found a small <a href="http://www.cs.bell-labs.com/cm/cs/pearls/timemod.c">C speed benchmark program. </a>I changed the source code (casting the pointer to right type) so that it runs on my 64 bit system. The test results is surprising but very logical. Modern CPU runs much faster on division and mod operation. Overall, my 2.8G Core 2 Due takes 13 seconds to terminate while the 1999 PII CPU takes 513 seconds.</p>
<p>Testing result on a 2.8Ghz Intel Core 2 Duo CPU (Date: Feb 23 2010)</p>
<pre>C Time Cost Model, n=5000
Integer Arithmetic (n=5000)                         <span style="color:#ff0000;">nanosecond per instruction</span>
 {}                     66372 66265 66226 66217 66212       3
 k++                    61226 61101 61105 61089 61112       2
 k = i + j              66915 66618 66593 66589 66378       3
 k = i - j              66905 66215 66413 66270 67377       3
 k = i * j              66908 66768 66696 66800 66713       3
 <span style="color:#ff0000;">k = i / j              84009 83901 83915 83896 83916       3 division and mod operation cost the same amount of time as addition and subtraction!
 k = i % j              87329 87328 87340 87317 87335       3</span>
 k = i &amp; j              66861 66588 66563 66471 66507       3
 k = i | j              67665 67547 67562 67493 67586       3
Floating Point Arithmetic (n=5000)
 fj=j;                  61255 61130 61096 61151 61094       2
 fj=j; fk = fi + fj;   107793107778107782107780107777       4
 fj=j; fk = fi - fj;   107816107781107784107822107783       4
 fj=j; fk = fi * fj;   116801116769116760116763116767       5
 fj=j; fk = fi / fj;   197412197467197431197405197428       8
Array Operations (n=5000)
 k = i + j              68272 68202 68198 68208 68196       3
 k = x[i] + j           61465 61294 61280 61305 61280       2
 k = i + x[j]           62285 62135 62112 62137 62108       2
 k = x[i] + x[j]        67986 67857 67861 67854 67871       3
Comparisons (n=5000)
 if (i &lt; j) k++         67828 67620 67623 67623 67608       3
 if (x[i] &lt; x[j]) k++   68377 68288 68286 68280 68276       3
Array Comparisons and Swaps (n=5000)
 k = (x[i]&lt;x[k]) ? -1:1 80980 80932 80932 80928 80931       3
 k = intcmp(x+i, x+j)  142630142660142621142593142599       6
 swapmac(i, j)         108802108758108734108766108734       4
 swapfunc(i, j)        189412189421189412189460189490       8
Max Function, Macro and Inline (n=5000)
 k = (i &gt; j) ? i : j    75729 75485 75551 75480 75543       3
 k = maxmac(i, j)       75842 75592 75522 75535 75518       3
 k = maxfunc(i, j)     143934143780143783143748143777       6
Math Functions (n=1000)
 fk = j+fi;              2733  2736  2739  2734  2734       3
 k = rand();            12512 12529 12557 12476 12485      13
 fk = sqrt(j+fi)        11497 11496 11506 11503 11500      12
 fk = sin(j+fi)         46135 46116 46092 46128 46106      46
 fk = sinh(j+fi)        11829 11819 11824 11837 11832      12
 fk = asin(j+fi)         6392  6387  6390  6386  6387       6
 fk = cos(j+fi)         46199 46183 46177 46174 46179      46
 fk = tan(j+fi)         55542 55496 55507 55488 55501      56
Memory Allocation (n=500)
 free(malloc(16));      13106 13017 12932 12779 12959      52
 free(malloc(100));     12972 12947 12867 13016 12923      52
 free(malloc(2000));    11653 11683 11536 11673 11620      47
<span style="color:#ff0000;"> Secs: 13.33</span>

<strong>Testing result of a PII CPU in 1999</strong>
<pre>C Time Cost Model, n=5000
Integer Arithmetic (n=5000)
{}                      1263  1313  1263  1263  1263       5
k++                     2011  2011  2010  2011  2011       8
k = i + j               2260  2260  2260  2260  2260       9
k = i - j               2244  2260  2259  2260  2260       9
k = i * j               4023  4005  4023  4022  4023      16
k = i / j              13814 13814 13980 13914 14163      56
k = i % j              13814 13814 13814 13797 13797      55
k = i &amp; j               2260  2277  2260  2260  2260       9
k = i | j               2260  2260  2260  2260  2260       9
Floating Point Arithmetic (n=5000)
fj=j;                   5019  5003  5021  4970  5036      20
fj=j; fk = fi + fj;     5021  5019  5019  5021  5019      20
fj=j; fk = fi - fj;     5019  5021  5036  5019  5021      20
fj=j; fk = fi * fj;     5036  5021  5019  5019  5038      20
fj=j; fk = fi / fj;    12549 12551 12551 12551 12567      50
Array Operations (n=5000)
k = i + j               2260  2260  2260  2260  2260       9
k = x[i] + j            2808  2810  2775  2808  2810      11
k = i + x[j]            2908  3341  2893  2875  2860      12
k = x[i] + x[j]         3490  3507  3490  3490  3490      14
Comparisons (n=5000)
if (i &lt; j) k++          2393  2393  2377  2393  2393      10
if (x[i] &lt; x[j]) k++    2926  2924  2926  2908  2926      12
Array Comparisons and Swaps (n=5000)
k = (x[i]&lt;x[k]) ? -1:1  3042  3057  3059  3059  3057      12
k = intcmp(x+i, x+j)    7015  7015  7015  7015  7016      28
swapmac(i, j)          15077 15110 15077 15110 15094      60
swapfunc(i, j)          8477  8479  8477  8494  8495      34
Max Function, Macro and Inline (n=5000)
k = (i &gt; j) ? i : j     2509  2509  2509  2526  2511      10
k = maxmac(i, j)        2509  2509  2526  2509  2509      10
k = maxfunc(i, j)       5536  5519  5536  5519  5534      22
Math Functions (n=1000)
fk = j+fi;               151   149   166   166   149      16
k = rand();              715   680   698   682   697      69
fk = sqrt(j+fi)         2360  2343  2360  2343  2343     235
fk = sin(j+fi)          2743  2742  2742  2743  2758     275
fk = sinh(j+fi)         9209  9226  9226  9242  9226     923
fk = asin(j+fi)         7747  7730  7728  7714  7714     773
fk = cos(j+fi)          2758  2758  2760  2758  2760     276
fk = tan(j+fi)          3256  3258  3258  3258  3258     326
Memory Allocation (n=500)
free(malloc(16));       1113  1113  1113  1113  1097     444
free(malloc(100));      1296  1296  1296  1296  1296     519
free(malloc(2000));     1296  1279  1298  1279  1296     516
<span style="color:#ff0000;">Secs: 513.37</span>
</pre>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/431/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=431&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2010/02/23/speed-comparison-between-1999-and-2010-cpu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>Ubuntu 9.10 Headphone Jack Troubleshooting on Gateway laptop</title>
		<link>http://hide1713.wordpress.com/2010/01/31/ubuntu-9-10-headphone-jack-troubleshooting-on-gateway-laptop/</link>
		<comments>http://hide1713.wordpress.com/2010/01/31/ubuntu-9-10-headphone-jack-troubleshooting-on-gateway-laptop/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 03:00:55 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=427</guid>
		<description><![CDATA[I am using a Gateway M6862 laptop and the sound card worked pretty well under Ubuntu 8.04. However, after I installed a Ubuntu 9.10, the front headphone jack stop working. After troubleshooting for a while.  The solution is quite simple. Append the following line at the end of /etc/modprobe.d/alsa-base.conf options snd-hda-intel model=eapd probe_mask=1 position_fix=1 The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=427&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am using a Gateway M6862 laptop and the sound card worked pretty well under Ubuntu 8.04. However, after I installed a Ubuntu 9.10, the front headphone jack stop working. After troubleshooting for a while.  The solution is quite simple.</p>
<p>Append the following line at the end of <strong>/etc/modprobe.d/alsa-base.conf </strong></p>
<p style="padding-left:30px;">options snd-hda-intel model=eapd probe_mask=1 position_fix=1</p>
<p>The reason is quite simple. The latest ALSA driver update introduced <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/438437">new bugs</a>. The consequence is that the drive can not correctly detect your sound card chip. Therefore, we have to tell the driver from modprobe.</p>
<p style="padding-left:30px;"><strong>aplay -l</strong></p>
<p style="padding-left:30px;">**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: STAC92xx Analog [STAC92xx Analog]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
card 1: HDMI [HDA ATI HDMI], device 3: ATI HDMI [ATI HDMI]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0</p>
<p style="padding-left:30px;"><strong>lspci -v</strong></p>
<p style="padding-left:30px;">00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)<br />
Subsystem: Gateway 2000 Device 0562<br />
Flags: bus master, fast devsel, latency 0, IRQ 22<br />
Memory at f3300000 (64-bit, non-prefetchable) [size=16K]<br />
Capabilities: &lt;access denied&gt;<br />
Kernel driver in use: HDA Intel<br />
Kernel modules: snd-hda-intel</p>
<p style="padding-left:30px;">
<p style="padding-left:30px;">
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/427/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=427&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2010/01/31/ubuntu-9-10-headphone-jack-troubleshooting-on-gateway-laptop/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>Python Decorator By Example</title>
		<link>http://hide1713.wordpress.com/2010/01/10/python-decorator-by-example/</link>
		<comments>http://hide1713.wordpress.com/2010/01/10/python-decorator-by-example/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 21:01:45 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=413</guid>
		<description><![CDATA[Here are three simple python decorator examples. A function decorator without argument, a function decorator with one argument and a decorator encapsulated in a class. Further usage of python decorator can be found in Charming Python: Decorators make magic easy Output: Say hi before execute func In test_func Say good bye Before My name is  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=413&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here are three simple python decorator examples. A function decorator without argument, a function decorator with one argument and a decorator encapsulated in a class. Further usage of python decorator can be found in <a href="http://www.ibm.com/developerworks/linux/library/l-cpdecor.html">Charming Python: Decorators make magic easy</a></p>
<pre class="brush: python;">

def test_decorator(func):
    def decorator():
        print &quot;Say hi before execute func&quot;
        func()
        print &quot;Say good bye&quot;
    return decorator

@test_decorator
def test_func():
    print &quot;In test_func&quot;

def test_decorator_with_argument(func):
    def decorator(args):
        print &quot;Before&quot;
        func(args)
        print &quot;After&quot;
    return decorator

@test_decorator_with_argument
def test_func_with_argument(name):
    print &quot;My name is &quot;,name

class DecoratorClass(object):
    def __init__(self,func):
        self.func = func
    def __call__(self):
        print &quot;Extra code&quot;
        self.func()
        print &quot;Extra code after&quot;

@DecoratorClass
def test_decorator_class():
    print &quot;Decorated by a class&quot;

test_func()
test_func_with_argument(&quot;leo&quot;)
test_decorator_class()
</pre>
<p>Output:<br />
Say hi before execute func<br />
In test_func<br />
Say good bye<br />
Before<br />
My name is  leo<br />
After<br />
Extra code<br />
Decorated by a class<br />
Extra code after</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/413/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=413&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2010/01/10/python-decorator-by-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>Python Scope Horror</title>
		<link>http://hide1713.wordpress.com/2009/11/20/python-scope-horror/</link>
		<comments>http://hide1713.wordpress.com/2009/11/20/python-scope-horror/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 20:10:20 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=409</guid>
		<description><![CDATA[In [71]: m=10 In [72]: i=[3,4] In [73]: j=[m for m in i] In [74]: j Out[74]: [3, 4] In [75]: m Out[75]: 4 Notice that the value of m changed from 10 to 4 and it&#8217;s not my intention.!! ﻿When you write [x for x in y], make sure x is unused!!!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=409&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In [71]: m=10</p>
<p>In [72]: i=[3,4]<br />
<span style="color:#ff0000;"><br />
In [73]: j=[m for m in i]</span></p>
<p>In [74]: j<br />
Out[74]: [3, 4]</p>
<p>In [75]: m<br />
Out[75]: 4<br />
Notice that the value of m changed from 10 to 4 and it&#8217;s not my intention.!!</p>
<h1>﻿When you write [x for x in y], make sure x is unused!!!</h1>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/409/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=409&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2009/11/20/python-scope-horror/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>Ubuntu 9.10 Dual Screen Resolution Problme[Solved]</title>
		<link>http://hide1713.wordpress.com/2009/11/08/ubuntu-9-10-dual-screen-resolution-problmesolved/</link>
		<comments>http://hide1713.wordpress.com/2009/11/08/ubuntu-9-10-dual-screen-resolution-problmesolved/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 16:53:18 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=360</guid>
		<description><![CDATA[I just installed Ubuntu 9.10 yesterday. The only problem is that 9.10 fail to detect my dual monitors; therefore, the resolution of my two monitors were set to 1024*768 by default. I spent one day to complete solve this problem. My graphic card is a ATI one. You may skip this page if your graphic [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=360&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just installed Ubuntu 9.10 yesterday. The only problem is that 9.10 fail to detect my dual monitors; therefore, the resolution of my two monitors were set to 1024*768 by default. I spent one day to complete solve this problem.<span style="color:#ff0000;"> My graphic card is a ATI one. You may skip this page if your graphic card is not ATI.</span> Here&#8217;s how.</p>
<p>1. Download ATI driver from Ubuntu Hardware Driver setting. Run the following command.</p>
<p style="padding-left:30px;">sudo amdcccle</p>
<p>2. Set correct resolution for both screen. (1280*800 and 1600*1200 for me). It was weird at the beginning, because ATI control center only allowed me to set my second monitor to 1280*800. I solved this problem by unplugging the monitor and reboot my box(Maybe).</p>
<p>3. (Optional) Revert the screen location. My second monitor is on my right hand side. I tried to set the screen position in AIT control center. But the control center always crash after I apply the change. I have no option but changing xorg.conf manually.</p>
<p style="padding-left:30px;">Section &#8220;Monitor&#8221;<br />
Identifier   &#8220;0-LCD&#8221;<br />
Option      &#8220;VendorName&#8221; &#8220;ATI Proprietary Driver&#8221;<br />
Option      &#8220;ModelName&#8221; &#8220;Generic Autodetecting Monitor&#8221;<br />
Option      &#8220;DPMS&#8221; &#8220;true&#8221;<br />
Option      &#8220;PreferredMode&#8221; &#8220;1280&#215;800&#8243;<br />
Option      &#8220;TargetRefresh&#8221; &#8220;60&#8243;<br />
<span style="color:#ff0000;"><strong>Option      &#8220;Position&#8221; &#8220;0 0&#8243;</strong></span><br />
Option      &#8220;Rotate&#8221; &#8220;normal&#8221;<br />
Option      &#8220;Disable&#8221; &#8220;false&#8221;<br />
EndSection</p>
<p style="padding-left:30px;">Section &#8220;Monitor&#8221;<br />
Identifier   &#8220;0-CRT1&#8243;<br />
Option      &#8220;VendorName&#8221; &#8220;ATI Proprietary Driver&#8221;<br />
Option      &#8220;ModelName&#8221; &#8220;Generic Autodetecting Monitor&#8221;<br />
Option      &#8220;DPMS&#8221; &#8220;true&#8221;<br />
Option      &#8220;PreferredMode&#8221; &#8220;1600&#215;1200&#8243;<br />
Option      &#8220;TargetRefresh&#8221; &#8220;60&#8243;<br />
<span style="color:#ff0000;">Option      &#8220;Position&#8221; &#8220;1280 0&#8243;</span><br />
Option      &#8220;Rotate&#8221; &#8220;normal&#8221;<br />
Option      &#8220;Disable&#8221; &#8220;false&#8221;<br />
EndSection</p>
<p>The position option indicates the start point of a screen.</p>
<p>All Done!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/360/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=360&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2009/11/08/ubuntu-9-10-dual-screen-resolution-problmesolved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>Gamebryo Frame Rendering System Reading Notes</title>
		<link>http://hide1713.wordpress.com/2009/10/21/gamebryo-frame-rendering-system-reading-notes/</link>
		<comments>http://hide1713.wordpress.com/2009/10/21/gamebryo-frame-rendering-system-reading-notes/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 01:43:04 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[GameBryo]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=350</guid>
		<description><![CDATA[Let&#8217;s look into Gamebryo frame rendering system. The documentation is located in: Gamebryo Document-&#62;Programmer Level-&#62; Core Runtime -&#62; Frame Rendering System The propose of the frame rendering system is to make rendering code portable.  Applications that use the frame rendering system do all their configuration work up front. The complex effects can be performed automatically [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=350&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s look into Gamebryo frame rendering system. The documentation is located in:</p>
<p><strong>Gamebryo Document-&gt;Programmer Level-&gt; Core Runtime -&gt; Frame Rendering System</strong></p>
<p>The propose of the frame rendering system is to make <strong>rendering code portable</strong>.  Applications that use the frame rendering system do all their configuration work up front. The complex effects can be performed automatically at render time.</p>
<p><strong>Render Frame(NiRenderFrame) </strong>represents an entire rendering process. It must be set up during initialization and displayed each frame. It has many render steps and iterates through the <em>rend steps</em> telling them to hook callback function to a frame.</p>
<p><strong>Render Step(NiRenderStep)</strong> is a single rendering effect. It does the actual rendering work. It can be turned on/off to control the final effect. One Rend Step usually performs one or more rendering passes via <em>render click</em> objects.</p>
<p><strong>Render Click(NiClickRenderStep)</strong> is a complete rendering pass. It can be easily enabled or disabled by 1) application in every frame 2) a<strong> render click validator</strong> according to some criteria. 3) pre/post callback function.</p>
<p><strong>Render View(NiRenderView)</strong> objects provide a certain type of render click with an array   of geometry to render. They can do this by culling a scene graph against   a camera or by using some other algorithm to determine which geometry   objects need to be rendered.</p>
<p><strong>Render List Processor(NiRenderListProcessor) </strong>,During rendering, the processor is passed an array of   geometry objects that need to be rendered and passes back an array of   objects that still need to be rendered. By controlling that output array,   the render list processor can modify the geometry array, such as rendering   some geometry objects immediately and deferring rendering of a sorted   list for later.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/350/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=350&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2009/10/21/gamebryo-frame-rendering-system-reading-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
		<item>
		<title>GameBryo Asset Service and Actionmap</title>
		<link>http://hide1713.wordpress.com/2009/10/15/gamebryo-asset-service-and-key-actionmap/</link>
		<comments>http://hide1713.wordpress.com/2009/10/15/gamebryo-asset-service-and-key-actionmap/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:00:26 +0000</pubDate>
		<dc:creator>hide1713</dc:creator>
				<category><![CDATA[GameBryo]]></category>

		<guid isPermaLink="false">http://hide1713.wordpress.com/?p=335</guid>
		<description><![CDATA[GameBryo Asset Service provides an easy way to access game data. For all the assets( Entity models, logic scripts,images etc), the asset service assigns a unique name to each of them.  The unique id is called Uniform Resource Identifier (URI) that is prefixed by the string &#8220;urn:&#8221;, followed by one or more specifiers. Examples: urn:gamebryo-scenegraph:Precache—All [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=335&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>GameBryo Asset Service provides an easy way to access game data. For all the assets( Entity models, logic scripts,images etc), the asset service assigns a unique name to each of them.  The unique id is called Uniform Resource Identifier (URI) that is prefixed by the string &#8220;urn:&#8221;, followed by one or     more specifiers.</p>
<p>Examples:</p>
<ul>
<li><em>urn:gamebryo-scenegraph:Precache</em>—All assets that are tagged with <em>both</em> &#8220;gamebryo-scenegraph&#8221; and &#8220;Precache&#8221;, which might be used to identify every asset that         should be pre-loaded during application startup.</li>
<li><em>urn:emergent-world:Level1</em>—An asset that is tagged with &#8220;emergent-world&#8221; and         has the name of &#8220;Level1&#8243;, which might be used to load all the entities needed in the         first level of a game.</li>
<li><em>urn:llid:0716a14d-81ca-46f2-9e7e-7dc30ff2c561:Wii</em>—A logical asset with the         indicated unique ID <em>and also tagged</em> &#8220;Wii&#8221;, which might be used to load the Wii         variation of an asset selected with an asset-picker in a tool.</li>
</ul>
<h2>Assets in Hello World Demo:</h2>
<p>In the hello world example, the HelloWorldService::SetupInputActions() function uses &#8220;urn:gamebryo-actionmap:HelloWorldActionMap&#8221; to load a key-action map. It maps the &#8220;m&#8221; key to HELLOWROLD_ACTION_DROP event and &#8220;n&#8221; key to HELLOWORLD_ACTION_PICKUP event. The  actionmap file is located in \Gamebryo\Media\Samples\GameFramework\HelloWorld\HelloWroldActionMap.actionmap.</p>
<p>Also, in ConfigCommon.ini file, the initial world is specified by</p>
<p style="padding-left:30px;">[Game]<br />
InitialWorld = urn:emergent-world:HelloWorld</p>
<p>The question is <strong>how does gamebryo map URN  to  file</strong>. This question is very important because you must understand the asset service in order to use assets.</p>
<p>Let&#8217;s take a close look on HelloWrold cpp project.</p>
<p>In Config.ini file, we have an attribute</p>
<p style="text-align:left;padding-left:30px;">[AssetWeb.Win32]<br />
Path=$(SourceBaseDir)/../../../Media</p>
<p style="text-align:left;">This attribute specifies the root directory for Asset directory. The config manager service will load this attribute in run time. On my computer, the AssetWeb root folder is F:\Gamebryo\Media. There are three files in <strong>Media/asset-web-config</strong> directory which define the asset web.</p>
<p style="text-align:left;">The<strong> LogicalIdTagger.ini</strong> defines some logical tags:</p>
<blockquote>
<p style="text-align:left;">; The Assets are a list of asset types (assigned by the MimeTagger) that should have logical<br />
; asset id&#8217;s assigned to them. If the asset does not possess one of these tags, then no logical<br />
; asset id is created for it.  Logical asset id&#8217;s are only needed for assets that will be referenced<br />
; by other asset files, like block or model files.<br />
[LogicalIdTagger.Assets]<br />
=gamebryo-scenegraph<br />
=gamebryo-animation<br />
=gamebryo-terrain<br />
=gamebryo-terrain-materialpkg<br />
=physx-terrain<br />
=gamebryo-actionmap<br />
=wwise-sound-bank<br />
=bmp-image</p>
</blockquote>
<p style="text-align:left;">In <strong>MimeTagger.ini,</strong> for each file extension, a pair of tags is created from the associated MIME  type.  For example, &#8220;py=script/python-behavior&#8221; will result in every file<br />
with the &#8220;.py&#8221; extension having two tag values &#8211; &#8220;script&#8221; and &#8220;python- behavior&#8221;.</p>
<blockquote>
<p style="text-align:left;">xblock=x-world/emergent-world</p>
<p style="text-align:left;">kf=application/gamebryo-sequence-file<br />
actionmap=application/gamebryo-actionmap<br />
bnk=audio/wwise-sound-bank</p>
</blockquote>
<p style="text-align:left;"><strong>Therefore,</strong> HelloWorldActionMap.actionmap file is named as &#8220;urn:gamebryo-actionmap:HelloWorldActionMap&#8221; and the HelloWrold.xblock is named as &#8220;urn:emergent-world:HelloWorld&#8221;. <strong> The path of those files are irrlevent to urn</strong>.  The asset service searches all the sub directories under AssetWeb root and classifies files accordingly.</p>
<h2 style="text-align:left;">Key Actionmap</h2>
<p>The Hello World example demonstrates two ways of handling key event.</p>
<p>1. Register a key handler function and switch the logic according to key code.</p>
<pre class="brush: cpp;">

EE_HANDLER(HelloWorldService, HandleKeyDownMessage, KeyDownMessage); // Register handler

void HelloWorldService::HandleKeyUpMessage(const KeyUpMessage *pMessage,
 efd::Category targetChannel)
{
 Entity* pAvatar = GetAvatar();
 if (pAvatar)
 {
 switch (pMessage-&gt;GetKey()) // Switch key code
 {
 case NiInputKeyboard::KEY_UP:
 pAvatar-&gt;SetPropertyValue(&quot;IsMoving&quot;, false);
 break;

 case NiInputKeyboard::KEY_LEFT:
 pAvatar-&gt;SetPropertyValue(&quot;IsTurningLeft&quot;, false);
 break;

...
</pre>
<p>2. Use a data-driven actionmap to bind keys to events. Currently, there&#8217;s no tool to help you generate actionmap  file; therefore, you need to edit the file by hand. Please read the<strong> The ecrInput Library </strong>documentation for detail.</p>
<pre class="brush: xml;">

HelloWorldActionMap.actionmap
...
 &lt;Event EventName=&quot;HELLOWORLD_ACTION_DROP&quot; EventCategory=&quot;0xC000000007765433&quot; EventFlags=&quot;RETURN_MAGNITUDE&quot;&gt;
 &lt;ActionsList&gt;
 &lt;!--Flags - InputService.h ActionFlags enum - use individual string values or combined bitmask as an int--&gt;
 &lt;!--DeviceID - a way to define action for specific controllers--&gt;
 &lt;!--Modifiers - NiInputKeyboard Modifiers enum--&gt;
 &lt;!--ActionClsID - (ACTION/DPAD/STICK)--&gt;
 &lt;!--Semantic - NiAction.h Semantic enum for gpad string values GP_BUTTON_LUP or NiInputKeyboard.h for key value strings KEY_M, etc--&gt;
 &lt;Action Flags=&quot;ON_ACTIVATE&quot; DeviceID=&quot;0&quot; Modifiers=&quot;0&quot; ActionClsID=&quot;ACTION&quot; Semantic=&quot;KEY_M&quot;MinRange=&quot;-1.000000&quot; MaxRange=&quot;1.000000&quot; /&gt;
 &lt;Action Flags=&quot;ON_ACTIVATE&quot; DeviceID=&quot;0&quot; Modifiers=&quot;0&quot; ActionClsID=&quot;ACTION&quot; Semantic=&quot;GP_BUTTON_RDOWN&quot; MinRange=&quot;-1.000000&quot; MaxRange=&quot;1.000000&quot; /&gt;
 &lt;/ActionsList&gt;
 &lt;/Event&gt;
 &lt;!--0xC000000007765432--&gt;
 &lt;!--13835058055407359026--&gt;
 &lt;Event EventName=&quot;HELLOWORLD_ACTION_PICKUP&quot; EventCategory=&quot;0xC000000007765432&quot; EventFlags=&quot;RETURN_MAGNITUDE&quot;&gt;
 &lt;ActionsList&gt;
 &lt;Action Flags=&quot;ON_ACTIVATE&quot; DeviceID=&quot;0&quot; Modifiers=&quot;0&quot; ActionClsID=&quot;ACTION&quot; Semantic=&quot;KEY_N&quot; MinRange=&quot;-1.000000&quot; MaxRange=&quot;1.000000&quot; /&gt;
 &lt;Action Flags=&quot;ON_ACTIVATE&quot; DeviceID=&quot;0&quot; Modifiers=&quot;0&quot; ActionClsID=&quot;ACTION&quot; Semantic=&quot;GP_BUTTON_RRIGHT&quot; MinRange=&quot;-1.000000&quot; MaxRange=&quot;1.000000&quot; /&gt;
</pre>
<p>After you create the actionmap, you can create an action message handler.</p>
<pre class="brush: cpp;">

// Define the message categories for the actions
static const efd::Category kCAT_STANDALONE_ACTION_PICKUP =
 Category( efd::UniversalID::ECU_Any, 0, 0x07765432 );

static const efd::Category kCAT_STANDALONE_ACTION_DROP =
 Category( efd::UniversalID::ECU_Any, 0, 0x07765433 );

...

void HelloWorldService::HandleActionMessage(const InputActionMessage* pMsg,
 efd::Category targetChannel)
{
 Entity* pAvatar = GetAvatar();

 switch(pMsg-&gt;GetClassID())
 {
 case efd::kMSGID_CoreInputAction:
 if (pAvatar)
 {
 if(targetChannel == kCAT_STANDALONE_ACTION_PICKUP)
 {
 pAvatar-&gt;SendEvent(pAvatar-&gt;GetEntityID(), &quot;Jack&quot;, &quot;PickupEntity&quot;);
 }
 else if(targetChannel == kCAT_STANDALONE_ACTION_DROP)
 {
 pAvatar-&gt;SendEvent(pAvatar-&gt;GetEntityID(), &quot;Jack&quot;, &quot;DropEntity&quot;);
 }
 }
 break;
 }

}
</pre>
<h2>Reference:</h2>
<p>Gamebryo Documentation: Programmer Level-&gt;Foundation-&gt;Asset Runtime Service</p>
<p>Gamebryo Documentation: The ecrInput Library</p>
<p>HelloWorld example project</p>
<p style="text-align:left;">
<p style="text-align:left;">
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hide1713.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hide1713.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hide1713.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hide1713.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hide1713.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hide1713.wordpress.com/335/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hide1713.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hide1713.wordpress.com/335/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hide1713.wordpress.com&amp;blog=5229194&amp;post=335&amp;subd=hide1713&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hide1713.wordpress.com/2009/10/15/gamebryo-asset-service-and-key-actionmap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/60a05cdce2660296672b37ad2654e00f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hide1713</media:title>
		</media:content>
	</item>
	</channel>
</rss>
