<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"><id>tag:blogger.com,1999:blog-2627804785977970904</id><updated>2008-07-17T07:45:08.579+08:00</updated><title type="text">Doom 的呐喊</title><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default?start-index=26&amp;max-results=25&amp;orderby=published" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>65</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><link rel="self" href="http://feeds.feedburner.com/blogspot/corsairdoom" type="application/atom+xml" /><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-7990680362610185599</id><published>2008-05-03T23:14:00.005+08:00</published><updated>2008-05-03T23:36:16.544+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">GTA IV</title><content type="html">&lt;div style="text-align: center;"&gt;&lt;img src="http://img209.imageshack.us/img209/8801/shotvl0.png"
     alt="Shot of trailer" /&gt; 
&lt;/div&gt;

&lt;p&gt;GTA IV has been put on shelves in market.  I've just watched the 4
  trailer videos, and I think the graphics sucks in comparison to
  Assassins Creed, the animation sucks in comparison to Prince of
  Persia 3, and the modeling sucks in comparison to Doom 3.  But,
  guys, BUT: it has got "Grand Theft Auto" in its name.  What else can
  a man want from a video game?&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2008/05/gta-iv.html" title="GTA IV" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=7990680362610185599" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/7990680362610185599/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/7990680362610185599" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/7990680362610185599" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-5924913994445793133</id><published>2008-04-24T10:52:00.000+08:00</published><updated>2008-04-24T10:57:29.776+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">EMI Sued MP3tunes</title><content type="html">&lt;p&gt;April 22th, CEO of &lt;a href="http://www.mp3tunes.com/"&gt;MP3tunes&lt;/a&gt; sent all users an email, saying that MP3tunes was sued by EMI because of that copywrong thing.&lt;/p&gt;

&lt;blockquote&gt;As you may be aware, the major record label EMI has sued MP3tunes, claiming
    our service is illegal. You can read about the case here. Much is at stake 
    -- if you don't have the right to store your own music online then you    
    won't have the right to store ebooks, videos and other digital products as
    well. The notion of ownership in the 21st century will evaporate. The idea
    of ownership is important to me and I want to make sure I have that right 
    and my kids do too.&lt;/blockquote&gt;

&lt;p&gt;I don't think MP3tunes did wrong and we all know what rights we have.  So I just want to say, EMI, you suck!&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2008/04/emi-sued-mp3tunes.html" title="EMI Sued MP3tunes" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=5924913994445793133" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/5924913994445793133/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/5924913994445793133" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/5924913994445793133" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-1064286687382664827</id><published>2008-03-20T13:31:00.001+08:00</published><updated>2008-03-20T13:32:49.287+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">I Need an Apple Cinema Display</title><content type="html">&lt;div style="text-align: center;"&gt;
  &lt;img src="http://images.apple.com/displays/images/index_display_30in20060721.png"
       alt="Apple Cinema Display" /&gt;&lt;/div&gt;

&lt;p&gt;Yes, I do.  Because when I'm working on my paper, my desktop
  becomes this:&lt;br /&gt;
  &lt;a href="http://img139.imageshack.us/img139/4346/crowdtd9.png"&gt;&lt;img src="http://img86.imageshack.us/img86/9725/thumbyv6.png"
  alt="sorry-looking desktop" /&gt;&lt;/a&gt;&lt;br/&gt;
  The apps are Emacs, xpdf x 3, rox file manager and terminal.&lt;/p&gt;

&lt;p&gt;And I can optimize it a little, which results in this:&lt;br /&gt;
  &lt;a href="http://img246.imageshack.us/img246/3339/crowdaltud6.png"&gt;
    &lt;img src="http://img143.imageshack.us/img143/7254/thumbaltpa3.png"
         alt="sorry-looking desktop 2" /&gt;&lt;/a&gt;&lt;br /&gt;
  I can make use of one xpdf now, while lose the usability of the
         terminal...&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2008/03/i-need-apple-cinema-display.html" title="I Need an Apple Cinema Display" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=1064286687382664827" title="8 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/1064286687382664827/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/1064286687382664827" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/1064286687382664827" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-7885563932367281889</id><published>2008-02-16T19:56:00.004+08:00</published><updated>2008-02-16T20:30:06.823+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">Report IP and More via e-mail</title><content type="html">&lt;p&gt;Want to SSH to you machine at home but don't know the DSL IP
address?  Why not make your home Linux mail it to you?  I wrote some tiny
programs that would keep an eye on you mail spool and do stuff
according to some specific mail subject.  For example, I can send an
e-mail to myself which has a subject &lt;code&gt;[CMD] ip_wan&lt;/code&gt; and
sometime later I will receive an e-mail containing the WAN IP of my
router, so that I can easily make a SSH/ftp/telnet session between
where I currently am and my box at home.&lt;/p&gt;

&lt;p&gt;The first program check my e-mail spool and tell if doing some
  tasks is needed.&lt;/p&gt;

&lt;pre&gt;
&lt;span style="color: #5f9ea0; font-style: italic;"&gt;#!/usr/bin/env python
&lt;/span&gt;
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; sys
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; mailbox
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; StringIO
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; rfc822

&lt;span style="color: #4eee94;"&gt;SPOOL&lt;/span&gt;=&lt;span style="color: #deb887;"&gt;"/var/mail/corsair"&lt;/span&gt;

&lt;span style="color: #00bfff; font-weight: bold; text-decoration: overline;"&gt;def lookUp(mbox):
&lt;/span&gt;    MBox = mailbox.mbox(mbox)
    Deletes = []
    CMDs = []
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;for&lt;/span&gt; Mail &lt;span style="color: #00bfff; font-weight: bold;"&gt;in&lt;/span&gt; MBox.items():
        Msg = StringIO.StringIO()
        Msg.write(str(Mail[1]))
        Msg.seek(0)
        MsgParsed = rfc822.Message(Msg)
        &lt;span style="color: #00bfff; font-weight: bold;"&gt;if&lt;/span&gt; MsgParsed[&lt;span style="color: #deb887;"&gt;"Subject"&lt;/span&gt;].startswith(&lt;span style="color: #deb887;"&gt;"[CMD]"&lt;/span&gt;):
            CMD = MsgParsed[&lt;span style="color: #deb887;"&gt;"Subject"&lt;/span&gt;][6:]
            MBox.remove(Mail[0])
            CMDs.append(CMD)
        Msg.close()
    MBox.close()
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;return&lt;/span&gt; CMDs

&lt;span style="color: #00bfff; font-weight: bold; text-decoration: overline;"&gt;def main():
&lt;/span&gt;    &lt;span style="color: #00bfff; font-weight: bold;"&gt;for&lt;/span&gt; CMD &lt;span style="color: #00bfff; font-weight: bold;"&gt;in&lt;/span&gt; lookUp(SPOOL):
        &lt;span style="color: #00bfff; font-weight: bold;"&gt;print&lt;/span&gt; CMD

&lt;span style="color: #00bfff; font-weight: bold;"&gt;if&lt;/span&gt; __name__ == &lt;span style="color: #deb887;"&gt;"__main__"&lt;/span&gt;:
    main()
    sys.exit(0)
&lt;/pre&gt;

&lt;p&gt;And the second is a shell script that does specific task according
  to standard input.&lt;/p&gt;

