<?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-5568483</id><updated>2012-02-16T14:46:03.801+08:00</updated><category term='stage'/><category term='java'/><category term='cache'/><category term='ifdef'/><category term='gentoo'/><category term='rootfs'/><category term='trace'/><category term='remote'/><category term='memory'/><category term='handler'/><category term='tar'/><category term='tip'/><category term='polkit'/><category term='jni'/><category term='unifdef'/><category term='android'/><category term='git'/><category term='zygote'/><category term='framebuffer'/><category term='conditional macro'/><category term='looper'/><category term='kernel'/><category term='setting'/><category term='index'/><category term='vim'/><category term='framework'/><title type='text'>roylee17's blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5568483.post-3006400119113106093</id><published>2011-06-19T22:05:00.001+08:00</published><updated>2011-06-19T23:38:16.824+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conditional macro'/><category scheme='http://www.blogger.com/atom/ns#' term='trace'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='ifdef'/><category scheme='http://www.blogger.com/atom/ns#' term='unifdef'/><title type='text'>Removing conditional macros when tracing C/C++ code with Vim</title><summary type='text'>Working with source code buried in conditional macros(#if, #ifdef, #ifndef, ...) is sometimes really annoying, especially when we are trying to get the whole picture of what it does instead of every details in it.

Simply expanding the conditionals with gcc -E usually doesn't help in this situation. Expansion of macros as well as the header files even makes the picture muddier. The unifdef(1) </summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/3006400119113106093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=3006400119113106093' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/3006400119113106093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/3006400119113106093'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2011/06/removing-conditional-macros-when.html' title='Removing conditional macros when tracing C/C++ code with Vim'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-6917840248087631889</id><published>2011-04-14T16:27:00.001+08:00</published><updated>2011-04-14T16:31:21.837+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tar'/><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><category scheme='http://www.blogger.com/atom/ns#' term='rootfs'/><title type='text'>[tip] Transform file or directory names during the extraction of tarball</title><summary type='text'>Suppose we have a tarball containing a directory structure of root filesystem for an embedded device.

ex:

  rootfs/
  rootfs/init.rc
  rootfs/dev/...
  rootfs/etc/...
  rootfs/usr/...


We'd like to extract the contained directory structure under the rootfs/ directly into the root directory of a mounted partition, for example, /mnt/sdb1. Otherwise, we will have to deal with the relocation of </summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/6917840248087631889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=6917840248087631889' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6917840248087631889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6917840248087631889'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2011/04/tip-transform-file-names-during.html' title='[tip] Transform file or directory names during the extraction of tarball'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-209590642373915928</id><published>2011-04-08T00:26:00.000+08:00</published><updated>2011-04-08T00:26:06.974+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='setting'/><category scheme='http://www.blogger.com/atom/ns#' term='polkit'/><title type='text'>[setting] Error occurred while mounting usb stick via the device notifier</title><summary type='text'>[reference]
https://bbs.archlinux.org/viewtopic.php?pid=909650
draugdel @ 2011-03-26 10:08:27

Error occurred while mounting usb stick via the device notifier

org.freedesktop.UDisks.Error.PermissionDenied: Not Authorized

Sol:
Add a file named with .pkla suffix in /etc/polkit-1/localauthority/50-local.d/

ex:
/etc/polkit-1/localauthority/50-local.d/mount.pkla

and stuff the following contents </summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/209590642373915928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=209590642373915928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/209590642373915928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/209590642373915928'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2011/04/setting-error-occurred-while-mounting.html' title='[setting] Error occurred while mounting usb stick via the device notifier'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-6306554549725316112</id><published>2011-03-20T03:17:00.002+08:00</published><updated>2011-03-20T13:57:25.070+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stage'/><category scheme='http://www.blogger.com/atom/ns#' term='index'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='remote'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><title type='text'>Introduction to Git Basics</title><summary type='text'>Check out this SlideShare Presentation: Introduction to Git BasicsView more presentations from Roy Lee.</summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/6306554549725316112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=6306554549725316112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6306554549725316112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6306554549725316112'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2011/03/introduction-to-git-basics.html' title='Introduction to Git Basics'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-6976450181142289329</id><published>2011-02-06T22:38:00.001+08:00</published><updated>2011-02-06T22:42:24.861+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='zygote'/><category scheme='http://www.blogger.com/atom/ns#' term='jni'/><category scheme='http://www.blogger.com/atom/ns#' term='framework'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Zygote Initialization Flow</title><summary type='text'>The code flow of zygote initialization is rather complicated, especially when the JNIs are extensively involved. My IDE often fails to cross reference between them. So I log the code flow here and the location they are defined as well.


In the very beginning, the init.rc initiated a Zygote process, which forks the SystemServer as we will see later.

system/core/rootdir/init.rc

service zygote /</summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/6976450181142289329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=6976450181142289329' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6976450181142289329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6976450181142289329'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2011/02/zygote-initialization-flow.html' title='Zygote Initialization Flow'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-5083621785162973042</id><published>2010-12-05T20:44:00.005+08:00</published><updated>2010-12-08T00:22:46.516+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='looper'/><category scheme='http://www.blogger.com/atom/ns#' term='framework'/><category scheme='http://www.blogger.com/atom/ns#' term='handler'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Loopers, MessageQueues, and Handlers (Part1)</title><summary type='text'>Loopers, MessageQueues, and Handlers provide one of the facilities for processes and threads to communicate with each other. They are also one of the basis to implement the Services of Android framework. The relationship between these classes and how they interact with each other are not so easy to be seen through at the first glance. And that's why there are so many articles talking about them. </summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/5083621785162973042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=5083621785162973042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/5083621785162973042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/5083621785162973042'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2010/12/loopers-messagequeues-and-handlers.html' title='Loopers, MessageQueues, and Handlers (Part1)'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-2001564934812287488</id><published>2010-06-20T15:21:00.003+08:00</published><updated>2010-12-25T16:23:04.021+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jni'/><title type='text'>Log of instructions for JNI</title><summary type='text'>
Reference:



Java Native Interface: Programmer's Guide and Specification




Edit HelloWorld.java


HelloWorld.java

class HelloWorld {
        private native void print();
        public static void main(String[] args) {
                new HelloWorld().print();
        }
        static {
                System.loadLibrary("HelloWorld");
        }
}


Compile the JAVA class -- HelloWorld.class</summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/2001564934812287488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=2001564934812287488' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/2001564934812287488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/2001564934812287488'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2010/06/log-of-instructions-for-jni.html' title='Log of instructions for JNI'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-6121522164200281146</id><published>2010-06-12T17:41:00.000+08:00</published><updated>2010-06-13T01:13:19.552+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='framebuffer'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Taking a snapshot of Android device</title><summary type='text'>We can dump the framebuffer of a android device and save it as a file on our host in one single step:


  $ adb pull /dev/graphics/fb0 fb.dump


The dumped raw data is in RGB565 pixel format. So we'd like to convert it into a more common image format that could be recognized by common image viewers.
And FFMPEG could be handy for doing the conversion like this:


  $ ffmpeg -f rawvideo -pix_fmt </summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/6121522164200281146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=6121522164200281146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6121522164200281146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/6121522164200281146'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2010/03/on-host-adb-pull-devgraphicsfb0-android.html' title='Taking a snapshot of Android device'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5568483.post-2638091412259956718</id><published>2010-06-12T11:31:00.000+08:00</published><updated>2010-06-13T19:51:43.431+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Estimating memory usage on Android and Linux</title><summary type='text'>Earlier kernels export Rss and Vss of each single process to show how many page frames it occupies and how the address space it spans on a particular time. But this information is process-wide, and it doesn't help when you estimate system-wide memory usage. The problem is the lacking of information about how the processes share pages with each other. Simply summing up the Rss of all processes </summary><link rel='replies' type='application/atom+xml' href='http://roylee17.blogspot.com/feeds/2638091412259956718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5568483&amp;postID=2638091412259956718' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/2638091412259956718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5568483/posts/default/2638091412259956718'/><link rel='alternate' type='text/html' href='http://roylee17.blogspot.com/2010/06/memory-usage-estimation-on-android.html' title='Estimating memory usage on Android and Linux'/><author><name>Roy Lee</name><uri>http://www.blogger.com/profile/07281846091489660503</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
