<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2365379269800339250</id><updated>2012-02-16T10:11:10.522-08:00</updated><category term='linux'/><category term='fvwm'/><category term='cvs'/><category term='usenet'/><category term='gdb'/><category term='vi'/><category term='gentoo'/><category term='vmware'/><category term='arm-linux'/><category term='lisp'/><category term='nyquist'/><category term='gnu'/><category term='embeded'/><category term='sed'/><category term='c'/><category term='life'/><category term='slackware'/><category term='audio'/><category term='android'/><category term='unix'/><category term='Mac'/><category term='cweb'/><category term='vim'/><category term='cscope'/><category term='code'/><category term='scripts'/><title type='text'>Fiddling</title><subtitle type='html'>Mark Chen's blog (computer programming)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dsmarkchen.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default?start-index=101&amp;max-results=100'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>136</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2912336345406639064</id><published>2011-05-27T20:19:00.000-07:00</published><updated>2011-05-27T20:20:41.333-07:00</updated><title type='text'>macbook pro alsa information</title><content type='html'>I install fedora 14 to my  macbook pro.  Alsa information (alsa-info) is located at &lt;br /&gt;&lt;br /&gt;http://www.alsa-project.org/db/?f=fbe5944331a383db3659bae2cd06659142f28af4&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2912336345406639064?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2912336345406639064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2912336345406639064'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2011/05/macbook-pro-alsa-information.html' title='macbook pro alsa information'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5811357571728580347</id><published>2010-07-27T13:52:00.000-07:00</published><updated>2010-07-27T13:57:34.332-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='sed'/><title type='text'>a script to replace extention of files</title><content type='html'>Suppose the file extension is "foo".&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;for f in `find . -name "*.foo" -type f`&lt;br /&gt;do&lt;br /&gt;    newname=`echo "$f" | sed "s/\.foo$//"`&lt;br /&gt;    mv $f $newname&lt;br /&gt;    echo "mv $f to $newname"&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;exit 0&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5811357571728580347?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5811357571728580347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5811357571728580347'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/07/script-to-replace-extention-of-files.html' title='a script to replace extention of files'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5777998705288742426</id><published>2010-07-05T09:19:00.000-07:00</published><updated>2010-07-05T09:21:54.119-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><category scheme='http://www.blogger.com/atom/ns#' term='vmware'/><title type='text'>vmware fusion --  network no connection</title><content type='html'>The following tip can fix "network bridge device on /dev/vmnet0 is not running" failure.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ sudo /Library/Application\ Support/VMWare Fusion/boot.sh –-restart&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5777998705288742426?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5777998705288742426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5777998705288742426'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/07/vmware-fusion-network-no-connection.html' title='vmware fusion --  network no connection'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7621382995257295429</id><published>2010-06-30T16:14:00.000-07:00</published><updated>2010-06-30T16:16:00.999-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>unlock android emulator</title><content type='html'>$ adb devices (to find port number 5554)&lt;br /&gt;$ telnet localhost 5554&lt;br /&gt;event send EV_KEY:KEY_MENU:1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7621382995257295429?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7621382995257295429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7621382995257295429'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/06/unlock-android-emulator.html' title='unlock android emulator'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3294277938482917756</id><published>2010-06-30T14:25:00.000-07:00</published><updated>2010-06-30T14:28:04.474-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>ubuntu 10.04 notes</title><content type='html'>1 install vmware-tools&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; $ uname -a          -&gt; to find linux header version&lt;br /&gt; $ sudo apt-get install linux-headers-2.6.32-21-generic&lt;br /&gt; $ sudo apt-get install build-essential&lt;br /&gt; $ sudo ./vmware-install.pl&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2 build android 2.2&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; $ sudo apt-get install gcc-multilib g++-multilib zlib1g-dev gperf&lt;br /&gt; $ sudo aptitude install libncurses-dev&lt;br /&gt; $ sudo apt-get install bison flex  git-core curl&lt;br /&gt; $ sudo apt-get install openjdk-6-jdk &lt;br /&gt; $ repo init -u git://android.git.kernel.org/platform/manifest.git -b&lt;br /&gt; android-2.2_r1&lt;br /&gt; $ repo sync&lt;br /&gt; $ vim ./build/core/main.mk change 1.5 to 1.6&lt;br /&gt; $ source ./build/envsetup.sh&lt;br /&gt; $ lunch 1&lt;br /&gt; $ make -j8&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3294277938482917756?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3294277938482917756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3294277938482917756'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/06/ubuntu-1004-notes.html' title='ubuntu 10.04 notes'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4950439691722373461</id><published>2010-03-17T16:31:00.000-07:00</published><updated>2010-03-17T16:55:22.822-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>learning iphone programming</title><content type='html'>I start to write some code for learning iphone programming especially objective-c. &lt;br /&gt;&lt;br /&gt;The first example shows here is an example to call ANSI C API (that is the first thing I want to figure out in the object-c environment). &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;/** @find_date generate date string from current time&lt;br /&gt; */&lt;br /&gt;- (char*) find_date&lt;br /&gt; {&lt;br /&gt;  static char date_str[80];&lt;br /&gt;  struct tm * my_tm = NULL;&lt;br /&gt;  char *month_str[12] = {&lt;br /&gt;   "January", "February", "March", "April",&lt;br /&gt;   "May",    "June", "July",   "August",&lt;br /&gt;   "September", "October", "November", "December"&lt;br /&gt;  };&lt;br /&gt;  time_t time_val;&lt;br /&gt;  time_val = time(NULL);&lt;br /&gt;  my_tm = localtime(&amp;time_val);&lt;br /&gt;  sprintf(date_str, "%s%02d", month_str[my_tm-&gt;tm_mon], my_tm-&gt;tm_mday);  &lt;br /&gt;  return date_str;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And here is the call to find_date. (convert to NSString from C-String)&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;{&lt;br /&gt;     char date_str[80];&lt;br /&gt;     sprintf(date_str, "modified: %s", [self find_date]);&lt;br /&gt;     label2.text = [NSString stringWithCString: date_str];         &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now another example, with given date as input, open a file and read the data from the file, returns the buffer which contains the file content.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;- (char*) init_jk_quote:  (char*) date_str&lt;br /&gt;   {&lt;br /&gt;    FILE* fp;&lt;br /&gt;    char* quote_buf;&lt;br /&gt;    int length;&lt;br /&gt;    &lt;br /&gt;    fp = fopen(date_str, "r");&lt;br /&gt;    if (fp == NULL) return NULL;&lt;br /&gt;    fseek(fp, 0, SEEK_END);&lt;br /&gt;    length = ftell(fp);&lt;br /&gt;    &lt;br /&gt;    quote_buf = (char*) malloc(length);&lt;br /&gt;    if (quote_buf == NULL) {&lt;br /&gt;     fclose(fp);&lt;br /&gt;     return NULL;&lt;br /&gt;    }&lt;br /&gt;    fseek(fp, 0, SEEK_SET);&lt;br /&gt;    &lt;br /&gt;    fread(quote_buf, sizeof(char), length, fp);&lt;br /&gt;    fclose(fp);&lt;br /&gt;    return quote_buf;&lt;br /&gt;   }&lt;br /&gt;- (void) free_jk_quote: (char*) quote_buf&lt;br /&gt; {&lt;br /&gt;  if (quote_buf) &lt;br /&gt;   free(quote_buf);&lt;br /&gt;  quote_buf = NULL;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And the call to the functions is demonstrated here.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt; {&lt;br /&gt;   char*  quote_text;&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   quote_text = [self init_jk_quote: "/tmp/March17.txt"];&lt;br /&gt;   if (quote_text == NULL || strlen(quote_text)== 0) {&lt;br /&gt;    label3.text = @"not supported!";&lt;br /&gt;   }&lt;br /&gt;   else {&lt;br /&gt;    NSString* mystring = [NSString stringWithCString: quote_text];&lt;br /&gt;    label3.text = [@"my quote: " stringByAppendingString: mystring];&lt;br /&gt;   }&lt;br /&gt;   [self free_jk_quote:quote_text];&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I think I need to break my habit of writing in C, and convert it to objective-c, so how to convert the above functions in object-c style? That is mainly something I need to learn.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4950439691722373461?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4950439691722373461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4950439691722373461'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/03/learning-iphone-programming.html' title='learning iphone programming'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2972622660611735397</id><published>2010-03-15T12:17:00.000-07:00</published><updated>2010-03-15T12:29:52.220-07:00</updated><title type='text'>eight steps to become an iphone developer</title><content type='html'>Here is the &lt;a href="http://www.guardian.co.uk/technology/gamesblog/2009/feb/10/gameculture-apple"&gt;link&lt;/a&gt; on how to become an iphone developer.&lt;br /&gt;&lt;br /&gt;In brief:&lt;br /&gt;1. buy a mac (done)&lt;br /&gt;2. down the sdk (done)&lt;br /&gt;3. learn objective c&lt;br /&gt;4. start writing something&lt;br /&gt;5. sign-up as an official developer ($99 done)&lt;br /&gt;6. prepare for a few weeks of work&lt;br /&gt;7. submit your app to Apple&lt;br /&gt;8. adapt, market and survive!&lt;br /&gt;&lt;br /&gt;It did not mention a iphone but I already bought it. I would spend some effort to become a iphone developer. Learning is important to a programmer, just like several years ago, I learn the development on Linux, and later found that it is useful in my career.  I did work on Linux platform. Mobile is a big market as I knew, so I can gain some skill here for the purpose of surviving.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2972622660611735397?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2972622660611735397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2972622660611735397'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/03/eight-steps-to-become-iphone-developer.html' title='eight steps to become an iphone developer'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7157936977099021148</id><published>2010-02-25T15:19:00.000-08:00</published><updated>2010-02-25T15:36:30.845-08:00</updated><title type='text'>patching the code using cvs</title><content type='html'>I have blogged &lt;a href="http://dsmarkchen.blogspot.com/2009/01/create-patch-with-cvs.html"&gt;this&lt;/a&gt; and &lt;a href="http://dsmarkchen.blogspot.com/2008/09/patch.html"&gt;this&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;But I would use the following command to create a patch and apply the patch.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cd /devel/foo&lt;br /&gt;$ cvs diff -uNa &gt; patch.txt&lt;br /&gt;...&lt;br /&gt;$ cvs co -r z_markc_-22jan2010 foo&lt;br /&gt;$ cd foo&lt;br /&gt;$ patch -p0 &lt; /path/to/your/patch.txt&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;In creating a patch,  "-a" is used for added code if needed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7157936977099021148?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7157936977099021148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7157936977099021148'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/02/patching-code-using-cvs.html' title='patching the code using cvs'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3984909943286751215</id><published>2010-01-04T09:32:00.000-08:00</published><updated>2010-01-04T09:39:41.879-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>merge library</title><content type='html'>1. extract the libraries foo and goo.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ mkdir t&lt;br /&gt;$ cd t&lt;br /&gt;$ ar x ../libfoo.a&lt;br /&gt;$ ar x ../libgoo.a&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. Prepare "Makefile.t"&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;all:&lt;br /&gt;       $(CROSS_COMPILE)g++ -shared -o libbar.so ./t&lt;br /&gt;       $(AR) -rcs libbar.a ./t/*.o   &lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3.generate the new lib&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ make -f Makefile.t&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3984909943286751215?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3984909943286751215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3984909943286751215'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2010/01/merge-library.html' title='merge library'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-9130220362188120598</id><published>2009-11-24T11:59:00.000-08:00</published><updated>2009-11-24T12:42:03.414-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><title type='text'>use glib</title><content type='html'>1. install glib&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ apt-get install libglib2.0-dev&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. write source code to print "hello world!"&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;#include &lt;glib.h&gt;&lt;br /&gt;int main(int argc, char** argv)&lt;br /&gt;{&lt;br /&gt;   g_printf("hello world!\n");&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3. compile&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;gcc `pkg-config --libs --cflags glib-2.0` hello.c&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-9130220362188120598?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9130220362188120598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9130220362188120598'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/11/use-glib.html' title='use glib'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1947913683256680889</id><published>2009-09-22T12:07:00.000-07:00</published><updated>2009-09-22T12:12:53.847-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>find/grep command</title><content type='html'>The following command searches C/C++ source code to find the content of "equalizer".&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ find ~/myspace/git/opencore -type f -name "*.[ch] -o -name "*.cpp" -exec grep -I "equalizer" {} \; -print &lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1947913683256680889?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1947913683256680889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1947913683256680889'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/09/findgrep-command.html' title='find/grep command'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1325260630003147083</id><published>2009-09-15T10:02:00.001-07:00</published><updated>2009-09-15T10:04:59.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>ubuntu - recording</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_i_1T8dlgrVk/Sq_I6QrgRhI/AAAAAAAAAVA/NwPJyauJuLk/s1600-h/icon.capture.0x140005b.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 199px;" src="http://3.bp.blogspot.com/_i_1T8dlgrVk/Sq_I6QrgRhI/AAAAAAAAAVA/NwPJyauJuLk/s320/icon.capture.0x140005b.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5381740982966437394" /&gt;&lt;/a&gt;&lt;br /&gt;I use "alsamixer -c 0" to set up my recording with microphone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1325260630003147083?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1325260630003147083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1325260630003147083'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/09/ubuntu-recording.html' title='ubuntu - recording'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_i_1T8dlgrVk/Sq_I6QrgRhI/AAAAAAAAAVA/NwPJyauJuLk/s72-c/icon.capture.0x140005b.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8012976301218955535</id><published>2009-08-20T19:52:00.000-07:00</published><updated>2009-08-22T19:57:52.322-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>ubuntu 8.04 - wireless network setup</title><content type='html'>I spent less than 9 hours to setup my wireless card on ubuntu. When use "lspci" command, I get the name of my wireless card, which is "AR2413 802.11bg".&lt;br /&gt;&lt;br /&gt;Here is the brief.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;1. disable the Atheros proprietary drivers from "system-&gt;adminstrator-&gt;hardware drivers"&lt;br /&gt;2. unplug the wired ethernet line&lt;br /&gt;&lt;br /&gt;3. extract ndiswrapper-1.55.tar.gz, and make &amp; sudo make install &lt;br /&gt;&lt;br /&gt;4. extract madwifi-hal-0.10.5.6-r3835-20080801.tar.gz, make &amp; sudo make install&lt;br /&gt;&lt;br /&gt;5. extract Wireless_Atheros.zip, use ndisgtk to install the net5211.inf &lt;br /&gt;or&lt;br /&gt;$ sudo ndiswrapper -a XXXX:YYYY ath0 (here XXXX:YYYY is get from lspci -n for Atheros card)&lt;br /&gt;&lt;br /&gt;6. setup&lt;br /&gt;add ndiswrapper at the end of /etc/modprobe.d/blacklist&lt;br /&gt;add ath_pci at the end of /etc/modules&lt;br /&gt;&lt;br /&gt;$ sudo iwconfig &lt;br /&gt;$ sudo lshw -C network&lt;br /&gt;$ iwlist scan (to find my wireless network)&lt;br /&gt;$ sudo network-admin (which should setup wireless network)&lt;br /&gt;&lt;br /&gt;check the following configuration at /etc/network/interfaces&lt;br /&gt;=======================&lt;br /&gt;iface ath0 inet dhcp&lt;br /&gt;wireless-key XXXX&lt;br /&gt;wireless-essid fade&lt;br /&gt;&lt;br /&gt;auto ath0&lt;br /&gt;=======================&lt;br /&gt;Here XXXX is my wep password.&lt;br /&gt;call "/etc/init.d/networking restart" to restart&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I also installed wpa_supplicant but it does not seem to be needed.&lt;br /&gt;&lt;br /&gt;After I reboot the OS, I found the system could not find ath0, so what I did is "sudo modprobe wlan_scan_sta" and reboot again, this time ath0 appears.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8012976301218955535?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8012976301218955535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8012976301218955535'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/08/ubuntu-804-wireless-network-setup.html' title='ubuntu 8.04 - wireless network setup'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4683521857655259590</id><published>2009-06-22T14:56:00.000-07:00</published><updated>2009-07-09T08:36:44.260-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>fedora 10 - setup i686 environment for android (1)</title><content type='html'>0. install git ($ sudo yum install git)&lt;br /&gt;1. Download JDK 5.0 (jdk-1_5_0_19-linux-i586-rpm.bin) from &lt;a href="http://java.sun.com/javase/downloads/5/jdk"&gt;sun&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;   $ cd /usr/local&lt;br /&gt;   $ /tmp/jdk-1_5_0_19-linux-i586.bin &lt;br /&gt;   $ sudo updatedb&lt;br /&gt;   $ locate javac | grep bin&lt;br /&gt;   /usr/local/jdk1.5.0_19/bin/javac          (the result)&lt;br /&gt;   $ sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/local/jdk1.5.0_19/bin/java 100 &lt;br /&gt;   $ sudo /usr/sbin/alternatives --install /usr/bin/jar jar /usr/local/jdk1.5.0_19/bin/jar 100  &lt;br /&gt;   $ sudo /usr/sbin/alternatives --install /usr/bin/javac javac /usr/local/jdk1.5.0_19/bin/javac 100&lt;br /&gt;   $ sudo /usr/sbin/alternatives --config java&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2 Play with curl&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt; $ cd ~/bin         (make sure ~/bin is in $PATH)&lt;br /&gt; $ curl http:/android.git.kernel.org/repo &gt; ~/bin/repo&lt;br /&gt; $ chmod a+x ~/bin/repo&lt;br /&gt; $ cd ~/myspace/mydroid&lt;br /&gt; $ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake&lt;br /&gt; $ repo sync &lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4683521857655259590?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4683521857655259590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4683521857655259590'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/06/fedora-10-setup-i686-environment-for.html' title='fedora 10 - setup i686 environment for android (1)'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4204304889105479943</id><published>2009-06-10T08:43:00.000-07:00</published><updated>2009-06-10T08:49:36.986-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>mips - the next  example</title><content type='html'>This example access an array which is a block of buffer.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;/* bar initialize input (or 3 to each element)&lt;br /&gt; */&lt;br /&gt;int bar(int* in, int n)&lt;br /&gt;{&lt;br /&gt;    int ret;&lt;br /&gt;    __asm__(&lt;br /&gt;    ".set push     \n"       // save assembler option&lt;br /&gt;    ".set noreorder\n"       // suppress reordering&lt;br /&gt;    "lw $9, %2     \n"       // $9 = n (counter end)&lt;br /&gt;    "li $8, 0      \n"       // $8 = 0&lt;br /&gt;    "li $12, 0     \n"       // $12 = 0&lt;br /&gt;    "move $4, %1\n"          // $4 = in&lt;br /&gt;    "loop:  \n"             &lt;br /&gt;    "lw $11, ($4) \n"        // $11 = *in   &lt;br /&gt;    "ori $11, $11, 3  \n"    // $11 = $11 || 3 &lt;br /&gt;    "sw $11, ($4) \n"        // *in = $11&lt;br /&gt;    "addi $4, $4, 4 \n"      // in++  (move to next addess)&lt;br /&gt;    "addi $8, $8, 1 \n"      // move to next sample&lt;br /&gt;    "bne $8, $9, loop \n"    // loop&lt;br /&gt;    "sw $11, %0    \n"        // save $12 to ret&lt;br /&gt;    ".set pop     \n"        // restore assembler option&lt;br /&gt;    : "=m" (ret)             // to return&lt;br /&gt;    : "r" (in),"m" (n)       // the input&lt;br /&gt;    );&lt;br /&gt;    return ret;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here the use of $8 is not the best, because the move the array element is by $4, soe the $8 is not most necessary, because $4 can be used to check the range for the loop.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4204304889105479943?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4204304889105479943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4204304889105479943'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/06/mips-next-example.html' title='mips - the next  example'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3295882077551373964</id><published>2009-06-09T15:06:00.000-07:00</published><updated>2009-06-09T15:15:15.326-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>mips - a first example</title><content type='html'>In the following sample, it shows how to send the input (val) and the output (ret) to assembly block.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;/* foo returns (val | 3)&lt;br /&gt; */&lt;br /&gt;int foo(int val)&lt;br /&gt;{&lt;br /&gt;    int ret;&lt;br /&gt;    __asm__(&lt;br /&gt;    ".set push\n"              // save assembler option&lt;br /&gt;    ".set noreorder\n"         // suppress reordering&lt;br /&gt;    "ori  $2, %1, %2\n"&lt;br /&gt;    "sw $2, %0\n"              // save $2 to ret&lt;br /&gt;    ".set pop\n"               // pop assembler option&lt;br /&gt;    : "=m" (ret)               // ret: memory&lt;br /&gt;    : "r" (val), "n" (3)       // val: read-only register, n: number&lt;br /&gt;    );&lt;br /&gt;    return ret;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The real code by dump is: &lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;08804554 &lt;foo&gt;:&lt;br /&gt; 8804554: 27bdffd0  addiu sp,sp,-48&lt;br /&gt; 8804558: afbe0020  sw s8,32(sp)&lt;br /&gt; 880455c: 03a0f021  move s8,sp&lt;br /&gt; 8804560: afc40010  sw a0,16(s8)&lt;br /&gt; 8804564: 8fc20010  lw v0,16(s8)&lt;br /&gt; 8804568: 34420003  ori v0,v0,0x3&lt;br /&gt; 880456c: afc20000  sw v0,0(s8)&lt;br /&gt; 8804570: 8fc20000  lw v0,0(s8)&lt;br /&gt; 8804574: 03c0e821  move sp,s8&lt;br /&gt; 8804578: 8fbe0020  lw s8,32(sp)&lt;br /&gt; 880457c: 27bd0030  addiu sp,sp,48&lt;br /&gt; 8804580: 03e00008  jr ra&lt;br /&gt; 8804584: 00000000  nop&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3295882077551373964?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3295882077551373964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3295882077551373964'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/06/mips-first-exsample.html' title='mips - a first example'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6404113047530461442</id><published>2009-05-27T12:45:00.000-07:00</published><updated>2009-05-27T14:19:28.194-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>android notes - the process of development</title><content type='html'>0 installation and setup&lt;br /&gt;1 create a project &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ android create project --target 1 --path ./demo --activity demo --package com.example.demo&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;2 edit source code ~/myspace/demo/src/example/demo/demo.java&lt;br /&gt;3 compile with ant&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ ant -debug -verbose&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;4 run emulator with  a script &lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;#! /bin/sh&lt;br /&gt;out/host/linux-x86/bin/emulator -verbose \&lt;br /&gt; -kernel prebuild/android-arm/kernel/kernel-qemu \&lt;br /&gt; -ramdisk out/target/product/generic/ramdisk.img \&lt;br /&gt; -system out/target/product/generic/system.img \&lt;br /&gt; -init-data out/target/product/generic/userdata.img \&lt;br /&gt; -avd myavd -sdcard ./sdcard.img -no-skin -no-boot-anim&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;5 install the application we have build&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cd ~/myspace/demo&lt;br /&gt;$ adb install bin/demo-debug.apk&lt;br /&gt;$ adb install -r bin/demo-debug.apk (for reinstall)&lt;br /&gt;$ adb shell&lt;br /&gt;# logcat&lt;br /&gt;# ps a               (to get process id to kill)&lt;br /&gt;# kill -9 &lt;pid&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's on java side, on the android side,&lt;br /&gt;1 setup&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cd ~/myspace/mydroid&lt;br /&gt;$ source ./build/envsetup.sh&lt;br /&gt;$ lunch 1&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;2 build the project in android&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cd ./frames/base/media/libmediaplayerservice&lt;br /&gt;$ mm           (it builds  libmediaplayerservice library as an example)&lt;br /&gt;$ cd ~/myspace/mydroid       (go back to the root)&lt;br /&gt;$ make snod                  (build the system image&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;then you can go back to run emulator with parameters specified in the script.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6404113047530461442?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6404113047530461442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6404113047530461442'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/05/android-notes-process-of-development.html' title='android notes - the process of development'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4469210785675445045</id><published>2009-05-20T13:15:00.000-07:00</published><updated>2009-05-20T13:25:57.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Calculate cpu usage in MCycles/sec</title><content type='html'>Here is the script to calculate cpu usage in MCycles per second.&lt;br /&gt;The cpu speed is 222MHz as an example, processing data rate is 44100, each block has 8192 samples, and the total calls to foo is 532.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;rate=44100&lt;br /&gt;blksize=8192&lt;br /&gt;cpu=222&lt;br /&gt;call=532&lt;br /&gt;&lt;br /&gt;# the following val is got from gprof as percentage cpu time, 30.11%.&lt;br /&gt;pcpu_foo=30.11&lt;br /&gt;&lt;br /&gt;duration=`echo "scale=4; $blksize * $call / $rate" | bc`&lt;br /&gt;echo "duration: " $duration&lt;br /&gt;&lt;br /&gt;secs_foo=`echo "scale=4; $duration * $pcpu_foo /100" | bc` &lt;br /&gt;echo "secs_foo " $secs_foo&lt;br /&gt;&lt;br /&gt;blksecs_foo=`echo "scale=4; $secs_foo/$call"|bc`&lt;br /&gt;echo "blocksecs_foo" $blksecs_foo&lt;br /&gt;&lt;br /&gt;cpu_foo=`echo "scale=4; $cpu * $rate / $blksize * $blksecs_foo"|bc`&lt;br /&gt;echo "cpu_foo " $cpu_foo " MCycle/sec"&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4469210785675445045?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4469210785675445045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4469210785675445045'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/05/how-to-get-cpu-usage-in-mcyclessec.html' title='Calculate cpu usage in MCycles/sec'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7515152534979560578</id><published>2009-05-13T10:05:00.000-07:00</published><updated>2009-05-13T10:11:23.230-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>u8.04 - build procmeter3</title><content type='html'>At last, I left Fedora Core 5 which I have used for these 2 years and move to Ubuntu. I am now running Ubuntu 8.04 which is not a very latest version, but at least it is newer than FC5.&lt;br /&gt;&lt;br /&gt;But by default to build procmeter3, it prompts "X11/Intristic.h is missing". I have to install the following packages:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ sudo apt-get install libxt-dev libxaw-headers libxaw7-dev&lt;br /&gt;$ make&lt;br /&gt;$ sudo make install&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7515152534979560578?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7515152534979560578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7515152534979560578'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/05/u804-build-procmeter3.html' title='u8.04 - build procmeter3'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7283812564132730204</id><published>2009-05-07T13:51:00.000-07:00</published><updated>2009-05-07T14:08:24.223-07:00</updated><title type='text'>android notes - build and test shared library</title><content type='html'>1. download  &lt;a href="http://benno.id.au/android/system.tar.gz"&gt;system.tar.gz&lt;/a&gt; from &lt;a href="http://benno.id.au/blog"&gt;benno&lt;/a&gt; and extract it to ~/myspace/tmp.&lt;br /&gt;2. make a link.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cd ~/myspace/tmp/system/lib&lt;br /&gt;ln -s libc.so libc.so.6&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Is it necessary? but it fixed the problem to looking for libc.so.6.&lt;br /&gt;3. Here is the Makefile.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;CC=arm-none-linux-gnueabi-gcc&lt;br /&gt;LD=arm-none-linux-gnueabi-ld&lt;br /&gt;AR=arm-none-linux-gnueabi-ar&lt;br /&gt;LD_OPTS= --entry=_start \&lt;br /&gt;    --dynamic-linker /system/bin/linker -nostdlib \&lt;br /&gt;    -rpath /system/lib -rpath ~/myspace/tmp/system/lib  \&lt;br /&gt;    -L ~/myspace/tmp/system/lib -L .&lt;br /&gt;foo2.a : foo2.c &lt;br /&gt; $(CC) -g -fpic -c foo2.c &lt;br /&gt; $(CC) -g -shared -nostdlib -o libfoo2.so  foo2.o&lt;br /&gt; $(AR) -rcs $@ foo2.o&lt;br /&gt;foo2: main.c start.c foo2.a&lt;br /&gt; $(CC) -g -c main.c&lt;br /&gt; $(CC) -g -c start.c&lt;br /&gt; $(LD) $(LD_OPTS) -lc  -lfoo2  -o foo2  main.o  start.o&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;when build the library, should set "-nostdlib"&lt;br /&gt;&lt;br /&gt;4. run the commands&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ make foo2&lt;br /&gt;$ adb push libfoo2.so /data&lt;br /&gt;$ adb push foo2 /data&lt;br /&gt;$ adb shell&lt;br /&gt;# cd data&lt;br /&gt;# ./trace ./foo2&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7283812564132730204?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7283812564132730204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7283812564132730204'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/05/android-notes-build-and-test-shared.html' title='android notes - build and test shared library'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5186425250763731067</id><published>2009-04-30T15:03:00.000-07:00</published><updated>2009-04-30T15:06:30.926-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>ubuntu notes - connect  to nfs  share folder</title><content type='html'>I have installed ubuntu 8.04, here is the command to connect to nfs share folder of my FC5.&lt;br /&gt;&lt;blockquote&gt;sudo apt-get install portmap nfs-common&lt;br /&gt;sudo /etc/init.d/portmap restart&lt;br /&gt;sudo /etc/init.d/nfs-common restart&lt;br /&gt;sudo mount -t nfs 192.168.0.9:/tftpboot /mnt -o nolock&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5186425250763731067?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5186425250763731067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5186425250763731067'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/04/ubuntu-notes-connect-to-nfs-share.html' title='ubuntu notes - connect  to nfs  share folder'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-107348104755457003</id><published>2009-04-29T10:21:00.000-07:00</published><updated>2009-04-29T11:52:30.162-07:00</updated><title type='text'>android notes</title><content type='html'>To develop on android, I need open four consoles at least:&lt;br /&gt;1. one console to show the log  -- ``$ adb logcat''.&lt;br /&gt;2. one console to run the emulator -- ``$ emulator -sdcard sd.img -avd qslavd''.&lt;br /&gt;3. A third console to build the source code, and install the package:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ ant debug  &lt;br /&gt;$ adb install -r .\bin\foo-debug.apk&lt;br /&gt;$ adb push your\file /sdcard&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;4. A vim gui/console to edit source code&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-107348104755457003?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/107348104755457003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/107348104755457003'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/04/android-notes.html' title='android notes'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-9123479230850579849</id><published>2009-04-27T10:08:00.000-07:00</published><updated>2009-04-27T10:16:40.174-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>chown and chgrp</title><content type='html'>When use ``ls -l'' command it shows the owner and group of the directory.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;markc@ubuntu-vm:/opt $ls -la&lt;br /&gt;total 16&lt;br /&gt;drwxr-xr-x  4 root   root  4096 2009-04-27 11:04 .&lt;br /&gt;drwxr-xr-x 25 root   root  4096 2009-02-18 11:04 ..&lt;br /&gt;drwxr-xr-x  7 root   root  4096 2008-08-08 11:04 alp-dev&lt;br /&gt;drwxr-xr-x  2 markc  markc 4096 2009-04-27 11:04 work&lt;br /&gt;                ^      ^&lt;br /&gt;                |      |&lt;br /&gt;               chown  chgrp&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here is the command (so I don't have to google it again) to change the directory "work"'s owner and group.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ sudo chown markc work&lt;br /&gt;$ sudo chgrp markc work&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-9123479230850579849?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9123479230850579849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9123479230850579849'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/04/chown-and-chgrp.html' title='chown and chgrp'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8412152576655219355</id><published>2009-04-02T19:40:00.000-07:00</published><updated>2009-04-02T19:42:48.417-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>fedora 10 - remove pulseaudio</title><content type='html'>The only problem with Fedora 10 I have is I have to remove pulseaudio, I am not sure when I installed it, but it cause the player no sound.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ sudo yum remove pulseaudio&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8412152576655219355?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8412152576655219355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8412152576655219355'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/04/fedora-10-remove-pulseaudio.html' title='fedora 10 - remove pulseaudio'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6511067940707577530</id><published>2009-03-24T15:39:00.000-07:00</published><updated>2009-03-24T15:52:36.512-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>setup cygwin</title><content type='html'>Not fun, but have to make cygwin work.&lt;br /&gt;1. Here is the batch file to start cygwin.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;@echo off&lt;br /&gt;&lt;br /&gt;SET MAKE_MODE=UNIX&lt;br /&gt;SET PATH=D:\disk\cygwin\bin;%PAtH%&lt;br /&gt;SET HOME=D:\disk\markc&lt;br /&gt;SET CYGWIN=tty binmode&lt;br /&gt;D:&lt;br /&gt;chdir %HOME%&lt;br /&gt;bash&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. A no special .bash_profile in $(HOME).&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# source the system wide bashrc if it exists&lt;br /&gt;if [ -e /etc/bash.bashrc ] ; then&lt;br /&gt;  source /etc/bash.bashrc&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;# source the users bashrc if it exists&lt;br /&gt;if [ -e "${HOME}/.bashrc" ] ; then&lt;br /&gt;  source "${HOME}/.bashrc"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3. Now, my .bashrc file.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;export PATH=/usr/bin:/sbin:/usr/local/bin&lt;br /&gt;export PATH=/usr/local/psp/gcc-2.8.2/bin:$PATH&lt;br /&gt;export PATH=/usr/local/psp/devkit/bin:$PATH:.&lt;br /&gt;export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The problem I have is '\r' cause the problem to start cygwin. To make cygwin happy with unix file format, we need set the unix file format in vimrc. The following code is my vimrc.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;set autoindent&lt;br /&gt;set softtabstop=4&lt;br /&gt;set tabstop=4&lt;br /&gt;set shiftwidth=4&lt;br /&gt;set showmatch&lt;br /&gt;set ignorecase&lt;br /&gt;set background=dark&lt;br /&gt;set hlsearch&lt;br /&gt;set incsearch&lt;br /&gt;set number&lt;br /&gt;syntax on&lt;br /&gt;set fileformats=unix,dos&lt;br /&gt;set fileformat=unix&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6511067940707577530?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6511067940707577530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6511067940707577530'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/03/setup-cygwin.html' title='setup cygwin'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1311058535207850298</id><published>2009-03-23T12:05:00.000-07:00</published><updated>2009-03-23T12:24:49.693-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><title type='text'>generate ssh key for github</title><content type='html'>It looks to me that github is a good place to host open source. Also git is aimed to replace svn, so I would move to git from svn. (currently googlecode is with svn). &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ git config --global user.name "foo"&lt;br /&gt;$ git config --global user.email "foo@gmail.com"&lt;br /&gt;$ cd sur&lt;br /&gt;$ git init&lt;br /&gt;$ git add sur.w                  %my source code&lt;br /&gt;$ git commit -m "first commit"&lt;br /&gt;$ git remote add origin git@github.com:dsmarkchen/sur.git&lt;br /&gt;$ git push origin master&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;I got permission denied error message. It is not very hard for me to figure it out.&lt;br /&gt;&lt;br /&gt;1. try to connect to github by ssh (it helps to know the problem)&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;ssh -v git@github.com&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. generate the public key&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cd ~/.ssh&lt;br /&gt;$ ssh-keygen -t rsa&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3. Add the the content of id_rsa.pub to github, then I am ready to see &lt;br /&gt;&lt;a href="http://github.com/dsmarkchen/sur/tree/master"&gt;the magic&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1311058535207850298?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1311058535207850298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1311058535207850298'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/03/generate-ssh-key-for-github.html' title='generate ssh key for github'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2151747284340556371</id><published>2009-01-30T09:13:00.000-08:00</published><updated>2009-01-30T10:21:55.780-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>boilerplate</title><content type='html'>When I read a blog about boilerplate in Qt, I tried to remember how to write boilerplate code with Gobject. The following code is a frame that I took from 1 year ago I wrote. It is not really hard to understand or write, just need to copy &amp; paste, or use simple tool to auto generate the code. It always need to write more lines in C (GObject) than using C++ for OO. But I don't feel the goodness. I am not feel that is the benifit of C, so I am not sure OO is really good for a Unix developer, so if I can avoid I would avoid the idea of OO in unix platform. (Linux Kernel is not written in OO)&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;/* macros*/&lt;br /&gt;G_BEGIN_DECLS&lt;br /&gt;&lt;br /&gt;#define GST_TYPE_MIDISRC  (gst_my_midisrc_get_type())&lt;br /&gt;#define GST_MIDISRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MIDISRC,GstMidisrc))&lt;br /&gt;#define GST_MIDISRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MIDISRC,GstMidisrcClass))&lt;br /&gt;#define GST_IS_MIDISRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIDISRC))&lt;br /&gt;#define GST_IS_MIDISRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIDISRC))&lt;br /&gt;&lt;br /&gt;/* standard function returning type information */&lt;br /&gt;GType gst_my_midisrc_get_type (void);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* definition a class of this element */&lt;br /&gt;typedef struct _GstMidisrc GstMidisrc;&lt;br /&gt;struct _GstMidisrc&lt;br /&gt;{&lt;br /&gt; GstBaseSrc       parent; &lt;br /&gt;        [...]&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;typedef struct _GstMidisrcClass GstMidisrcClass;&lt;br /&gt;&lt;br /&gt;struct _GstMidisrcClass &lt;br /&gt;{&lt;br /&gt; GstBaseSrcClass parent_class;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;G_END_DECLS&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now we can make the boilerplate:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;GST_BOILERPLATE (GstMidisrc, gst_my_midisrc, GstBaseSrc, GST_TYPE_BASE_SRC);&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;After that is the element details.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;static GstElementDetails midisrc_details = {&lt;br /&gt; "A Gstreamer Plug-in", &lt;br /&gt; "Src/Audio", &lt;br /&gt;        "audio src for GStreamer Plug-in", &lt;br /&gt;        ""&lt;br /&gt; };&lt;br /&gt;&lt;br /&gt;/* set detail with _base_init function when register the plugin */&lt;br /&gt;static void &lt;br /&gt;gst_my_midisrc_base_init (gpointer klass)&lt;br /&gt;{&lt;br /&gt; GstElementClass *element_class = GST_ELEMENT_CLASS (klass);&lt;br /&gt; &lt;br /&gt; gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&amp;src_factory));&lt;br /&gt;&lt;br /&gt; gst_element_class_set_details (element_class, &amp;midisrc_details);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Then implementation:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;/* create the class, here we define which function need to be re-implmented from the base class, and add property for the class */&lt;br /&gt;static void &lt;br /&gt;gst_my_midisrc_class_init (GstMidisrcClass *klass)&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt; GObjectClass *gobject_class;&lt;br /&gt; GstBaseSrcClass *basesrc_class;&lt;br /&gt; gobject_class = G_OBJECT_CLASS (klass);&lt;br /&gt; basesrc_class = GST_BASE_SRC_CLASS (klass);&lt;br /&gt; gobject_class-&gt;set_property = gst_midisrc_set_property;&lt;br /&gt; gobject_class-&gt;get_property = gst_midisrc_get_property;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; /* basesrc_class-&gt;get_caps = gst_midisrc_get_caps; &lt;br /&gt;        basesrc_class-&gt;set_caps = gst_midisrc_set_caps; */&lt;br /&gt;        basesrc_class-&gt;start = gst_midisrc_start;&lt;br /&gt;        basesrc_class-&gt;stop = gst_midisrc_stop; &lt;br /&gt;        basesrc_class-&gt;create = gst_midisrc_create;&lt;br /&gt;&lt;br /&gt;        /* install a property for the class as an example */&lt;br /&gt;        g_object_class_install_property (&lt;br /&gt;        gobject_class, ARG_LOCATION,&lt;br /&gt;        g_param_spec_string ("location", "File Location",&lt;br /&gt;             "Location of the file to read", NULL, G_PARAM_READWRITE));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* create the object */&lt;br /&gt;static void &lt;br /&gt;gst_my_midisrc_init (GstMidisrc *midisrc, GstMidisrcClass *klass)&lt;br /&gt;{ &lt;br /&gt;   [...]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now the reset part:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;/* set property sample */&lt;br /&gt;static gboolean&lt;br /&gt;gst_midisrc_set_location (GstMidisrc * src, const gchar * location)&lt;br /&gt;{&lt;br /&gt;  /* the element must be stopped in order to do this */&lt;br /&gt;  GST_STATE_LOCK (src);&lt;br /&gt;  {&lt;br /&gt;    GstState state;&lt;br /&gt;&lt;br /&gt;    state = GST_STATE (src);&lt;br /&gt;    if (state != GST_STATE_READY &amp;&amp; state != GST_STATE_NULL)&lt;br /&gt;      goto wrong_state;&lt;br /&gt;  }&lt;br /&gt;  GST_STATE_UNLOCK (src);&lt;br /&gt;&lt;br /&gt;  g_free (src-&gt;filename);&lt;br /&gt;  g_free (src-&gt;uri);&lt;br /&gt;&lt;br /&gt;  /* clear the filename if we get a NULL (is that possible?) */&lt;br /&gt;  if (location == NULL) {&lt;br /&gt;    src-&gt;filename = NULL;&lt;br /&gt;    src-&gt;uri = NULL;&lt;br /&gt;  } else {&lt;br /&gt;    src-&gt;filename = g_strdup (location);   &lt;br /&gt;  }&lt;br /&gt;  return TRUE;&lt;br /&gt;&lt;br /&gt;  /* ERROR */&lt;br /&gt;wrong_state:&lt;br /&gt;  {&lt;br /&gt;    GST_DEBUG_OBJECT (src, "setting location in wrong state");&lt;br /&gt;    GST_STATE_UNLOCK (src);&lt;br /&gt;    return FALSE;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;static void&lt;br /&gt;gst_midisrc_set_property (GObject * object,&lt;br /&gt;    guint prop_id, const GValue * value, GParamSpec * pspec)&lt;br /&gt;{&lt;br /&gt; GstMidisrc *midisrc;&lt;br /&gt; int tmp = 0;&lt;br /&gt; g_return_if_fail (GST_IS_MIDISRC (object));&lt;br /&gt; midisrc = GST_MIDISRC (object);&lt;br /&gt;&lt;br /&gt;  switch (prop_id) {&lt;br /&gt;    case ARG_LOCATION:&lt;br /&gt;        gst_midisrc_set_location(midisrc,  g_value_get_string (value));&lt;br /&gt;        printf("set location done!\n");&lt;br /&gt;        break;&lt;br /&gt;    default:&lt;br /&gt;        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);&lt;br /&gt;        break;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void&lt;br /&gt;gst_midisrc_get_property (GObject * object,&lt;br /&gt;    guint prop_id, GValue * value, GParamSpec * pspec)&lt;br /&gt;{&lt;br /&gt;   GstMidisrc *midisrc;&lt;br /&gt;&lt;br /&gt;   g_return_if_fail (GST_IS_MIDISRC (object));&lt;br /&gt;   midisrc = GST_MIDISRC (object);&lt;br /&gt;&lt;br /&gt;   switch (prop_id) {&lt;br /&gt;    case ARG_LOCATION:&lt;br /&gt;        g_value_set_string(value, midisrc-&gt;filename);&lt;br /&gt;        break;&lt;br /&gt;    default:&lt;br /&gt;        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);&lt;br /&gt;        break;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static gboolean&lt;br /&gt;gst_midisrc_start (GstBaseSrc * src)&lt;br /&gt;{&lt;br /&gt;   GstMidisrc *midisrc = GST_MIDISRC (src);&lt;br /&gt;        [...]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static GstFlowReturn&lt;br /&gt;gst_midisrc_create (GstBaseSrc * src, &lt;br /&gt;                    guint64 offset,&lt;br /&gt;                    guint length, &lt;br /&gt;                    GstBuffer ** buffer)&lt;br /&gt;{&lt;br /&gt;    GstMidisrc *midisrc = GST_MIDISRC (src);&lt;br /&gt;    if (midisrc-&gt;eos_reached) &lt;br /&gt;        return GST_FLOW_UNEXPECTED;&lt;br /&gt;    return( gst_midisrc_get_read (src, buffer));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static GstFlowReturn&lt;br /&gt;gst_midisrc_get_read (GstBaseSrc * basesrc, GstBuffer ** buffer)&lt;br /&gt;{    &lt;br /&gt;    GstFlowReturn res;&lt;br /&gt;   GstMidisrc *midisrc = GST_MIDISRC (basesrc);&lt;br /&gt;    [...]&lt;br /&gt;&lt;br /&gt;    [...]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I would like to put my time on learning Git (I was heard git is written by a Unix kernal developer), for desktops, such as gnome or KDE I don't have a lot of interests, I may feel KDE is better since it is written in C++, but who knows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2151747284340556371?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2151747284340556371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2151747284340556371'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/01/boilerplate.html' title='boilerplate'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1616166452138612130</id><published>2009-01-21T15:35:00.000-08:00</published><updated>2009-01-21T15:41:53.336-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>smb4k on Ubuntu</title><content type='html'>smb4k does not work well on Ubuntu, but it is Ok with Fedora. When I try to mount my Windows share folder, I get this error:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;smbmnt must be installed suid root for direct user mount.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I use google to know how to fix. Here is the command:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ sudo chmod u+s `which smbmnt`&lt;br /&gt;$ sudo chmod u+s `which smbumount`&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1616166452138612130?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1616166452138612130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1616166452138612130'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/01/smb4k-on-ubuntu.html' title='smb4k on Ubuntu'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1845840776516036821</id><published>2009-01-20T12:42:00.000-08:00</published><updated>2009-01-20T12:45:14.490-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cvs'/><title type='text'>create a patch with cvs</title><content type='html'>Here is the command from a Linux shell:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cvs diff -u8pN /path/foo &gt; markc_20090120.patch&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1845840776516036821?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1845840776516036821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1845840776516036821'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/01/create-patch-with-cvs.html' title='create a patch with cvs'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5590983369523964403</id><published>2009-01-19T09:55:00.000-08:00</published><updated>2009-01-19T10:39:01.358-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'></title><content type='html'>0 Usually I use this blog to take notes on computer programming, and there's not really my thoughts. I would change this style and use the blog to write more my thoughts.&lt;br /&gt;&lt;br /&gt;1 Last Friday, my wife and I went to TD bank to sign our new house mortgage paper. Our new house mortgage is $1400 CAD/month, compared to our current town house $600CAD (mortgage) + $200 (condo fees). What a difference! Our current living is convenient, just not luxury. The community is not very good but at least safe. We will move to Kincore in the north west, is it really make a difference? But the pressure in finance is some thing that I started to feel, we currently use the money in three ways. First, the living cost (house mortgage &amp; condo fees, cost for two cars, food &amp; electricity &amp; water &amp; gas etc). Second, some money to my parents in China although they don't need it (the money just gave them some more security feelings). Third,  money donated to the monastery or other charity. Now I am starting to think do I have enough money for donation or support my parents? we need to calculate to make the balance.&lt;br /&gt;&lt;br /&gt;2 Last Sunday, I did not get up early to go to the monastery for the morning ceremony at 8:00. Instead, I stayed in the bed for resting --. And I decide not go to monastery the day. Now I feel that was a good decision. In the afternoon, we went to the zoo for several hours. The weather was very good with sun shine that we did not feel cold wind, the snow is melting. The boy was happy to see the animals again, and we had really a good time to stay as a family that all of us enjoyed. I think spending the time with family is somewhat better than going to the monastery chanting and bowing to the Buddha &amp; Bodhisattva. The goal is to get rid of the hatred/greed/desire etc in mind no matter what methods to choose.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5590983369523964403?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5590983369523964403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5590983369523964403'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/01/0-usually-i-use-this-blog-to-take-notes.html' title=''/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7431726536441096292</id><published>2009-01-15T10:12:00.000-08:00</published><updated>2009-01-15T10:35:27.747-08:00</updated><title type='text'>Do you remember when?</title><content type='html'>As a programmer, I have passed my mid of thirties, so I can not be called "young" at this age. As a programmer, am I success or do I feel I was success? I am not quite sure, it is just a career that I've took for the past 13 years. 13 years, that's a long time, I don't have anything that I can be very pride of, (am I not talented or blessed) but I do have a lot of experience and programming skills. Now, I spend more my personal time on Buddhist meditation, I am more consider myself as a Buddhist than a programmer. But to be a programmer, I know I should spent some of my personal time on programming.&lt;br /&gt;&lt;br /&gt;I am not cheer up as a programmer right now. The economy or the immigrant life is some reasons. But my attitude need to flesh up, and I need to do some replaning to take the charge of on my programming career.&lt;br /&gt;&lt;br /&gt;I like the following video:&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/5ACPSechyzs&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/5ACPSechyzs&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;A programmer works on beauty of code.&lt;br /&gt;A gymnast    works on beauty of body.&lt;br /&gt;A Buddhist   works on beauty of mind.&lt;br /&gt;All takes hard work!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7431726536441096292?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7431726536441096292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7431726536441096292'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2009/01/do-you-remember-when.html' title='Do you remember when?'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2470971359475523500</id><published>2008-12-15T14:28:00.000-08:00</published><updated>2008-12-15T14:37:30.990-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='embeded'/><title type='text'>nanddump</title><content type='html'>Here is the command to dump linux kernel, suppose "ddd" is the image name, "2097152" is the digit number of 0x200000 in hex, may not be exactly the same of the actual length, but it works.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# nanddump -b -o -f ddd -l 2097152 /dev/mtd3&lt;br /&gt;&lt;br /&gt;# nandwrite /dev/mtd3 ddd 0 (I have not test it yet)&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2470971359475523500?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2470971359475523500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2470971359475523500'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/12/nanddump.html' title='nanddump'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-548547216696044475</id><published>2008-11-21T16:51:00.000-08:00</published><updated>2008-11-21T16:55:38.343-08:00</updated><title type='text'>Knuth</title><content type='html'>I was shocked that Knuth was diagnosed with prostate cancel. It is not a news, but I just got know today from this &lt;a href="http://www.informit.com/articles/article.aspx?p=1193856"&gt;interview&lt;/a&gt;.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Andrew: In late 2006, you were diagnosed with prostate cancer. How is your health today?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Donald: Naturally, the cancer will be a serious concern. I have superb doctors. At the moment I feel as healthy as ever, modulo being 70 years old. Words flow freely as I write TAOCP and as I write the literate programs that precede drafts of TAOCP. I wake up in the morning with ideas that please me, and some of those ideas actually please me also later in the day when I’ve entered them into my computer.&lt;br /&gt;&lt;br /&gt;On the other hand, I willingly put myself in God’s hands with respect to how much more I’ll be able to do before cancer or heart disease or senility or whatever strikes. If I should unexpectedly die tomorrow, I’ll have no reason to complain, because my life has been incredibly blessed. Conversely, as long as I’m able to write about computer science, I intend to do my best to organize and expound upon the tens of thousands of technical papers that I’ve collected and made notes on since 1962.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I like the words "If I should unexpectedly die tomorrow, I’ll have no reason to complain, because my life has been incredibly blessed. ", very inspiring.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-548547216696044475?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/548547216696044475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/548547216696044475'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/11/knuth.html' title='Knuth'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8411519650140942720</id><published>2008-11-21T12:53:00.000-08:00</published><updated>2008-11-21T12:57:48.347-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arm-linux'/><title type='text'>flash jffs2</title><content type='html'>Use flash on a arm-linux board always requires jffs2. &lt;br /&gt;&lt;br /&gt;Here is the command that do flash erase and copy rootfs to mtdblock4.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# flash_eraseall -j /dev/mtd4&lt;br /&gt;# dd if=rootfs.jffs2 of=/dev/mtd4 bs=4096&lt;br /&gt;# mount -t jffs2 /dev/mtdblock4 /mnt/jffs2 &lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8411519650140942720?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8411519650140942720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8411519650140942720'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/11/flash-jffs2.html' title='flash jffs2'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5059225051660475228</id><published>2008-11-06T12:01:00.000-08:00</published><updated>2008-11-06T12:19:18.956-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><title type='text'>coding standard  (GNU)</title><content type='html'>I feel I am quite like the coding standard with GNU by reading &lt;a href="http://www.antcom.de/gtick/"&gt;GTick&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;1. variables and variable types are small characters. (add "_t" for types)&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;dsp_t* dsp;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. function names are small characters, and written in this way: (in function name: words are connected by "_", this is my favorite way)&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;dsp_t* dsp_new(comm_t* comm);&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3. comments in this layout.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt; /* headers*/&lt;br /&gt;#include &lt; stdio.h&gt;&lt;br /&gt;#include &lt; stdlib.h&gt;&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt; * brief.&lt;br /&gt; *&lt;br /&gt; * input:  from: data source of input&lt;br /&gt; *         from_size: the number of frames in [from]&lt;br /&gt; * output: to: the pointer to the allocated data.&lt;br /&gt; *&lt;br /&gt; * NOTE: here is the note. [to] should be free by the caller.&lt;br /&gt; */&lt;br /&gt;static int foo(short* from, int from_size, unsigned char** to);&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;4. CONSTANTS and MACROES are large characters.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5059225051660475228?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5059225051660475228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5059225051660475228'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/11/coding-standard-gnu.html' title='coding standard  (GNU)'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1822880949036392698</id><published>2008-11-05T12:48:00.000-08:00</published><updated>2008-11-05T12:52:31.232-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>no writing permission on /tmp</title><content type='html'>I found myself has no writing permission on /tmp with FC5. It caused many troubles,  firefox would not launch, because it creates temporary files when it starts... To solve it is quite simple:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ cd /&lt;br /&gt;$ sudo chmod 777 tmp&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1822880949036392698?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1822880949036392698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1822880949036392698'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/11/no-writing-permission-on-tmp.html' title='no writing permission on /tmp'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6188485407064751984</id><published>2008-10-24T15:44:00.000-07:00</published><updated>2008-10-24T16:11:33.808-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>remove files in different directories</title><content type='html'>I used to know how to find files in different directories,&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;find . -name '*.raw' &lt;/span&gt;will list all the raw files, but how to delete them?&lt;br /&gt;&lt;br /&gt;Here is the result:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;[root@QSLENG13_FC5 xxx]# find . -name '*.raw' -exec ls {} \;&lt;br /&gt;./SP-MIDI/output_midi.raw&lt;br /&gt;./SMAF_MA-5/output_midi.raw&lt;br /&gt;./SMAF_MA-3/output_midi.raw&lt;br /&gt;./SMAF_MA-2/output_midi.raw&lt;br /&gt;./MXMF/output_midi.raw&lt;br /&gt;./MIDI_RIFF_Format_1/output_midi.raw&lt;br /&gt;./MIDI_RIFF_Format_0/output_midi.raw&lt;br /&gt;./MIDI_Format_1/output_midi.raw&lt;br /&gt;./MIDI_Format_0/output_midi.raw&lt;br /&gt;./KAR/output_midi.raw&lt;br /&gt;./JTS/output_midi.raw&lt;br /&gt;./iMelody/output_midi.raw&lt;br /&gt;[root@QSLENG13_FC5 xxx]# find . -name '*.raw' -exec rm {} \;&lt;br /&gt;[root@QSLENG13_FC5 xxx]# find . -name '*.raw' -exec ls {} \;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Another usage: I want remove GNU assembly code which is generated by ADS and all the other object files.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# find . \( -name  '*.o.s' -o -name '*.o' \) -exec rm {} \;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;or using "-ok" with control by the user (type 'y' or 'n' for each file).&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;[root@QSLENG13_FC5 linux]# find . \( -name '*.a' -o -name '*.so' \)  -ok rm {} \;&lt;br /&gt;&lt; rm ... ./libmqcore32.a &gt; ? n&lt;br /&gt;&lt; rm ... ./libmqcore32.so &gt; ? n&lt;br /&gt;&lt; rm ... ./libq3di32.so &gt; ? n&lt;br /&gt;&lt; rm ... ./libq3di32.a &gt; ? n&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6188485407064751984?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6188485407064751984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6188485407064751984'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/10/remove-files-in-different-directories.html' title='remove files in different directories'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3009768105004881338</id><published>2008-10-23T10:13:00.000-07:00</published><updated>2008-10-23T10:17:49.342-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>use of scp</title><content type='html'>My memory is easy to forget, usually I am using tftp and nfs to share files, but I can not do it through ssh. When one door is close, there is another door open, I can use '&lt;a href="http://dsmarkchen.blogspot.com/2008/01/work-on-ipaq-5550-pocketpc.html"&gt;scp&lt;/a&gt;' from my Linux PC to transfer files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3009768105004881338?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3009768105004881338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3009768105004881338'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/10/use-of-scp.html' title='use of scp'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1702020820380977256</id><published>2008-10-08T16:25:00.000-07:00</published><updated>2008-10-08T16:44:34.512-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arm-linux'/><title type='text'>clone jffs2</title><content type='html'>&lt;blockquote&gt;&lt;br /&gt;mount -t jffs2 /dev/mtdblock4 /mnt/nand&lt;br /&gt;mount /dev/mmcblk0p2 /mnt/mmc2&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I use mmc card as the media to save the rootfs at nand flash. It is not as easy as type: "tar czvf /mnt/mmc2/target.tar.gz /mnt/nand/". It won't work within busybox from the ARM target, could be the problem of tar.&lt;br /&gt;&lt;br /&gt;How ever here is the magic:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;tar cf - -C /mnt/nand . | tar xvf - -C /mnt/mmc2/target&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Then pull the SD card and connect to the Linux PC, copy the file system with simply "cp -r /tftpboot /mnt/mmc2/target".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1702020820380977256?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1702020820380977256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1702020820380977256'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/10/clone-jffs2.html' title='clone jffs2'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8731500680850606026</id><published>2008-10-07T08:48:00.000-07:00</published><updated>2008-10-07T08:55:28.390-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>tftp on FC5</title><content type='html'>1. edit tftp file in "/etc/xinetd.d"&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;service tftp&lt;br /&gt;{&lt;br /&gt;    disable = no&lt;br /&gt;    socket_type = dgram&lt;br /&gt;    protocol = yes&lt;br /&gt;    user = root&lt;br /&gt;    server = /usr/sbin/in.tftpd&lt;br /&gt;    server_args = -s /tftpboot&lt;br /&gt;#   disable = yes&lt;br /&gt;    per_source = 11&lt;br /&gt;    cps = 100 2&lt;br /&gt;    flags = IPv4&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;"/tftpboot" is my directory to be used by tftp. comment out "disable = yes" to enable tftp.&lt;br /&gt;&lt;br /&gt;2. restart xinetd service.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ sudo /sbin/service xinetd restart&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8731500680850606026?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8731500680850606026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8731500680850606026'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/10/tftp-on-fc5.html' title='tftp on FC5'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6001952139866567311</id><published>2008-10-03T17:00:00.000-07:00</published><updated>2008-10-03T17:11:13.211-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arm-linux'/><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><title type='text'>compile mplayer with ALSA for ARM</title><content type='html'>1. download mplayer source code. I am using (MPlay-1.0rc2.tar.bz2)&lt;br /&gt;2. extract it.&lt;br /&gt;3. write a script mybuild.sh for configuring&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;export CROSS_CC=/opt/CodeSourcery/arm-2007q3-51&lt;br /&gt;export PATH=$CROSS_CC/bin:$PATH&lt;br /&gt;export TGT="your target file system"&lt;br /&gt;./configure --enable-cross-compile -cc=arm-none-linux-gnueabi-gcc \&lt;br /&gt; --host-cc=gcc --target=arm-linux --prefix=$TGT \&lt;br /&gt; --disable-network --disable-x11 --disable-gui  \&lt;br /&gt;  --with-extralibdir=$TGT/lib \&lt;br /&gt;  --with-extraincdir=$TGT/include&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here $TGT contains alsa include files and library "libasound.so.2".&lt;br /&gt;&lt;br /&gt;4. type "make"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6001952139866567311?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6001952139866567311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6001952139866567311'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/10/compile-mplayer-with-alsa-for-arm.html' title='compile mplayer with ALSA for ARM'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6061232594879683855</id><published>2008-09-18T16:47:00.000-07:00</published><updated>2008-09-18T17:01:46.037-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><category scheme='http://www.blogger.com/atom/ns#' term='cvs'/><title type='text'>patch</title><content type='html'>As I use cvs for code control, I found patch is a good tool that helps to build the actual release. To do actual release, some times I need to make changes on the code such as change the macro of "#define ENABLE_FOO 0" or some thing else, and these change may not be good to commit to cvs, and I also don't want to create branch with cvs, as each branch can be orphan if I forget to update. So the basic way is:&lt;br /&gt;&lt;br /&gt;1. cvs tag &lt;your_current_project&gt;&lt;br /&gt;2. modify some code and build the release.&lt;br /&gt;3. make patch (I use tortoriseCVS)&lt;br /&gt;&lt;br /&gt;When you want to apply the patches, first make sure you can the patch is for what 'tag' version. after that&lt;br /&gt;1. cvs co -r "tag" "module name"&lt;br /&gt;2. go to the directory you just check out the source code.&lt;br /&gt;3. patch -p0 &lt; "your patch file"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6061232594879683855?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6061232594879683855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6061232594879683855'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/09/patch.html' title='patch'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-524808711807008074</id><published>2008-09-11T11:15:00.000-07:00</published><updated>2008-09-11T12:08:00.860-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><title type='text'>Macbook</title><content type='html'>My Macbook died a week ago, yesterday I got it back from &lt;a href="http://www.westworld.ca/"&gt;west world&lt;/a&gt; who repaired it. The harddrive is changed, but all the data are lost.&lt;br /&gt;&lt;br /&gt;I use all the systems (windows, Linux), but feel extremely addicted to Mac OS X. It mainly changed my way of surfing internet. Here is the trick:&lt;br /&gt;&lt;br /&gt; 1. &lt;a href="http://tuxtina.de/software/"&gt;delicouse2safari&lt;/a&gt;: save my delicious bookmarks to safari&lt;br /&gt; 2. &lt;a href="http://www.obdev.at/products/launchbar/index.html"&gt;Launchbar&lt;/a&gt;: rescan all the bookmarks, then I am ready to use.&lt;br /&gt;&lt;br /&gt;The new Firefox (version 3.01) is released, yesterday I saw the new face on Mac for the first time, I don't feel it looks better than on the PC, but it works fine. I've been using &lt;a href="http://vimperator.mozdev.org/"&gt;vimperator&lt;/a&gt; for quite a while, it gave me quick access with firefox using vim-style key binding, but as the firefox3 pop up, I feel difficulty with vimperator. So I disable this add-on, hope the author of vimperator can improve it. (The most unhappy experience with vimperator, is I did not see tabs on the gui, although I can type "tabs" to show all the tabs in the buffer. I would like to see the tabs bar, not sure where the problem is)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-524808711807008074?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/524808711807008074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/524808711807008074'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/09/macbook.html' title='Macbook'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6521503599782022076</id><published>2008-08-25T16:04:00.000-07:00</published><updated>2008-08-25T16:09:35.520-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>fpos_t</title><content type='html'>When compile with gcc, it prompt "cannot convert fpos_t to long int". &lt;br /&gt;&lt;br /&gt;Here is the solution:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;long dataOffset;&lt;br /&gt;fpos_t filepos;&lt;br /&gt;...&lt;br /&gt;dataOffset = filepos.__pos;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6521503599782022076?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6521503599782022076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6521503599782022076'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/08/fpost.html' title='fpos_t'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2174010577787974431</id><published>2008-07-31T12:00:00.000-07:00</published><updated>2008-07-31T12:03:54.989-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>ip_local_port_range</title><content type='html'>The following command modifies the file /proc/sys/net/ipv4/ip_local_port_range.&lt;br /&gt;Some times I can not directly write to the file in proc. But this works:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$ sudo sysctl -w net.ipv4.ip_local_port_range="1024 64000"&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2174010577787974431?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2174010577787974431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2174010577787974431'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/07/iplocalportrange.html' title='ip_local_port_range'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4031709813657977488</id><published>2008-07-30T13:36:00.000-07:00</published><updated>2008-07-30T13:48:40.848-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='vmware'/><title type='text'>Windows share folders with vmware Ubuntu</title><content type='html'>I have trouble to view share folder from Ubuntu 7.0.4. There are several ways to do it. One is through smb4k, the other is with vmware share folder settings. Neither works for me. So with the second way, I found out the solution from the Internet.&lt;br /&gt;&lt;br /&gt;Here is the fix: &lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;/*&lt;br /&gt;#define INODE_SET_II_P(inode, info) do { (inode)-&gt;u.generic_ip = (info); } while (0)&lt;br /&gt;#define INODE_GET_II_P(inode) ((HgfsInodeInfo *)(inode)-&gt;u.generic_ip)&lt;br /&gt;*/&lt;br /&gt;#define INODE_SET_II_P(inode, info) do { (inode)-&gt;i_private = (info); } while (0)&lt;br /&gt;#define INODE_GET_II_P(inode) ((HgfsInodeInfo *)(inode)-&gt;i_private)&lt;br /&gt;&lt;br /&gt;// inode-&gt;i_blksize = HGFS_BLOCKSIZE;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This fix changes the driver.c in /usr/lib/vmware-tools/modules/source. Make a backup on vmhgfs.tar, untar it (tar xvf vmhgfs.tar), make edit on driver.c, tar it back (tar cvf vmhgfs.tar vmhgfs-only) and re-run vmware-config-tools.pl.&lt;br /&gt;&lt;br /&gt;Everything is fine on building hgfs module.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4031709813657977488?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4031709813657977488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4031709813657977488'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/07/windows-share-folders-with-vmware.html' title='Windows share folders with vmware Ubuntu'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8142061371554775224</id><published>2008-07-29T21:32:00.000-07:00</published><updated>2008-07-31T12:29:36.543-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='nyquist'/><title type='text'>nyquist - built it on Ubuntu 7.04</title><content type='html'>I am not really familiar with Ubuntu, usually I use Fedora Core 5 at work, but this time I got a new project which need to install ACCESS Linux platform(ALP), ALP is provided with debian-based packages, so I can only do my job on Ubuntu or Debian.&lt;br /&gt;&lt;br /&gt;I install Ubuntu 7.0.4 though vmware on PC at work and MacBook at Home. At work, I have a big trouble, is the amxier &amp; aplay can not be used to play audio file, I do some fix to make amixer work, but aplay still not work. I also got Ubuntu 7.10 installed, it is OK with audio playing. And there's no audio problem on my MacBook with Ubuntu 7.04.&lt;br /&gt;&lt;br /&gt;At I am trying to compile nyquist myself. At start, gcc complains  it can not find "stdio.h" file. So I install libc-dev, then it complains could not find g++. So I install g++. After that, I got link errors. It could not find readline. The follow command solves the issue:&lt;br /&gt;&lt;blockquote&gt;sudo apt-get libreadline5-dev &lt;/blockquote&gt;&lt;br /&gt;Then is asound. I use the following command to find libasound.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;apt-cache search libasound&lt;br /&gt;..&lt;br /&gt;sudo apt-get install libasound2-dev&lt;br /&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;br /&gt;The last problem is it could not find javac, it is hard to find through "apt-cache search", the following command make it work.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;sudo apt-get install sun-java6-jdk&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8142061371554775224?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8142061371554775224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8142061371554775224'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/07/nyquist-built-it-on-ubuntu-704.html' title='nyquist - built it on Ubuntu 7.04'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6134738054569388513</id><published>2008-07-25T15:23:00.000-07:00</published><updated>2008-08-20T20:25:22.862-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lisp'/><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><title type='text'>Wind generation from Audacity-Nyquist</title><content type='html'>Audacity is a free audio editor for Windows, Linux and Mac OS X. What I found the interesting thing is -- it support writing plugins with Nyquist. Well, Nyquist is a Lisp enhancement for audio/synth  based on a common language -- XLISP. XLISP is a very old Lisp Language with support of object-oriented concept such as "class", I print the manual, and the date for the manual is 1988.&lt;br /&gt;&lt;br /&gt;So I have the platform to do the following:&lt;br /&gt;1. Experiment writing in Lisp.&lt;br /&gt;2. To Learn the two most common parts in DSP (DFT and Digital filters)&lt;br /&gt;3. Learn audio processing (gain, db etc)&lt;br /&gt;&lt;br /&gt;Wow, in my life I am eager to learn all these three parts, but I have not get any benefits even I have put years of time. I just could not understand. I think it may take more years. I am just not smart enough. But any way it is my direction.&lt;br /&gt;&lt;br /&gt;Below you will hear wind, I generate it based on David R. Sky's Wind plugin. I am using Audacity 1.3.5, and the wind is a mono audio. It fails when I set it to stereo, not sure what is wrong with it.&lt;br /&gt;&lt;br /&gt;note 20080818: I have removed the wind flash link.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6134738054569388513?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6134738054569388513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6134738054569388513'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/07/wind-generation-from-audacity-nyquist.html' title='Wind generation from Audacity-Nyquist'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-654817614354819351</id><published>2008-07-21T16:05:00.000-07:00</published><updated>2008-07-21T16:41:22.738-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><title type='text'>audacity - build &amp; install on FC5</title><content type='html'>The default audacity package does not have mp3 built as default on FC5. So I spend some time to build my own audacity on FC5.&lt;br /&gt;&lt;br /&gt;1. Install libmad. This is the mp3 decoder library. I directly found a previous build at &lt;a href="http://dries.ulyssis.org/rpm/packages/libmad/info.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;2. Install libsndfile. (It is already there).&lt;br /&gt;&lt;br /&gt;3. Build wxGTK. Since the default wxGTK is 2.4.2 (audacity 1.2.5) and I am try to build audacity 1.3.5 which needs wxGTK 2.6.1 plus, I have to uninstall the default install package.  &lt;br /&gt;&lt;br /&gt;Also, make sure gtk is installed. (FC5 default contains these libs). Following is the script to build wxGTK (2.6.4).&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;./configure --with-gtk --enable-gtk2&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And "wx-config --list" is a useful command to list how wxGTK is configured.&lt;br /&gt;&lt;br /&gt;4. Build audacity.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;./configure&lt;br /&gt;make &lt;br /&gt;make install&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;5. Fix libwx_gtk shared libary with ldconfig. Since my build shared library is installed at /usr/local/lib. So I have to do some fix with "/etc/ld.so.conf". I creat and edit a file named "audacity-i386.conf" in /etc/ld.so.conf.d directory of FC5, just add a line "/usr/local/lib", and do "/sbin/ldconfig". To check result use "/sbin/ldconfig -v".&lt;br /&gt;&lt;br /&gt;6. Launch audacity to open a mp3 file to see is it work.&lt;br /&gt;&lt;br /&gt;MISC.&lt;br /&gt;&lt;br /&gt;To query a package (for example wxgtk) on FC5. I want to know what the package name is, is it installed on the system, and the version number etc.&lt;br /&gt;I use "yum info wxgtk" to get the package information, but some times I have no idea with the package name, so I use the following command to find out:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;rpm -q -a | grep -i wxgtk&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-654817614354819351?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/654817614354819351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/654817614354819351'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/07/audacity-build-install-on-fc5.html' title='audacity - build &amp; install on FC5'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1684090351564260609</id><published>2008-06-30T14:22:00.000-07:00</published><updated>2008-06-30T14:33:19.553-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='sed'/><title type='text'>use shell variables in sed</title><content type='html'>&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;input=abc.wav&lt;br /&gt;i=0&lt;br /&gt;while test $i != 10&lt;br /&gt;do&lt;br /&gt;   echo "run case $i&lt;br /&gt;   tag=`expr output-foo-$i`&lt;br /&gt;   output=`echo $input | sed -e "s/^\(.*\)\.wav$/\1-$tag\.wav"`&lt;br /&gt;   ./foo.bin -v -e -E $i -o $output $input&lt;br /&gt;done&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here instead of&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sed -e 's/^\(.*\)\.wav$/\1-$tag\.wav'&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Use&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sed -e "s/^\(.*\)\.wav$/\1-$tag\.wav"&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1684090351564260609?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1684090351564260609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1684090351564260609'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/06/use-shell-variables-in-sed.html' title='use shell variables in sed'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1553280360937640168</id><published>2008-06-20T16:42:00.000-07:00</published><updated>2008-06-20T16:53:18.690-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><title type='text'>Set up for recording audio with Windows</title><content type='html'>Here is some set up for recording audio.&lt;br /&gt;&lt;br /&gt;0. Use blue line-in jack and green line-out jack&lt;br /&gt;&lt;br /&gt;1. Set playback control, especially Volume Control, Wave and Line In, it is ok to mute CDPlayer, PC Beep or SW Synth.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_i_1T8dlgrVk/SFxBgodvqkI/AAAAAAAAAG4/h9bVt9MLK4M/s1600-h/volume-ctrl.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_i_1T8dlgrVk/SFxBgodvqkI/AAAAAAAAAG4/h9bVt9MLK4M/s320/volume-ctrl.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5214114497461987906" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Set recording control, select "WaveOut Mix", then we are ready to go.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_i_1T8dlgrVk/SFxCFnpIhiI/AAAAAAAAAHA/6PtWczQ9pkY/s1600-h/record-ctrl.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_i_1T8dlgrVk/SFxCFnpIhiI/AAAAAAAAAHA/6PtWczQ9pkY/s320/record-ctrl.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5214115132896478754" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1553280360937640168?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1553280360937640168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1553280360937640168'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/06/set-up-for-recording-audio-with-windows.html' title='Set up for recording audio with Windows'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_i_1T8dlgrVk/SFxBgodvqkI/AAAAAAAAAG4/h9bVt9MLK4M/s72-c/volume-ctrl.JPG' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2487095462259789570</id><published>2008-06-17T16:42:00.000-07:00</published><updated>2008-06-18T12:34:35.136-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>nfs client</title><content type='html'>I got an error when mount NFS disks with my OMAP linux box.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;rpcbind: server localhost not responding, timed out&lt;br /&gt;RPC: failed to contact local rpcbind server (errno 5).&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here is the result. (The reason is I don't have portmap running in the box)&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;mount -t nfs -o nolock 192.168.0.9:/tmp /mnt/mmc&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And then, I got another panic message, when I run a program.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;nfs: server 192.168.0.9 not responding, still trying&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here is the result.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;mount -t nfs 192.168.0.9:/tmp /mnt/mmc -o nolock,hard,rsize=1024,wsize=1024&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2487095462259789570?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2487095462259789570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2487095462259789570'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/06/nfs-client.html' title='nfs client'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8888818400889136237</id><published>2008-06-16T12:29:00.000-07:00</published><updated>2008-06-16T13:05:22.226-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>setup dhcp, nfs on FC5</title><content type='html'>&lt;span style="font-weight:bold;"&gt;setup dhcp server&lt;/span&gt;&lt;br /&gt;I need to setup dhcp server under my router.&lt;br /&gt;Here is the configuration file (/etc/dhcpd.conf)&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;ddns-updates on;&lt;br /&gt;subnet 192.168.2.0 netmask 255.255.255.0 {&lt;br /&gt;   option routers 192.168.2.1;&lt;br /&gt;   option subnet-mask 255.255.255.0;&lt;br /&gt;   option domain-name "local.net";&lt;br /&gt;   option domain-name-servers ns.local.net;&lt;br /&gt;   host trgt {&lt;br /&gt;      hardware ethernet 08:00:28:01:15:F7;&lt;br /&gt;      fixed-address 192.168.2.110;&lt;br /&gt;      option root-path "/opt/eldk/ppc_8xx";&lt;br /&gt;      option host-name "trgt";&lt;br /&gt;      next-server 192.168.2.151;&lt;br /&gt;      filename "tftpboot/pImage";&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;ddns-update-style ad-hoc;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Here "trgt" is a linux device which has fixed ip address, and need boot image through NFS from linux host with ip "192.168.2.151".&lt;br /&gt;&lt;br /&gt;Start dhcp-server with: `/etc/rc.d/init.d/dhcpd start`&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Setup nfs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Edit /etc/exports&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;/tftp 192.168.2.110(rw,no_root_squash,sync)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Edit /etc/hosts.allow&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;portmap: 10.10.10.20&lt;br /&gt;lockd:   10.10.10.20&lt;br /&gt;mountd:  10.10.10.20&lt;br /&gt;rquotad: 10.10.10.20&lt;br /&gt;statd: 10.10.10.20 &lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And edit /etc/hosts.deny&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;portmap: ALL&lt;br /&gt;lockd: ALL&lt;br /&gt;mountd: ALL&lt;br /&gt;statd: ALL&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;run: `exportfs -ra`&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scripts on start nfs&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;/etc/init.d/portmap start&lt;br /&gt;/etc/init.d/nfslock start&lt;br /&gt;/etc/init.d/nfs start&lt;br /&gt;/etc/init.d/netnfs start&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Check nfs status with: `/sbin/service nfs status`&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;rpc.mountd (pid 4181) is running...&lt;br /&gt;nfsd (pid 4183 4182 4181 4180) is running&lt;br /&gt;rpc.rquotead (pid 4170) is running&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;You may need to "/sbin/service iptables stop" sometimes if you can the ip but can not mount while getting "no route and host" message.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8888818400889136237?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8888818400889136237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8888818400889136237'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/06/setup-dhcp-nfs-on-fc5.html' title='setup dhcp, nfs on FC5'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6159751405471930036</id><published>2008-06-10T16:05:00.000-07:00</published><updated>2008-06-10T16:27:09.227-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>use cu</title><content type='html'>1. install uucp "sudo apt-get install uucp"&lt;br /&gt;2. edit /etc/uucp/sys&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;system          S0@115200&lt;br /&gt;port            serial0_115200&lt;br /&gt;time            any&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;3. edit /etc/uucp/port to add serial0_115200&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;port            serial0_115200&lt;br /&gt;type            direct&lt;br /&gt;device          /dev/ttyS0&lt;br /&gt;speed           115200&lt;br /&gt;hardflow        false&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;4. Add serial port to VM, otherwise it will not show up.&lt;br /&gt;5. run `cu S0@115200` and get a response "Connected."&lt;br /&gt;To terminate, type `~.`&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6159751405471930036?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6159751405471930036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6159751405471930036'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/06/use-cu.html' title='use cu'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6893861352265086857</id><published>2008-05-22T14:51:00.000-07:00</published><updated>2008-05-22T14:58:38.686-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><category scheme='http://www.blogger.com/atom/ns#' term='cvs'/><title type='text'>gnu make on win32 shell</title><content type='html'>1. The version of gnu make that works on win32 is 3.80, while both 3.78 and 3.81 would not work.&lt;br /&gt;&lt;br /&gt;2. win32 shell script. The following is a sample which uses cvs to check out foo source code&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;@echo off&lt;br /&gt;&lt;br /&gt;set PRJ_DIR=%PRJ_ROOT%\foo-%PRJ_TSTAMP%&lt;br /&gt;set PRJ_NAME=foo&lt;br /&gt;if "%1"=="-D" goto check_out_tstamp;&lt;br /&gt;&lt;br /&gt;echo "check out HEAD of %PRJ_NAME%"&lt;br /&gt;cvs co -d %PRJ_DIR% -P %PRJ_NAME%&lt;br /&gt;&lt;br /&gt;goto end;&lt;br /&gt;&lt;br /&gt;: check_out_tstamp&lt;br /&gt;echo "check out with time stamp"&lt;br /&gt;cvs co -D %PRJ_TIME% "-d" %PRJ_DIR% -P %PRJ_NAME%&lt;br /&gt;&lt;br /&gt;:end&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6893861352265086857?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6893861352265086857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6893861352265086857'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/05/gnu-make-on-win32-shell.html' title='gnu make on win32 shell'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3434629702844796930</id><published>2008-05-15T17:07:00.000-07:00</published><updated>2008-05-15T17:20:02.835-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='cscope'/><title type='text'>vim - some tips on use cscope and ctags</title><content type='html'>1. cscope does not work very well on c++, it is hard to search class members. (so don't expect cscope can do everything)&lt;br /&gt;&lt;br /&gt;2. don't use "cscope -b -q" to build the database&lt;br /&gt;&lt;br /&gt;3. with ctrl-\ and f, open header file in a c/C++ source code&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;nmap &lt; C-\&gt;f :cs find f &lt; C-R&gt;=expand("&lt; cword&gt;") . ".h" &lt; CR&gt;&lt; CR&gt; &lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;4. add database with specification on ignore charactor case.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt; cs add cscope.out . -C&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;5. Here is my build bat file for win32&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;rm cscope.* tags&lt;br /&gt;set project=c:\work\foo&lt;br /&gt;find %project% -name "*.cpp" -o -name "*.[ch]" &gt; cscope.files&lt;br /&gt;cscope -b  &lt;br /&gt;ctags --extra=+q -L cscope.files&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3434629702844796930?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3434629702844796930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3434629702844796930'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/05/vim-some-tips-on-use-cscope-and-ctags.html' title='vim - some tips on use cscope and ctags'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3837292667299854165</id><published>2008-05-12T09:55:00.000-07:00</published><updated>2008-05-12T10:53:36.127-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>utils - ti memory data conversion</title><content type='html'>The ccs IDE provides a function to save memory data to a file, here is a saved file:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;1651 1 10032238 0 300&lt;br /&gt;0x00000000&lt;br /&gt;0x00000000&lt;br /&gt;0x00000000&lt;br /&gt;0x00000000&lt;br /&gt;....&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;It is a text file, with the first line, contains the memory address, the data length etc. From the next line, comes the data. Since the output is still the text file, I need to convert it to actual binary data. So I develop a little application to do the conversion. Not good on awk, or with sed, I use c programming language directly. C is such powerful.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;#include &lt; stdio.h&gt;&lt;br /&gt;#include &lt; string.h&gt;&lt;br /&gt;&lt;br /&gt;#define LINE_MAX 256&lt;br /&gt;char my_asc2hex(char a, char b)&lt;br /&gt;{&lt;br /&gt; char o;&lt;br /&gt; if (a &gt;= '0' &amp;&amp; a &lt;='9') a = a - '0';&lt;br /&gt; if (a &gt;= 'a' &amp;&amp; a &lt;='f') a = a - 'a' + 10;&lt;br /&gt; if (a &gt;= 'A' &amp;&amp; a &lt;='F') a = a - 'A' + 10;&lt;br /&gt; if (b &gt;= '0' &amp;&amp; b &lt;='9') b = b - '0';&lt;br /&gt; if (b &gt;= 'a' &amp;&amp; b &lt;='f') b = b - 'a' + 10;&lt;br /&gt; if (b &gt;= 'A' &amp;&amp; b &lt;='F') b = b - 'A' + 10;&lt;br /&gt; o = a + b * 16;&lt;br /&gt; return (o);&lt;br /&gt;}&lt;br /&gt;int main(int argc, char* argv[])&lt;br /&gt;{&lt;br /&gt; char line_buf[LINE_MAX];&lt;br /&gt; char* lp;&lt;br /&gt; FILE* fp, *fp_out;&lt;br /&gt; char aa,bb,cc,dd;&lt;br /&gt; &lt;br /&gt; if (argc &lt; 3){&lt;br /&gt;  printf("%s ti_input_file output_file", argv[0]);&lt;br /&gt;  return 1;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; fp = fopen(argv[1], "r");&lt;br /&gt; if (fp == NULL) return 1;&lt;br /&gt; fp_out = fopen(argv[2], "w+b");&lt;br /&gt; if (fp_out == NULL) {&lt;br /&gt;  fclose(fp); &lt;br /&gt;  return 1;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; for(;;) {&lt;br /&gt;  lp = fgets(line_buf, LINE_MAX, fp);&lt;br /&gt;  if (lp == NULL) goto main_exit;&lt;br /&gt;  if (*lp++ == '0' &amp;&amp; *lp++ == 'x' &amp;&amp; strlen(lp) &gt;= 8) {&lt;br /&gt;   aa = my_asc2hex(*lp++, *lp++);&lt;br /&gt;   bb = my_asc2hex(*lp++, *lp++);&lt;br /&gt;   cc = my_asc2hex(*lp++, *lp++);&lt;br /&gt;   dd = my_asc2hex(*lp++, *lp++);&lt;br /&gt;   &lt;br /&gt;   fwrite(&amp;dd, 1, sizeof(char), fp_out);&lt;br /&gt;   fwrite(&amp;cc, 1, sizeof(char), fp_out);&lt;br /&gt;   fwrite(&amp;bb, 1, sizeof(char), fp_out);&lt;br /&gt;   fwrite(&amp;aa, 1, sizeof(char), fp_out);   &lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;main_exit:&lt;br /&gt; fclose(fp);&lt;br /&gt; fclose(fp_out);&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I just need to pay attention to the byte order, for example, if it is "0x00004F99" from the input, the output will be "99 4F 00 00". BUT the confusing part is here: &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;if (*lp++ == '0' &amp;&amp; *lp++ == 'x'...)&lt;br /&gt;....&lt;br /&gt;my_asc2hex(*lp++, *lp++);&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;In "if" condition, the evaluating is one by one, the first item "evaluate" first, then is the next, while in function, the "evaluation" of parameters is, the last item first (put on the stack first), and moves on previous items. so that is why the first parameter to my_asc2hex is the latter one. kind of confusing using pointer!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3837292667299854165?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3837292667299854165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3837292667299854165'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/05/utils-ti-memory-data-conversion.html' title='utils - ti memory data conversion'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5417371080530873331</id><published>2008-04-21T12:55:00.000-07:00</published><updated>2008-04-21T14:15:17.394-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='sed'/><title type='text'>sed programming - commands combination</title><content type='html'>Sed is a programming language, to me it basically contains two things, one is regexp, the other is the control commands such as "g G H h" which manipulate the hold buffer and pattern buffer. Sed only contains these two buffers, so it is simple. No more.&lt;br /&gt;&lt;br /&gt;Although Sed itself is simple, programming with Sed can be complicated. This is like playing chess, to know the rule of each play does not mean you know how to play. You need to know at least some combinations.&lt;br /&gt;&lt;br /&gt;Combination of "G h d". Here is an example "1!G;h;$!d" which REVERSE a list of items, typically 3 states control, at start it is "h d", then the second state which can be looped, which is "G h d", and the third state is "G h". Explanation is quite not hard to understand, the hold buffer was used to save the result, so for the first item, it hold it and delete current pattern, for the second, add "\n' on current buffer and append current buffer with the content in hold buffer, save current buffer to hold buffer,  so the second item will be ahead of the first item in the hold buffer. it do the same for third, fourth, etc. until the last item, is just "G h",  with out "d" means it did not delete current buffer, so at last the current buffer contains the reverse list of items. (My opinion, the last 'h' is not necessary since hold buffer is only for assistant use)&lt;br /&gt;&lt;br /&gt;"x;x" combination. A second example:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;/^&lt;\example&gt;/ {  h; }&lt;br /&gt;x&lt;br /&gt;/^&lt; example&gt;/ { x; p; d;}&lt;br /&gt;x&lt;br /&gt;/^&lt; example&gt;/ {h;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;The five line script find the content of a XML "example" tag. It need a little time to figure out how it works, this script is not using b and n command, remember it and  use it in some cases. A altered way may be easy to understand, here the hold buffer contains the content of the example tag.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;/^&lt; example&gt;/ {&lt;br /&gt;  h&lt;br /&gt;  : example-loop&lt;br /&gt;  n&lt;br /&gt;  /^&lt;\/example&gt;/! {&lt;br /&gt;     H&lt;br /&gt;     b example-loop&lt;br /&gt;  }&lt;br /&gt;  x&lt;br /&gt;  p&lt;br /&gt;  d&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here is some of my thought, &lt;br /&gt;1. "n" is alway used "p", thus with "sed -n". And if you use "p", then "p" is always connect with with "d", you don't do "b end" since "d" itself restart a new cycle, -- read a next line to current buffer.&lt;br /&gt;2. using branch is easy to understand the flow, but in some case, the "x;x" command combination can also be considered.&lt;br /&gt;&lt;br /&gt;Other thoughts:&lt;br /&gt;3. eol : Use "sed -e 's/\r//' your_file" to convert line ending "dos to unix".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5417371080530873331?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5417371080530873331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5417371080530873331'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/04/sed-programming-commands-combination.html' title='sed programming - commands combination'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6248254920263842975</id><published>2008-04-10T21:58:00.000-07:00</published><updated>2008-04-10T22:16:37.505-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='usenet'/><title type='text'>some newsgroup readers</title><content type='html'>1. Outlook Express. This is the traditional news reader, it works fine on Windows, you never have any problems with it.&lt;br /&gt;&lt;br /&gt;2. Pan. This is based on gtk, it is almost as great as Outlook Express, but it need tough build on Mac OS X. &lt;br /&gt;&lt;br /&gt;3. slrn. Should we read news on a terminal? maybe that's the one. Terminal can have a lot of brilliant applications, but not do a good job on web browsing, news reading.&lt;br /&gt;&lt;br /&gt;4. MT-NewsWatcher. It is free, but it is NOT in a good shape with GUI.&lt;br /&gt;&lt;br /&gt;5. Unison. Just download it and get it a try, which is brilliant! It tell me what news server from my ISP I can use,  great work! And I have no trouble to startup, love it.&lt;br /&gt;&lt;br /&gt;Ususally I would try Pan, because it is free and it can be used on all platforms, just like firefox. And I am not willing to pay a comercial newsreader, such basic tool should be free, but I am considering buy Unison.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6248254920263842975?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6248254920263842975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6248254920263842975'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/04/some-newsgroup-readers.html' title='some newsgroup readers'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8072277387344799743</id><published>2008-03-19T11:30:00.000-07:00</published><updated>2008-03-19T12:23:44.415-07:00</updated><title type='text'>Understanding Digital Signal Processing - by Richard Lyons</title><content type='html'>There are a lot of praise on this DSP book, the following is a typical one from Amazon.com:&lt;br /&gt;&lt;br /&gt;"We need this Richard Lyons guy in other fields!!"&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;The last mathematics course I took was Calulus 3 during my senior year in high school... I graduated in 1991. That was my last exposure to mathematics. My undergrad was in biochemistry (no math) and after that I went to medical school (no math). I started my residency in neurology and I became interested in analyzing EEG brain waves. Unfortunately, most work in this field is done in collaboration with engineers, since us docs have minimal knowledge of mathematics and data analysis. I stumbled upon Lyons's book at Borders and decided to give it a shot. Voila!! No more engineers needed!! I now understand sufficiently the concepts of periodic sampling, the Fourier stuff, filters, signal averaging, etc. all the way down to the simple sums of products that they are. Lyons motivated me so much that I picked up Dietel and Dietel's C++ book and now... a month later... I develop my own software to anaylize these EEG signals.&lt;br /&gt;&lt;br /&gt;This may not seem as a big deal to the mathematician or engineer... but you have to remember that I'm a neurologist with no math exposure since high school!! If I can learn digital signal processing through Lyons's book... anyone can.&lt;br /&gt;&lt;br /&gt;Congratulations, Richard G. Lyons... I wish you would write something on time-series predictions. &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I got this book 2 days ago, and just read a few chapters, it is really a wonderful study journey presented by Lyons.  In my work, I was exposed to the audio processing area, and I feel I have trouble to understand dsp filters... The hard thing on DSP is the DFT or FFT which contains a lot of math, while I only study it at College that was 13 years ago, another difficulty is English is my second language, I have never use a English math book for study; Third, DSP area and math are different, for example "i" is used in math to express the root of -1, while in DSP it uses "j", (Thanks to Steve Smith's online dsp book tell me the difference)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I enjoy reading some classic books, Lyon's book should be one of them, what the book contains is like a great teacher, not feed you the knowledge, but guide you to understand it, this book acts like this! &lt;br /&gt;&lt;br /&gt;Other books on DSP, one is &lt;a href="http://ccrma.stanford.edu/~jos/mdft/"&gt;jos&lt;/a&gt;, this book is quite fit to my area, but I would not choose it, because I am not in the college to spend that time. The other wonderful online book is by &lt;a href="http://www.dspguide.com/"&gt;Steve Smith&lt;/a&gt;, this book is quite interesting, it choose not to expose the mathematics way, so you will not be overwelmed by the equation. But I still think Lyon's approach is the best, avoid math may be ok, but equation can also be a good role, be clean if you understand it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8072277387344799743?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8072277387344799743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8072277387344799743'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/03/understanding-digital-signal-processing.html' title='Understanding Digital Signal Processing - by Richard Lyons'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6063649457434918097</id><published>2008-02-27T11:09:00.000-08:00</published><updated>2008-02-27T11:56:03.411-08:00</updated><title type='text'>Use markdown to build - foyep.org</title><content type='html'>After 15 days, it seems I build nothing on the website, but I have something to talk. My most concern is I have to use a powerful editor such as vim which will make changes on pages more easily and more controllable.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt;: Basically it is two things. One, a light-markup language, the syntax is similar to emacs-wiki I have used to write notes before, and I can use the language in vim to write pages. Second, a perl software tool to convert the written markdown to html.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.realmacforge.com/trac/wiki/RWPluginMarkup"&gt;Markup RW plugin&lt;/a&gt;: It is a Rapidweaver plugin, it support markdown language, thus I can use markdown in Rapidweaver, also the plugin contains a bash interface, which could be most meaningful to me -- a programmer.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yourhead.com/blocks/index.html"&gt;Blocks&lt;/a&gt;: from&lt;a href="http://www.paulbradforth.com/rapidweaver/"&gt;Paul&lt;/a&gt;,it seems that Blocks is a must have plugin with rapidweaver. The price is an issue, compared to RW (36CAD with coupon), it costs 26CAD, is it valuable to spent for just a plugin. Right now, I think it is worth after I bought it online, it provides me a simple way to design my website as I am not a designer, so I feel great although I need to figure out the usage such as use page blocks, html blocks or align images, etc. One good thing to me is Blocks works with the markup plugin. It is obviously that markdown can be used in blocks.&lt;br /&gt;&lt;br /&gt;webyep: NOT choosed as a result.&lt;br /&gt;&lt;br /&gt;PlusKit: it supports Markdown and bash, but I have difficulty to use it with blocks, don't know why. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yourhead.com/accordion/"&gt;accordion&lt;/a&gt;: Anthor beautiful  plugin from yourhead, I see some nice samples but not got a chance to try, would like to investe the use with it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6063649457434918097?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6063649457434918097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6063649457434918097'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/02/markdown-to-build-webite-foyeporg.html' title='Use markdown to build - foyep.org'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8205855347543030421</id><published>2008-02-20T10:29:00.000-08:00</published><updated>2008-02-20T10:56:36.394-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><title type='text'>setup  a website - foyep.org</title><content type='html'>I spent a whole night to setup a new website, I feel I need to create a site on Buddhism (in Chinese). To register and setup my host account with Godaddy is so efficient, they are doing a great job.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.realmacsoftware.com/rapidweaver/"&gt;RapidWeaver&lt;/a&gt; - I have fiddling it for a little while, liked or dis-liked, but it should be a top 10 Mac application. I used it to create and weave my pages and publish to my website, it also includes some nice and clean themes. The forum of RapidWeaver is quite good. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.niedling.info/ralf/projekte/rapidweaver/themes/simple_theme.html"&gt;Ralf Simple Theme&lt;/a&gt; - A quite nice theme I choose when I don't want to use the default themes from RW.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.obdev.at/products/webyep/index.html"&gt;webyep&lt;/a&gt; - I may feel sad with RW until I found the Webyep plugin, I have never imagen to use CMS but I like the idea, especially when I found it is developed by the guys who bring LaunchBar, while LaunchBar is so impressive to me and it is my #1 Mac Application.&lt;br /&gt;&lt;br /&gt;Still need learning to fill the gap, but here is my &lt;a href="http://www.foyep.org/sutra"&gt;website&lt;/a&gt;, still in construction.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8205855347543030421?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8205855347543030421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8205855347543030421'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/02/setup-website-foyeporg.html' title='setup  a website - foyep.org'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8241486825871077366</id><published>2008-01-31T09:19:00.000-08:00</published><updated>2008-02-06T21:28:28.054-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><title type='text'>Install Gentoo VM  on Macbook -1</title><content type='html'>I use Minimum CD, the installation is more hard than using a liveCD, so I failed a bunch of times. And as my learning, I started installation with stage3, so I don't need to catch stage1 and stage2, but even stage3, is a lot to me. Every time with Minimum CD, I have to get stage3 and portage, so at last I save them to another machine that I can easily get with ssh.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;0 startup with Minimum CD&lt;br /&gt; vmware: other linux 2.6.x&lt;br /&gt;         connected: NAT&lt;br /&gt;&lt;br /&gt;1 check network&lt;br /&gt;- ifconfig =&gt; eth0&lt;br /&gt;- dhcpcd   =&gt; some times need it if eth0 did not show ip address&lt;br /&gt;- ssh      =&gt; connect with my file server where I save stage3 and portage etc.&lt;br /&gt; /etc/init.d/sshd start&lt;br /&gt; ssh 192.168.0.104&lt;br /&gt;&lt;br /&gt;2 prepare disks...&lt;br /&gt;- fdisk /dev/sda&lt;br /&gt; =&gt; /dev/sda1 for boot&lt;br /&gt; =&gt; /dev/sda2 for swap&lt;br /&gt; =&gt; /dev/sda3 for / (the root)&lt;br /&gt; mkfs.ext2 /dev/sda1&lt;br /&gt; mkfs.ext3 /dev/sda3&lt;br /&gt; mkswap /dev/sda2&lt;br /&gt; swapon /dev/sda2&lt;br /&gt; mount /dev/sda3 /mnt/gentoo&lt;br /&gt; mkdir /mnt/gentoo/boot&lt;br /&gt; mount /dev/sda1 /mnt/gentoo/boot&lt;br /&gt;&lt;br /&gt;3 install stage3 and portage&lt;br /&gt; scp -p -r 192.168.0.104:/root/gentoo .&lt;br /&gt; cd /mnt/gentoo&lt;br /&gt; tar xjpf stage3-&lt;&gt;.tar.bz2&lt;br /&gt; tar xjf portage-&lt;&gt;.tar.bz2 -C /mnt/gentoo/usr&lt;br /&gt;&lt;br /&gt;4. env setup&lt;br /&gt; vi /mnt/gentoo/etc/make.conf&lt;br /&gt; CFLAGS as "-O2 -march=prescott -fomit-frame-pointer -pipe"&lt;br /&gt; mirrorselect -i -o &gt;&gt; /mnt/gentoo/etc/make.conf&lt;br /&gt; cp -L /etc/resolv.conf  /mnt/gentoo/etc&lt;br /&gt; mount -t proc none /mnt/gentoo/proc&lt;br /&gt; mount -o bind /dev /mnt/gentoo/dev&lt;br /&gt; chroot /mnt/gentoo /bin/bash&lt;br /&gt; env-update&lt;br /&gt; source /etc/profile&lt;br /&gt; export PS1="{chroot} $PS1"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. emerge -sync --quiet&lt;br /&gt;  emerge vim lilo subversion&lt;br /&gt;&lt;br /&gt;6. vi /etc/fstab&lt;br /&gt;7. network&lt;br /&gt;  vi /etc/conf.d/hostname =&gt; "gentoovm"&lt;br /&gt;  vi /etc/conf.d/net =&gt; for dhcp: config_eth0="dhcp", but i did not set.&lt;br /&gt;  rc-update add net.eth0 default =&gt; boot eth0 as default&lt;br /&gt;  emerge dhcpcd =&gt; MUST&lt;br /&gt;  vi /etc/hosts&lt;br /&gt;  =&gt; 127.0.0.1 gentoovm.homenetwork gentoovm localhost&lt;br /&gt;&lt;br /&gt;8. System&lt;br /&gt;  passwd =&gt; MUST&lt;br /&gt;  useradd&lt;br /&gt;  emerge syslog-ng vixie-cron&lt;br /&gt;  rc-update add syslog-ng default&lt;br /&gt;  rc-update add vixie-cron default&lt;br /&gt;&lt;br /&gt;9. lilo&lt;br /&gt;  vi /etc/lilo.conf&lt;br /&gt;  prepare the default kernel (from ssh) and save to /boot&lt;br /&gt;  /sbin/lilo&lt;br /&gt;&lt;br /&gt;10 reboot&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8241486825871077366?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8241486825871077366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8241486825871077366'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/01/install-gentoo-vm-on-macbook-1.html' title='Install Gentoo VM  on Macbook -1'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-690624806082305554</id><published>2008-01-18T16:29:00.000-08:00</published><updated>2008-01-18T16:42:13.885-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='fvwm'/><title type='text'>xwd : capture window on linux</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_i_1T8dlgrVk/R5FE_Eh4WrI/AAAAAAAAADY/KLrOxhzQbik/s1600-h/icon.capture.0x1a00003.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_i_1T8dlgrVk/R5FE_Eh4WrI/AAAAAAAAADY/KLrOxhzQbik/s320/icon.capture.0x1a00003.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5156978898654223026" /&gt;&lt;/a&gt;&lt;br /&gt;xwd is the basic tool to do screen (or window) capture. I used it in my xw manager fvwm2. Here is a shot, but it seems not dump the title part of the window (gvim). Would like to find out the reason.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-690624806082305554?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/690624806082305554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/690624806082305554'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/01/xwd-capture-window-on-linux.html' title='xwd : capture window on linux'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_i_1T8dlgrVk/R5FE_Eh4WrI/AAAAAAAAADY/KLrOxhzQbik/s72-c/icon.capture.0x1a00003.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6362417940381167506</id><published>2008-01-16T09:39:00.000-08:00</published><updated>2008-01-16T10:00:30.767-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gnu'/><title type='text'>gcc - shared library</title><content type='html'>When I link the shared library in dynamic mode on FC5 (Fedoral Core 5), I got a failure when run my executables: "cannot restore segment prot after reloc: Permission denied", is it only happend on FC5?&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# make compile&lt;br /&gt;/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -x c++ -c -Wall -Wno-unknown-pragmas -fno-common -fbounds-check -pipe  -g  -Wno-deprecated -pipe -o foo.o foo.cpp&lt;br /&gt;/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -shared -o libfoo.so foo.o -lc&lt;br /&gt;/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-ar -rcs libfoo.a foo.o&lt;br /&gt;/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -x c++ -c -Wall -Wno-unknown-pragmas -fno-common -fbounds-check -pipe  -g  -Wno-deprecated -pipe -o test.o test.cpp&lt;br /&gt;/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -dynamic -L. -lfoo -o test test.o&lt;br /&gt;/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -static -L. -lfoo -o test.static test.o libfoo.a&lt;br /&gt;# ./test&lt;br /&gt;./test: error while loading shared libraries: ./libfoo.so: cannot restore segment prot after reloc: Permission d[...]&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here is the solution:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# chcon -t textrel_shlib_t ./libfoo.so&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6362417940381167506?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6362417940381167506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6362417940381167506'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/01/gcc-shared-library.html' title='gcc - shared library'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1688211084958271786</id><published>2008-01-09T13:45:00.000-08:00</published><updated>2008-01-09T14:42:46.515-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='cvs'/><title type='text'>version controls with cvs</title><content type='html'>0. I have a simple script to set my working CVSROOT. So when I work on it. I just run the script.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;. cvs.sh&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Here is cvs.sh script.(which is just 2 lines)&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;#! /bin/sh&lt;br /&gt;export CVSROOT=":pserver:user:192.168.10.7:2401/home/repository"&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;1. Create a branch with tag.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cvs co -P -d foo FOO&lt;br /&gt;cvs tag -b z_markc_unknown&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;To create a branch, you first need to check out the source code. here FOO is the module name and foo is the checkout directory.&lt;br /&gt;&lt;br /&gt;2. Work on a branch.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cvs co -P -d foo -r z_markc_unknown FOO&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3. Merge from a branch&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cd foo&lt;br /&gt;cvs update -j z_markc_1&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;It will merge the branch to where you currently work on (can be main trunk or a branch)&lt;br /&gt;&lt;br /&gt;4. Commit your changes&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cvs update&lt;br /&gt;cvs diff Makefile&lt;br /&gt;cvs commit Makefile &lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;When you merge the code from a branch, it does not commit yet, so you need to commit it.&lt;br /&gt;&lt;br /&gt;5. To delete a branch tag. (THIS SHOULD BE VERY CAREFUL!)&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cd foo&lt;br /&gt;cvs tag -dB z_markc_1&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1688211084958271786?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1688211084958271786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1688211084958271786'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/01/version-controls-with-cvs.html' title='version controls with cvs'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2820081157131748140</id><published>2008-01-08T13:30:00.000-08:00</published><updated>2008-10-24T12:27:14.488-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='embeded'/><title type='text'>Work on iPAQ 5550 PocketPC</title><content type='html'>Use the COM port to connect with PC. On Windows, HyperTerminal is perfact for the connection. In most time, it is desire to work on Linux,  here is the way to connect througth ssh on my Linux Host:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;ssh root@192.168.10.177&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;you need to get the ip address, user name and password to enter into the system.&lt;br /&gt;To find out the ip address, you can start the terminal in iPAQ (GPE installed), and type ifconfig.&lt;br /&gt;&lt;br /&gt;Copy files forth and back with scp on Linux Host:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;scp foo root@192.168.10.177:/home/root&lt;br /&gt;scp -p -r root@192.168.10.177:/home/root/foo foo&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Right now my iPAQ's ip address is connected to the wireless network, and is associated with an external ip address (NOT 192*), so it can not ping my internel network, but the linux host can ping the external ip address. That is why scp works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2820081157131748140?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2820081157131748140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2820081157131748140'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/01/work-on-ipaq-5550-pocketpc.html' title='Work on iPAQ 5550 PocketPC'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5746179785272008744</id><published>2008-01-06T07:00:00.000-08:00</published><updated>2008-01-06T07:10:27.377-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='slackware'/><title type='text'>slckware 12.0 - install Bitstream Vera Fonts</title><content type='html'>1. Download the font package from &lt;a href="http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Extract it&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cd /tmp&lt;br /&gt;tar xjf ~/Desktop/ttf-bitstream-vera-1.10.tar.bz2&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. Copy the font to ~/.fonts&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cp -r ttf-bitstream-vera-vera-1.10 ~/.fonts&lt;br /&gt;fc-cache -f -v ~/.fonts&lt;br /&gt;xset fp rehash&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now it's ready to use! just open gvim and select the font.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5746179785272008744?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5746179785272008744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5746179785272008744'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2008/01/slckware-120-install-bitstream-vera.html' title='slckware 12.0 - install Bitstream Vera Fonts'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3884035861054284470</id><published>2007-12-21T21:01:00.000-08:00</published><updated>2007-12-21T21:12:11.639-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><title type='text'>emacs - malloc_jumpstart() error</title><content type='html'>After upgrade to OS X Leopard (Currently 10.5.1), the default emacs version fails to start. I checked with Google, and find out how to do it.&lt;br /&gt;&lt;br /&gt;The problem is because my emacs version is still 21.X, need to update with dumpemacs.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;bash-3.2$ sudo mv /usr/bin/emacs-i386 /usr/bin/emacs-i386.orig&lt;br /&gt;bash-3.2$ /usr/libexec/dumpemacs -V&lt;br /&gt;22.1&lt;br /&gt;&lt;br /&gt;bash-3.2$ sudo /usr/libexec/dumpemacs -d&lt;br /&gt;Checking if emacs is up-to-date&lt;br /&gt;emacs is not up-to-date. Needs dumping&lt;br /&gt;...&lt;br /&gt;bash-3.2$ emacs --version&lt;br /&gt;GNU Emacs 22.1.1&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3884035861054284470?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3884035861054284470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3884035861054284470'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/emacs-mallocjumpstart-error.html' title='emacs - malloc_jumpstart() error'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7148875954558610219</id><published>2007-12-19T10:53:00.000-08:00</published><updated>2007-12-19T11:04:18.845-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cscope'/><title type='text'>cscope on windows</title><content type='html'>"cscope -bqR" failed on Windows, it does not prompt any message but when I do a search for a function with cscope, it always doesn't give me a happy message. Because my project is mainly a c++ project!!! It is confusion on Windows "-R" recusive just find c not cpp files.&lt;br /&gt;&lt;br /&gt;I need a extra script to generate "cscope.files", then generate cscope database.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;find . -name "*.cpp" -o -name "*.[ch]" &gt; cscope.files&lt;br /&gt;cscope -b -q&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;On linux, there is no such problems.&lt;br /&gt;&lt;br /&gt;And I also install "UnxUtils.zip" from &lt;a href="http://unxutils.sourceforge.net/"&gt;here&lt;/a&gt;, it provides basic gnu tools for win32.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7148875954558610219?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7148875954558610219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7148875954558610219'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/cscope-on-windows.html' title='cscope on windows'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-771754898061327358</id><published>2007-12-18T15:41:00.000-08:00</published><updated>2007-12-18T16:07:18.453-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vi'/><title type='text'>dsfoo - with vcscommand</title><content type='html'>As I check Google code, it works with &lt;a href="http://vim.sourceforge.net/scripts/script.php?script_id=90"&gt;vcscommand&lt;/a&gt; which is a vim plugin. &lt;br /&gt;&lt;br /&gt;For Windows user, to use Google code, has to install svn first, I download "svn-1.4.3-setup.exe" for the Windows version, and it works well with my vim. (Mostly I would like to use svn on Linux or Mac platform, but I also need my vim work on Windows)&lt;br /&gt;&lt;br /&gt;using vcscommand with vim is quite simple.&lt;br /&gt;&lt;br /&gt;- install vcscommand to vim 7.0&lt;br /&gt;- checkout dsfoo with svn (demonstrates with my previous blog)&lt;br /&gt;- find help :help vcscommand, the document is great!&lt;br /&gt;- :VCSLog, :VCSDiff check the log and difference, use zz to close the buffer.&lt;br /&gt;- :VCSCommit -m "commit..." will commit current file in vim, quite easy!&lt;br /&gt;&lt;br /&gt;Note vcscommand is not only work with svn, it also works with cvs, the baseline is after you checkout the source code, you can edit the source code with vim, and commit any changes in vim.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-771754898061327358?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/771754898061327358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/771754898061327358'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/dsfoo-with-vcscommand.html' title='dsfoo - with vcscommand'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5281009265432276796</id><published>2007-12-18T14:05:00.000-08:00</published><updated>2008-01-04T16:26:46.859-08:00</updated><title type='text'>dsfoo on Google Code</title><content type='html'>Today, I found Google provides hosting for open source project, so I just create a project -- &lt;a href="http://code.google.com/p/dsfoo"&gt;dsfoo&lt;/a&gt;, to host some of my programming notes, scripts and code for share in the Internet.&lt;br /&gt;&lt;br /&gt;To check out with anonymous...&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;svn checkout http://dsfoo.googlecode.com/svn/trunk dsfoo-read-only&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Myself, to import...&lt;br /&gt;&lt;blockquote&gt;$ svn import -m "import..." ./turing https://dsfoo.googlecode/svn/trunk&lt;br /&gt;Adding   turing/turing_first.sed&lt;br /&gt;Adding   turing/README.turing_first&lt;br /&gt;&lt;br /&gt;Committed revision 2.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;to checkout and checkin...&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;$ svn checkout https://dsfoo.googlecode.com/svn/trunk dsfoo --username dsmarkchen&lt;br /&gt;...&lt;br /&gt;$ svn commit -m "update README..." dsfoo --username dsmarkchen&lt;br /&gt;Sending dsfoo/README.turing_first&lt;br /&gt;Transmitting file data.&lt;br /&gt;Committed revision 3.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And check the log...&lt;br /&gt;&lt;blockquote&gt;$ svn log ./dsfoo&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5281009265432276796?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5281009265432276796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5281009265432276796'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/dsfoo-on-google-code.html' title='dsfoo on Google Code'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7276415333451631316</id><published>2007-12-13T20:22:00.000-08:00</published><updated>2007-12-13T20:43:28.945-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><title type='text'>Mac - Terminal font</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_i_1T8dlgrVk/R2IFeUh4WqI/AAAAAAAAACk/mydBUS1Hmxg/s1600-h/Picture+5.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_i_1T8dlgrVk/R2IFeUh4WqI/AAAAAAAAACk/mydBUS1Hmxg/s320/Picture+5.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5143679742875556514" /&gt;&lt;/a&gt;&lt;br /&gt;The default Terminal font on Mac is Monaco 10pt, but I am a little missed with the font with Linux (xorg 7.0), so I make a little search, to try some other fonts, and find the bitstream Vera Mono 10pt is quite the same with the Linux, and "bitstream-vera" is gnome's free font, so it is free for me to use. Great.&lt;br /&gt;&lt;br /&gt;Download font to Mac is not very hard, First download the package of the font and open it which extracts the ttf file (I did it with FireFox), and with the Finder, I can open the ttf file by double click on the file itself, it brings up the font text demo with a button "install the font", so I just click on the button and it will do what it is supposed to do. Super easy!&lt;br /&gt;&lt;br /&gt;Then with Terminal Preference, I can select the font to use, and should be enable "antialias text" (the default is disabled that makes the monospaced font ugly), and if I choose black as background, I have to change opacity to 100% as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7276415333451631316?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7276415333451631316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7276415333451631316'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/mac-terminal-font.html' title='Mac - Terminal font'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_i_1T8dlgrVk/R2IFeUh4WqI/AAAAAAAAACk/mydBUS1Hmxg/s72-c/Picture+5.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7551582747074386595</id><published>2007-12-07T12:08:00.000-08:00</published><updated>2007-12-07T12:33:07.821-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vi'/><title type='text'>switch to vi</title><content type='html'>It's been a big decision to switch to vi. I have been using emacs for 10 years, it helps me on all the platforms from Windows, Linux to Mac OS X. Emacs lisp is such a powerful language which makes emacs so extensible. I would be miss the use of calender and diary, eshell, and xcscope with emacs.&lt;br /&gt;&lt;br /&gt;Switching does not mean emacs is bad, may be I will change back to emacs if failed on vi, it's more like the personal taste. As I learned in these days, cscope, sed, the LaunchBar instead of QuickSilver, I feel I am more fond of "efficiency" instead of beauty.&lt;br /&gt;&lt;br /&gt;I still didn't totally change to vi because of the gap of learning vi. Here is some notes I would like to share.&lt;br /&gt;&lt;br /&gt;1. open file in vim. I learn vim from tutor, it shows :r to read file content to current file buffer, but did not show me how to open a file to a buffer compared with emacs's ctrl-x ctrl-f command. Here is the result :e with a file name will open the file.&lt;br /&gt;&lt;br /&gt;2. text column. As the first experience, I enter some text, but find a line is more than 80 charactors if I don't hit cr to change to a new line, and it is a little annoying. Here is the result :set tw=80 will set textwidth to 80.&lt;br /&gt;&lt;br /&gt;3. vimrc. Where is the location of vimrc? It is different on all the platforms, to find it the best way is use :version. In windows, it $VIM/.vimrc, on Linux it is ~/.vim/.vimrc, while on mac os x, it is "~/.vimrc".&lt;br /&gt;&lt;br /&gt;4. The insert mode and the normal mode. Still a long way to get used to the normal mode, why the default is set to the normal mode instead of the insert mode? Also learning key strokes on normal mode, for instance, y is for copy, p is for paste, d is for delete and / for search, blah blah.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7551582747074386595?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7551582747074386595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7551582747074386595'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/switch-to-vi.html' title='switch to vi'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8182772308172401421</id><published>2007-12-03T20:33:00.000-08:00</published><updated>2007-12-03T20:44:38.241-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><category scheme='http://www.blogger.com/atom/ns#' term='sed'/><title type='text'>gnu sed on mac</title><content type='html'>I found the default sed tool on my MacBook is a bsd version instead of the gnu version, and my Turing machine script can not run with the bsd sed:-(, there are too many differences, so I have to build gnu sed on my Mac.&lt;br /&gt;&lt;br /&gt;First download the source code from &lt;a href="http://ftp.gnu.org/gnu/sed"&gt;here&lt;/a&gt;, currently I am using the version 4.1.4, and 4.1.5 is broken for "install_sh" dependency. &lt;br /&gt;&lt;br /&gt;Build sed with:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;./configure --prefix=/opt/markc&lt;br /&gt;make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Then sed is ready to use, but make sure the path /opt/markc/bin is in PATH environment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8182772308172401421?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8182772308172401421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8182772308172401421'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/gnu-sed-on-mac.html' title='gnu sed on mac'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4963547104584333199</id><published>2007-12-03T12:26:00.000-08:00</published><updated>2007-12-03T12:51:16.050-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='sed'/><title type='text'>Turing's Very First Example (with sed)</title><content type='html'>I have fun with sed and &lt;a href="http://en.wikipedia.org/wiki/Turing_machine"&gt;Turing Machine&lt;/a&gt;. It is pleasure to digg into sed, to find out the powerful features by sed. To me, sed is not just a tool for string find and replacement, but also &lt;a href="http://en.wikipedia.org/wiki/Turing_completeness"&gt;Turing-Complete&lt;/a&gt;, that means sed is programable, the best way to prove it is to construct a Turing Machine. What I choose here is Turing's very first example by Alan Turing, so I can learn Turing Theory.&lt;br /&gt;&lt;br /&gt;The following is my coding with seds, I implement the 4 state (b c e f) table, and use "_" to identify the head position, "$" to identify the end of tap cells and "*" for blank symbols on the tap.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;# Turing's very first example&lt;br /&gt;&lt;br /&gt;# check input&lt;br /&gt;/^_\?[\*]*$/! b error&lt;br /&gt;&lt;br /&gt;# start from first&lt;br /&gt;s/^\*/_/&lt;br /&gt;s/\([_\*]\)$/\1\$/&lt;br /&gt;&lt;br /&gt;# b blank P0,R c&lt;br /&gt;: b&lt;br /&gt;h&lt;br /&gt;s/^/b /&lt;br /&gt;p&lt;br /&gt;g&lt;br /&gt;&lt;br /&gt;/_/ {&lt;br /&gt;# write 0&lt;br /&gt;s/_/0/&lt;br /&gt;&lt;br /&gt;# move right&lt;br /&gt;s/0\*/0_/&lt;br /&gt;&lt;br /&gt;/0\$$/ b H&lt;br /&gt;&lt;br /&gt;b c&lt;br /&gt;}&lt;br /&gt;b error&lt;br /&gt;&lt;br /&gt;: c&lt;br /&gt;h&lt;br /&gt;s/^/c /&lt;br /&gt;p&lt;br /&gt;g &lt;br /&gt;&lt;br /&gt;/_/ {&lt;br /&gt;# print blank&lt;br /&gt;s/_/ /&lt;br /&gt;# right&lt;br /&gt;s/ \*/ _/&lt;br /&gt;&lt;br /&gt;/ \$$/ b H&lt;br /&gt;b e&lt;br /&gt;}&lt;br /&gt;b error&lt;br /&gt;&lt;br /&gt;: e&lt;br /&gt;h&lt;br /&gt;s/^/e /&lt;br /&gt;p&lt;br /&gt;g &lt;br /&gt;&lt;br /&gt;/_/ {&lt;br /&gt;# print one&lt;br /&gt;s/_/1/&lt;br /&gt;# turn right&lt;br /&gt;s/1\*/1_/&lt;br /&gt;&lt;br /&gt;/1\$$/ b H&lt;br /&gt;b f&lt;br /&gt;}&lt;br /&gt;b error&lt;br /&gt;&lt;br /&gt;: f&lt;br /&gt;&lt;br /&gt;h&lt;br /&gt;s/^/f /&lt;br /&gt;p&lt;br /&gt;g &lt;br /&gt;&lt;br /&gt;/_/ {&lt;br /&gt;# print blank&lt;br /&gt;s/_/ /&lt;br /&gt;# right&lt;br /&gt;&lt;br /&gt;s/ \*/ _/&lt;br /&gt;&lt;br /&gt;/ \$$/ b H&lt;br /&gt;b b&lt;br /&gt;}&lt;br /&gt;b error&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;: error&lt;br /&gt;s/^/error with turing machine/&lt;br /&gt;&lt;br /&gt;q 1&lt;br /&gt;&lt;br /&gt;: H&lt;br /&gt;s/^/= /&lt;br /&gt;s/\$$//&lt;br /&gt;q 0&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And the output:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt; # echo "********" | sed -f Turing_first.sed &lt;br /&gt;b _*******$&lt;br /&gt;c 0_******$&lt;br /&gt;e 0 _*****$&lt;br /&gt;f 0 1_****$&lt;br /&gt;b 0 1 _***$&lt;br /&gt;c 0 1 0_**$&lt;br /&gt;e 0 1 0 _*$&lt;br /&gt;f 0 1 0 1_$&lt;br /&gt;= 0 1 0 1 &lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4963547104584333199?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4963547104584333199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4963547104584333199'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/12/turings-very-first-example-with-sed.html' title='Turing&apos;s Very First Example (with sed)'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8958989226731741510</id><published>2007-11-29T18:15:00.000-08:00</published><updated>2007-11-29T18:29:55.052-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><title type='text'>xbench on my macbook - 105.18</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_i_1T8dlgrVk/R091h-AVkmI/AAAAAAAAACc/214HZ9d4zpo/s1600-R/Picture+2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_i_1T8dlgrVk/R091h-AVkmI/AAAAAAAAACc/Ad6un6YlaQ0/s320/Picture+2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5138454926293570146" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I run xbench on my macbook and got the score 105.18.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8958989226731741510?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8958989226731741510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8958989226731741510'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/xbench-on-my-macbook-10518.html' title='xbench on my macbook - 105.18'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_i_1T8dlgrVk/R091h-AVkmI/AAAAAAAAACc/Ad6un6YlaQ0/s72-c/Picture+2.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-8557234229266684867</id><published>2007-11-29T12:18:00.000-08:00</published><updated>2007-11-29T13:18:19.520-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><title type='text'>Seven steps to write a functioning Makefile</title><content type='html'>In my opinion, writing a Makefile is not simple, it sometimes can be more complicated if you want to your code compiled with different compilers, different running environments or targets, and different builds to support diffent features. A Makefile can accept shell or sed scripts, it makes the building process more advance. Today, I just want to cover the basic part of Makefile, or the parts I am using for a Makefile.&lt;br /&gt;&lt;br /&gt;First define directory variables, you specifies this to tell `make' where is your project?&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;PROJECT_ROOT_DIR  = /devel/src/foo&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Second, specify the common compiler settings, most of my time is build for embedded target, so here is the code:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;export ARCH  :=arm&lt;br /&gt;export CROSS_COMPILE := arm-linux-&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Include make variables (CC, etc...)&lt;br /&gt;#&lt;br /&gt;ASM := $(CROSS_COMPILE)as&lt;br /&gt;LD := $(CROSS_COMPILE)ld&lt;br /&gt;CC := $(CROSS_COMPILE)gcc&lt;br /&gt;CXX     := $(CROSS_COMPILE)g++&lt;br /&gt;AR := $(CROSS_COMPILE)ar&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;3rd, specifies the source code compileing rules, how you compile c++ or c code. The rules will make the later life easier&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;%.o : %.cpp&lt;br /&gt; $(CXX) $(CXXFLAGS) -c -o $@ $&lt;&lt;br /&gt;&lt;br /&gt;%.o : %.c&lt;br /&gt; $(CC) $(CFLAGS) -c -o $@ $&lt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Fourth, is more specific compiling setting, you define CFLAGS, CXXFLAGS, or LDFLAGS,  so you specify what header directory to include, you specify what library to link, you also specify "-g" for debug, and how you want the compiler post warning message etc.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;CFLAGS += -I$(PROJECT_ROOT_DIR)/include &lt;br /&gt;CFLAGS += -I$(INCLS) -D_FOO_=1 -g&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Fiveth, now you can provide the basic feature you want in the Makefile. Here is the sample:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;compile: libfoo foo_bin&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;You want the user use "make compile" for build foo.&lt;br /&gt;&lt;br /&gt;Sixth, specifiy all source code you build in seperate directories.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;SRCS_FOO_DIR =  $(PROJECT_ROOT_DIR)/src&lt;br /&gt;SRCS_FOO =  $(SRCS_FOO_DIR)/util_arm.s \&lt;br /&gt; $(SRCS_FOO_DIR)/foo_info.c  \&lt;br /&gt; $(SRCS_FOO_DIR)/foo_main.c $(FOO_SRC_DIR)/foo_help.c &lt;br /&gt;OBJS_FOO = $(patsubst %.s,%.o, $(patsubst %.c,%.o, $(SRCS_FOO)))&lt;br /&gt;$(OBJS_FOO) : INCLS=-I$(SRCS_FOO_DIR)&lt;br /&gt;&lt;br /&gt;SRCS_GST_DIR = $(PROJECT_ROOT_DIR)/gst&lt;br /&gt;SRCS_GST = $(SRCS_GST_DIR)/gst.c&lt;br /&gt;OBJS_GST = $(SRCS_GST:.c=.o)&lt;br /&gt;$(OBJS_GST) : INCLS=-I$(SRCS_GST_DIR)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Seventh, now weave them together.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;libfoo : $(OBJS_FOO) $(OBJS_GST)&lt;br /&gt; $(CC)  $(CFLAGS) -shared -o $@.so $^&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;For now, the Makefile is done, to add "clean" feature, is quite simple based the content from here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-8557234229266684867?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8557234229266684867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/8557234229266684867'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/seven-steps-to-write-functioning.html' title='Seven steps to write a functioning Makefile'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2783435170862166995</id><published>2007-11-28T11:23:00.000-08:00</published><updated>2007-11-28T11:30:32.100-08:00</updated><title type='text'>Marvell</title><content type='html'>&lt;blockquote&gt;&lt;br /&gt;After the close of trading on Tuesday, Marvell Technology's  (nasdaq: MRVL -  news  -  people ) reported a third-quarter loss of $6.4 million, or 1 cent per share, compared to a profit of $6 million, or 1 cent per share in the similar period a year ago.&lt;br /&gt;&lt;br /&gt;Investors took notice, pushing Marvell's stock down 7.3%, or $1.22, to $15.43, in Wednesday morning trading.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I quote this from &lt;a href="http://www.forbes.com/2007/11/28/marvell-technology-semiconductors-markets-equity-cx_ml_1128markets17.html?partner=yahootix"&gt;here&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;What happens to Marvell today, I am not sure, it seems Marvell is sold to another big company, Intel? But any way the cut-off the work force is started, some on-going projects are dead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2783435170862166995?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2783435170862166995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2783435170862166995'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/marvell.html' title='Marvell'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4592464819209291375</id><published>2007-11-21T11:12:00.000-08:00</published><updated>2007-11-21T11:36:42.915-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><title type='text'>LaunchBar</title><content type='html'>I am using LaunchBar on my Mac, it is $20 for a single user, but it is worth for the cost, I see spotlight from Leopard can do the same kind of job as LaunchBar does, but I still choose LB on my everyday basis use because LaunchBar is more fast -- Actually I only use Mac at night after work.&lt;br /&gt;&lt;br /&gt;Here is a video shows the basic usage of LaunchBar.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/6w_vkIItEb4&amp;rel=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/6w_vkIItEb4&amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Here is my experience, basically I am using LB to launch applications, I can launch application from Finder Application directory, or click an application to run from the Dock but I don't want to a long list of applications in the dock, I want the dock to be simple. so I feel use LB is the best choice for me. The second thing with LB is browse the internet, I found LB remembers well bookmarks of Safari or Firefox, so if I wanna quick goes to the website I have to save the site to bookmarks of my Firefox as an example, otherwise LB will have no way to remember. But I am using &lt;a href="http://del.icio.us/ifade"&gt;delicous&lt;/a&gt; a lot, the hard thing for LB is it is not supported to the share society bookmarks, still did not try delicious2Safari (correct me if the name is not correct). There is some other beautiful functions by LB explained on the video, but I did not have a chance to use it. &lt;br /&gt;&lt;br /&gt;At last, I think the experience will grows with using LB.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4592464819209291375?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4592464819209291375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4592464819209291375'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/launchbar.html' title='LaunchBar'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7299957181999419446</id><published>2007-11-13T12:33:00.000-08:00</published><updated>2007-11-13T12:44:44.269-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><title type='text'>script - create package</title><content type='html'>Today I write a shell script that is used to create project package, so I can backup easily. There are two features I want the script supports, one is have a date stamp automatically generated, second in the source code directory I want to filter only c source code, for instance just have c and h file.&lt;br /&gt;&lt;br /&gt;Here is the script:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;export PROJECT_NAME=foo&lt;br /&gt;export PROJECT_PATH=/devel/project&lt;br /&gt;export PROJECT_SRC_PATH=$PROJECT_PATH/src&lt;br /&gt;export DATESTAMP=`date +%d%b%Y`&lt;br /&gt;&lt;br /&gt;cd $PROJECT_SRC_PATH&lt;br /&gt;tar czf $PROJECT_NAME-$DATESTAMP.tar.gz ./Makefile.arm-linux ./plugin/*.[ch] ./application/*.c&lt;br /&gt;&lt;br /&gt;echo "DONE!"&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7299957181999419446?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7299957181999419446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7299957181999419446'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/script-create-package.html' title='script - create package'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4195945479380543731</id><published>2007-11-06T10:55:00.000-08:00</published><updated>2007-11-06T11:02:32.398-08:00</updated><title type='text'>Slackware-Current.Net</title><content type='html'>I found this site several days ago, then try to download gstreamer from there, but guess what happened, it just contains the core of gstreamer, but without the build of the plugins, it is just a crap, I try to loggin to its forum and can not get into it. I found plugins from slacky.it, but the plugins did not work with the crap streamer from the site, so I remove the crap and install slacky's gstreamer and it it works.&lt;br /&gt;&lt;br /&gt;Today I found the following quote from this site, I recommend any slack user will never go to this site until its construction is ready !!!&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;** Because of the many false package requests (over 300 were incorrect), I had to clean the requests db table.PLEASE, report ONLY the packages that really have newer versions! If a package doesn't runs for you, check the dependent libraries, and download them. If it still doesn't work, use the forum to tell me what you get and why I should rebuild it. Recently I don't have much time for this site :( **&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4195945479380543731?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4195945479380543731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4195945479380543731'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/slackware-currentnet.html' title='Slackware-Current.Net'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2113005500465023743</id><published>2007-11-05T13:35:00.000-08:00</published><updated>2007-11-05T13:54:15.930-08:00</updated><title type='text'>ALSA and Gstreamer on Linux</title><content type='html'>First, check alsa in the kernel or not.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;/root/wiki/web # cat /proc/asound/cards&lt;br /&gt; 0 [AudioPCI       ]: ENS1371 - Ensoniq AudioPCI&lt;br /&gt;                      Ensoniq AudioPCI ENS1371 at 0x1400, irq 18&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Second, use amixer to understand your audio device.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;~/.gstreamer-0.10 # amixer info&lt;br /&gt;Card default 'AudioPCI'/'Ensoniq AudioPCI ENS1371 at 0x1400, irq 18'&lt;br /&gt;  Mixer name : 'Cirrus Logic CS4297A rev 3'&lt;br /&gt;  Components : 'AC97a:43525913'&lt;br /&gt;  Controls      : 24&lt;br /&gt;  Simple ctrls  : 13&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And the controls.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;~/.gstreamer-0.10 # amixer controls&lt;br /&gt;numid=1,iface=MIXER,name='Master Playback Switch'&lt;br /&gt;numid=2,iface=MIXER,name='Master Playback Volume'&lt;br /&gt;numid=16,iface=MIXER,name='PCM Playback Switch'&lt;br /&gt;numid=17,iface=MIXER,name='PCM Playback Volume'&lt;br /&gt;numid=8,iface=MIXER,name='Line Playback Switch'&lt;br /&gt;numid=9,iface=MIXER,name='Line Playback Volume'&lt;br /&gt;numid=10,iface=MIXER,name='CD Playback Switch'&lt;br /&gt;numid=11,iface=MIXER,name='CD Playback Volume'&lt;br /&gt;numid=7,iface=MIXER,name='Mic Boost (+20dB)'&lt;br /&gt;numid=5,iface=MIXER,name='Mic Playback Switch'&lt;br /&gt;numid=6,iface=MIXER,name='Mic Playback Volume'&lt;br /&gt;numid=3,iface=MIXER,name='Phone Playback Switch'&lt;br /&gt;numid=4,iface=MIXER,name='Phone Playback Volume'&lt;br /&gt;numid=12,iface=MIXER,name='Video Playback Switch'&lt;br /&gt;numid=13,iface=MIXER,name='Video Playback Volume'&lt;br /&gt;numid=14,iface=MIXER,name='Aux Playback Switch'&lt;br /&gt;numid=15,iface=MIXER,name='Aux Playback Volume'&lt;br /&gt;numid=18,iface=MIXER,name='Capture Source'&lt;br /&gt;numid=19,iface=MIXER,name='Capture Switch'&lt;br /&gt;numid=20,iface=MIXER,name='Capture Volume'&lt;br /&gt;numid=21,iface=MIXER,name='IEC958 Playback Con Mask'&lt;br /&gt;numid=22,iface=MIXER,name='IEC958 Playback Pro Mask'&lt;br /&gt;numid=23,iface=MIXER,name='IEC958 Playback Default'&lt;br /&gt;numid=24,iface=MIXER,name='IEC958 Playback Switch'&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then find out how to change the volume with amixer.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;~/.gstreamer-0.10 # amixer cset iface=MIXER,name='Master Playback Volume' 45&lt;br /&gt;numid=2,iface=MIXER,name='Master Playback Volume'&lt;br /&gt;  ; type=INTEGER,access=rw---,values=2,min=0,max=63,step=0&lt;br /&gt;  : values=45,45&lt;br /&gt;~/.gstreamer-0.10 # amixer cget iface=MIXER,name='Master Playback Volume' &lt;br /&gt;numid=2,iface=MIXER,name='Master Playback Volume'&lt;br /&gt;  ; type=INTEGER,access=rw---,values=2,min=0,max=63,step=0&lt;br /&gt;  : values=45,45&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Then use aplay to test a stereo wav samples.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;~/.gstreamer-0.10 # aplay ~/Desktop/nelly_raw_225.wav&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Till now we can say alsa is ok if aplay works. Now let's play with gstreamer.&lt;br /&gt;I am using gstreamer-0.10 it is the current release. &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;gst-launch-0.10 -v fakesrc num-buffers=8 ! fakesink&lt;br /&gt;gst-launch-0.10 -v audiotestsrc ! audioconvert ! audioresample ! osssink&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;One import thing is use "gst-inspect | grep -i wavparse" if I want to know wavparse is ready with my gstreamer. Also directly check the xml in "~/.gstreamer-0.10" is acceptable.&lt;br /&gt;&lt;br /&gt;Then use gstreamer to play the same wave file.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;gst-launch-0.10 filesrc location=~/Desktop/nelly_raw_225.wav !&lt;br /&gt;wavparse ! audioconvert ! audioresample ! osssink&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Hopefully gstreamer works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2113005500465023743?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2113005500465023743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2113005500465023743'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/11/alsa-and-gstreamer-on-linux.html' title='ALSA and Gstreamer on Linux'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4588502041810193873</id><published>2007-10-31T10:18:00.000-07:00</published><updated>2007-10-31T10:45:42.386-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='slackware'/><category scheme='http://www.blogger.com/atom/ns#' term='vmware'/><title type='text'>slackware 12 - on macbook</title><content type='html'>I install VMware fusion to my mac book, thus I can install other OS to my macbook, I am choosing slackware 12, the installation of slackware is quite simple. But to install VMWare tool is a little tricky, I never make it work before, because I don't know what to do when I see the menu item change to "cancell vmtool installation" and it hangs there forever. Now I know is just mount /dev/cdrom to /mnt/cdrom to run the install package from 'virtual' cdrom.   &lt;br /&gt;&lt;br /&gt;And to make vmtool install successfull, I have to install &lt;a href="ftp://ftp.kernel.org/pub/linux/libs/pam/pre/library/"&gt;pam&lt;/a&gt; first, here is the build script:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;./configure --prefix=/usr/local --sysconfdir=/etc&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;ldconfig&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;also mkdir /etc/pam.d used by vmware tool, &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cat &lt;&lt; EOF &gt; /etc/pam.d/vmware-authd&lt;br /&gt;#%PAM-1.0&lt;br /&gt;auth required /usr/local/lib/security/pam_unix.so shadow nullok&lt;br /&gt;auth required /usr/local/lib/security/pam_nologin.so&lt;br /&gt;account required /usr/local/lib/security/pam_unix.so&lt;br /&gt;EOF &lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;In case there are some problems, here is the way on use vmxnet driver&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cp /etc/rc.d/rc.inet1 /etc/init.d/network&lt;br /&gt;cp /etc/rc.d/rc.inet1 /etc/init.d/networking&lt;br /&gt;/usr/bin/vmware-config.pl&lt;br /&gt;&lt;br /&gt;/etc/init.d/network stop&lt;br /&gt;rmmod pcnet32&lt;br /&gt;rmmod vmxnet&lt;br /&gt;modprobe vmxnet&lt;br /&gt;/etc/init.d/network start&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now it is time to enjoy vmware-toolbox!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4588502041810193873?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4588502041810193873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4588502041810193873'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/slackware-12-on-macbook.html' title='slackware 12 - on macbook'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-9118436503849915806</id><published>2007-10-29T11:24:00.000-07:00</published><updated>2007-10-29T11:43:18.574-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='embeded'/><title type='text'>tftp - on marvell device</title><content type='html'>My marvell device(PXA300) seems only work on static ip. I use HyperTerminal as emulator on Windows, with ifconfig, I got "192.168.1.101", while my workstation ip is 192.168.10.130, and my vmware Fedora Core 5 is 192.168.100.129. I don't know how to connect the device to my linux host, but here is how it works on my workstation. &lt;br /&gt;&lt;br /&gt;- I change my workstation ip to "192.168.1.102", gateway to "192.168.1.100"&lt;br /&gt;- Then on HyperTerminal, I can "ping 192.168.1.102", and on workstation I can "ping 192.168.1.101"&lt;br /&gt;- On workstation(XP), I download and install tftp server. (Let google help to find one)&lt;br /&gt;- Setup tftp, that is, start or stop tftp server, I would say my tftp server is local.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_i_1T8dlgrVk/RyYnux-mSwI/AAAAAAAAACA/7Af2LeXbmF8/s1600-h/config-tftp.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_i_1T8dlgrVk/RyYnux-mSwI/AAAAAAAAACA/7Af2LeXbmF8/s200/config-tftp.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5126828910451247874" /&gt;&lt;/a&gt;&lt;br /&gt;- on HyperTerminal:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;tftp -p -r blah 192.168.1.102 (send blah to workstation)&lt;br /&gt;tftp -g -r clock.txt 192.168.1.102 (get clock.txt from workstation)&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-9118436503849915806?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9118436503849915806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9118436503849915806'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/tftp-on-marvell-device.html' title='tftp - on marvell device'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_i_1T8dlgrVk/RyYnux-mSwI/AAAAAAAAACA/7Af2LeXbmF8/s72-c/config-tftp.JPG' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-722820987084650177</id><published>2007-10-26T16:36:00.000-07:00</published><updated>2007-10-26T16:38:37.425-07:00</updated><title type='text'>cscope - setup</title><content type='html'>Here is the setting in my .emacs&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;(require 'xcscope)&lt;br /&gt;(setq cscope-do-not-update-database t)&lt;br /&gt;(setq cscope-initial-directory "/path/of/src")&lt;br /&gt;&lt;br /&gt;(define-key global-map [(ctrl f3)]  'cscope-set-initial-directory)&lt;br /&gt;(define-key global-map [(ctrl f4)]  'cscope-unset-initial-directory)&lt;br /&gt;(define-key global-map [(ctrl f5)]  'cscope-find-this-symbol)&lt;br /&gt;(define-key global-map [(ctrl f6)]  'cscope-find-global-definition)&lt;br /&gt;(define-key global-map [(ctrl f7)]&lt;br /&gt;  'cscope-find-global-definition-no-prompting)&lt;br /&gt;(define-key global-map [(ctrl f8)]  'cscope-pop-mark)&lt;br /&gt;(define-key global-map [(ctrl f9)]  'cscope-next-symbol)&lt;br /&gt;(define-key global-map [(ctrl f10)] 'cscope-next-file)&lt;br /&gt;(define-key global-map [(ctrl f11)] 'cscope-prev-symbol)&lt;br /&gt;(define-key global-map [(ctrl f12)] 'cscope-prev-file)&lt;br /&gt;(define-key global-map [(meta f9)]  'cscope-display-buffer)&lt;br /&gt;(define-key global-map [(meta f10)] 'cscope-display-buffer-toggle)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-722820987084650177?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/722820987084650177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/722820987084650177'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/cscope-setup.html' title='cscope - setup'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5680816992456171065</id><published>2007-10-26T11:12:00.000-07:00</published><updated>2007-10-26T11:26:47.068-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lisp'/><title type='text'>Common Lisp - startup</title><content type='html'>1 Pick up a Lisp implementation.&lt;br /&gt;&lt;br /&gt;- sbcl (my current choice)&lt;br /&gt;- OpenMCL, but I am not sure OpenMCL is dieing or NOT (I would like to give it a try on my MacBook.)&lt;br /&gt;&lt;br /&gt;2 Setup development&lt;br /&gt;&lt;br /&gt;- slime (always using the cvs version, from Marco's &lt;a href="http://common-lisp.net/movies/slime.mov"&gt;slime &lt;/a&gt; movie.&lt;br /&gt;- Emacs (I would choose carbon Emacs instead of aquamacs, build Emacs from cvs is also an option, but I got a failure, is that a bug in current development version)&lt;br /&gt;&lt;br /&gt;3 Tutorial&lt;br /&gt;&lt;br /&gt;- &lt;a href="http://common-lisp.net/movies/slime.mov"&gt;slime movie&lt;/a&gt;, rich on coding and debugging with slime, also with Emacs tricks I never know!&lt;br /&gt;- &lt;a href="http://www.gigamonkeys.com/book/"&gt;Practial Common Lisp&lt;/a&gt; (suggest by David Steuber)&lt;br /&gt;- ANSI Common Lisp by Paul Graham (I own this book)&lt;br /&gt;&lt;br /&gt;4 Community&lt;br /&gt;&lt;br /&gt;- usenet comp.lang.lisp&lt;br /&gt;- #lisp on irc.freenode.net&lt;br /&gt;&lt;br /&gt;5 Where to start next&lt;br /&gt;&lt;br /&gt;- time (1 or 2 hours quite time on MacBook)&lt;br /&gt;- starter project (programming on lisp - algorithm first Red black tree)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5680816992456171065?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5680816992456171065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5680816992456171065'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/common-lisp-startup.html' title='Common Lisp - startup'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4844736253411873678</id><published>2007-10-24T10:25:00.000-07:00</published><updated>2007-10-24T10:38:40.333-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='vmware'/><title type='text'>VMWare - allocate disk space</title><content type='html'>Today I need to add another free disk for my new project, and &lt;a href="http://dsmarkchen.blogspot.com/2007/07/vmware-add-new-disk.html"&gt;my previous blog &lt;/a&gt; still works. Here is the steps, I am writing to create a new scsi virtual disk.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;1. use vmware workstation to create a new disk 8G, and allocate spaces as well.&lt;br /&gt;&lt;br /&gt;2. Start Fedora Core 5, run a terminal.&lt;br /&gt;&lt;br /&gt;3. "fdisk -l /dev/sdc" to list the hard disk information, here there is no sdc1 sdc2 etc.&lt;br /&gt;&lt;br /&gt;4. "fdisk /dev/sdc" to create a new primary disk with "n", use the all space for sdc1.&lt;br /&gt;&lt;br /&gt;5. "mkfs.ext3 /dev/sdc1" to format the disk to ext3 format.&lt;br /&gt;&lt;br /&gt;6. edit /etc/fstab, add a line "/dev/sdc1 /opt/marvell ext3 defaults 0 2".&lt;br /&gt;   &lt;br /&gt;7. Then I can mount /dev/sdc1 by "mount /dev/sdc1", but make sure the empty directory  /opt/marvell is created first.&lt;br /&gt;&lt;br /&gt;8. use "df" to check.&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4844736253411873678?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4844736253411873678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4844736253411873678'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/vmware-allocate-disk-space.html' title='VMWare - allocate disk space'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-2158784951964588610</id><published>2007-10-20T21:53:00.001-07:00</published><updated>2007-10-20T22:23:16.779-07:00</updated><title type='text'>New MacBook</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_i_1T8dlgrVk/Rxrbd056NLI/AAAAAAAAAB4/x3QMlEFQavo/s1600-h/Photo+2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_i_1T8dlgrVk/Rxrbd056NLI/AAAAAAAAAB4/x3QMlEFQavo/s200/Photo+2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5123648831551583410" /&gt;&lt;/a&gt;&lt;br /&gt;I don't want to wait 6 days for Leopard release, so last night I head to futureshop to buy a new MacBook which is 2.16GHz Due Core and 1G Memory. The new one is great, its LCD is the best compared to my previous used laptops, my first ibook's LCD is a tragedy I think.&lt;br /&gt;I have installed and played a lot on my MacBook, Firefox, LaunchBar, MacPorts, Emacs. Now I am maily working on to make Common Lisp on Mac OSX.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-2158784951964588610?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2158784951964588610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/2158784951964588610'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/new-macbook.html' title='New MacBook'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_i_1T8dlgrVk/Rxrbd056NLI/AAAAAAAAAB4/x3QMlEFQavo/s72-c/Photo+2.jpg' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4454498655856647285</id><published>2007-10-19T08:55:00.000-07:00</published><updated>2007-10-19T09:03:18.028-07:00</updated><title type='text'>date</title><content type='html'>I found my time is wrong on my FC5.  I run "date" and get the following result while I am in October.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Sat Sep 29 07:19:00 EDT 2007&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Also I find EDT is incorrect which stand for East Daylight Time. So the first thing for me is to change time zone. I use "timeconfig" to select "America|Edmenton" for Mount Daylight time.&lt;br /&gt;&lt;br /&gt;Then is change date, the second command save the time to hardware.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;date 10190953&lt;br /&gt;hwclock --utc --systohc&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4454498655856647285?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4454498655856647285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4454498655856647285'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/date.html' title='date'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-6582046921834317337</id><published>2007-10-16T11:04:00.000-07:00</published><updated>2007-10-16T11:16:48.508-07:00</updated><title type='text'>Mac OS X Leopard on Oct 26</title><content type='html'>Yesterday I make up my mind to wait for Leopard, today I check the apple's online web store, and find that it is updated, the great news is Oct 26 it will be released, in about 2 weeks! Originally I thought it would be Oct 31, because of a mac guy's point -- it is said to released at October, but doesn't mean Oct 1 or Oct 2, most likely it could be on Oct 31. Now the question to me is how long I can see it with a new MacBook on a store of FutureShop or BestBuy. At Oct 27?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-6582046921834317337?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6582046921834317337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/6582046921834317337'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/mac-os-x-leopard-on-oct-26.html' title='Mac OS X Leopard on Oct 26'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-1741362270752313558</id><published>2007-10-15T19:34:00.000-07:00</published><updated>2007-10-15T19:47:59.209-07:00</updated><title type='text'>mac os X - Leopard</title><content type='html'>I am a huge fan of Mac laptops, and I am so missed my ibook. The only thing I can do is to buy a new one, a 13 inches MacBook should fit my need. I almost bought one from Staple yesterday, it sells the 2.16GHz white laptop only for 1254 Bucks, the same prize as the 2.0GHz one, maybe it is a mistake. But I checked with the sales, there are only demo left in Calgary, no stocks for this city:-( Then today I found mac os X - Leopard will be unveil in this month - October, so I think I should wait to the end of the month or the early of next month, to buy a MacBook with Leopard. So be patient, just wait.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-1741362270752313558?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1741362270752313558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/1741362270752313558'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/mac-os-x-leopard.html' title='mac os X - Leopard'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-4616406484358279175</id><published>2007-10-11T15:16:00.000-07:00</published><updated>2007-10-11T15:23:55.447-07:00</updated><title type='text'>Zamzar</title><content type='html'>I find &lt;a href="http://www.zamzar.com/"&gt;Zamzar&lt;/a&gt;, a online PDF converter, today. And tried it with my PDF file, for PDF can not be modified by my co-worker, so I convert it to word doc format, it is good. Better than another trialed version converter I download to my PC. The only problem is I have to wait a little while (30-minutes) to let Zamzar inform me by email. I suggest Zamzar for its great quality.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-4616406484358279175?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4616406484358279175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/4616406484358279175'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/zamzar.html' title='Zamzar'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3649205253205522428</id><published>2007-10-09T13:03:00.000-07:00</published><updated>2007-10-09T13:24:32.587-07:00</updated><title type='text'>Trolltech</title><content type='html'>Trolltech is an amazing company which produces a lot of interesting staff, Qt, KDE, Qtopia, Greenphone etc. It did contribution to the Free Software world, but it also make profits by commercial license fees. I don't know the opinion of RMS to Trolltech, but I know he is against Lessor GPL. I have a mixing feeling to Trolltech. I'm stand on GNU side in spirit, but make a living on GNU's opposite side. &lt;br /&gt;&lt;br /&gt;Can you agree "Keep Linux free, use KDE!"? Myself does not use KDE. KDE is the default x window manager by Slackware, and I just find there are many LGPL packages with KDElibs, &lt;a href="http://developer.kde.org/documentation/licensing/licensing.html"&gt;here &lt;/a&gt; is a reference.&lt;br /&gt;&lt;br /&gt;I noticed &lt;a href="http://labs.trolltech.com/blogs/2007/09/18/qtopia-phone-is-completely-gpl/"&gt;a news&lt;/a&gt; related to Trolltech today, that is, it will make &lt;span style="font-weight:bold;"&gt;Qtopia Phone Free&lt;/span&gt;. Is that true? and When? Because when I worked on Qtopia Phone several month ago, I was with a commercial version.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3649205253205522428?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3649205253205522428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3649205253205522428'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/trolltech.html' title='Trolltech'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7384627189356881075</id><published>2007-10-05T11:40:00.000-07:00</published><updated>2007-10-05T12:51:33.471-07:00</updated><title type='text'>-ck</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_i_1T8dlgrVk/RwaG4056NHI/AAAAAAAAABU/LCm-zI-rtHI/s1600-h/ck1.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_i_1T8dlgrVk/RwaG4056NHI/AAAAAAAAABU/LCm-zI-rtHI/s200/ck1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5117926337385477234" /&gt;&lt;/a&gt;&lt;br /&gt;Con Kolivas, or known as -ck which is his kernel patch's identity. He is a Linux kernel patcher for sure. Visit &lt;a href="http://members.optusnet.com.au/ckolivas/kernel/"&gt;here&lt;/a&gt; for his home page on kernel patches. But he is quit what he has been doing. Why? &lt;a href="http://apcmag.com/6735/interview_con_kolivas"&gt; Here &lt;/a&gt;is an interview that you must read. &lt;br /&gt;&lt;br /&gt;As a Linux user, I know there are a lot of code monkey, they love programming, so Linux is just a perfect platform for them, there are always new devices in the market, new software that brings solutions on specific area, and new bugs that are found to be fixed, ..., so all the code monkey can do is coding, coding and coding, and thus what I am doing is install, install and install. Some times I make my own customized change on my thinkpad because the software I installed is still not very good on my slackware. iMac makes life easier for me, but Linux brings challenge to me -- that is what I thought. I seems choose the later in my life.&lt;br /&gt;&lt;br /&gt;CPU performance is now not a big problem since the hardware has been upgrading for decades. To me, on audio area, it still could be causing problems on mobile devices, because the processor on mobile device is not as powerful as on PC, and sound is special time restrict, for instance, you have to fill 1764 bytes buffer in 20ms for sound rate  22050, stereo audio. CPU usage is important measurements, so if you use 10ms to fill the buffer, the usage of CPU is 50%.&lt;br /&gt;&lt;br /&gt;I like to get in deep, to know audio, to know kernel... I read books on operating systems, on learning the Linux source code, on configure, build and install the kernel,  but I never be a patcher. I may know how to write a module, and get it run in the kernel mode, but usually I don't have to build a device driver from scratch, so I am not "certain". There are a lot that need to be learn.&lt;br /&gt;&lt;br /&gt;Although it is pity to see "-ck" gone, &lt;blockquote&gt;To be or not to be, that's a question. (Shakespeare)&lt;/blockquote&gt; but it is good to see what he brings to us.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7384627189356881075?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7384627189356881075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7384627189356881075'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/ck.html' title='-ck'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_i_1T8dlgrVk/RwaG4056NHI/AAAAAAAAABU/LCm-zI-rtHI/s72-c/ck1.jpg' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-7485377290312851863</id><published>2007-10-01T00:38:00.000-07:00</published><updated>2007-10-01T11:55:17.435-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cweb'/><title type='text'>cweb - the way to coding</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_i_1T8dlgrVk/RvqSNKgQLRI/AAAAAAAAABM/QbwgAUK35CE/s1600-h/knuth_don.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_i_1T8dlgrVk/RvqSNKgQLRI/AAAAAAAAABM/QbwgAUK35CE/s200/knuth_don.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5114561081688206610" /&gt;&lt;/a&gt;&lt;br /&gt;I found Knuth's image &lt;a href="http://www.stanfordalumni.org/news/magazine/2006/mayjun/features/knuth.html"&gt;here&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;I think I learned 3 things from Knuth. One, life is too short; Second, code can be beautiful; Third, math is for God? &lt;br /&gt;&lt;br /&gt;CWEB is developed by Knuth &amp; Levy. I am using CWEB again in my job. Basically I don't have a design for what I am doing, and I am using C language to solve my problems, then I can use CWEB. The good for using CWEB is -- code is always followed by my thoughts, so the Tex part of CWEB is my thoughts, and Code part is what I would sent to the compiler. What amazing me is my current work is mixing the channel of sound in a mixer, while in coding CWEB acts as a mixer on code and thoughts.&lt;br /&gt;&lt;br /&gt;There are two other things I would mention with CWEB. One is doxygen, I didn't use it for my design. Doxygen is a wonderful tool good at on showing source code design. I use it a lot in my work. But with CWEB I can see the progress on the design and solving my problems, just with C language.&lt;br /&gt;&lt;br /&gt;The second thing I want to mention is Wiki, I use wiki a lot, because I want to document what I learned. Wiki is a fast way to take notes. I think CWEB, Doxygen and Wiki make sense to me, because my way of coding is more like documenting it well. Documenting gives me the sense of solving problems, and also for reference.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-7485377290312851863?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7485377290312851863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/7485377290312851863'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/10/cweb-way-to-coding.html' title='cweb - the way to coding'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_i_1T8dlgrVk/RvqSNKgQLRI/AAAAAAAAABM/QbwgAUK35CE/s72-c/knuth_don.jpg' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5994449917714150630</id><published>2007-09-19T11:27:00.000-07:00</published><updated>2007-09-19T11:36:47.712-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fvwm'/><title type='text'>fvwm - newbie for the years</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_i_1T8dlgrVk/RvFrd2PVNdI/AAAAAAAAAA0/6yxktxYrBeQ/s1600-h/micro_GUI.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_i_1T8dlgrVk/RvFrd2PVNdI/AAAAAAAAAA0/6yxktxYrBeQ/s200/micro_GUI.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5111985212562421202" /&gt;&lt;/a&gt;&lt;br /&gt;I find myself newbie on many things such as cvs, fvwm even I use them for a long times.&lt;br /&gt;On Fvwm, although most people use gnome or kde, but I am still get it a try. I like it simple, not cost too much memory. In spare time, I am fiddling into FVWM, and at last I figure out the set up of "micro GUI" decor.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5994449917714150630?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5994449917714150630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5994449917714150630'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/09/fvwm-newbie-for-years.html' title='fvwm - newbie for the years'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_i_1T8dlgrVk/RvFrd2PVNdI/AAAAAAAAAA0/6yxktxYrBeQ/s72-c/micro_GUI.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-3252299289646377557</id><published>2007-09-11T11:21:00.000-07:00</published><updated>2007-09-11T11:37:29.680-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cvs'/><title type='text'>cvs</title><content type='html'>I have a long history of using CVS, but I am still not an expert on using it. Here is a great &lt;a href="http://cvsbook.red-bean.com/"&gt; link &lt;/a&gt;, it provides several types of format on learning cvs.  I am using the "info" one.&lt;br /&gt;&lt;br /&gt;1. First set CVSROOT. I use shellscript:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;export CVSROOT=":pserver:markc@xxx.xxx.xxx:2401/cvs/repsitory"&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;2. login "cvs login "&lt;br /&gt;&lt;br /&gt;3. import my package&lt;br /&gt;&lt;br /&gt;Here I make a mistake. my package is /devel/src/myproj, but I am in /devel/src, then do an import, it will import everything in /devel/src to myproj. :-(&lt;br /&gt;&lt;br /&gt;4. Remove directories and files&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cd dir&lt;br /&gt;rm file1 file2&lt;br /&gt;cd ..&lt;br /&gt;cvs remove dir&lt;br /&gt;cvs commit -m " message remove xxx"&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;5. Add myproj&lt;br /&gt;&lt;br /&gt;cvs add myproject&lt;br /&gt;&lt;br /&gt;6. check out and update and release&lt;br /&gt;for check out and update, use "-P" option to avoid the empty directories.&lt;br /&gt;"cvs release -d project" will end use of it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-3252299289646377557?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3252299289646377557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/3252299289646377557'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/09/cvs.html' title='cvs'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-9098585813516858017</id><published>2007-08-29T10:50:00.001-07:00</published><updated>2007-08-29T11:01:31.299-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arm-linux'/><title type='text'>arm-linux : struct alignment</title><content type='html'>The following code examine arm structure....&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;#include &lt; stdio.h &gt;&lt;br /&gt;&lt;br /&gt;#define PACKED __attribute__((packed))&lt;br /&gt;&lt;br /&gt;typedef struct struct_Foo&lt;br /&gt;{&lt;br /&gt;    char c; &lt;br /&gt;    int  r;&lt;br /&gt;    long f;&lt;br /&gt;} PACKED FOO;&lt;br /&gt;&lt;br /&gt;typedef struct struct_Foo2&lt;br /&gt;{&lt;br /&gt;    char c; &lt;br /&gt;    int r;&lt;br /&gt;    long f;&lt;br /&gt;} FOO2;&lt;br /&gt;&lt;br /&gt;int main(int argc, char* argv[])&lt;br /&gt;{&lt;br /&gt;    printf ("Test arm...\n");&lt;br /&gt;    printf ("  char : %2d\n", sizeof(char));&lt;br /&gt;    printf ("  int  : %2d\n", sizeof(int));&lt;br /&gt;    printf ("  long : %2d\n", sizeof(long));&lt;br /&gt;    printf ("  foo  : %2d\n", sizeof(FOO));&lt;br /&gt;    printf ("  foo2 : %2d\n", sizeof(FOO2));&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;and my Makefile:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;# where is my tool chains for arm&lt;br /&gt;BLD_NAME=greenphone&lt;br /&gt;BLD_TOOL_VER = gcc-4.1.1-glibc-2.3.6&lt;br /&gt;BLD_TARGET=arm-linux&lt;br /&gt;BLD_PREFIX= /opt/toolchains/greenphone/$(BLD_TOOL_VER)&lt;br /&gt;CROSS_COMPILE=$(BLD_PREFIX)/$(BLD_TARGET)/bin/$(BLD_TARGET)-&lt;br /&gt;&lt;br /&gt;# tools... I am using&lt;br /&gt;&lt;br /&gt;LD          = $(CROSS_COMPILE)ld&lt;br /&gt;CC          = $(CROSS_COMPILE)gcc&lt;br /&gt;CPP         = $(CC) -E&lt;br /&gt;&lt;br /&gt;CFLAGS = -x c&lt;br /&gt;&lt;br /&gt;all:&lt;br /&gt; $(CC) $(CFLAGS) -o test test.c&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;result?&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;int  :  4&lt;br /&gt;long :  4&lt;br /&gt;foo  :  9&lt;br /&gt;foo2 : 12 &lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-9098585813516858017?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9098585813516858017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/9098585813516858017'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/08/arm-linux-struct-alignment.html' title='arm-linux : struct alignment'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2365379269800339250.post-5289369004187248932</id><published>2007-08-22T11:06:00.000-07:00</published><updated>2007-08-22T11:34:53.604-07:00</updated><title type='text'>Book - The C Programming Language</title><content type='html'>Write a post is different then write a program, if you have nothing intested to say, be quiet. That is a rule in programming on Unix. But for write a post, I don't have to follow the rule when i don't have any interesting things to say.&lt;br /&gt;&lt;br /&gt;I am talking about the book "The C Programming Book" by KR. Despite the high price, I bought it from Chapters. Is that good value for me? yes, I think so, a C programmer need to have such a book. C language is not too hard to follow or learn,  and this book is 270 pages including the index. I have  already grasp the C language, so I don't learn the language from this book. But the point is, I want to know how C inventer think about C language, how they use it, it is interested to me, so this book give me the idea. &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;C "wears well as one's experience with it grows".&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;There are several points I want to confess:&lt;br /&gt;&lt;br /&gt;1. C language and Unix. C is invented for programming on Unix, so unix is C's target, especailly the C standard library contains the interface to Unix OS. To use a language, understand well about the target is one of the keys. Note the book does not talk about the OS, it focus on Lanuage its self.&lt;br /&gt;&lt;br /&gt;2. Algorithm and Data structures. They are important but, the book does not cover these two area, although it has code to implement fast search. Still the focus is the language itself.&lt;br /&gt;&lt;br /&gt;3. The way to learn a lanuage, is to write programs. This book contains a lot of asignments, to modify code, or write code with what it present. We are be certain when we write programs with the language.&lt;br /&gt;&lt;br /&gt;4. The auther write the book on the stand of the user point, so it is not top down, but on the same level as the user.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2365379269800339250-5289369004187248932?l=dsmarkchen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5289369004187248932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2365379269800339250/posts/default/5289369004187248932'/><link rel='alternate' type='text/html' href='http://dsmarkchen.blogspot.com/2007/08/book-c-programming-language.html' title='Book - The C Programming Language'/><author><name>Mark</name><uri>http://www.blogger.com/profile/06084095748729100227</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