&lt;pre&gt;
&lt;span style="color: #5f9ea0; font-style: italic;"&gt;#&lt;/span&gt;&lt;span style="color: #5f9ea0; font-style: italic;"&gt;!/bin/&lt;/span&gt;&lt;span style="color: #00bfff; font-weight: bold;"&gt;zsh&lt;/span&gt;&lt;span style="color: #5f9ea0; font-style: italic;"&gt;
&lt;/span&gt;
&lt;span style="color: #4eee94;"&gt;MailAddr&lt;/span&gt;=&lt;span style="color:
                                                           #deb887;"&gt;"My Email Address"&lt;/span&gt;

&lt;span style="color: #daa520; font-weight: bold;"&gt;mailsend&lt;/span&gt;()
{
    &lt;span style="color: #f08080;"&gt;print&lt;/span&gt; -l &lt;span style="color: #deb887;"&gt;"Subject: CMD reply\n"&lt;/span&gt; $&lt;span style="color: #4eee94;"&gt;1&lt;/span&gt; $&lt;span style="color: #4eee94;"&gt;2&lt;/span&gt; | msmtp $&lt;span style="color: #4eee94;"&gt;MailAddr&lt;/span&gt;
}

&lt;span style="color: #00bfff; font-weight: bold;"&gt;for&lt;/span&gt; CMD&lt;span style="color: #00bfff; font-weight: bold;"&gt; in&lt;/span&gt; $(cat); &lt;span style="color: #00bfff; font-weight: bold;"&gt;do&lt;/span&gt;
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;case&lt;/span&gt; $&lt;span style="color: #4eee94;"&gt;CMD&lt;/span&gt;&lt;span style="color: #00bfff; font-weight: bold;"&gt; in&lt;/span&gt;
        ip_wan)
            &lt;span style="color: #f08080;"&gt;echo&lt;/span&gt; &lt;span style="color: #deb887;"&gt;"Sending wan IP..."&lt;/span&gt;
            mailsend &lt;span style="color: #deb887;"&gt;"Wan IP is"&lt;/span&gt; &lt;span style="color: #deb887;"&gt;\&lt;/span&gt;
                $(wget -O - -q http://myip.dk/ | sed -nr &lt;span style="color: #deb887;"&gt;'s|^&amp;lt;title&amp;gt;Your IP: ([^&amp;lt;]+)&amp;lt;/title&amp;gt;$|\1|p'&lt;/span&gt;)
            ;;
        ip_lan)
            &lt;span style="color: #f08080;"&gt;echo&lt;/span&gt; &lt;span style="color: #deb887;"&gt;"Sending lan IP..."&lt;/span&gt;
            mailsend &lt;span style="color: #deb887;"&gt;"Lan IP is"&lt;/span&gt; &lt;span style="color: #deb887;"&gt;"$(ifconfig)"&lt;/span&gt;
            ;;
        *)
            ;;
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;esac&lt;/span&gt;
&lt;span style="color: #00bfff; font-weight: bold;"&gt;done&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;You can tell that this script currently only support sending LAN
  and WAN IP.&lt;/p&gt;

&lt;p&gt;A possible usage of these two programs is to run the following
  every some minutes:&lt;/p&gt;

&lt;pre&gt;mailcmd.py | mailcmdexec.sh&lt;/pre&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2008/02/report-ip-and-more-via-e-mail.html" title="Report IP and More via e-mail" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=7885563932367281889" title="1 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/7885563932367281889/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/7885563932367281889" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/7885563932367281889" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-5204505258800315791</id><published>2007-11-07T11:53:00.000+08:00</published><updated>2007-11-11T12:33:03.458+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">Terminal Broadcasting</title><content type="html">&lt;p&gt;Some days ago I
  registered an &lt;a href="http://www.aardwolf.com/"&gt;Aardwolf MUD&lt;/a&gt; account, and
  want to show to my girlfriend about MUD and how to play it.  So I
  needed a method to copy the content of my terminal to hers, which I
  called terminal broadcasting.  I got help from the official
  &lt;acronym title="Bulletin Board System"&gt;BBS&lt;/acronym&gt; of my college,
  that I could redirect the output of the &lt;code&gt;script&lt;/code&gt; program to the
  target &lt;acronym title="Pseudo Terminal"&gt;pt&lt;/acronym&gt;.  The shell
  command ran thus:&lt;/p&gt;

&lt;pre&gt;$ script /dev/null 2&gt;&amp;1 | tee /dev/pts/2&lt;/pre&gt;

&lt;p&gt;Where I assumed that the target &lt;acronym title="Pseudo
                                                   Terminal"&gt;pt&lt;/acronym&gt;
                                                   was &lt;code&gt;/dev/pts/2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Why was &lt;code&gt;script&lt;/code&gt; functional?  What I wanted was to duplicate
  the content of my terminal to hers, both of which, in fact, were
  file under &lt;code&gt;/dev&lt;/code&gt;.  So what I've got to do was to write
  the content of &lt;code&gt;/dev/pts/1&lt;/code&gt; (I assume it's my pt)
  to &lt;code&gt;/dev/pts/2&lt;/code&gt;.  Generally, for regular files, one can
  just do a redirected &lt;code&gt;cat&lt;/code&gt; like this&lt;/p&gt;

&lt;pre&gt;$ cat /dev/pts/1 &gt; /dev/pts/2&lt;/pre&gt;

&lt;p&gt;But since &lt;code&gt;/dev/pts/1&lt;/code&gt; changes continuously, the command
  above does not suit our needs.  Furthermore, if we just redirect the
  output, we ourselves are not able to see the content
  of &lt;code&gt;/dev/pts/1&lt;/code&gt;, which will make us unable to do any
  thing in it.  So quite natually, &lt;code&gt;tee&lt;/code&gt; will be used.  And for
  the real-time-update stuff, we need a tool that gives us a subshell,
  and "watch" all the input and output and err.  It very seems that a
  shell itself will do;  however, unfortunately, a shell is too
  low-leveled for this task, and &lt;code&gt;script&lt;/code&gt; is the very program
  (just see what &lt;code&gt;script&lt;/code&gt; does: it write the content of
  current &lt;acronym title="Pseudo Terminal"&gt;pt&lt;/acronym&gt; to a file).
  But the question is that why redirect?  It seem a
  simple &lt;code&gt;script /dev/pts/2&lt;/code&gt; will do it perfectly.  Yes it
  &lt;em&gt;seems&lt;/em&gt;; however the answer is concerning the
  "update &lt;em&gt;continuously&lt;/em&gt;" thing: by default, script only
  updates the file when encounter a line break (return), so we have to
  use a pipe.  If you really hate pipes and redirection, you can pass
  a &lt;code&gt;-f&lt;/code&gt; as an option like this:&lt;/p&gt;

&lt;pre&gt;$ script -f /dev/pts/2&lt;/pre&gt;

&lt;p&gt;It works similarly as using a pipe.&lt;/p&gt;

&lt;p&gt;So for now we have two methods, and there is one more: using a
  named pipe.&lt;/p&gt;

&lt;pre&gt;$ mkfifo temp.fifo
$ nc -l -p 1234 -c "cat temp.fifo" &amp;
$ script -f temp.fifo
&lt;/pre&gt;

&lt;p&gt;When others want to see your terminal, they can telnet you via
  port 1234.  This is a more robotic way.&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/11/ternimal-broadcasting.html" title="Terminal Broadcasting" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=5204505258800315791" title="1 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/5204505258800315791/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/5204505258800315791" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/5204505258800315791" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-6454676926201580410</id><published>2007-10-18T10:50:00.000+08:00</published><updated>2007-10-18T10:57:16.871+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="有目的地随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">Youtube Blocked by Chinese Internet Nanny</title><content type="html">&lt;p&gt;Yes.  &lt;a href="http://www.youtube.com/" title="Youtube Homepage"&gt;Youtube&lt;/a&gt; has been blocked by &lt;abbr title="Great Fire Wall"&gt;GFW&lt;/abbr&gt;.  And meanwhile, blogspot is unblocked.  Don't know what's in their brains...&lt;/p&gt;

&lt;p&gt;在十七大召开，举国欢庆的日子里，打开 &lt;a href="http://tor.eff.org/" title="Tor Homepage"&gt;tor&lt;/a&gt; 以庆祝。&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/10/youtube-blocked-by-chinese-internet.html" title="Youtube Blocked by Chinese Internet Nanny" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=6454676926201580410" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/6454676926201580410/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/6454676926201580410" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/6454676926201580410" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-1032598115375514736</id><published>2007-10-13T15:15:00.000+08:00</published><updated>2007-10-13T15:30:01.891+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">Wiki is GFWed</title><content type="html">&lt;p&gt;&lt;a href="http://www1.webng.com/Corsair/"&gt;My wiki&lt;/a&gt; (and
  webng.com) was &lt;acronym title="Great Fire Wall"&gt;GFW&lt;/acronym&gt;ed.  If
  you are not a chinese, and want to know about GFW (aka. Chinese
  Internet Nanny), I recommand
  you &lt;a href="http://www.itnews.com.au/News/62931,chinese-internet-censorship-machine-revealed.aspx"&gt;Chinese
    internet censorship machine revealed&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At first when I found my wiki could not be browsed, I thought that
  webng.com was down.
  But &lt;a href="http://galoisabel.blogspot.com/"&gt;GaloisAbel&lt;/a&gt; told me
  today that she can read it, and I realized that webng.com might be
  blocked.  So I inserted webng.com into my .pac (which Firefox will
  parse automatically) and started tor and type the
  &lt;abbr title="Uniform Resource Identifier"&gt;URI&lt;/abbr&gt;.  After a
  while, that familiar blue webpage appeared~~  Ha!!~~&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/10/wiki-is-gfwed.html" title="Wiki is GFWed" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=1032598115375514736" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/1032598115375514736/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/1032598115375514736" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/1032598115375514736" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-4088855363109714224</id><published>2007-09-23T11:04:00.000+08:00</published><updated>2007-09-23T11:19:49.232+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X" /><title type="text">Mac OS X on IBM T40</title><content type="html">&lt;p&gt;Installed Mac OSX on my IBM T40 laptop, and Windows was totally
