<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-2365379269800339250</atom:id><lastBuildDate>Tue, 24 Nov 2009 20:42:03 +0000</lastBuildDate><title>Fiddling</title><description>Mark Chen's blog (computer programming)</description><link>http://dsmarkchen.blogspot.com/</link><managingEditor>noreply@blogger.com (Mark)</managingEditor><generator>Blogger</generator><openSearch:totalResults>127</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-9130220362188120598</guid><pubDate>Tue, 24 Nov 2009 19:59:00 +0000</pubDate><atom:updated>2009-11-24T12:42:03.414-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>gnu</category><title>use glib</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/11/use-glib.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-1947913683256680889</guid><pubDate>Tue, 22 Sep 2009 19:07:00 +0000</pubDate><atom:updated>2009-09-22T12:12:53.847-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>unix</category><title>find/grep command</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/09/findgrep-command.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-1325260630003147083</guid><pubDate>Tue, 15 Sep 2009 17:02:00 +0000</pubDate><atom:updated>2009-09-15T10:04:59.026-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>ubuntu - recording</title><description>&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;</description><link>http://dsmarkchen.blogspot.com/2009/09/ubuntu-recording.html</link><author>noreply@blogger.com (Mark)</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'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-8012976301218955535</guid><pubDate>Fri, 21 Aug 2009 02:52:00 +0000</pubDate><atom:updated>2009-08-22T19:57:52.322-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>ubuntu 8.04 - wireless network setup</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/08/ubuntu-804-wireless-network-setup.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-4683521857655259590</guid><pubDate>Mon, 22 Jun 2009 21:56:00 +0000</pubDate><atom:updated>2009-07-09T08:36:44.260-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>android</category><title>fedora 10 - setup i686 environment for android (1)</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/06/fedora-10-setup-i686-environment-for.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-4204304889105479943</guid><pubDate>Wed, 10 Jun 2009 15:43:00 +0000</pubDate><atom:updated>2009-06-10T08:49:36.986-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>code</category><title>mips - the next  example</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/06/mips-next-example.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-3295882077551373964</guid><pubDate>Tue, 09 Jun 2009 22:06:00 +0000</pubDate><atom:updated>2009-06-09T15:15:15.326-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>code</category><title>mips - a first example</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/06/mips-first-exsample.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-6404113047530461442</guid><pubDate>Wed, 27 May 2009 19:45:00 +0000</pubDate><atom:updated>2009-05-27T14:19:28.194-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>android</category><title>android notes - the process of development</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/05/android-notes-process-of-development.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-4469210785675445045</guid><pubDate>Wed, 20 May 2009 20:15:00 +0000</pubDate><atom:updated>2009-05-20T13:25:57.676-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>scripts</category><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>Calculate cpu usage in MCycles/sec</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/05/how-to-get-cpu-usage-in-mcyclessec.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-7515152534979560578</guid><pubDate>Wed, 13 May 2009 17:05:00 +0000</pubDate><atom:updated>2009-05-13T10:11:23.230-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>u8.04 - build procmeter3</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/05/u804-build-procmeter3.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-7283812564132730204</guid><pubDate>Thu, 07 May 2009 20:51:00 +0000</pubDate><atom:updated>2009-05-07T14:08:24.223-07:00</atom:updated><title>android notes - build and test shared library</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/05/android-notes-build-and-test-shared.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-5186425250763731067</guid><pubDate>Thu, 30 Apr 2009 22:03:00 +0000</pubDate><atom:updated>2009-04-30T15:06:30.926-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>ubuntu notes - connect  to nfs  share folder</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/04/ubuntu-notes-connect-to-nfs-share.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-107348104755457003</guid><pubDate>Wed, 29 Apr 2009 17:21:00 +0000</pubDate><atom:updated>2009-04-29T11:52:30.162-07:00</atom:updated><title>android notes</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/04/android-notes.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-9123479230850579849</guid><pubDate>Mon, 27 Apr 2009 17:08:00 +0000</pubDate><atom:updated>2009-04-27T10:16:40.174-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>chown and chgrp</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/04/chown-and-chgrp.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-8412152576655219355</guid><pubDate>Fri, 03 Apr 2009 02:40:00 +0000</pubDate><atom:updated>2009-04-02T19:42:48.417-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>fedora 10 - remove pulseaudio</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/04/fedora-10-remove-pulseaudio.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-6511067940707577530</guid><pubDate>Tue, 24 Mar 2009 22:39:00 +0000</pubDate><atom:updated>2009-03-24T15:52:36.512-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><category domain='http://www.blogger.com/atom/ns#'>code</category><title>setup cygwin</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/03/setup-cygwin.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-1311058535207850298</guid><pubDate>Mon, 23 Mar 2009 19:05:00 +0000</pubDate><atom:updated>2009-03-23T12:24:49.693-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>gnu</category><title>generate ssh key for github</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/03/generate-ssh-key-for-github.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-2151747284340556371</guid><pubDate>Fri, 30 Jan 2009 17:13:00 +0000</pubDate><atom:updated>2009-01-30T10:21:55.780-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>c</category><title>boilerplate</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/01/boilerplate.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-1616166452138612130</guid><pubDate>Wed, 21 Jan 2009 23:35:00 +0000</pubDate><atom:updated>2009-01-21T15:41:53.336-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>linux</category><title>smb4k on Ubuntu</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/01/smb4k-on-ubuntu.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-1845840776516036821</guid><pubDate>Tue, 20 Jan 2009 20:42:00 +0000</pubDate><atom:updated>2009-01-20T12:45:14.490-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>cvs</category><title>create a patch with cvs</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/01/create-patch-with-cvs.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-5590983369523964403</guid><pubDate>Mon, 19 Jan 2009 17:55:00 +0000</pubDate><atom:updated>2009-01-19T10:39:01.358-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>life</category><title></title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/01/0-usually-i-use-this-blog-to-take-notes.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-7431726536441096292</guid><pubDate>Thu, 15 Jan 2009 18:12:00 +0000</pubDate><atom:updated>2009-01-15T10:35:27.747-08:00</atom:updated><title>Do you remember when?</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2009/01/do-you-remember-when.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-2470971359475523500</guid><pubDate>Mon, 15 Dec 2008 22:28:00 +0000</pubDate><atom:updated>2008-12-15T14:37:30.990-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>embeded</category><title>nanddump</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2008/12/nanddump.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-548547216696044475</guid><pubDate>Sat, 22 Nov 2008 00:51:00 +0000</pubDate><atom:updated>2008-11-21T16:55:38.343-08:00</atom:updated><title>Knuth</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2008/11/knuth.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2365379269800339250.post-8411519650140942720</guid><pubDate>Fri, 21 Nov 2008 20:53:00 +0000</pubDate><atom:updated>2008-11-21T12:57:48.347-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>arm-linux</category><title>flash jffs2</title><description>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;</description><link>http://dsmarkchen.blogspot.com/2008/11/flash-jffs2.html</link><author>noreply@blogger.com (Mark)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item></channel></rss>