<?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-968719233835958791</id><updated>2012-02-17T06:46:47.779+08:00</updated><category term='linux'/><category term='video'/><category term='ros'/><category term='c++'/><category term='programming'/><title type='text'>Brice Rebsamen</title><subtitle type='html'>&lt;a href="https://sites.google.com/site/bricerebsamen"&gt;https://sites.google.com/site/bricerebsamen&lt;/a&gt;</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-4841445073293827381</id><published>2011-08-02T16:03:00.002+08:00</published><updated>2011-12-23T11:34:07.014+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>3G USB dongle in Linux</title><content type='html'>I purchased this USB dongle for internet connection over 3G. I got one from singtel and one from M1. They are meant to work under Windows and MacOSX, but not under Linux (no surprise here ...).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First the dongle is detected as a storage device (this is where they stored the windows drivers). It's called a "flip-flop" USB gear, or mode switching, or multiple device. Once the windows driver is installed, it manage to switch the mode to modem type device. There is a tool under Linux that does it, called usb-modeswitch, available from the Ubuntu repository. Once installed, the dongle appeared as a modem in my network manager.&lt;br /&gt;See http://www.draisberghof.de/usb_modeswitch/ for more info on the mode switching tool.&lt;br /&gt;&lt;br /&gt;Second, I am not sure how to configure the network interface. The configuration window has many fields, but under windows none of them is filled in, except for Number (*99#) and APN (internet on the Singtel card, sunsurf on the M1).&lt;br /&gt;&lt;br /&gt;As of now, I can't make it work. The M1 card works on a different computer running Ubuntu and Gnome though, apparently it wasn't too difficult. I am using KDE... So their must be a solution somewhere...&lt;br /&gt;&lt;br /&gt;EDIT: installing package mobile-broadband-provider-info helps: it automatically fills in the connection info. Tested under Gnome.&lt;br /&gt;&lt;br /&gt;One more trick: the Ethernet card does not provide internet access, but the 3G dongle does. So the network settings have to be configured so that  eth0 is not use as a gateway when routing. This can be done (in Gnome) as follow:&lt;br /&gt;System &amp;gt; Preferences &amp;gt; Network Connections&lt;br /&gt;Wired tab, edit the settings for the Ethernet connection&lt;br /&gt;IPV4 tab, click on Route&lt;br /&gt;check "Use this connection only for resources on its network"&lt;br /&gt;OK&lt;br /&gt;Disconnect and reconnect  eth0&lt;br /&gt;&lt;br /&gt;This should allow connecting to the internet via the 3G dongle. In a terminal, type route and check that the gateway's address corresponds to the one provided by the dongle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-4841445073293827381?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/4841445073293827381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/08/3g-usb-dongle-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/4841445073293827381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/4841445073293827381'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/08/3g-usb-dongle-in-linux.html' title='3G USB dongle in Linux'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-5121046988883822700</id><published>2011-07-29T10:54:00.000+08:00</published><updated>2011-07-29T10:54:55.415+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>disable touchpad while typing</title><content type='html'>On laptops, the touchpad sometimes gets in the way of typing. It is possible to configure the touchpad so that it is automatically disabled while typing.&lt;br /&gt;&lt;br /&gt;I did this in KUbuntu 10.04 &lt;br /&gt;&lt;br /&gt;This is done using syndaemon (found in package xserver-xorg-input-synaptics). Create a script called syndaemon.sh with the following content:&lt;br /&gt;syndaemon -i 1 -d&lt;br /&gt;Then set the script as executable and place it in your startup scripts (System Settings &amp;gt; Startup)&lt;br /&gt;May need to restart...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-5121046988883822700?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/5121046988883822700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/07/disable-touchpad-while-typing.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/5121046988883822700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/5121046988883822700'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/07/disable-touchpad-while-typing.html' title='disable touchpad while typing'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-1670669548517146536</id><published>2011-07-28T12:45:00.001+08:00</published><updated>2011-10-04T16:57:57.535+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>printing on a canon printer from linux with job accounting</title><content type='html'>At work we have this Canon iRC2550i network printer. Job accounting (username and password) is used to protect against unauthorized used of the printer / photocopier. Unfortunately, it does not work out of the box under Linux. So here is how to do it. (Note: I had to try lots of things before I managed to make this work, so maybe there were so hidden steps...)&lt;br /&gt;&lt;br /&gt;- Download and install the UFR II driver from Canon&lt;br /&gt;&lt;a href="http://support-sg.canon-asia.com/P/search?model=iRC2550i&amp;amp;menu=download&amp;amp;filter=0&amp;amp;tagname=g_os&amp;amp;g_os=Linux"&gt;http://support-sg.canon-asia.com/P/search?model=iRC2550i&amp;amp;menu=download&amp;amp;filter=0&amp;amp;tagname=g_os&amp;amp;g_os=Linux&lt;/a&gt;&lt;br /&gt;Choose the UFR_II driver. This is an archive file, unpack it and go to the 32 bit debian folder.&lt;br /&gt;&lt;br /&gt;Before installing the debs there is a small trick, as they depend on gs-esp and it has been removed from the repo starting from Maverick.&lt;br /&gt;&lt;br /&gt;Make sure ghostscript-x is installed (sudo apt-get install ghostscript-x)&lt;br /&gt;Generate a fake gs-esp package:&lt;br /&gt;&lt;br /&gt;Install equivs (sudo apt-get install equivs)&lt;br /&gt;echo "Package: fake-gs-esp" &amp;gt; fake-gs-esp.control&lt;br /&gt;echo "Provides: gs-esp" &amp;gt;&amp;gt; fake-gs-esp.control&lt;br /&gt;equivs-build fake-gs-esp.control&lt;br /&gt;sudo dpkg -i fake-gs-esp_1.0_all.deb&lt;br /&gt;Then install the UFR cups drivers: &lt;br /&gt;sudo dpkg -i cndrvcups-common_2.20-1_i386.deb&lt;br /&gt;sudo dpkg -i cndrvcups-ufr2-uk_2.20-1_i386.deb&lt;br /&gt;&lt;br /&gt;- Add the printer on your system (Cups) using the UFR II driver: HP JetDirect &lt;span lang="EN-SG"&gt;172.18.114.223:9100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- Configure the job accounting:&lt;br /&gt;sudo cnjatool -e [printer name] (to enable job accounting)&lt;br /&gt;cnjatool -p [printer name] (to set the username and password)&lt;br /&gt;&lt;br /&gt;Optionally, cngplp can be used to configure the printer (it's a GUI) &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-1670669548517146536?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/1670669548517146536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/07/printing-on-canon-printer-from-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1670669548517146536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1670669548517146536'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/07/printing-on-canon-printer-from-linux.html' title='printing on a canon printer from linux with job accounting'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-4894494443547314517</id><published>2011-06-02T11:10:00.001+08:00</published><updated>2011-06-02T11:10:35.010+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Test a serial port</title><content type='html'>Use a loopback cable: connect pin 2 and 3. Data sent out come back on the receive line.&lt;br /&gt;&lt;br /&gt;optionally configure it to disable echoing: stty -F /dev/ttyS0 -echo&lt;br /&gt;Otherwise the characters are sent again and again in an infinite loop...&lt;br /&gt;&lt;br /&gt;in a console read from the line: cat /dev/ttyS0&lt;br /&gt;in another console write to the line: echo "test message" &amp;gt; /dev/ttyS0&lt;br /&gt;&lt;br /&gt;check if it is printed in the first console...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-4894494443547314517?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/4894494443547314517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/test-serial-port.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/4894494443547314517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/4894494443547314517'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/test-serial-port.html' title='Test a serial port'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-8698587716331276070</id><published>2011-06-02T11:09:00.002+08:00</published><updated>2011-06-02T11:09:55.670+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Debootstrap</title><content type='html'>This is to install a minimum ubuntu. It can be used to install to any folder, i.e. some local folder on which to chroot later, or a mounted drive.&lt;br /&gt;&lt;br /&gt;First install the debootstrap package&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;sudo apt-get install debootstrap&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then start the job:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;sudo debootstrap --arch i386 hardy /mnt http://sg.archive.ubuntu.com/ubuntu&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will install hardy on /mnt by downloading all required packages from the singapore archive.&lt;br /&gt;&lt;br /&gt;Then chroot in the new created environment: &lt;span style="font-weight: bold;"&gt;sudo chroot /mnt&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;create a root passwd: &lt;span style="font-weight: bold;"&gt;passwd&lt;/span&gt;&lt;br /&gt;write /etc/fstab, /etc/network/interfaces and /etc/hostname&lt;br /&gt;mount proc and pts:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mount -t proc proc /proc&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mount -t sysfs sysfs /sys&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mount -t devpts devpts /dev/pts&lt;/span&gt;&lt;br /&gt;configure language: &lt;span style="font-weight: bold;"&gt;apt-get install language-pack-en&lt;/span&gt;&lt;br /&gt;under Debian: &lt;span style="font-weight: bold;"&gt;apt-get install locales; dpkg-reconfigure locales&lt;/span&gt;&lt;br /&gt;install a kernel and GRUB: &lt;span style="font-weight: bold;"&gt;apt-get install linux-image grub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;write MBR and create GRUB images:&lt;br /&gt;(from outside the chroot, i.e. from a normal console): &lt;span style="font-weight: bold;"&gt;sudo grub-install --root-directory=/mnt /dev/sdc&lt;/span&gt;&lt;br /&gt;This will install the GRUB images in /mnt/boot/grub and write the MBR on disk sdc&lt;br /&gt;Then from the chroot environment: &lt;span style="font-weight: bold;"&gt;update-grub&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;this will write a menu.lst (the GRUB config) for you&lt;br /&gt;&lt;br /&gt;then install whatever you want using apt-get&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-8698587716331276070?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/8698587716331276070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/debootstrap.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/8698587716331276070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/8698587716331276070'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/debootstrap.html' title='Debootstrap'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-1097075180619128210</id><published>2011-06-02T11:08:00.002+08:00</published><updated>2011-06-02T11:08:22.356+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Remove executable permission on all files except directories</title><content type='html'>&lt;span style="font-weight: bold;"&gt;find . -type f -print0 | xargs -0 chmod -x&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;find .&lt;/span&gt; : search the current directory recursively&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-type f&lt;/span&gt; : select only regular files (&lt;span style="font-weight: bold;"&gt;-type d&lt;/span&gt; would select directories)&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-print0&lt;/span&gt; : (where 0 is a zero) print the list with each file separated by a null character rather than a space. This allow handling filenames with a space in it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;xargs&lt;/span&gt; : execute a cmd on each argument&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-0&lt;/span&gt; : (where 0 is a zero) instruct xargs that argument list is null charater separated rather than by a space. Corresponds to -print0 in find.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;chmod -x&lt;/span&gt; : remove executable permission&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-1097075180619128210?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/1097075180619128210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/remove-executable-permission-on-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1097075180619128210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1097075180619128210'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/remove-executable-permission-on-all.html' title='Remove executable permission on all files except directories'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-5708298066977536186</id><published>2011-06-02T11:07:00.002+08:00</published><updated>2011-06-02T11:07:32.820+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>password-less login with ssh</title><content type='html'>On the originating machine:&lt;br /&gt;&lt;b&gt;ssh-keygen -t rsa&lt;/b&gt;Save the key in the default file (~/.ssh/id_rsa) and do not use a passphrase. This will create a file ~/.ssh/id_rsa.pub.&lt;br /&gt;&lt;br /&gt;Add the contents of this file to the file ~/.ssh/authorized_keys on the &lt;em&gt;remote&lt;/em&gt; machine (i.e., the machine on which you want to log on). Whereas the id_rsa.pub file is world readable, the authorized_keys file should only be readable by you. Use chmod to set the permissions accordingly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-5708298066977536186?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/5708298066977536186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/password-less-login-with-ssh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/5708298066977536186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/5708298066977536186'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/password-less-login-with-ssh.html' title='password-less login with ssh'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-3196899197548678322</id><published>2011-06-02T11:06:00.002+08:00</published><updated>2011-06-02T11:06:59.076+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Create a zip from a m3u playlist</title><content type='html'>&lt;span style="font-weight: bold;"&gt;grep -v "#" test.m3u | zip -j test -@ -&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;"-v #" is used to discard lines starting with # (comments maybe...)&lt;br /&gt;-@ is to get input from the file, here -, i.e. stdin, i.e. the output of grep&lt;br /&gt;-j is to junk the path and store only the file&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-3196899197548678322?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/3196899197548678322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/create-zip-from-m3u-playlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/3196899197548678322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/3196899197548678322'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/create-zip-from-m3u-playlist.html' title='Create a zip from a m3u playlist'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-3593607927077893934</id><published>2011-06-02T11:05:00.003+08:00</published><updated>2011-07-04T20:34:36.425+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>mplayer / mencoder / ffmpeg recipes</title><content type='html'>&lt;b&gt;Concatenate AVI files&lt;/b&gt;&lt;br /&gt;&lt;i&gt;cat file1.avi file2.avi &amp;gt; big.avi&lt;br /&gt;mencoder -ovc copy -oac copy -o out.avi -forceidx big.avi&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Split video&lt;/b&gt;&lt;br /&gt;From a start pos (4 mins 20 secs) to end:&lt;br /&gt;&lt;i&gt;mencoder -ss 00:04:20 -oac copy -ovc copy in.avi -o out.avi&lt;/i&gt;&lt;br /&gt;From beginning to an end pos (11 mins 44 secs):&lt;br /&gt;&lt;i&gt;mencoder -endpos 00:11:44 -oac copy -ovc copy in.avi -o out.avi&lt;/i&gt;&lt;br /&gt;From a start pos (4 mins 20 secs), extract 5 mins of video:&lt;br /&gt;&lt;i&gt;mencoder -ss 00:04:20 -endpos 00:05:00 -oac copy -ovc copy in.avi -o out.avi&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Extract audio from video&lt;/b&gt;&lt;br /&gt;&lt;i&gt;mplayer -dumpaudio videoFile.avi -dumpfile audioFile.mp3&lt;/i&gt;&lt;br /&gt;or&lt;br /&gt;&lt;i&gt;mplayer -ao pcm -vo null videoFile.avi&lt;/i&gt;&lt;br /&gt;it dumps the audio to audiodump.wav&lt;br /&gt;&lt;br /&gt;Best is to use ffmpeg:&lt;br /&gt;&lt;i&gt;ffmpeg -i &amp;lt;input media&amp;gt; -ss &amp;lt;bgn time&amp;gt; -t &amp;lt;duration&amp;gt; -acodec copy -vn &amp;lt;output file&amp;gt;&lt;/i&gt;&lt;br /&gt;where:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;-i input media&lt;/i&gt; is the source media (i.e. an avi file)&lt;/li&gt;&lt;li&gt;&lt;i&gt;-ss bgn time&lt;/i&gt;: Seek to given time position in seconds.&amp;nbsp; "hh:mm:ss[.xxx]" syntax is also supported.&lt;/li&gt;&lt;li&gt;&lt;i&gt;-t duration&lt;/i&gt;: duration of the segment to extract&lt;/li&gt;&lt;li&gt;&lt;i&gt;output file&lt;/i&gt;: the output file, e.g. a mp3 file (depending on the input's audio encoding)&lt;/li&gt;&lt;/ul&gt;To encode the audio stream use a different -acodec option and see extra options (bitrate, etc.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-3593607927077893934?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/3593607927077893934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/mplayer-mencoder-usage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/3593607927077893934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/3593607927077893934'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/mplayer-mencoder-usage.html' title='mplayer / mencoder / ffmpeg recipes'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-2844034240504491136</id><published>2011-06-02T11:04:00.002+08:00</published><updated>2011-06-02T11:04:38.287+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>grep, sed, awk ...</title><content type='html'>&lt;span style="font-size: large;"&gt;Search TEX files for \label commands and check for double ref:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cat *.tex | grep "label{" | sed 's/.*{\(.*\)}.*/\1/' | uniq -c | sort -n&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;extract the IP address from ifconfig&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;$ ifconfig eth0&lt;br /&gt;eth0 Link encap:Ethernet HWaddr 00:13:72:BE:FF:63&lt;br /&gt;inet addr:172.19.65.12 Bcast:172.19.79.255 Mask:255.255.240.0&lt;br /&gt;inet6 addr: fe80::213:72ff:febe:ff63/64 Scope:Link&lt;br /&gt;UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1&lt;br /&gt;RX packets:4801968 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;TX packets:1088918 errors:0 dropped:0 overruns:0 carrier:0&lt;br /&gt;collisions:0 txqueuelen:1000&lt;br /&gt;RX bytes:2559338610 (2.3 GiB) TX bytes:90195114 (86.0 MiB)&lt;br /&gt;Interrupt:16&lt;br /&gt;&lt;br /&gt;$ ifconfig eth0 | awk '/inet addr/ {FS=" "; gsub("addr:","",$2); print $2}'&lt;br /&gt;172.19.65.12&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-2844034240504491136?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/2844034240504491136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/grep-sed-awk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/2844034240504491136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/2844034240504491136'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/grep-sed-awk.html' title='grep, sed, awk ...'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-642831606126879898</id><published>2011-06-02T11:03:00.001+08:00</published><updated>2011-06-02T11:03:02.665+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Internet access from chroot</title><content type='html'>I always had internet connection from a chroot environment. However, when using wireless, it seems that it's requires one more step: resolv.conf must contains the address of a DNS server (the gateway usually).&lt;br /&gt;&lt;br /&gt;echo nameserver 192.168.1.254 &gt; /etc/resolv.conf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-642831606126879898?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/642831606126879898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/internet-access-from-chroot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/642831606126879898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/642831606126879898'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/internet-access-from-chroot.html' title='Internet access from chroot'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-1344080781291841842</id><published>2011-06-02T11:02:00.002+08:00</published><updated>2011-06-02T11:02:12.592+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Setting a custom terminal prompt</title><content type='html'>In .bashrc, add:&lt;br /&gt;&lt;br /&gt;PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 30 ]; then CurDir=${DIR:0:12}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'&lt;br /&gt;PS1="[\$CurDir] \$ "&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-1344080781291841842?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/1344080781291841842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/setting-custom-terminal-prompt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1344080781291841842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1344080781291841842'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/setting-custom-terminal-prompt.html' title='Setting a custom terminal prompt'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-1524530868297393955</id><published>2011-06-02T11:01:00.002+08:00</published><updated>2011-06-02T11:01:29.615+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Backup a linux system</title><content type='html'>backup with tar:&lt;br /&gt;see https://help.ubuntu.com/community/BackupYourSystem/TAR&lt;br /&gt;&lt;br /&gt;Summary: the backup can be done from the system directly (i.e. no need to run from a live CD). We don't want to backup some directories: proc, sys and dev are virtual filesystems... lost+found is not useful.&lt;br /&gt;-p option in tar is to preserve permissions&lt;br /&gt;&lt;br /&gt;sudo tar -cvpzf /backup.tar.gz -–exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/dev --exclude=/mnt --exclude=/media /&lt;br /&gt;&lt;br /&gt;For restoration: this must be done from another system. We will restore to /mnt&lt;br /&gt;&lt;br /&gt;sudo tar -xvpzf backup.tar.gz -C /mnt&lt;br /&gt;&lt;br /&gt;then recreate the missing directories:&lt;br /&gt;mkdir /proc /lost+found /sys /mnt /media&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-1524530868297393955?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/1524530868297393955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/backup-linux-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1524530868297393955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/1524530868297393955'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/backup-linux-system.html' title='Backup a linux system'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-7405936348635853657</id><published>2011-06-02T11:00:00.003+08:00</published><updated>2011-06-02T11:00:44.216+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Purge packages</title><content type='html'>The purge package (or the --purge) option in apt-get deletes configuration files along with the package content.&lt;br /&gt;&lt;br /&gt;To identify packages that were removed but not purge, use pdkg -l to list all packages, and grep ^rc to find the lines that start with rc.&lt;br /&gt;&lt;br /&gt;Finally, the whole command is:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;sudo apt-get purge `dpkg -l | grep ^rc | cut -d' ' -f3 | xargs echo`&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-7405936348635853657?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/7405936348635853657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/purge-packages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/7405936348635853657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/7405936348635853657'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/purge-packages.html' title='Purge packages'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-290525290068603567</id><published>2011-06-02T11:00:00.000+08:00</published><updated>2011-06-02T11:00:06.721+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>undelete files from a VFAT partition</title><content type='html'>Use testdisk:&lt;br /&gt;sudo testdisk /dev/sdb&lt;br /&gt;&lt;br /&gt;Basically:&lt;br /&gt;- select the partition and type (Intel)&lt;br /&gt;- select advanced operation, then select undelete&lt;br /&gt;- find the files to undelete and press c (copy), choose where to copy&lt;br /&gt;- done!&lt;br /&gt;&lt;br /&gt;More details here:&lt;br /&gt;&lt;a href="http://www.cgsecurity.org/wiki/TestDisk:_undelete_file_for_FAT"&gt;http://www.cgsecurity.org/wiki/TestDisk:_undelete_file_for_FAT&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-290525290068603567?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/290525290068603567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/undelete-files-from-vfat-partition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/290525290068603567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/290525290068603567'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/undelete-files-from-vfat-partition.html' title='undelete files from a VFAT partition'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-6945075959281444158</id><published>2011-06-01T11:29:00.000+08:00</published><updated>2011-06-01T11:29:55.505+08:00</updated><title type='text'></title><content type='html'>Checking out TI's EZ430-Chronos watch. Besides being a watch, it offers a 3-axis accelerometer, a temperature sensor, a pressure sensor, and acts as a wireless hub (to integrate with other wearable sensors), etc. It can be programmed too.&lt;br /&gt;&lt;br /&gt;Here are the full specs along with a list of applications&lt;br /&gt;&lt;a href="http://processors.wiki.ti.com/index.php/EZ430-Chronos?DCMP=Chronos&amp;amp;HQS=Other+OT+chronoswiki"&gt;http://processors.wiki.ti.com/index.php/EZ430-Chronos?DCMP=Chronos&amp;amp;HQS=Other+OT+chronoswiki&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is the demo video&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object width="320" height="266" class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://3.gvt0.com/vi/LDJIBydJvoM/0.jpg"&gt;&lt;param name="movie" value="http://www.youtube.com/v/LDJIBydJvoM&amp;fs=1&amp;source=uds" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/LDJIBydJvoM&amp;fs=1&amp;source=uds" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-6945075959281444158?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/6945075959281444158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/checking-out-tis-ez430-chronos-watch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/6945075959281444158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/6945075959281444158'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/06/checking-out-tis-ez430-chronos-watch.html' title=''/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-968719233835958791.post-6280799489772676782</id><published>2011-05-31T11:45:00.000+08:00</published><updated>2011-05-31T11:46:36.889+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='ros'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>First exercise with ROS: a node to interface with Player</title><content type='html'>I am starting to learn ROS. I needed an exercise and I do not have any robot to play with, except Player/Stage. So I decided to write a ROS node for my Player/Stage robot. ROS already has a stack called stageros that allows to interface with Stage. Mine is different: it allows to interface with Player. Hence it can also be used to interface with Stage (via Player), but with any other Player-enabled robot as well. Anyway, it's not very useful, but it's a good experimentation platform and exercise.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Requirements&lt;/span&gt;&lt;br /&gt;- Linux (I use Debian Wheezy)&lt;br /&gt;- ROS (see ROS tutorials on how to install and learn the basics)&lt;br /&gt;- Player and Stage (see respective tutorials as well, mine are install from source)&lt;br /&gt;- A Player configuration file and world to start a robot in Stage&lt;br /&gt;&lt;br /&gt;I assume familiarity with ROS and Player/Stage&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Design&lt;br /&gt;&lt;/span&gt;The final aim is to be able to use the navigation stack with the Player robot. So I followed the guidelines and how to setup a robot for the navigation stack:&lt;br /&gt;http://www.ros.org/wiki/navigation/Tutorials/RobotSetup&lt;br /&gt;&lt;br /&gt;This means that we will need to publish laser data on the &lt;span style="font-style: italic;"&gt;base_scan&lt;/span&gt; topic, odometry data on the &lt;span style="font-style: italic;"&gt;odom&lt;/span&gt; topic, publish transform configuration too, and accept velocity commands on the &lt;span style="font-style: italic;"&gt;cmd_vel&lt;/span&gt; topic.&lt;br /&gt;&lt;br /&gt;I wrote 2 versions. One version has everything in one node, the other version is made of 3 smaller nodes (one per task aforementioned). We will first check the one node version.&lt;br /&gt;&lt;br /&gt;The code is object oriented. I found the solution better than having global variables, because it allowed better control of initialization order: some stuffs can only be created after ros::init has been called.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Preparation&lt;/span&gt;&lt;br /&gt;First of all, let's create a package.&lt;br /&gt;&lt;br /&gt;I have created a directory where I can experiment, i.e. ~/ros_playground. I added this directory to the ROS_PACKAGE_PATH environment variable: in ~/.bashrc, after the source xxx/ros/setup.sh line added when installing ROS (see ROS tutorial), I added the following line:&lt;br /&gt;ROS_PACKAGE_PATH=~/ros_playground:$ROS_PACKAGE_PATH&lt;br /&gt;&lt;br /&gt;Then from the ros_playground directory:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;roscreate-pkg playerros_1node roscpp tf nav_msgs sensor_msgs geometry_msgs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;playerros_1node&lt;/span&gt; is the name of my package. The &lt;span style="font-style: italic;"&gt;roscreate-pkg&lt;/span&gt; creates a directory ~/ros_playground/playerros_1node that contains several files, including the CMakeList.txt and manifest.xml&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;roscpp&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;tf&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;nav_msgs&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;sensor_msgs&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;geometry_msgs&lt;/span&gt; are the dependencies we will need. &lt;span style="font-style: italic;"&gt;roscpp&lt;/span&gt; is needed to write a C++ ROS client, &lt;span style="font-style: italic;"&gt;tf&lt;/span&gt; is needed to send transform configurations, &lt;span style="font-style: italic;"&gt;nav_msgs&lt;/span&gt; for the odometry messages, &lt;span style="font-style: italic;"&gt;sensor_msgs&lt;/span&gt; for the laser messages, and &lt;span style="font-style: italic;"&gt;geometry_msgs&lt;/span&gt; for the velocity command messages.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;Code for the one node version&lt;/span&gt;&lt;br /&gt;Create playerros.cpp in the src directory in the playerror_1node directory just created.&lt;br /&gt;&lt;br /&gt;First the includes:&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=Rn0KTn97" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Then the class definition:&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=bnqVYMWJ" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;The constructor creates all the Player objects, connects to Player, sets the callback functions (when new laser or odometry data is available), sets the cmd_vel callback function when a cmd_vel message is received from another ROS node, and starts the Player thread. We will look at all of this in detail, but first the main function:&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=y25TViRA" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Up to here, I think everything should be quite obvious. Let's now take a look at the contructor:&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=jGCuiS4C" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Now the odometry callback function:&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=iXFmYcgi" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;One note here on frames. This code defines a few frames. One is called &lt;span style="font-style: italic;"&gt;base_link&lt;/span&gt;, which is the root frame of the robot, i.e. the base. The &lt;span style="font-style: italic;"&gt;odom&lt;/span&gt; frame is a fixed frame; it's origin is defined by the starting position of the robot. There is also the &lt;span style="font-style: italic;"&gt;base_link&lt;/span&gt; frame, which is the frame attached to the laser.&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=HngHGi1m" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=f4KEu3cw" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Full code: &lt;a href="http://pastebin.com/psZyY40E"&gt;http://pastebin.com/psZyY40E&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Building the code&lt;/span&gt;&lt;br /&gt;Edit CMakeList.txt:&lt;br /&gt;&lt;iframe src="http://pastebin.com/embed_iframe.php?i=YyGjJNsk" style="border:none;width:100%"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;To build:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;rosmake playerros_1node&lt;/span&gt;&lt;br /&gt;This will compile all the dependencies and the code we just created.&lt;br /&gt;In case there are errors and you just want to recompile player_node.cpp, simply type &lt;span style="font-style: italic;"&gt;make&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Running&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;rosrun playerros_1node playerros_node&lt;/span&gt;&lt;br /&gt;(Player must be running first)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Testing&lt;/span&gt;&lt;br /&gt;The program can be tested by sending commands to the robot. This can be done using &lt;span style="font-style: italic;"&gt;rostopic&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;rostopic pub cmd_vel geometry_msgs/Twist '[0.2,0,0]' '[0,0,0]' -1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will set the velocity to 0.2m/s&lt;br /&gt;&lt;br /&gt;Or you can use the following program to control the robot from the keyboard.&lt;br /&gt;http://&lt;a href="http://pastebin.com/7ibrBQq8"&gt;pastebin.com/7ibrBQq8&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Add the following line to CMakeList.txt to compile:&lt;br /&gt;rosbuild_add_executable(teleop src/teleop.cpp)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/968719233835958791-6280799489772676782?l=brice-rebsamen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://brice-rebsamen.blogspot.com/feeds/6280799489772676782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/05/first-exercise-with-ros-node-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/6280799489772676782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/968719233835958791/posts/default/6280799489772676782'/><link rel='alternate' type='text/html' href='http://brice-rebsamen.blogspot.com/2011/05/first-exercise-with-ros-node-to.html' title='First exercise with ROS: a node to interface with Player'/><author><name>brice rebsamen</name><uri>http://www.blogger.com/profile/17139580172011089263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-sCoa8ZD916E/TeMUQh3S9ZI/AAAAAAAAA6w/eWhM318-TC4/s220/ID_macdo_misterio.jpg'/></author><thr:total>0</thr:total></entry></feed>