wiped out from my box.&lt;/p&gt;

&lt;p&gt;The installation was quite easy, and it reminded me of installing
Ubuntu.  What troubled me was the hard drive partitioning
  process. Before, The &lt;acronym title="Master Boot
                                       Record"&gt;MBR&lt;/acronym&gt; on my
  hard disk was definitely a mess, for that since I was about to
  install Ubuntu, I used to dynamically part it using Powerquest
  Magic, and it must produce some junk in the MBR.  So when I formated
  the used-to-be windows partition to HFS+ with Disk Utility, it
  refused to do that, and said that it couldn't write into MBR.  I had
  to back up all my important data with size of 30GB onto a mobile
  disk, and repartition the whole drive.  Finally, I could format a
  primary partition into HFS+ and installed Mac OSX.&lt;/p&gt;

&lt;p&gt;This OS is amazing, and of fantastic convenience.  And everything
  in it goes smooth and shiny.  What shock me most are the dock and
  the structure of applications.  The dock can communicate with other
  running applications, and it do it a lot, so I have a funny duck
  with its wings spread and the number of new messages when Adium got
  some, as well as a fat rocket on which text is shown indicating the
  download speed when BitRocket is flying.  And for the structure of
  applications, each one of them is a folder whose name is ended
  with &lt;code&gt;.app&lt;/code&gt;, and the stuff this program needs is in this
  folder, including icons, &lt;abbr title="Extensible Markup
  Language"&gt;xml&lt;/abbr&gt;-s, logic, etc..  So Installing an application
  is all about drag the folder to somewhere local.&lt;/p&gt;

&lt;p&gt;There are also some troubles.  The first one is that I cannot get
  video card driver installed, so QE and hardware acceleration cannot
  be enabled.  Another one concerning the stability of OSX x86.  Some
  of the applications can be easily stuck or exit abnormally such as
  Grapher and Safari.  I am planning to replace Grapher with
  GNUPlot.&lt;/p&gt;

&lt;p&gt;At last, a screenshot.&lt;/p&gt;

&lt;div style="text-align:center;"&gt;&lt;a href="http://cryingdoom.deviantart.com/art/2007-09-23-65553525"&gt;&lt;img src="http://tn3-2.deviantart.com/fs19/300W/f/2007/265/7/1/2007_09_23_by_CryingDoom.png"
                                                alt="Mac OSX
                                                screenshot" /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/09/mac-os-x-on-ibm-t40.html" title="Mac OS X on IBM T40" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=4088855363109714224" title="2 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/4088855363109714224/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/4088855363109714224" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/4088855363109714224" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-5848591715139548447</id><published>2007-08-17T11:27:00.000+08:00</published><updated>2007-08-17T11:45:18.992+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">Program To Generate Random Sentences and Emacs's Popularity</title><content type="html">&lt;p&gt;Just wrote a program to randomly generate sentences, which is somewhat more advanced than a similar program I wrote some mouth ago.  The former one just randomly chose a pre-defined pattern and fill it with randomly chosen words, while this one, using &lt;a href="http://en.wikipedia.org/wiki/Recursive_transition_network"&gt;recursive transition networks&lt;/a&gt; to indicate some basic rules of English grammar, can produce quite nice sentences with subject and object clauses, such as&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The fool which reluctantly rocks unwillingly eats a book.&lt;/li&gt;
&lt;li&gt;The silly man that is silly unwillingly kicks a book which finally pisses.&lt;/li&gt;
&lt;li&gt;A book reluctantly eats a bug that is red.&lt;/li&gt;
&lt;li&gt;A man unwillingly sucks.&lt;/li&gt;
&lt;li&gt;The piece of shit that happily runs reluctantly kicks a bug.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another thing, popularity of Emacs has descended during these years.  And now it is less popular than even GEdit and Kite.  See &lt;a href="http://gnuvince.net/?p=407"&gt;Vincent's post&lt;/a&gt;.&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/08/program-to-generate-random-sentences.html" title="Program To Generate Random Sentences and Emacs's Popularity" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=5848591715139548447" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/5848591715139548447/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/5848591715139548447" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/5848591715139548447" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-6623669222871234614</id><published>2007-07-28T20:34:00.000+08:00</published><updated>2007-07-28T20:48:14.070+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">Youtube Video URL Extractor in Python</title><content type="html">&lt;p&gt;This is a little programme I've just written, &lt;code&gt;youtube-url.py&lt;/code&gt;.  It finds the &lt;acronym title="Uniform Resource Locator"&gt;URL&lt;/acronym&gt;s of &lt;a href="http://www.youtube.com/"&gt;youtube&lt;/a&gt; videos according to video IDs.  Thus we can download the video file whose ID is, for example, &lt;code&gt;qNKtKm3SXvs&lt;/code&gt; with this command line:&lt;/p&gt;

&lt;pre&gt;wget -O video.flv `youtube-url.py qNKtKm3SXvs`&lt;/pre&gt;

