<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Peaceful Revolution</title>
	<atom:link href="http://en.youxu.info/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://en.youxu.info</link>
	<description>a computer scientist&#039;s thoughts</description>
	<lastBuildDate>Tue, 02 Aug 2011 20:07:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to do adjustments to your latex generated references</title>
		<link>http://en.youxu.info/?p=139</link>
		<comments>http://en.youxu.info/?p=139#comments</comments>
		<pubDate>Tue, 02 Aug 2011 20:07:53 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=139</guid>
		<description><![CDATA[A fellow graduate student had to format his two-column paper using LaTeX. He had about 30 reference items. When using LaTeX, he got 20 reference items in the left column and the rest 10 in the right. It looked unbalanced. So he asked me how to make the reference balanced by forcing LaTeX to put 15 [...]]]></description>
			<content:encoded><![CDATA[<p>A fellow graduate student had to format his two-column paper using LaTeX. He had about 30 reference items. When using LaTeX, he got 20 reference items in the left column and the rest 10 in the right. It looked unbalanced. So he asked me how to make the reference balanced by forcing LaTeX to put 15 references on the right and the rest on the left.</p>
<p>Normally it is easy to use \vfill \eject to force a column change. However, since all references are automatically generated, he didn&#8217;t know where to insert that command. I poked around a little bit and found the trick: the bbl file. Turned out that the bbl file is generated by Bibtex that will be included in the main document. Once you are done will BibTeX, you can further edit the bbl file.  I inserted the \vfill \eject commands after the fifteenth item and it worked!</p>
<p>LaTeX tip of the day: bbl file is the final file that contains all the format information of your reference, if you use BibTex.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=139</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autojump and mark based directory jumping</title>
		<link>http://en.youxu.info/?p=135</link>
		<comments>http://en.youxu.info/?p=135#comments</comments>
		<pubDate>Fri, 17 Jun 2011 01:29:38 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=135</guid>
		<description><![CDATA[In the *NIX world, if you use bash or zsh, you are blessed. There is a tool called autojump that can help you jump from folders to folders. Considering 20% of my command line inputs are cd commands, jumping quickly helps productivity a lot. I don’t actually use bash that often. Instead, I use a shell called [...]]]></description>
			<content:encoded><![CDATA[<p>In the *NIX world, if you use bash or zsh, you are blessed. There is a tool called <a href="https://github.com/joelthelion/autojump/wiki">autojump</a> that can help you jump from folders to folders. Considering 20% of my command line inputs are cd commands, jumping quickly helps productivity a lot.</p>
<p>I don’t actually use bash that often. Instead, I use a shell called <a href="http://fishshell.com/">fish</a>. Fish is not compatible with bash, and autojump relies on some bash features, so I can’t use autojump out-of-box.</p>
<p>I decided to poke around autojump and see if I can port it to fish. Turned out that it is a quite straightforward task. I want to share some of the findings, because apparently the author of autojump hasn’t write any document on this matter (though I am sure a guy who knows both python and shell can figure that out quickly, but instead of getting hands dirty, reading this blog  post is even quicker).</p>
<h3><strong>Autojump, under the hood</strong></h3>
<p>If you have a long folder like</p>
<pre style="padding-left: 30px;">/User/borg/Applications/School/Math/M301/Lecture1/</pre>
<p>you will know that it is painful to get into that folder. Even with autocompletion in place, you still have to press a couple of letter keys and tabs. With autojump, you can do something like</p>
<pre style="padding-left: 30px;">j m301 1</pre>
<p>to jump to that folder, given that you only have one folder called m301 that contains a subfolder containing “1” in its name (Otherwise you can give more keywords). To better categorize things to our needs, it is typical for us to come up with a storage system that has certain level of redundancies. Autojump is a tool that can squeeze out these redundancies when you just want to find that folder/path.</p>
<p>How can autojump do that? Basically, it maintains a database that has all folders you’ve been to, along with “weights” that measure approximately how frequent you use that folder. Whenever you want to jump to a folder with some keywords, autojump searches the database, find matching folders, and call “cd” to do the dirty work for you.</p>
<p>Needless to say, the key components of autojump are the database and the matching strategy. These components are in a Python file called “autojump” (no .py suffix). Without diving too deep, let’s just say that you can use</p>
<pre style="padding-left: 30px;">autojump -a &lt;some_folder&gt;</pre>
<p>to add a folder to the database; and</p>
<pre style="padding-left: 30px;">autojump --completion &lt;some_keyword&gt;</pre>
<p>to get all possible matching folders.</p>
<p>Having infrastructure ready, we only need to a) somehow automatically add folders to autojump; b) have a handy utility called j that calls autojump and delegates requests to cd.</p>
<p>For bash, the first part is cleverly done by putting</p>
<pre style="padding-left: 30px;">autojump -a "$(pwd -P)"</pre>
<p>in the <em>PROMPT_COMMAND</em> environmental variable. Bash documents defines that “[t]he contents of this variable are executed as a regular Bash command just before Bash displays a prompt”.</p>
<p>Part b is also straightforward. In Bash, you can designate application-specific command line completions by using</p>
<pre style="padding-left: 30px;">complete -F &lt;the_function&gt; &lt;the_command&gt;</pre>
<p>Here to make “j” a cool command, in autojump, the author wrote a function that used the output of</p>
<pre style="padding-left: 30px;">autojump --completion</pre>
<p>as the command line completion of j, and defines j as a proxy to cd.</p>
<p>Easy, huh?</p>
<h3><strong>Adding autojump to fish</strong></h3>
<p>Based on the above discussion, I have made changes to my fish to empower it with autojump. It is actually much easier than I thought.</p>
<p>First, in fish’s <em>fish_prompt</em> function, add</p>
<pre style="padding-left: 30px;">autojump -a $PWD  &gt; /dev/null   &amp;</pre>
<p>On my machine, I created a “<em>fish_prompt.fish</em>” file and put it under <em>~/.config/fish/function</em> (create this directory if you don’t have it already). I just copied the<em> fish_prompt.fish</em> file from <em>/opt/local/share/fish/functions/</em> (where fish puts all default functions) and added the above line.</p>
<p>Adding this autojump -a command to the fish_prompt function will ensure folders are added to the autojump database whenever you are operating under it.</p>
<p>Second, we create the “j” function that can do the autojump. I just created a j.fish file under the ~/.config/fish/function folder again. Given the Bash script example, I just follow suit.</p>
<pre>function j
    set l (autojump $argv)
    if test -d $l
        cd "$l"
        return
    else
        return
    end
end</pre>
<p>The last thing is auto-completion. When you type “j &lt;part_of_keyword&gt;”, and press Tab, the shell can invoke autojump and generate<br />
a possible list of completions. I poked around fish for a while, and didn’t find a good way of doing this. Basically to generate the list,<br />
I have to give &lt;part_of_keyword&gt; as a parameter to autojump. While fish allows you to have a customized auto-completion function<br />
using the following syntax:</p>
<pre style="padding-left: 30px;">complete -c your_program -a “(your_customized_function)”</pre>
<p>I sort of have a function like this:</p>
<pre style="padding-left: 30px;">function __fish_complete_autojump_targets
    set -e argv[1]
    set newarg (echo $argv | sed -e 's/__//')
    set output (autojump --completion $newarg)
    for item in $output;
        echo $item
    end
end</pre>
<pre style="padding-left: 30px;">complete -x -c j -a "(__fish_complete_autojump_targets (commandline -o))"</pre>
<p>But it can only do part of the auto-complete for me. Most of the time it won’t match anything. I made sure that the function indeed outputs correct matches. However, fish won’t be able to output these matches. I suspect that it is because fish assumes that the matching string contains the typed token as a prefix. Perhaps I can use the commandline commands provided by Fish to walk around this problem by rewriting the input token, but I don’t want invest too much time here.</p>
<h3><strong>Mark-based jumping </strong></h3>
<p>In VIM, I use command <strong>m</strong> and <strong>`</strong> a lot to jump between lines. Even with autojump, I still have to make couple of keystrokes to get into certain folders, especially<br />
when there is no “short “name” that can easily identify it uniquely. Inspired by VIM, I also have the following two functions in my system:</p>
<pre style="padding-left: 30px;">function g
    if test (count $argv) = 0
        cd $__fish_directory_buffer
    else
        cd $$argv
    end
end</pre>
<pre style="padding-left: 30px;">function m
   if test (count $argv) = 0
        set -g __fish_directory_buffer $PWD
    else
        set -g $argv $PWD
    end
end</pre>
<p>Now in any folder, I can just use “m x“ to store the directory into register “x”, and “g x” will take me back to the folder stored in “x”. This “m/g” pair<br />
also replaces pushd/popd. You can use “m” for pushd and “g” for popd.</p>
<p>Life is short, save some keystrokes.</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=135</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MinGW, LALR left recursion and others</title>
		<link>http://en.youxu.info/?p=130</link>
		<comments>http://en.youxu.info/?p=130#comments</comments>
		<pubDate>Tue, 30 Nov 2010 23:26:37 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=130</guid>
		<description><![CDATA[For some unfortunate reason, I had to port a program written on Linux to Windows. In general, it is quite painful. Fortunately, I then found MinGW. It provides GNU toolchain on Windows. The installment is straightforward. After the successful install, it creates bin/, include/, lib/ and other folders that pretty much replicates the GNU toolchain [...]]]></description>
			<content:encoded><![CDATA[<p>For some unfortunate reason, I had to port a program written on Linux to Windows. In general, it is quite painful.</p>
<p>Fortunately, I then found <a href="http://www.mingw.org/">MinGW</a>. It provides GNU toolchain on Windows. The installment is straightforward. After the successful install, it creates bin/, include/, lib/ and other folders that pretty much replicates the GNU toolchain on *NIX. The good thing is that you only need to make minor changes to Makefile to compile the whole project. For my project, I commented out lines that invoke commands like rm and mv, since they are not available on Windows (although of course you can port it). Also, point GCC to the one in MinGW. MinGW is really handy for small projects where you don&#8217;t need autoconf.</p>
<p>As an LALR parser, yacc/bison has its limitation that you have to write the language in left recursion. Namely, you should always write<br />
<code><br />
A -&gt;<br />
NULL|<br />
A a<br />
</code><br />
instead of<br />
<code><br />
A-&gt;<br />
NULL |<br />
a A<br />
</code><br />
Failing to do so will cause error when the &#8220;A&#8221; list is too long. It won&#8217;t be a trouble if the expression we are going to parse is short though.</p>
<p>Shift/Reduce and Reduce/Reduce conflicts are annoying. Here are several &#8220;rule of thumbs&#8221; to remove them.</p>
<ul>
<li>Always use the -v option to see where those conflicts are.</li>
<li>Try to construct a case to show the ambiguity of your language. Computers won&#8217;t lie, so your language HAS to me ambiguous.</li>
<li>Pretty much all Shift/Reduce conflict can be reduced to the classic tailing else structure where yacc cannot determine if that ELSE is part of the IF ELSE (Shift) or the statement before ELSE is already complete  (Reduce). The structure here is<br />
<code><br />
expr =<br />
IF expr |<br />
IF expre ELSE ...<br />
</code><code><br />
</code></li>
<li>All Reduce/Reduce conflict can be reduced to the following case:<br />
<code><br />
something =<br />
prefix  expr  TAIL |<br />
expr  TAIL<br />
</code><br />
Whenever yacc eats the tail, it might have no clue (not always) on which rule to follow to reduce to &#8220;something&#8221;. The correct way of doing this is to make &#8220;expr TAIL&#8221; a nonterminal AND make sure prefix cannot be reduced to NULL.</li>
</ul>
<p>ltrace and strace are two great tools to inspect the runtime behavior of programs. Together with valgrind and gdb, you can debug programs quite efficiently.</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=130</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quantum Leap and Augmented Reality</title>
		<link>http://en.youxu.info/?p=128</link>
		<comments>http://en.youxu.info/?p=128#comments</comments>
		<pubDate>Mon, 04 Oct 2010 01:58:59 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=128</guid>
		<description><![CDATA[Oh boy, I love Quantum Leap. While leaping around changing/saving people&#8217;s lives, Sam always needs help from Ziggy and Al. After watching some episodes, I began to think that Al and Ziggy were really the augmented reality for Sam. For instance, in the episode Pool Hall Blues, Al and Ziggy uses hologram beams to help [...]]]></description>
			<content:encoded><![CDATA[<p>Oh boy, I love Quantum Leap. </p>
<p>While leaping around changing/saving people&#8217;s lives, Sam always needs help from Ziggy and Al. After watching some episodes, I began to think that Al and Ziggy were really the augmented reality for Sam. </p>
<p>For instance, in the episode Pool Hall Blues, Al and Ziggy uses hologram beams to help Sam to win a pool game. It is essentially adding a digital layer to Sam&#8217;s reality. Given that nobody, except Sam, can see those holograms, it is really a personalized augmented reality for Sam (Ziggy is a computer while Al is a better interface). </p>
<p>I really hope that someday, by waring something glasses, we human can use a hologram to help us dealing with reality. Things from Quantum Leap are exactly what I would like to have. </p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=128</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On the pass of house Health Care Bill</title>
		<link>http://en.youxu.info/?p=125</link>
		<comments>http://en.youxu.info/?p=125#comments</comments>
		<pubDate>Tue, 23 Mar 2010 14:03:13 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=125</guid>
		<description><![CDATA[I am happy to see that the house health care gets passed. Although I am not a citizen and don&#8217;t have right to vote on this issue, I really want to make some comments. During this year-long debate, I am sure about one thing: those conservatives have no fair mind. Their belief system is heavily [...]]]></description>
			<content:encoded><![CDATA[<p>I am happy to see that the house health care gets passed.</p>
<p>Although I am not a citizen and don&#8217;t have right to  vote on this issue, I really want to make some comments.</p>
<p>During  this year-long debate, I am sure about one thing: those conservatives  have no fair mind. Their belief system is heavily distorted by  so call&#8230;ed conservative leaders ( Fox, Rush, etc.). They develop a so-called &#8220;theory&#8221; to link health care bill with  verses from Bible or budget deficit without any rational basis. Health care reform is such a complicated issue that we  might have to wait a decade to see the true impact of this bill. However, we only see &#8220;clever&#8221; comments about how terrible this reform is without any justification.</p>
<p>For  people who have no health care and don&#8217;t want health care, I would  suggest you to try living in a country like China for a year. When you  have to pay every doctor visit and can&#8217;t get you bill paid because of  the pre-existing condition, you will get the idea.</p>
<p>Universal  health care won&#8217;t necessarily make this country socialism ( or like  Canada). Labeling is a basic form of logic fallacy. An educated person  with fair mind and basic critical thinking skill won&#8217;t use it in  debating. Some conservative leaders really don&#8217;t know it is a fallacy  and use is as an &#8220;argument&#8221; everywhere.</p>
<p>Despite all those  disappointments towards conservatives in this debate, I won&#8217;t suggest  those people to move to other countries with no universal health care.  The greatest thing about this country&#8217;s democracy and freedom of speech  is that everyone can speak and gets his/her idea expressed in the final  resolution.  This is an everlasting national treasure our founding  fathers gave us. I do get a lot of thought-provoking arguments from the  conservative group, and I think some of the issues they raise are very  valuable ( e.g., how to handle deficit).</p>
<p>Here is my last piece  of philosophical thought.  Scientific revolution, rationalism and all  other distinguished thinkers in the 18th century all showed us one  thing: this mundane world is not perfect, however, we human as a race can  make it better via collective intelligence, via the power of reasoning.  I personally will exclude God from any mundane argument, but the  precondition is we have a solid ethic common ground (what is good, what  is bad). Currently we are not there yet, so God ( and other  ideological, religious beliefs), pre-existed in some people&#8217;s brain,  will still jump to mundane debates.  I accept this because I accept  evolution, as I know the &#8220;belief&#8221; system is planted in out brain a gift, a  result and a legacy of evolution.</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=125</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>On Google&#8217;s quitting China</title>
		<link>http://en.youxu.info/?p=119</link>
		<comments>http://en.youxu.info/?p=119#comments</comments>
		<pubDate>Thu, 14 Jan 2010 19:10:12 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=119</guid>
		<description><![CDATA[Maybe I should say something on this issue since I have done a lot of thinking about Google&#8217;s strategy in China since the first time they entered China. I have to make a disclaimer that I am Chinese, and I don&#8217;t agree with Google&#8217;s self-censorship in the first place. To make long story short, let [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe I should say something on this issue since I have done a lot of thinking about Google&#8217;s strategy in China since the first time they entered China. I have to make a disclaimer that I am Chinese, and I don&#8217;t agree with Google&#8217;s self-censorship in the first place.</p>
<p>To make long story short, let me briefly review how the censorship works in China. For every website that offers services in China, a so-called &#8220;ISP license&#8221; is required. However, the government will revoke your license if it thinks that you are not so &#8220;manageable&#8221;, and therefore you have to shutdown your website (or they will block you if your servers are abroad). When Google first entered China, Chinese gov didn&#8217;t give it a license, and banned the access to Google.com from China since its search result was uncensored. To make the service available to Internet users in China, four years ago, Google started to filter the search results and provided them via Google.cn. Google.cn is a domain name registered in China. Google is just one example among many Internet service providers that do self-censorship.</p>
<p>Every website in China, if their servers are in China, do self-censorship. Otherwise, secret-police will unplug your server cable and put you to jail if necessary.  As you can see, by restricting the service provider&#8217;s license and setting up the Great Firewall to restrict the access of Internet users, Chinese government literally set up a panopticon so that the prisoners (users and service providers) can watch each other and have to do self-censorship to survive.</p>
<p>However, Chinese government was still not satisfied with what Google had done. They want to have full control of Google. During these years, say, pretty much once every year, Chinese government and the state controlled media would criticize Google for something that &#8220;is not legal according to local laws&#8221; and would suggest a solution with no surprise: tighter self-censorship. For instance, last year, they tried to flood Google.cn with some obscene keywords so that those keywords would be high frequent enough to enter auto-completion system. Then, they made a TV program showing that when you type in &#8220;son&#8221;, Google search box would hint you with &#8220;son and milf&#8221;. On that program, they were criticizing Google for &#8220;helping distributing pornography&#8221;. In one word, Google has been under a very high pressure doing business in China. Chinese government<br />
always wants Google to be its homeboy, which we obviously know Google&#8217;s response: No, simple and straight.</p>
<p>I do agree that Google&#8217;s market share in China is not good enough, so I don&#8217;t think Google will lose any revenue substantially by quitting China&#8217;s market. China now is different than 10 years ago. Even it looks very nice from the outside now, it is extremely corrupted inside. Maybe I am making an oversimplified statement, but the truth is that no private business, not a single one, with proper moral standard, can make money in China. The reason is fairly simple: it is a government controlled market instead of a free market.</p>
<p>Essentially, the market is controlled by the government and you have to &#8220;pay&#8221; for &#8220;using&#8221; the market. It sounds crazy since according to Adam Smith, nobody can really control market, the hidden hand. But currently, seriously, Chinese government, with a huge visible hand, is able to. Being a country with very high tax rate and secret police everywhere, the government has a much higher controlling power than that we would<br />
normally think of over the domestic market. It can simply kick the player out, or arrest the player, if that player doesn&#8217;t obey those so-called rules. Google is one of the victims.</p>
<p>As a totalitarian state, it naturally needs some common bonds to control people&#8217;s mind. In China, insofar, the best mind weapon is called nationalism. Chinese government, intentionally or unintentionally, make some netizens believe that Baidu is a local company and it is a good kid, while Google is controlled by &#8220;westerners&#8221; and also is a bad kid.</p>
<p>I am not concerned about Google&#8217;s losing money in China. In modern society,  some business might be able to earn money in a country without free speech, free market and democracy; some business might be able to earn money under a big government. However, in a country when tyranny is combined with big government, which we usually call totalitarian state, no private-owned company can make any profit if<br />
its moral standard is not compromised. The history in the last half century has provided so many examples.</p>
<p>Also, I am very optimistic about the future of Google&#8217;s business in China. Again, i<br />
I strongly believe that Google will return to China on the day that China becomes a democratic nation where all citizens enjoy proper human right protection. Then Google will dominate China&#8217;s market, since it is really a superior service and there will be fair competitions.</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=119</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Fix Latex-beamer</title>
		<link>http://en.youxu.info/?p=115</link>
		<comments>http://en.youxu.info/?p=115#comments</comments>
		<pubDate>Mon, 02 Nov 2009 18:20:48 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=115</guid>
		<description><![CDATA[A recent upgrade of latex on my Debian/Ubuntu caused some problem on compiling my latex-beamer slides. Latex reported that l.17 \pgfdeclareimage[ width=14pt,height=12pt]{beamericonbook}{beamericonbook} You're in trouble here.  Try typing  &#60;return&#62;  to proceed. If that doesn't work, type  X &#60;return&#62;  to quit. According to some posts on the forum, it is because the latest version of latex [...]]]></description>
			<content:encoded><![CDATA[<p>A recent upgrade of latex on my Debian/Ubuntu caused some problem on compiling my latex-beamer slides. Latex reported that</p>
<p><code>l.17 \pgfdeclareimage[<br />
width=14pt,height=12pt]{beamericonbook}{beamericonbook}<br />
You're in trouble here.  Try typing  &lt;return&gt;  to proceed.<br />
If that doesn't work, type  X &lt;return&gt;  to quit.</code></p>
<p>According to some posts on the forum, it is because the latest version of latex put pgf package to core. Thus, the original pgf package become obsoleted.</p>
<p>To fix this, you can just go to your latex directory and remove the whole pgf directory. On my machine by default, it&#8217;s</p>
<p><code>/usr/share/texmf-texlive/tex/latex/pgf</code></p>
<p>remove this and the problem solved.</p>
<p>I wrote this because I found no explicit solution on the Internet. I tried a couple of times removing different pgf packages (they are scattered in more than one places) and finally found this solution.</p>
<p>Happy hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=115</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Rant] Springer sucks</title>
		<link>http://en.youxu.info/?p=111</link>
		<comments>http://en.youxu.info/?p=111#comments</comments>
		<pubDate>Tue, 08 Sep 2009 01:27:34 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=111</guid>
		<description><![CDATA[First, LNCS is a place where 90% of the papers are not worth publishing. They are just the enemy of trees and the first cause of global warming in academia. Second, it does not support the bibtex format exporting. Who the hell wants your RIS format citation? For every citation from Springer, I have to [...]]]></description>
			<content:encoded><![CDATA[<p>First, LNCS is a place where 90% of the papers are not worth publishing. They are just the enemy of trees and the first cause of global warming in academia.<br />
<strong><br />
Second, it does not support the bibtex format exporting. Who the hell wants your RIS format citation? </strong></p>
<p>For every citation from Springer, I have to spend 3 minutes in reformatting everything to a bibtex format. For those terrible papers I have to cite (some of the reviewers are so stupid, they force us to read a paper in LNCS, saying that our work would be complete without noticing some &#8220;significant&#8221; work published in a workshop held in the middle of no where in Europe by a group of unknown people. Come on, if you have some self-respect, you won&#8217;t want people to cite your own f* work published in a f* bad conference talking about a f* terrible idea without any intellectual merit], I have to write a script to change it from RIA format to bibtex. What should I waste time on these stupid things. All other publisher like ACM and IEEE (even Citeseer) supports the bibtex format.</p>
<p>Shame on you, Springer, your LNCS sucks!</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=111</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Know your shell and GNU coreutils</title>
		<link>http://en.youxu.info/?p=102</link>
		<comments>http://en.youxu.info/?p=102#comments</comments>
		<pubDate>Sat, 25 Jul 2009 23:51:55 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=102</guid>
		<description><![CDATA[A friend of mine was frustrated by the fact that in his bash, the `pwd` command gave him the following `unwanted` results: When he is in the directory `/usr/a`, pwd gives &#8216;/usr/a/&#8217;. In this directory, if he has a symbolic link &#8216;b&#8217; pointing to /sys/b, then after using `cd b`, pwd gives him `/usr/a/b/` instead [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine was frustrated by the fact that in his bash, the `pwd` command gave him the following `unwanted` results:</p>
<blockquote><p>When he is in the directory `/usr/a`, pwd gives &#8216;/usr/a/&#8217;. In this directory, if he has a symbolic link &#8216;b&#8217; pointing to /sys/b, then after using `cd b`, pwd gives him `/usr/a/b/` instead of `/sys/b`.</p></blockquote>
<p>What he wants is the physical/absolute path name as the result, but he can&#8217;t get that in bash. (Later we know that we have to use `pwd -P`, but this trick is not stated in `man pwd`, this is in `man bash`) He tried to consult man page, but <code>man pwd</code> redirects him to the man page of pwd in the coreutils, while using it in shell doesn&#8217;t give him the expected result indicated by the pwd command in coreutils . Strange, isn&#8217;t it?</p>
<p>The problem here is that for commands like &#8216;pwd&#8217; (and  &#8216;cd&#8217;, &#8216;echo&#8217;, etc.), your shell will not actually start a process to execute these commands, instead, your shell has build in functions to do the job. If you consult the man page of pwd, there is a line of text in the man page stating:</p>
<blockquote><p>NOTE:  your shell may have its own version of pwd, which usually supersedes the version described here.  Please refer to your shell’s documentation for details about the options it supports.</p></blockquote>
<p>Aha! Blame the shell !!!</p>
<p>Why would your shell want to replace the pwd from GNU? Well, the reason for this kind of replacement is mainly efficiency. If these commands are build-in, shell can run these frequently accessed commands without forking new processes. The downside is that, now you have to put your bet on the shell &#8212; if the shell behaves differently than you&#8217;ve expected, you are in trouble.</p>
<p>The differences between shell&#8217;s build-in commands perhaps are the direct reasons why we want to have a platform-independent tool set. For every Linux distribution, GNU coreutils is always included. If you force your shell to use the pwd from coreutils by typing /bin/pwd, you are insured that even on different platforms with different shells, all results are the same.</p>
<p>Some shell-dependent features:<br />
alias, echo, cd, printf,  background/foreground process (&amp; syntax), pipe and IO redirecting, env variable setting/accessing.</p>
<p>Suffice it to say that you should know your shell&#8217;s behavior under some circumstances, especially when you want a consistent sh shell scripts behavior.</p>
<p>Happy hacking!</p>
<p>&#8211;EOF&#8211;</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=102</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Arduino IDE without an Arduino</title>
		<link>http://en.youxu.info/?p=98</link>
		<comments>http://en.youxu.info/?p=98#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:26:36 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://en.youxu.info/?p=98</guid>
		<description><![CDATA[Arduino is essentially an AVR microcontroller interfaced with an USB/Serial chip to compter. It&#8217;s not hard to build your own arduino, and there are a lot of resources on the internet about this. See this. However, all these tricks requires you to buy an USB interface such that you can program your arduino. That small [...]]]></description>
			<content:encoded><![CDATA[<p>Arduino is essentially an AVR microcontroller interfaced with an USB/Serial chip to compter. It&#8217;s not hard to build your own arduino, and there are a lot of resources on the internet about this. <a href="http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard">See this</a>.</p>
<p>However, all these tricks requires you to buy an USB interface such that you can program your arduino. That small chip or cable usually costs you more than 20 dollars. For a cheap person like me, I don&#8217;t want to do that. However, the arduino IDE is really handy. I love to program in it, even though I use VIM a lot, I still want to use this IDE to program my AVR. So I really want to use this IDE such that I can upload the file to the arduino with one click. However, I don&#8217;t want to invest any money on the buying an arduino, since I know it&#8217;s just a uC with interface, and I usually use my uC in a naked way.</p>
<p>I know that the IDE uses avr-gcc and avrdude.Avr-gcc compiles any thing into a standard hex file to the avr uC. Thus, the IDE didn&#8217;t do anything special here. The avrdude program supports way more programming methods to an AVR chip than the Arduino way (usb/serial). Thus, it is possible to make a cheap ass ISP programmer to the uC, and then modify the IDE such that it calls avrdude with the function you want.</p>
<p>To make things easier, I give a very simpler version to make a cheap arduino (I will call it naked avr chip with battery included):</p>
<p>An AVR uC, for instance, ATMEGA8L ($3 here? My uncle in China mailed me many. Pick the uC with suffix L, meaning a 3V voltage is high enough for it to work, you don&#8217;t need 5V. For using 5V, you might have to buy a 7805 regulator, which I don&#8217;t want to.)</p>
<p>Some LED to test it. (Radio Shack, around $3 for 20, any LED will be good. They are cheap and robust, you don&#8217;t need transistors to protect them, or your uC)</p>
<p>A 2-AA battery box (Radio Shack, less than $2)</p>
<p>A breadboard and some jump wire  (ebay, 20$ for both, free shipping, find the best deal)</p>
<p>You don&#8217;t need a 20Mhz clock and capacitors around it, you can just use the clock inside the AVR chip.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>If you want to DIY an DB-25 ISP programmer cable:</p>
<p>A DB-25 connector (male, you plug it to your computer&#8217;s parallel port)</p>
<p>Some wire</p>
<p>To see these simple steps to make a parallel port programmer, see this link:</p>
<p>You can also buy one online, <a href="http://robokitsworld.com/index.php?main_page=product_info&amp;products_id=53">for like $8</a>.</p>
<p>Connect your ISP to your AVR correctly (you can find the instructions easily online), you don&#8217;t need any resistor or any capacitor whatever on the breadboard, seriously. Again, your AVR is robust enough to handle things under 3V voltage AA battery power. 3V voltage won&#8217;t destroy your LED either, so don&#8217;t even bother connecting your LED to a transistor (I know it&#8217;s suggested, but I just want to show you that you can be lazy here. Every transistor/capacitor on the breadboard will scare away half hobbists ).</p>
<p>OK, here is the real hack.</p>
<p>1. To burn the bootloader down, choose your board, and your cable (w/ parallel programmer, depends on your ISP cable), you can see that there is a menu item for it. You can see if it works. Mine doesn&#8217;t, because my cable is called stk200, and arduino assumes another interface. What I did was go to your hardware/tools folder, you will find avrdude there. I changed avrdude to avrdude1 and then write a bash script called avrdude and calls avadude. In this way, I use echo $* to see the command line passed to avrdude. I then changed the fifth option to -t stk200, which is my ISP programmer protocol.</p>
<p>Actually it&#8217;s not that important to burn bootloader, especially everytime you actually use ISP programmer instead of using the bootloader. I write it here because I hacked it and in case you want to burn the bootloader for your AVR in Arduino environment.</p>
<p>2. To upload. I tried to click the &#8220;Upload to uC with I/O&#8221; button in the IDE. It complains that there is no Serial port. Of course there is not, because I don&#8217;t use it <img src='http://en.youxu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I also found the exception stack saying something about AvrdudeUploader. Haha, that&#8217;s it. So, I checked the souce code out from arduino website using:</p>
<p><tt id="checkoutcmd">svn checkout <strong><em>http</em></strong>://arduino.googlecode.com/svn/trunk/ arduino-read-only</tt></p>
<p>Then, you edit <span style="color: #3366ff;">app/AvrdudeUploader.java</span>, you will find a function called &#8220;<span style="color: #3366ff;">uploadViaBootloader</span>&#8220;, that&#8217;s exactly the function that IDE calls to upload the program. Here, comment out the <span style="color: #3366ff;">String protocol =</span> line, change it to something like</p>
<p><span style="color: #3366ff;">String protocol = &#8220;your_protocol&#8221;;</span></p>
<p>Assign it to the protocol you use ( for instance, I use stk200, or the parallel cable protocol). Remove the line with comment &#8220;<span style="color: #3366ff;">don&#8217;t erase</span>&#8221; (yes, erase it <img src='http://en.youxu.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , remove the whole &#8220;<span style="color: #3366ff;">if (Preference.get&#8230;)</span>&#8221; chuck, and remove the link that contains &#8220;<span style="color: #3366ff;">upload.speed</span>&#8220;, then go to the build/linux folder, ececute the make and dist script. It will create a folder called arduino-0016 something, and you can go inside to the lib/ director, copy all the &#8220;.jar&#8221; files to the install director of your arduion install directory.</p>
<p>Now, do everything you want on your naked avr, using arduino IDE <img src='http://en.youxu.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>(I quick tip, Arduino uses pin 13 as the default LED pin. It it used as SCK pin for the programmer, so, when you test &#8220;Blink&#8221;, you&#8217;d better use another pin, otherwise, unplug your programmer from the uC. The programmer draw sink the current such that you won&#8217;t see the blinking light.</p>
<p>I will post some photos later about my hack.</p>
<p>Happy hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://en.youxu.info/?feed=rss2&#038;p=98</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