&lt;p&gt;The code runs thus:&lt;/p&gt;

&lt;pre&gt;
&lt;span style="color: #5f9ea0; font-style: italic;"&gt;#!/usr/bin/env python
# Time-stamp: &amp;lt;corsair 2007-07-28 16:16:38&amp;gt;
&lt;/span&gt;
&lt;span style="color: #5f9ea0; font-style: italic;"&gt;# Corsair &amp;lt;&lt;a href="mailto:chris.corsair&amp;#64;gmail.com"&gt;chris.corsair&amp;#64;gmail.com&lt;/a&gt;&amp;gt;
# Usage: youtube-url video-id
&lt;/span&gt;
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; sys
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; urllib2
&lt;span style="color: #00bfff; font-weight: bold;"&gt;import&lt;/span&gt; getopt

&lt;span style="color: #00bfff; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: #daa520; font-weight: bold;"&gt;main&lt;/span&gt;():
    &lt;span style="color: #5f9ea0; font-style: italic;"&gt;# Options parsing, fake for now.
&lt;/span&gt;    &lt;span style="color: #00bfff; font-weight: bold;"&gt;try&lt;/span&gt;:
        Options, Args = getopt.gnu_getopt(sys.argv[1:], &lt;span style="color: #deb887;"&gt;""&lt;/span&gt;, [])
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;except&lt;/span&gt; getopt.GetoptError:
        &lt;span style="color: #5f9ea0; font-style: italic;"&gt;# print help information and exit:
&lt;/span&gt;        &lt;span style="color: #00bfff; font-weight: bold;"&gt;pass&lt;/span&gt;

    &lt;span style="color: #00bfff; font-weight: bold;"&gt;if&lt;/span&gt; len(sys.argv) == 1:
        &lt;span style="color: #00bfff; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #deb887;"&gt;"Pleas specify a video-id."&lt;/span&gt;
        sys.exit(1)

    VideoID = sys.argv[1]
    WatchPage = urllib2.urlopen(
        &lt;span style="color: #deb887;"&gt;""&lt;/span&gt;.join([&lt;span style="color: #deb887;"&gt;"http://youtube.com/watch?v="&lt;/span&gt;, VideoID]))

    HtmlLine = &lt;span style="color: #deb887;"&gt;""&lt;/span&gt;
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;while&lt;/span&gt; HtmlLine.find(&lt;span style="color: #deb887;"&gt;"SWFObject"&lt;/span&gt;) == -1:
        HtmlLine = WatchPage.readline()
    UrlOriginal = HtmlLine[HtmlLine.find(&lt;span style="color: #deb887;"&gt;"BASE_YT_URL"&lt;/span&gt;)+12:]
    UrlOriginal = &lt;span style="color: #deb887;"&gt;'?'&lt;/span&gt;.join([&lt;span style="color: #deb887;"&gt;"http://www.youtube.com/get_video"&lt;/span&gt;, 
                            UrlOriginal[:UrlOriginal.find(&lt;span style="color: #deb887;"&gt;'\"'&lt;/span&gt;)].
                            partition(&lt;span style="color: #deb887;"&gt;'&amp;amp;'&lt;/span&gt;)[2]])
    
    &lt;span style="color: #5f9ea0; font-style: italic;"&gt;# Redirect
&lt;/span&gt;    RedirectOpener = urllib2.build_opener(
        urllib2.HTTPRedirectHandler)
    Request = urllib2.Request(UrlOriginal)
    UrlReal = RedirectOpener.open(Request).url
    &lt;span style="color: #00bfff; font-weight: bold;"&gt;print&lt;/span&gt; UrlReal

&lt;span style="color: #00bfff; font-weight: bold;"&gt;if&lt;/span&gt; __name__ == &lt;span style="color: #deb887;"&gt;"__main__"&lt;/span&gt;:
    main()
&lt;/pre&gt;

&lt;p&gt;Also, there is &lt;a href="http://cmsir.scinese.com/2007/07/27/youtube-video-downloader-in-ruby/"&gt;a Ruby version&lt;/a&gt; by &lt;a href="http://cmsir.scinese.com/"&gt;Cheng Meng&lt;/a&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/07/youtube-video-url-extractor-in-python.html" title="Youtube Video URL Extractor in Python" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=6623669222871234614" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/6623669222871234614/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/6623669222871234614" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/6623669222871234614" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-4313737238006794407</id><published>2007-07-20T15:21:00.000+08:00</published><updated>2007-07-20T15:26:00.697+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">New Blog and This Blog</title><content type="html">&lt;p&gt;Create a &lt;a href="http://corsair.scinese.com"&gt;new blog&lt;/a&gt; on
scinese.com, 'cause this blog is blocked by Chinese Internet Nanny.
The plan is that I write this blog purely in English, and the scinese
one in Chinese.&lt;/p&gt;

&lt;p&gt;The new blog is &lt;a href="http://www.wordpress.org/"&gt;Wordpress&lt;/a&gt;
  based and has its traditional problem that it checks and alters
  my &lt;abbr title="Hypertext Markup Language"&gt;html&lt;/abbr&gt; code pretty
  much (even the code in &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt;).&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/07/new-blog-and-this-blog.html" title="New Blog and This Blog" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=4313737238006794407" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/4313737238006794407/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/4313737238006794407" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/4313737238006794407" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-6430201973941868908</id><published>2007-07-16T20:57:00.000+08:00</published><updated>2007-07-16T21:14:05.048+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">Rockbox</title><content type="html">&lt;p&gt;刚才吃方便面的时候，不禁想起了以前住宿舍，用量子力学压面的生活...&lt;/p&gt;

&lt;p&gt;给 iPod 买了袜套，又忍不住自由的诱惑，重新安上
  了 &lt;a href="http://www.rockbox.org/" title="Rockbox
  Homepage"&gt;Rockbox&lt;/a&gt; 系统。比以前进步不少，菜单有了图标，好像也比以
  前快了，tag database 和 bootloader 都升级为第二版，但是耗电的问题还是
  没有解决，所以暂时不敢放弃苹果原来的操作系统...&lt;/p&gt;

&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_jrPg8mYSpq4/Rptr-hPCh3I/AAAAAAAAAE0/wfac59Gb8g0/s1600-h/pict0017.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_jrPg8mYSpq4/Rptr-hPCh3I/AAAAAAAAAE0/wfac59Gb8g0/s400/pict0017.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5087778925862618994" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;重新制作了一个主题，自己觉得还挺不错的，发布一下~~~ &lt;/p&gt;
&lt;p style="text-align:center;"&gt;
&lt;img src="http://img374.imageshack.us/img374/1663/mclarenzc9.png"
     alt="Screenshot" /&gt;
&lt;br /&gt;
&lt;a
href="http://www.box.net/lite/ozh2e013c7"&gt;&lt;img style="border-width:0px;" 
src="http://www.box.net/lite/image/ozh2e013c7.png" alt="McLaren.zip" /&gt;&lt;/a&gt;
&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/07/rockbox.html" title="Rockbox" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=6430201973941868908" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/6430201973941868908/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/6430201973941868908" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/6430201973941868908" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-6414160332912737228</id><published>2007-06-20T12:02:00.000+08:00</published><updated>2007-06-20T12:03:30.788+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">我的 Wiki 和考试拉稀</title><content type="html">&lt;p&gt;更新了&lt;a href="http://www1.webng.com/Corsair/index.html"&gt;我的
    Wiki&lt;/a&gt;，写了一些关于 Mutt 的东西，改进
    了&lt;a href="http://www1.webng.com/Corsair/Muse.html#sec5" title="代
    码加亮问题的改进"&gt;代码加亮&lt;/a&gt;，最重要的是 hack 了 Muse 的源码，使
    产生的 xhtml 符合 &lt;a href="http://www.w3.org/TR/xhtml11/"&gt;xhtml
    1.1 标准&lt;/a&gt;，patch 已经提交给 Muse 的邮件列表。&lt;/p&gt;
&lt;p&gt;妈妈的，考试的时候又拉稀了...&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/06/wiki.html" title="我的 Wiki 和考试拉稀" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=6414160332912737228" title="2 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/6414160332912737228/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/6414160332912737228" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/6414160332912737228" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-4130492658662096972</id><published>2007-06-05T12:14:00.000+08:00</published><updated>2007-06-05T22:42:51.061+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">LaTeX 幻灯片</title><content type="html">&lt;p&gt;要做幻灯片，所以这几天找了一些关于 TeX 做幻灯片的文档，基本上就是
  pdfscreen + ppower4, Beamer, ConTeXt 这几个东西。第一个没用过，因为比
  较麻烦，后面两个都试了一下。ConTeXt 是最牛逼的，强大而不失简洁，美丽
  而不失庄重，实乃我辈中人之良择，可惜配置中文字体未遂...  Beamer 就比
  较好办，因为是在 LaTeX 之上，只要 LaTeX 能出中文就没什么问题，效果虽
  然比 ConTeXt 要逊色不少，但是强大而不失简洁，美丽而不失庄重，实乃我辈
  中人之良择。&lt;/p&gt;

&lt;p&gt;顺便做了一个&lt;a href="http://www.box.net/shared/drntvlbmmm"&gt;幻灯片&lt;/a&gt;用来测试，模板部分参考了沈坚的。只是个 Demo，内容
  不必在意。&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/06/latex.html" title="LaTeX 幻灯片" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=4130492658662096972" title="2 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/4130492658662096972/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/4130492658662096972" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/4130492658662096972" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-6446257804508771473</id><published>2007-06-05T11:03:00.000+08:00</published><updated>2007-06-06T22:15:52.159+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">How to Convert Video for iPod: The Freeway</title><content type="html">&lt;p&gt;The freeway = the free software way.&lt;/p&gt;

  &lt;p&gt;There is a non-free way as well.
    See &lt;a
    href="http://corsairdoom.blogspot.com/2007/03/how-to-convert-video-for-ipod.html"&gt;my
    old post&lt;/a&gt; which also includs the format and limit of video
    files that an iPod can accept.&lt;/p&gt;

  &lt;p&gt;Software needed:
    &lt;ul&gt;
      &lt;li&gt;For video
      transcoding: &lt;a
      href="http://sourceforge.net/projects/ffmpeg"&gt;ffmpeg&lt;/a&gt;,
      &lt;a
      href="http://www.videolan.org/developers/x264.html"&gt;x264&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;For audio
      transcoding: &lt;a
      href="http://sourceforge.net/projects/faac/"&gt;FAAC&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;Muxer: &lt;a
      href="http://gpac.sourceforge.net/index.php"&gt;MP4Box&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;Misc.: &lt;a href="http://www.mplayerhq.hu/"&gt;MPlayer&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;&lt;/p&gt;

  &lt;p&gt;Take a flash video (flv) from youtube for example.  Such a flash video
  includes a MPEG-2 video stream and a MP3 audio stream, both of which
    are need to transcode.  Assume the filename is liu4.flv.&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;First off, play this video file in mplayer which will display
    the format of this file (frame rate, coding, etc.).  Keep them in
    mind.&lt;/li&gt;
    &lt;li&gt;&lt;p&gt;Transcode the video stream.  iPod accepts both MPEG-4 and H264
        stream.  For MPEG-4 coding:&lt;/p&gt;

      &lt;pre&gt;ffmpeg -r [fps] -i liu4.flv \
-vcodec mpeg4 -b [bitrate]k liu4.m4v&lt;/pre&gt;

      &lt;p&gt;Notice that the position of options makes sense!  For
        detail, go to ffmpeg's manual.&lt;/p&gt;

      &lt;p&gt;Things are a little tougher if you wants to use x264, for
      that x264 only accepts YUV 4:2:0, YUV4MPEG 4:2:0 and avi/avs (if
      compiled with AVIS support) as input, so for a flv file, it
        should be first convert to YUV4MPEG (make sure you have
      adequate space on the hard disk).&lt;/p&gt;

      &lt;pre&gt;mplayer -vo yuv4mpeg:file=liu4.yuv liu4.flv&lt;/pre&gt;

      &lt;p&gt;Then&lt;/p&gt;

      &lt;pre&gt;x264 -B [bitrate] --fps [fps] -o liu4.264 \
        liu4.yuv 320x240&lt;/pre&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;p&gt;Transcode the audio stream.  First dump the audio stream
        from the flv.&lt;/p&gt;
      
      &lt;pre&gt;mplayer -dumpaudio -dumpfile liu4.mp3 liu4.flv&lt;/pre&gt;
      
      &lt;p&gt;Then use something to decode the stream to wav.  I prefer
        Lame.  After that, use FAAC to encode it to aac.&lt;/p&gt;
      
      &lt;pre&gt;faac -b [bitrate] -o liu4.m4a -w liu4.wav&lt;/pre&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;p&gt;Finally, mux them up.&lt;/p&gt;
      &lt;pre&gt;MP4Box -fps [fps] -add liu4.m4v
MP4Box -fps [fps] -add liu4.m4a&lt;/pre&gt;
    &lt;/li&gt;
  &lt;/ol&gt;

  &lt;p&gt;That's it.  One last thing: variable frame rate and fake variable frame rate video
    files are not support by this freeway.  (Is there a encoder that
    support it?)&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/06/how-to-convert-video-for-ipod-freeway.html" title="How to Convert Video for iPod: The Freeway" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=6446257804508771473" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/6446257804508771473/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/6446257804508771473" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/6446257804508771473" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-6575156011176494566</id><published>2007-05-26T13:32:00.000+08:00</published><updated>2007-05-26T13:34:04.106+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="有目的地随便说说" /><title type="text">锂离子电池 FAQ</title><content type="html">&lt;ol&gt;
&lt;li&gt;锂离子电池没有记忆效应&lt;br /&gt;
    锂离子电池真的没有记忆效应&lt;br /&gt;
    锂离子电池真的一点记忆效应也没有！&lt;/li&gt;
&lt;li&gt;不用激活，因为出场时电池已经激活好了。&lt;/li&gt;
&lt;li&gt;&lt;p&gt;只有带“油表”的电池才需要每月放满-充满一次。“油表”是指电池中记
  录容量信息的芯片。放满-充满的过程是为了 reset 油表中的信息，而不是为
    了再次激活电池。&lt;/p&gt;
  &lt;p&gt;所有的笔记本电池都带有油表，其它的小型移动设备（比如手机和各种
    music player）大多都不带。&lt;/p&gt;
&lt;li&gt;因为没有记忆效应，所以不需要用光再充，完全可以随用随充，而且这是推
  荐的使用方式。&lt;/li&gt;
&lt;li&gt;&lt;p&gt;不是充的次数越少寿命就越长，而是放满-充满循环的次数越多寿命就越
    短。锂离子电池的寿命大约是 300~500 循环，在这个次数以后电量才会有比
    较明显的下降。&lt;/p&gt;
  &lt;p&gt;假如一个电池的容量是 800 mAh，某此使用了 100 mAh，然后又充满，这
    等于是 1/8 个放满-充满循环。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;过放电和过充电是最大的伤害。&lt;/li&gt;
&lt;li&gt;但是不用担心笔记本电脑或 ipod 总是接着电源会炸掉，因为充满以后
  就自动断路了。（锂离子电池不能浮充！)&lt;/li&gt;
&lt;li&gt;上一条只对质量比较好的移动产品成立。&lt;/li&gt;
&lt;li&gt;高温是对电池的第二大伤害。&lt;/li&gt;
&lt;li&gt;保持 p, T 不变，锂离子电池的电量在 40% 左右时有最长的寿命。&lt;/li&gt;
&lt;li&gt;实在看不惯周围的人折磨自己的电池，特发此文。&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.batteryuniversity.com/parttwo-34.htm"
       title="Further reading"&gt;How to prolong lithium-based batteries&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;以下是关于 iPod 的。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;iPod 的电池都是锂离子电池。&lt;/li&gt;
  &lt;li&gt;iPod 的电池是 Sony 或 Sanyo 产的，是正常人能见到的最好的电池，所
  以如果你的电池寿命显著的低于平均，那基本上是你自己的问题。
  &lt;/li&gt;
&lt;/ol&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/05/faq.html" title="锂离子电池 FAQ" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=6575156011176494566" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/6575156011176494566/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/6575156011176494566" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/6575156011176494566" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-8176082465480491565</id><published>2007-05-19T12:10:00.000+08:00</published><updated>2007-05-19T13:43:34.559+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><title type="text">KOSS Spark Plug</title><content type="html">&lt;p&gt;3年高寿的 Sennheiser MX400 挂掉了...，昨天去买了一个 KOSS 的 Spark
  Plug，就是传说中的火花塞~~~，￥160。堡了一夜，说说感受。&lt;/p&gt;

&lt;p&gt;先说点客观的，频响范围。很多人都说包装盒上写的频响是骗人的，其实不
  是，只不过是那些人理解错了。盒上的那个频响是“有响应的频率”，那些
  10 ~ 20K 或者 20 ~ 20K 基本上都还正常，而一般说的频响是“有正确的响
  应的频率”，当然就不可能是那个数了。上学期为了测试我的 Sennheiser
  PX200，我用 Matlab 生成了很多各种频率的正弦波，这次又派上用场了 :-)。
  经过测试，KOSS SP 在 40~12K 内的频响基本上是正确的，可见在 ￥100~200
  这个价位上，火花塞的低音下潜算是很不错的了，高音么...  嗯，今天天气
  真好啊~~&lt;/p&gt;

&lt;p&gt;再来点主观的。作为一代低音王 KOSS PP 的简化版，火花塞的低音真不是盖
  的，量是没的说，质也还可以，一般的鼓和 bass 都还听得清楚。中音来说，
  由于低音的量比较高，有些喧宾夺主（认为低音是主的人请把准备扔出的西红
  柿和臭鸡蛋自行吃下），但是质量也还可以，虽然没有 PX200 来的圆润，但在
  同价位的耳塞中应该算是平均水平。高音则是火花塞的硬伤，KOSS 在这里犯了
  Hifi 的大忌。Hifi 设备的一条重要准则就是宁可不发，也不发错，而火花塞
  不仅发错了，而且一点隐藏的意思都没有，形容一下就是稀稀拉拉的，好像拉
  稀一样。对于那些充满三角铁的曲目，比如 Bedrich Smetana 的 La
  Moldau（我也不知道是第几乐章），简直是惨不忍睹...  音场上，火花塞是
  入耳式的，所以不错，比 PX200 要近一些。瞬态我就听不出来了，可能我的
  耳膜瞬态就不好...&lt;/p&gt;

&lt;p&gt;总的来说，火花塞的音色算是极其有特点，音染很重的那种，声音偏闷，而且
  比较冷，人声出不来那种甜的流蜜的感觉。作为我的 PX200 的调剂还是不错
  的:-p。在 ￥200 以下的价位，这种有特点的耳机还真不多。比较适合听摇滚
  和 Jazz（流行不算在音乐的范畴内），古典也还凑合。当听到 Pink Floyd 的
  Time 开头那一坨铃声的时候，请一定强迫自己认为昨晚没睡好觉，以至影响听
  力...&lt;/p&gt;

&lt;p&gt;看图：从左下到右上为 KOSS SP，MX400，PX200。&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_jrPg8mYSpq4/Rk6OMfWn1eI/AAAAAAAAAEM/9hWYFa7XF-A/s1600-h/pict0029-mod.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_jrPg8mYSpq4/Rk6OMfWn1eI/AAAAAAAAAEM/9hWYFa7XF-A/s320/pict0029-mod.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5066142976064345570" /&gt;&lt;/a&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/05/koss-spark-plug.html" title="KOSS Spark Plug" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=8176082465480491565" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/8176082465480491565/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/8176082465480491565" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/8176082465480491565" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-1458128350757557367</id><published>2007-05-17T22:53:00.000+08:00</published><updated>2007-05-17T22:56:53.388+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">GNU Screen Is Fucking Amazing!</title><content type="html">&lt;p&gt;I was doing
some &lt;a
href="http://en.wikipedia.org/wiki/Diffusion-limited_aggregation"&gt;DLA&lt;/a&gt;
thing in a &lt;a href="http://www.gnu.org/software/screen/"&gt;screen&lt;/a&gt;
session.  After half an hour's slow and boring calculation I decided
to have some fun.  So I opened up Firefox and started browsing.  At
that time, for that it seemed that a web page required some multimedia
plug-ins which I did not have, the system stuck for a second and the X
  server restarted, which meant that I was forced to logout!&lt;/p&gt;

&lt;p&gt;I was quite upset and thought that I have done a half-an-hour
full-cpu-consuming (can them be combined thus?) job for nothing.  But
after I logged in again, I found my CPU was still working in high
load.  Opening up Top, I recognize my calculation program at the first
sight -- it remained there.  Filled with hope, I started screen using
the &lt;kbd&gt;-r&lt;/kbd&gt; switch and reattached the previous session and found that it
  was exacting what I lost.  It was really amazing~~~&lt;/p&gt;

&lt;p&gt;So one suggestion: start your terminal using &lt;code&gt;termname -e
screen&lt;/code&gt;.&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/05/gnu-screen-is-fucking-amazing.html" title="GNU Screen Is Fucking Amazing!" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=1458128350757557367" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/1458128350757557367/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/1458128350757557367" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/1458128350757557367" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-4326867636436438457</id><published>2007-05-07T23:04:00.000+08:00</published><updated>2007-05-15T22:53:53.612+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><title type="text">我的 Wiki 和 Muse 和南京</title><content type="html">&lt;p&gt;更新了我的 &lt;a href="http://www1.webng.com/Corsair/"&gt;Wiki&lt;/a&gt;。这次把
  所有的页面全部
  用 &lt;a href="http://mwolson.org/projects/EmacsMuse.html"&gt;Muse&lt;/a&gt; 重新
  发布，并且添加了一
  个 &lt;a href="http://www1.webng.com/Corsair/Muse.html"&gt;Muse 的页&lt;/a&gt;。
  以前一直有这个计划，就在等 Muse 支持语法加亮，嘎嘎~~~&lt;/p&gt;

&lt;p&gt;这个五一的收获就是发现南京有的地方还是挺漂亮的，南京的树比北京多，但
  是... 兄弟们阿，但是！南京的空气好差，比北京还差，下完雨还是灰不溜秋
  的...&lt;/p&gt;

  &lt;p&gt;&lt;ins datetime="20070515"&gt;PS：再次更新 wiki，更新内容是整个 Emacs
  页，另外更改了 css，把页面变窄了，行距变大了。删除了什么都没有的
  Misc 页。&lt;/ins&gt;&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/05/wiki-muse.html" title="我的 Wiki 和 Muse 和南京" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=4326867636436438457" title="8 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/4326867636436438457/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/4326867636436438457" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/4326867636436438457" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-8813639747719716310</id><published>2007-05-05T15:38:00.000+08:00</published><updated>2007-05-05T15:44:36.356+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><title type="text">GTR 2007</title><content type="html">&lt;p&gt;狗日的，我居然不知道今年的第一场 GT 是在我的生日和其后的一天举行的，
  而且是在珠海，真是人神共愤...&lt;/p&gt;
&lt;p&gt;看图先。珠海赛道：&lt;/p&gt;
&lt;p style="text-align:center;"&gt;
&lt;img src="http://img209.imageshack.us/img209/624/zhuhaiwm3.png" alt="珠海赛道" /&gt;
&lt;/p&gt;
&lt;p&gt;赛道相对不是很难，有两个稍有难度的弯。1组的冠军是Lamborghini Murciélago（终于...），可怜的 Maserati...&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.fiagt.com/img/showimg.php.jpg?countkey=40&amp;key=4708&amp;season=2007&amp;event=1&amp;size=3&amp;rnd=true"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px;" src="http://www.fiagt.com/img/showimg.php.jpg?countkey=40&amp;key=4708&amp;season=2007&amp;event=1&amp;size=3&amp;rnd=true" border="0" alt="" /&gt;&lt;/a&gt;
&lt;p&gt;2组的前两名是意料之中的两辆 Ferrari 430，Porsche 997 只拿到第四（默
  哀一小时）...&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.fiagt.com/img/showimg.php.jpg?countkey=8&amp;key=4676&amp;season=2007&amp;event=1&amp;size=3&amp;rnd=true"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px;" src="http://www.fiagt.com/img/showimg.php.jpg?countkey=8&amp;key=4676&amp;season=2007&amp;event=1&amp;size=3&amp;rnd=true" border="0" alt="" /&gt;&lt;/a&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/05/gtr-2007.html" title="GTR 2007" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=8813639747719716310" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/8813639747719716310/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/8813639747719716310" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/8813639747719716310" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-7068764114247765122</id><published>2007-05-04T23:20:00.000+08:00</published><updated>2007-05-05T00:07:14.488+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><category scheme="http://www.blogger.com/atom/ns#" term="web" /><title type="text">出去玩 ＆ MSN Space</title><content type="html">&lt;p&gt;一个高中同学过来玩，早上 6:15 爬起来，到车站去接她，经过很多周折找到了住的地方，然后去夫子庙吃了午饭。下午先去了雨花台，然后跑到总统府，这两个地方我都没去过...  印象比较深的是雨花台里的什么烈士纪念碑，感觉好像魔法塔一样...&lt;/p&gt;

&lt;p&gt;晚上到秦淮河上坐船，了解到她居然听过 Pink Floyd，比较诡异...&lt;/p&gt;

&lt;p&gt;吃完晚饭以后把她送回宾馆，才发现公共汽车的末班车早就过了，日...  只好打个的。回来洗了个凉水澡，洗得我都要成仙了...&lt;/p&gt;

&lt;p&gt;About MSN Space: Seems that msn space has upgraded frequently during these days, which leaded some problems concerning viewing msn spaces in Firefox.  At first it just showed nothing for every spaces (and spaces.live.com) but a xml parsing error.  Then I learned that this could be solved by adding a string key named &lt;code&gt;general.useragent.override&lt;/code&gt; with value &lt;code&gt;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)&lt;/code&gt; in about:config page.  It seemed to be all right - spaces can be displayed; However, I found later that, still, all blog entries were not showed which means that I can only see sidebars...  I guess it is because that some of the codes in msn space are not w3c-compatible.  Hope it will be fixed soon, though there is little hope, really...</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/05/blog-post.html" title="出去玩 ＆ MSN Space" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=7068764114247765122" title="1 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/7068764114247765122/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/7068764114247765122" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/7068764114247765122" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-1454705615908635321</id><published>2007-04-25T20:57:00.000+08:00</published><updated>2007-04-25T21:40:16.656+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="有目的地随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">Scheme48 vs. PLT Scheme 与今天晚上坐在我右边的傻逼</title><content type="html">&lt;p&gt;Seems that Scheme48 have some problem with &lt;code&gt;lambda&lt;/code&gt;
  solving.  I was doing exercise 1.37 in &lt;em&gt;SICP&lt;/em&gt; and defined a
  procedure to represent "continued fraction" process:&lt;/p&gt;

&lt;p style="text-align:center;"&gt;
&lt;img src="http://img231.imageshack.us/img231/3829/texpngoutte6.png" alt="Continued Fraction" /&gt;
&lt;/p&gt;

&lt;div class="code"&gt;
&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#ffff00"&gt;define&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;con-frac&amp;nbsp;N&amp;nbsp;D&amp;nbsp;n&amp;nbsp;init-value&lt;font
color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#40ffff"&gt;=&lt;/font&gt;&amp;nbsp;n&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#40ffff"&gt;/&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;N&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font
color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#40ffff"&gt;+&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;D&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font
color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;init-value&lt;font
color="#ffa500"&gt;))&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;con-frac&amp;nbsp;N&amp;nbsp;D&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#40ffff"&gt;-&lt;/font&gt;&amp;nbsp;n&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#40ffff"&gt;/&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;N&amp;nbsp;n&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#40ffff"&gt;+&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;D&amp;nbsp;n&lt;font
color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;init-value&lt;font
color="#ffa500"&gt;)))))&lt;/font&gt;
&lt;/div&gt;

&lt;p&gt;And I used the following code to test this procedure in Scheme48&lt;/p&gt;
&lt;div class="code"&gt;
&lt;font
color="#ffa500"&gt;(&lt;/font&gt;con-frac&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#ffff00"&gt;lambda&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;n&lt;font
color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;&lt;font
color="#ffff00"&gt;lambda&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa500"&gt;(&lt;/font&gt;n&lt;font
color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font
color="#ffa0a0"&gt;100&lt;/font&gt;&amp;nbsp;&lt;font
color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;
&lt;/div&gt;

&lt;p&gt;It showed an error:&lt;/p&gt;
&lt;pre&gt;
Error: attempt to call a non-procedure
       (100 100)
&lt;/pre&gt;

&lt;p&gt;While in PLT Scheme, the procedure can run properly.  I had no idea
  why this happened.&lt;/p&gt;

&lt;p&gt;再说一下今天晚上，我去上西方文学鉴赏课，那个老师三十岁出头，看着还
  挺年轻。说屠格涅夫的《父与子》的时候说到了六四。老师说，那场风波的时
  候我正在上高中。坐在我右边的一个傻逼立马小声说，64年的时候你上高中？
  &lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/04/scheme48-vs-plt-scheme.html" title="Scheme48 vs. PLT Scheme 与今天晚上坐在我右边的傻逼" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=1454705615908635321" title="4 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/1454705615908635321/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/1454705615908635321" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/1454705615908635321" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-2069567015110445843</id><published>2007-04-22T12:11:00.000+08:00</published><updated>2007-04-22T12:57:24.076+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">texpng.py</title><content type="html">&lt;p&gt;I wrote a python script called texpng.py which converts a block of LaTeX code to a png picture file.  &lt;a href="http://www-cdf.fnal.gov/~cplager/latex/#png"&gt;Charles's tex2png.pl&lt;/a&gt; is fine, but it makes some errors on my machine.  So I just wanted to DIY my own.&lt;/p&gt;
&lt;p&gt;Download here.&lt;br /&gt;
&lt;a href="http://www.box.net/lite/uuch6m32oi"&gt;&lt;img src="http://www.box.net/lite/image/uuch6m32oi.png" border="0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;
Usage: texpng.py [options]

Options:
  -h, --help            show this help message and exit
  -o FILE, --output-file=FILE
                        Write the generated PNG to FILE.
  -b BG, --background=BG
                        Specify the background color.
                        Eg. 'rgb 1.0 1.0 1.0', which is the 
                        default.
  -f FG, --foreground=FG
                        Specify the foreground color.  
                        Eg. 'rgb 0.0 0.0 0.0', which is the
                        default.
  -p, --opaque          Tell whether the background should be not 
                        transparent.
  -n, --negtive         Do the same things as "-b 'rgb 0.0 0.0 0.0'
                        -f 'rgb 1.0 1.0 1.0'".  This will override 
                        "-f" and "-b" options.
  -v, --verbose         Output lots of informations.
&lt;/pre&gt;

&lt;p&gt;Show one example.  The TeX code is&lt;/p&gt;
&lt;pre&gt;
\[
y(x) = \int_{x_0}^x \left[\cos\frac{i\omega t}{x_0^2}+
\sin(i\omega t + \phi_0)\right]\textrm{d}t
\]
&lt;/pre&gt;
&lt;p&gt;And the output is&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_jrPg8mYSpq4/Rirk0GWEgyI/AAAAAAAAAEE/X8SLtuqL3VM/s1600-h/texpng-out.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_jrPg8mYSpq4/Rirk0GWEgyI/AAAAAAAAAEE/X8SLtuqL3VM/s400/texpng-out.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5056105115384316706" /&gt;&lt;/a&gt;

&lt;ins&gt;FIX: Added --dpi option, which enables users to adjust the font size.  See --help information for detail.&lt;/ins&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/04/texpngpy.html" title="texpng.py" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=2069567015110445843" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/2069567015110445843/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/2069567015110445843" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/2069567015110445843" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-4673985063688895847</id><published>2007-04-21T13:31:00.000+08:00</published><updated>2007-04-22T00:10:56.710+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="有目的地随便说说" /><title type="text">王开源同学的故事</title><content type="html">&lt;p&gt;传说昨天 Bill Gates 在北大演讲时，一
  个搞开源教育的人，&lt;a
  href="http://blog.csdn.net/arthur5933/archive/2007/04/20/1571507.aspx"&gt;王开源&lt;/a&gt;同学，冲上台去，振臂抗议 M$ 垄断，呼吁开源，
  然后被警察带走了...&lt;/p&gt;

&lt;p&gt;我觉得王同学的勇气十分可嘉，做法十分有问题。首先，抗议这种东西，在
  中国是没什么用的。自古以来国人的奴性就十分强烈，完全不能理解抗议这种
  行为，同时也不能理解与自己行为方式不同的行为。所以抗议在中国被理想成
  一种炒作。其次，国内的计算机用户基本上从来就没听说过开源这回事，就算
  听说过，也不知道是什么，就好像机器人这种东西对于幼儿园小朋友来说，就
  是一些类似变形金刚，会杀人的牛逼人形机器。国人对于开源的理解，基本上
  就是开源 = 免费 = 盗版。所以王同学的这种行为，在主流媒体和主流受众看
  来，就好像一个盗版商在呼吁大家买盗版，因为 Bill Gates 的东西太贵了。
  &lt;/p&gt;

&lt;p&gt;当然，不是所有的中国人都是幼儿园小朋友，也有一些小学生，在国内的一
  些小公司里写了几年数据库，以为自己是个大牛了，就认为开源软件 = 便宜
  的软件 = 易用性非常差的软件 = 没有技术支持的软件 = those softwares
  whose authors 都穷的快要乞讨了。&lt;/p&gt;

&lt;p&gt;话说回来，万一开源在国内一不小心普及了，就会有无数的爱国科学家开始
  开发“完全自主知识产权”的操作系统、办公系统、开发环境、... 、麒麟、麒麟
  2000、麒麟 XP、麒麟 2003、麒麟 vista... 中国就不用收税了：纳税人直接把
  钱交给这些爱国科学家就行了。&lt;/p&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/04/blog-post.html" title="王开源同学的故事" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=4673985063688895847" title="0 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/4673985063688895847/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/4673985063688895847" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/4673985063688895847" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-2627804785977970904.post-2086253137227305051</id><published>2007-04-08T01:45:00.000+08:00</published><updated>2007-04-08T01:48:57.695+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="随便说说" /><category scheme="http://www.blogger.com/atom/ns#" term="computer related" /><title type="text">C, Scheme</title><content type="html">&lt;p&gt;I was doing the assignment of computational physics course, solve
  classic three-body problem.  I decided to use the old method of
  Lagrange's, in which only the lightest object was considered to be
  dynamic, and the other two were too heavy to move.  And I got four
  first-ordered differential equations.  Naturally I wrote (a function
  &lt;span style="font-style:italic;"&gt;/*in c*/&lt;/span&gt; that takes (a pointer to (an array of (pointers to
  functions)))) as a formal parameter, and felt very sweet for that I
  still remember the notation for such a pointer-array-function
  thing:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;void solveDE_RK_4(double (*func)()[]);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But when compiling, GCC keep showing errors whatever I change the
  declaration.  I tried a whole lot of combination of (), * and [],
  and finally, after 1 hour of doing this, I reached the working
  declaration:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;void solveDE_RK_4(double (*func[])
    (double, double, double, double));
/* All functions in func[] takes four doubles as
 * parameters. */&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;I spare some time
  reading &lt;a
  href="http://mitpress.mit.edu/sicp/full-text/book/book.html"&gt;SICP&lt;/a&gt;
  tonight.  And I found &lt;a href="http://s48.org/"&gt;Scheme48&lt;/a&gt;
  interpreter uses applicative-order evaluation, because the code
  below (Exercise 1.5, &lt;span style="font-style:italic;"&gt;SICP&lt;/span&gt;) makes it stuck.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(define (p) (p))
(define (test x y)
    (if (= x 0)
      0 y))

(test 0 (p))&lt;/code&gt;&lt;/pre&gt;</content><link rel="alternate" type="text/html" href="http://corsairdoom.blogspot.com/2007/04/c-scheme.html" title="C, Scheme" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2627804785977970904&amp;postID=2086253137227305051" title="1 Comments" /><link rel="replies" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/2086253137227305051/comments/default" title="Post Comments" /><link rel="self" type="application/atom+xml" href="http://corsairdoom.blogspot.com/feeds/posts/default/2086253137227305051" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2627804785977970904/posts/default/2086253137227305051" /><author><name>Corsair</name><uri>http://www.blogger.com/profile/15684562313533914313</uri><email>noreply@blogger.com</email></author></entry></feed>
