<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DEAHQXY4eCp7ImA9WhVTFE0.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501</id><updated>2012-02-28T10:55:30.830+05:30</updated><category term="Proximity-sensor" /><category term="Light Sensor" /><category term="DroidCon2011" /><category term="boot" /><category term="cache" /><category term="Game" /><category term="Invensense" /><category term="adb" /><category term="ARM" /><category term="Accelerometer Sensor" /><category term="GeomagneticField" /><category term="x86" /><category term="patch resend" /><category term="nGPS" /><category term="Heuristics" /><category term="u-boot" /><category term="Programming" /><category term="Artificial Intelligence" /><category term="tftp" /><category term="NFS" /><category term="linux-kernel" /><category term="keyevents" /><category term="git" /><category term="Gingerbread" /><category term="AI" /><category term="Orientation Sensor" /><category term="Test-Driven-Development" /><category term="chocosticks" /><category term="Magnetic-Field sensor" /><category term="Patches" /><category term="Misc." /><category term="Android" /><category term="Sensors" /><category term="Quilt" /><title>The Code Artist</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://thecodeartist.blogspot.com/" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.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>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/TheCodeArtist" /><feedburner:info uri="thecodeartist" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" /><entry gd:etag="W/&quot;Ck4DR3g9eip7ImA9WhRbGUs.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-4774407325399048891</id><published>2012-02-11T17:14:00.000+05:30</published><updated>2012-02-11T17:19:36.662+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-11T17:19:36.662+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="patch resend" /><category scheme="http://www.blogger.com/atom/ns#" term="git" /><title>[patch] [resend] Preparing a modified patch</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;In case of any collaborated project (eg. linux-kernel), often after submitting a patch for review,&amp;nbsp; we often receive several comments and need to make appropriate changes and generate a new "version2" of the patch containing the changes. If we are using &lt;a href="http://en.wikipedia.org/wiki/Git_%28software%29" target="_blank"&gt;Git&lt;/a&gt; for revision control, then the entire process becomes a snap.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;






How to prepare a modified patch for resend in &lt;u&gt;5 easy steps&lt;/u&gt;:&lt;/h2&gt;
&lt;br /&gt;
STEP1.&lt;br /&gt;
&lt;code class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;git rebase -i &amp;lt;commit-id-just-before-our-changes&amp;gt;&lt;/span&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
STEP2.&lt;br /&gt;
As discussed in the review, make the new changes to the source-files.&lt;br /&gt;
&lt;br /&gt;
STEP3.&lt;br /&gt;
&lt;code class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;git add &amp;lt;modified-filenames&amp;gt;&lt;/span&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;
STEP4.&lt;br /&gt;
&lt;code class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;git commit --amend&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
(shows editor with original commit-msg)&lt;br /&gt;
Edit the commit-msg (or leave as-is) and quit.&lt;br /&gt;
New commit is generated in the place of old commit.&lt;br /&gt;
&lt;br /&gt;
STEP5.&lt;br /&gt;
&lt;code class="tr_bq"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;git format-patch HEAD~1&lt;/span&gt;&lt;/code&gt;
&lt;br /&gt;
DONE!! New patch version2 is ready for review now. :-)&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
If we do a diff between the PREV and NEW patch, we can see :&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
+ Changes made after review.&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
+ Time-Stamp change.&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
+ Hash change.&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-4774407325399048891?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xLJBgG4XKrPqN7miRLxGojnVHzU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xLJBgG4XKrPqN7miRLxGojnVHzU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xLJBgG4XKrPqN7miRLxGojnVHzU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xLJBgG4XKrPqN7miRLxGojnVHzU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/QFPUs545BLE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/4774407325399048891/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2012/02/patch-resend-preparing-modified-patch.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4774407325399048891?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4774407325399048891?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/QFPUs545BLE/patch-resend-preparing-modified-patch.html" title="[patch] [resend] Preparing a modified patch" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2012/02/patch-resend-preparing-modified-patch.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUNSHY4fip7ImA9WhRVFUg.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-6179143951810232618</id><published>2012-01-14T20:10:00.000+05:30</published><updated>2012-01-14T21:54:59.836+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-14T21:54:59.836+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Magnetic-Field sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="Invensense" /><category scheme="http://www.blogger.com/atom/ns#" term="Proximity-sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="nGPS" /><category scheme="http://www.blogger.com/atom/ns#" term="Accelerometer Sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="Light Sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="Sensors" /><category scheme="http://www.blogger.com/atom/ns#" term="Orientation Sensor" /><title>Android Sensors and Location based services</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Here is the talk i presented about &lt;u&gt;Sensors and location based services on Android&lt;/u&gt; at &lt;a href="http://blog.blrdroid.org/" target="_blank"&gt;B.A.(U).G / BLR-DROID.&lt;/a&gt; Felt awesome talking to people, answering Qs about &lt;a href="http://thecodeartist.blogspot.com/2011/11/ngps-location-fix-without-gps.html" target="_blank"&gt;nGPS.&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;iframe frameborder="0" height="413" marginheight="0" marginwidth="0" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/11039276" width="500"&gt;&lt;/iframe&gt; &lt;/div&gt;
&lt;br /&gt;
Download &lt;b&gt;&lt;a href="http://www.slideshare.net/cvs26/sensors-and-location-based-services/download" target="_blank"&gt;Sensors and location based services on Android&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-6179143951810232618?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IZeyhbGm3VSq0-DDaSvvvF04U6s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IZeyhbGm3VSq0-DDaSvvvF04U6s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IZeyhbGm3VSq0-DDaSvvvF04U6s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IZeyhbGm3VSq0-DDaSvvvF04U6s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/wEWx_pU2oYA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/6179143951810232618/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2012/01/android-sensors-and-location-based.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/6179143951810232618?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/6179143951810232618?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/wEWx_pU2oYA/android-sensors-and-location-based.html" title="Android Sensors and Location based services" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2012/01/android-sensors-and-location-based.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cDSHk8eip7ImA9WhRWEUo.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-4333206887207912301</id><published>2011-12-28T19:44:00.005+05:30</published><updated>2011-12-29T21:41:19.772+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-29T21:41:19.772+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="linux-kernel" /><category scheme="http://www.blogger.com/atom/ns#" term="NFS" /><category scheme="http://www.blogger.com/atom/ns#" term="u-boot" /><category scheme="http://www.blogger.com/atom/ns#" term="tftp" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="Test-Driven-Development" /><category scheme="http://www.blogger.com/atom/ns#" term="boot" /><title>Booting Android completely over ethernet</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When developing embedded-systems, initial development stages often involve huge number of "&lt;b&gt;Modify-Build-Flash-Test&lt;/b&gt;" cycles. &lt;/span&gt;&lt;span style="font-size: small;"&gt;Test-Driven-Development methodology further promotes this style of development. &lt;/span&gt;&lt;span style="font-size: small;"&gt;This leads to a break in the "flow" at the &lt;b&gt;Flash&lt;/b&gt; stage. Flashing the device with a newly built set of binaries interrupts the otherwise smooth "&lt;b&gt;Modify-Build-Test&lt;/b&gt;" flow. Also errors tend to creep-in in the form of an older binary being copied/flashed, often causing confusion during debugging and&amp;nbsp; endless grief to the developer.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;A simple way to avoid this is to have the binaries on the host-machine (a PC) and boot the embedded device directly using those binaries. In case of Android embedded system development, these binaries are the Linux-Kernel and the Android filesystem image.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;&lt;u&gt;&lt;span style="font-size: small;"&gt;Pre-requisites:&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The embedded device&lt;/li&gt;
&lt;li&gt;A linux PC &lt;/li&gt;
&lt;li&gt;Ethernet connectivity between the two&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;b&gt;NOTE&lt;/b&gt;&lt;/span&gt;: Below listed parts 1, 2 &amp;amp; 3 involve setting-up the "host" Linux PC. Part 4 describes configuring the device to boot directly using the binaries present on the "host". It is assumed that a functional bootloader (u-boot) is present on the device (internal-flash/mmc-card) and that ethernet-support(either direct or over usb) is enabled.&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;h1&gt;&lt;br /&gt;
&lt;span class="mw-headline" id="Part1: Linux kernel over tftp"&gt;Part1: Linux kernel over tftp&lt;/span&gt;&lt;/h1&gt;&lt;h2&gt;&lt;span class="mw-headline" id="Install_tftpd_and_related_packages"&gt;1. Install tftpd and related packages&lt;/span&gt;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;sudo apt-get install xinetd tftpd tftp
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Create_.2Fetc.2Fxinetd.d.2Ftftp"&gt;2. Create /etc/xinetd.d/tftp &lt;/span&gt;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/xinetd.d/tftp
service tftp
{
    protocol        = udp
    port            = 69
    socket_type     = dgram
    wait            = yes
    user            = nobody
    server          = /usr/sbin/in.tftpd
    server_args     = /srv/tftp
    disable         = no
}
EOF
&lt;/code&gt;
&lt;/pre&gt;&lt;h2&gt;&lt;span class="mw-headline" id="Make tftp-server directory"&gt;3. Make tftp-server directory&lt;/span&gt;&lt;/h2&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;mkdir &amp;lt;tftp-server-path&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;host-PC$ &lt;/b&gt;chmod -R 777 &amp;lt;tftp-server-path&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;host-PC$ &lt;/b&gt;chown -R nobody &amp;lt;tftp-server-path&amp;gt; &lt;/code&gt; &lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Start_tftpd_through_xinetd"&gt;4. Start tftpd through xinetd&lt;/span&gt;&lt;/h2&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt; sudo /etc/init.d/xinetd restart&amp;nbsp;&lt;/code&gt; &lt;br /&gt;
This concludes the tftp part of the setup process on the host.&lt;br /&gt;
&lt;h1&gt;&lt;br /&gt;
&lt;span class="mw-headline" id="Android fs over NFS"&gt;Part2: Android fs over NFS&lt;/span&gt;&lt;/h1&gt;&lt;h2&gt;&lt;span class="mw-headline" id="Install nfs packages"&gt;1. Install nfs packages &lt;/span&gt;&lt;/h2&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;sudo apt-get install nfs-kernel-server nfs-common&amp;nbsp;&lt;/code&gt; &lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Modify /etc/exports"&gt;2. Add this line to /etc/exports&lt;/span&gt; &lt;/h2&gt;&lt;code&gt;&amp;lt;rootfs-path&amp;gt;   *(rw,sync,no_subtree_check,no_root_squash)  &lt;/code&gt; &lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Restart service"&gt;3. Restart service&lt;/span&gt; &lt;/h2&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;sudo service nfs-kernel-server restart &lt;/code&gt; &lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Update exports for the NFS server"&gt;4. Update exports for the NFS server&lt;/span&gt; &lt;/h2&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;exportfs -a &lt;/code&gt; &lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Check NFS server"&gt;5. Check NFS server&lt;/span&gt;  &lt;/h2&gt;&lt;code&gt;&lt;b&gt;host-PC$ &lt;/b&gt;showmount -e &lt;/code&gt; &lt;/div&gt;&lt;br /&gt;
If everything went right, the &amp;lt;rootfs-path&amp;gt; will be listed in the output of showmount. &lt;br /&gt;
&lt;h1&gt;&lt;br /&gt;
&lt;span class="mw-headline" id="Where to put the files"&gt;Part3: Where to put the files&lt;/span&gt;&lt;/h1&gt;&lt;h2&gt;&lt;span class="mw-headline" id="Linux Kernel uImage"&gt;1. Linux Kernel uImage&lt;/span&gt;&lt;/h2&gt;On the "host" PC,&lt;br /&gt;
Copy the Linux-Kernel &lt;b&gt;uImage&lt;/b&gt; into &amp;lt;tftp-server-path&amp;gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;/ul&gt;&lt;h2&gt;&lt;span class="mw-headline" id="Android rootfs"&gt;2. Android rootfs&lt;/span&gt;&lt;/h2&gt;On the "host" PC,&lt;br /&gt;
Copy the contents of the Android rootfs into &amp;lt;rootfs-path&amp;gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;/ul&gt;&lt;h1&gt;&lt;br /&gt;
&lt;span class="mw-headline" id="Configuring the bootloader"&gt;Part4: Configuring the bootloader&lt;/span&gt;&lt;/h1&gt;&lt;/div&gt;&lt;/div&gt;&lt;h2&gt;&lt;span class="mw-headline" id="Update bootargs"&gt;1. Update bootargs&lt;/span&gt;&lt;/h2&gt;Connect the embedded device to the host-PC over ethernet (either directly or via a switch/router) and power it on. As shown below, configure the bootloader to pick-up the kernel from the host-PC over tftp and to mount the filesystem from the host-PC over NFS. As both support configuring a static-ip for the embedded-device or obtaining one dynamically using dhcp, 4 combinations are possible (2 shown below). &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;nfs(static-ip)&lt;/u&gt;&lt;u&gt; and &lt;/u&gt;&lt;u&gt;tftp(dhcp)&lt;/u&gt;&lt;br /&gt;
&lt;code&gt;&lt;b&gt;U-Boot# &lt;/b&gt;setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=/dev/nfs ip=&amp;lt;client-device-ip&amp;gt; nfsroot=&amp;lt;nfs-server-ip&amp;gt;:&amp;lt;rootfs-path&amp;gt; rootdelay=2' &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;U-Boot# &lt;/b&gt;setenv serverip 'host-pc-ip'&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; U-Boot# &lt;/b&gt;bootm &amp;lt;Load address&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;nfs(dhcp)&lt;/u&gt;&lt;u&gt; and&lt;/u&gt;&lt;u&gt; tftp(static-ip)&lt;/u&gt;&lt;br /&gt;
&lt;code&gt;&lt;b&gt;U-Boot# &lt;/b&gt;setenv bootargs 'console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=/dev/nfs ip=dhcp nfsroot=&amp;lt;nfs-server-ip&amp;gt;:&amp;lt;rootfs-path&amp;gt; rootdelay=2'&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;U-Boot# &lt;/b&gt;setenv serverip 'host-pc-ip'&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;U-Boot# &lt;/b&gt;setenv ipaddr 'client-device-ip'&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;U-Boot# &lt;/b&gt;tftp &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;U-Boot# &lt;/b&gt;bootm &amp;lt;Load address&amp;gt; &lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;&lt;span class="mw-headline" id="Boot"&gt;2. Boot ;-)&lt;/span&gt;&lt;/h2&gt;&lt;/div&gt;&lt;b&gt; &lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;b&gt;Linux-Kernel loaded over tftp&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-LUeMVw97tMQ/Tvx735Nf2cI/AAAAAAAAAwk/xmA5fnfGeyA/s500/dhcp-boot.jpg" /&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;b&gt;Filesystem mounted over NFS&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.blogger.com/blogger.g?blogID=5879050571098780501" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-9nT6viM535U/TvyIDfw0axI/AAAAAAAAAxA/ksZrs0fL6qM/s500/nfs-mount.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-4333206887207912301?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LrwkQ03GkfUoi3ECEsD6yvjlFDU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LrwkQ03GkfUoi3ECEsD6yvjlFDU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LrwkQ03GkfUoi3ECEsD6yvjlFDU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LrwkQ03GkfUoi3ECEsD6yvjlFDU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/sfZzLerxzqI" height="1" width="1"/&gt;</content><link rel="related" href="http://thecodeartist.blogspot.com/2011/12/booting-android-completely-over-ethernet.html" title="Booting Android completely over ethernet" /><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/4333206887207912301/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/12/booting-android-completely-over.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4333206887207912301?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4333206887207912301?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/sfZzLerxzqI/booting-android-completely-over.html" title="Booting Android completely over ethernet" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-LUeMVw97tMQ/Tvx735Nf2cI/AAAAAAAAAwk/xmA5fnfGeyA/s72-c/dhcp-boot.jpg" height="72" width="72" /><thr:total>0</thr:total><georss:featurename>HAL 3rd Stage, New Thipasandra, Bengaluru, Karnataka, India</georss:featurename><georss:point>12.971062185172919 77.65342674902342</georss:point><georss:box>12.967906685172919 77.64610574902342 12.974217685172919 77.66074774902343</georss:box><feedburner:origLink>http://thecodeartist.blogspot.com/2011/12/booting-android-completely-over.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcBQH09fyp7ImA9WhRQFUw.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-4808524863142163783</id><published>2011-12-01T08:32:00.000+05:30</published><updated>2011-12-10T17:24:11.367+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-10T17:24:11.367+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ARM" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="linux-kernel" /><category scheme="http://www.blogger.com/atom/ns#" term="x86" /><category scheme="http://www.blogger.com/atom/ns#" term="cache" /><title>Why __read_mostly does NOT work as it should</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="font-size: x-small;"&gt;( OR&lt;/span&gt; Why linux does NOT implement &lt;i&gt;__read_mostly&lt;/i&gt; for ARM&lt;i&gt; &lt;/i&gt;)&lt;/div&gt;
&lt;br /&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
In modern SMP(multicore) systems, any processor can write to a memory location. The other
processors have to update their caches immediately.  For that reason, SMP systems implement the concept of "cacheline bouncing" to move "ownership" of cached-data between cores.  This is effective but expensive.&lt;br /&gt;
&lt;br /&gt;
Individual cores have private L1 caches which are extremely faster than the L2 and L3 caches which are shared between multiple cores. Typically, when a memory location is going to be ONLY read repeatedly, but never written to (for example a variable tagged with the &lt;i&gt;const&lt;/i&gt; modifier), each core on the SMP system can safely store its own copy of that variable in its private(non-shared) cache. As the variable is NEVER written, the cache-entry never gets invalidated or "dirty". Hence the cores never need to get into "cache line bouncing" for that variable.&lt;br /&gt;
&lt;br /&gt;
Take the case of the x86 architecture,&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;img border="0" height="320" src="https://lh6.googleusercontent.com/-PIETb3X6Qjk/Tt_Vdd4tfuI/AAAAAAAAAvI/3hf9nfocZuU/s480/intel-die-caches.jpg" style="margin-left: auto; margin-right: auto;" width="520" /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;An Intel core i5 die showing the various caches present&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;[NON-SMP]&lt;/span&gt; Intel Pentium 4 processor  has to communicate between threads over 
the front-side bus, thus requiring at least a 400-500 cycle delay.&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt;[SMP]&lt;/span&gt; Intel Core processor family allowed for communication over a shared
 L2 cache with a delay of only 20 cycles between pairs of cores and the 
front-side bus between multiple pairs on a quad-core design.&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: x-small;"&gt; [SMP]&lt;/span&gt; The use of a
 shared L3 cache in the Intel Core i7 processor means that going across a
 bus to synchronize with another core is NEVER required unless a 
multiple-socket system is being used.&lt;/li&gt;
&lt;/ul&gt;
The copies of "read-only" locations usually end-up being cached in the private caches of the individual cores, which are several orders of magnitude faster than the shared L3 cache.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: large;"&gt;How &lt;i&gt;__read_mostly&lt;/i&gt; is &lt;b&gt;supposed&lt;/b&gt; to work:&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
When a variable is tagged with the&lt;i&gt; __read_mostly&lt;/i&gt; annotation, it is a signal to the compiler that accesses to the variable will be mostly reads and rarely(but NOT never) a write.&lt;br /&gt;
&lt;br /&gt;
All variables tagged &lt;i&gt;__read_mostly&lt;/i&gt; are grouped together into a single section in the final executable.
 This is to improve performance by allowing the system to optimise access time 
to those variables in SMP systems by allowing each core to maintain its own copy of them variable in it local cache. Once in a while when the variable does get written to, "cacheline bouncing" takes place. But this is&amp;nbsp; acceptable as the the time spent by the cores constantly synchronising using locks and using the slower shared-cache would be far more than the time it takes for the multiple cores to operate on own copies in their independent caches.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;What &lt;i&gt;&lt;b&gt;actually&lt;/b&gt;&lt;/i&gt; happens:&lt;/span&gt;&lt;br /&gt;
The problem with the above approach is that once all the &lt;i&gt;__read_mostly&lt;/i&gt; variables are grouped into one section, the remaining "non-read-mostly" variables end-up&amp;nbsp; together too. This increases the chances that two frequently used locations (in the "non-read-mostly" region) will end-up competing for the same position in the cache. Thus frequent accesses will cause excessive cache thrashing thereby degrading the overall system performance.&lt;br /&gt;
&lt;br /&gt;
This situation is slightly alleviated by the fact that modern cpu caches are mostly 8way or 16way set-associative. In a 16way associative cache, each location has a choice of 16 different cache-slots. This means that two very frequently accessed memory-locations, though closely located in memory, can still end-up in 2 different slots in the cache, thereby preventing cache-thrashing (which would have occurred had both continued competing for the same cache-slot). In other words a minimum of 17 elements frequently accessed and closely located in memory are required for 2 of them to begin competing for a common cache-slot.&lt;br /&gt;
&lt;br /&gt;
While this is true in the case of INTEL and its x86 architecture, ARM still sticks to 4way &amp;amp; 2way set-associative caches even in its latest CortexA9 &amp;amp; A15 offerings; which means that just 3 or 5 closely located, frequently accessed elements can result in cache-thrashing on an ARM system.&amp;nbsp; This is probably why &lt;i&gt;__read_mostly&lt;/i&gt; is NOT implemented for the ARM architecture in the linux-kernel:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;b&gt;kernel/arch/x86/include/asm/cache.h&lt;/b&gt; contains&lt;/span&gt;&lt;br /&gt;
&lt;code class="tr_bq"&gt;
&lt;span style="font-size: x-small;"&gt;#define __read_mostly __attribute__((__section__(".data..read_mostly"))) &lt;/span&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;kernel/arch/arm/include/asm/cache.h:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: x-small;"&gt; does NOT, thereby defaulting to the empty definition in&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt; kernel/include/linux/cache.h&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;code class="tr_bq"&gt;
&lt;span style="font-size: x-small;"&gt;#ifndef __read_mostly&lt;br /&gt;#define __read_mostly&lt;br /&gt;#endif&lt;/span&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/code&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
With the number of cores increasing rapidly and the on-die cache size growing slowly, one must always aim to:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Minimise access to
 the last level of shared cache to improve performance on multicore systems.&lt;/li&gt;
&lt;li&gt;Increase associativity of private caches (of individual cores) to eliminate cache-slot contention and reduce cache-thrashing.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-4808524863142163783?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9idD6BUc4x-ce2jQp398SsEbpZw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9idD6BUc4x-ce2jQp398SsEbpZw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9idD6BUc4x-ce2jQp398SsEbpZw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9idD6BUc4x-ce2jQp398SsEbpZw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/JsyNMiwMtz4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/4808524863142163783/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/12/why-readmostly-does-not-work-as-it.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4808524863142163783?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4808524863142163783?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/JsyNMiwMtz4/why-readmostly-does-not-work-as-it.html" title="Why __read_mostly does NOT work as it should" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh6.googleusercontent.com/-PIETb3X6Qjk/Tt_Vdd4tfuI/AAAAAAAAAvI/3hf9nfocZuU/s72-c/intel-die-caches.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/12/why-readmostly-does-not-work-as-it.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUECQHc6eSp7ImA9WhRVGE0.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-4863516113311330916</id><published>2011-11-28T14:46:00.001+05:30</published><updated>2012-01-17T18:04:21.911+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-17T18:04:21.911+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Magnetic-Field sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="nGPS" /><category scheme="http://www.blogger.com/atom/ns#" term="DroidCon2011" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="GeomagneticField" /><category scheme="http://www.blogger.com/atom/ns#" term="Sensors" /><title>nGPS : Location fix without GPS</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;NOTE: Skip this post if you do NOT live on planet earth.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;This is one of the ideas that i hit upon when preparing for a talk &lt;a href="http://thecodeartist.blogspot.com/2011/11/sensors-on-android-droidcon2011.html" target="_blank"&gt;Sensors on Android @DroidCon2011&lt;/a&gt;. It is an unusual application of the on-board sensors present most Android devices. Due to lack of time i was unable to present it in much detail during my talk. So here goes...&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;nGPS&lt;/b&gt;&lt;/span&gt; (NO GPS) is a way of obtaining a location fix without using any &lt;a href="http://en.wikipedia.org/wiki/Global_Positioning_System" target="_blank"&gt;GPS&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Assisted_GPS" target="_blank"&gt;AGPS&lt;/a&gt;, &lt;a class="mw-redirect" href="http://en.wikipedia.org/wiki/Wi-Fi_Positioning_System" title="Wi-Fi Positioning System"&gt;Wi-Fi Positioning&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Mobile_phone_tracking" title="Mobile phone tracking"&gt;cell-site triangulation&lt;/a&gt;  technologies.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote class="tr_bq" style="font-family: Verdana,sans-serif;"&gt;
&lt;div&gt;
&lt;u&gt;&lt;span style="font-size: small;"&gt;Why would anyone want to use nGPS&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-size: small;"&gt;- Pure GPS based systems take upto 10mins for 1st fix.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-size: small;"&gt;- AGPS, Wi-Fi positioning require an active data-connection.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-size: small;"&gt;- Cell-site triangulation requires network coverage.&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;So without any of these technologies at our disposal, how do we obtain a "location-fix" i.e. a latitude-longitude pair representing our current position. The answer lies in the magnetic-field sensor.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="justify" style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;The Earth's magnetic field, as measured by a magnetic sensor on the Earth's surface, is combination of of several 
    magnetic fields generated by various sources. These fields interact with each other and the net resultant what the magnetic sensor measures.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://cgz.e2bn.net/e2bn/leas/c99/schools/cgz/accounts/staff/rchambers/GeoBytes%20GCSE%20Blog%20Resources/Images/Plate%20Tectonics/Plate%20Tectonics/ConvectionCurrent_labelled.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Structure_of_the_magnetosphere_mod.svg/669px-Structure_of_the_magnetosphere_mod.svg.png" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="153" src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Structure_of_the_magnetosphere_mod.svg/669px-Structure_of_the_magnetosphere_mod.svg.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;span style="font-size: large;"&gt;&lt;u&gt;World Magnetic Model (WMM)&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;span style="font-size: small;"&gt;Major contributors to a magnetic-field:&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;span style="font-size: small;"&gt;+ Conducting, fluid outer core.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;+ Earth's crust and upper mantle.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;+ Electrical currents in the atmosphere.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;span style="font-size: small;"&gt;+ Local magnetic interference.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;span style="font-size: small;"&gt;By filtering the local magnetic interference due to other electronic/electrical devices, we have a unique magnetic-field signature present at each place on earth. The WMM aims to provide an accurate estimate of this field. A device (having a magnetic sensor) can measure the components of this field. Then comparing it with the WMM values of the earth's field, one can identify the latitude/longitude of the present location.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.ngdc.noaa.gov/geomagmodels/IGRFWMM.jsp?defaultModel=WMM" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-POMJnPFfqbU/TtOAP0xMLEI/AAAAAAAAAuk/hJDKb9opCik/s1600/wmm.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Android contains built-in support for the WMM using the &lt;/span&gt;&lt;b style="font-family: Verdana,sans-serif;"&gt;&lt;a href="http://developer.android.com/reference/android/hardware/GeomagneticField.html" target="_blank"&gt;GeomagneticField&lt;/a&gt; &lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Verdana,sans-serif; font-size: small;"&gt;class. The GeomagneticField class utilises the WMM internally to provide an estimated magnetic field at any given point on
 Earth at a given time. The important thing to note is that this class accepts the location (alongwith altitude and time) and provides the expected magnetic-field at that position (at that particular altitude and instant of time).&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;To determine the location using the GeomagneticField class, requires some reverse-lookup trickery on our part. More on it in another post.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;u&gt;UPDATE&lt;/u&gt; : A recent &lt;a href="http://thecodeartist.blogspot.com/2012/01/android-sensors-and-location-based.html" target="_blank"&gt;talk on Sensors and Location based services on Android&lt;/a&gt; at &lt;a href="http://www.meetup.com/blrdroid/events/47569402/?a=ea1_lnm&amp;amp;rv=ea1" target="_blank"&gt;blr-droid meetp#12&lt;/a&gt; featuring nGPS among other things.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-4863516113311330916?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JdTM5d1NyP59PcuW9vq1_I1SM0E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JdTM5d1NyP59PcuW9vq1_I1SM0E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JdTM5d1NyP59PcuW9vq1_I1SM0E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JdTM5d1NyP59PcuW9vq1_I1SM0E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/Sns1ukGnt2o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/4863516113311330916/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/11/ngps-location-fix-without-gps.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4863516113311330916?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/4863516113311330916?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/Sns1ukGnt2o/ngps-location-fix-without-gps.html" title="nGPS : Location fix without GPS" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-POMJnPFfqbU/TtOAP0xMLEI/AAAAAAAAAuk/hJDKb9opCik/s72-c/wmm.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/11/ngps-location-fix-without-gps.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEANRHo-cCp7ImA9WhRSGUg.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-5988045338743118265</id><published>2011-11-22T14:22:00.001+05:30</published><updated>2011-11-22T14:36:35.458+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-22T14:36:35.458+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Misc." /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><title>Tonight's the night : ICS</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Two weeks after ICS was released, finally synced-up the entire source. 6GB.&lt;br /&gt;Gave a repo sync and woke-up and it was done! Sweet na?...&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;A good thing with ICS is that pandaboard is supported as-is.&lt;br /&gt;This means that i can&lt;/span&gt;&lt;span style="font-size: small;"&gt;... &lt;/span&gt;&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;
&lt;span style="font-size: small;"&gt;$ source build/envsetup.sh&lt;br /&gt;$ lunch full_panda-eng&lt;br /&gt;$ make -j4&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: right;"&gt;
&lt;span style="font-size: small;"&gt; ...and i'm done! :-)&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: right;"&gt;
&lt;div style="text-align: left;"&gt;
&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;And so i have. Estimating 4hrs for a build on my "old" pc.
Tonight's the night... ;-)&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-5988045338743118265?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/U9p7ncWRE4Us7SP4c9q4QP1Czz4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/U9p7ncWRE4Us7SP4c9q4QP1Czz4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/U9p7ncWRE4Us7SP4c9q4QP1Czz4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/U9p7ncWRE4Us7SP4c9q4QP1Czz4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/ss19lEERGX0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/5988045338743118265/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/11/tonights-night-ics.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/5988045338743118265?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/5988045338743118265?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/ss19lEERGX0/tonights-night-ics.html" title="Tonight's the night : ICS" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/11/tonights-night-ics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIDRX46eSp7ImA9WhRVFUg.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-7905783747223968161</id><published>2011-11-18T22:33:00.001+05:30</published><updated>2012-01-14T21:59:34.011+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-14T21:59:34.011+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="DroidCon2011" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="Sensors" /><title>Sensors on Android @ DroidCon2011</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Here is the talk i presented @ &lt;a href="http://funnel.hasgeek.com/droidcon/71-sensors-on-android" target="_blank"&gt;DroidCon2011&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;&lt;iframe frameborder="0" height="413" marginheight="0" marginwidth="0" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/10220894" width="500"&gt;&lt;/iframe&gt; &lt;br /&gt;
&lt;br /&gt;
Download &lt;a href="http://www.slideshare.net/cvs26/sensors-on-android-10220894/download" target="_blank"&gt;&lt;b&gt;Sensors on Android @ DroidCon2011&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Gathered lots of inspiration talking (and listening) to several bright minds @DroidCon2011. Will be posting a "few" of them here. So &lt;a href="http://feeds.feedburner.com/TheCodeArtist" target="_blank"&gt;&lt;b&gt;subscribe&lt;/b&gt;&lt;/a&gt; to TheCodeArtist or take a quick peek &lt;a href="http://thecodeartist.blogspot.com/search/label/DroidCon2011" target="_blank"&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt;. &lt;br /&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-7905783747223968161?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cm3VVJFRbWKtaUv3eRPSnzgpGHM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cm3VVJFRbWKtaUv3eRPSnzgpGHM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cm3VVJFRbWKtaUv3eRPSnzgpGHM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cm3VVJFRbWKtaUv3eRPSnzgpGHM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/kCIqMbtA6xs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/7905783747223968161/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/11/sensors-on-android-droidcon2011.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/7905783747223968161?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/7905783747223968161?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/kCIqMbtA6xs/sensors-on-android-droidcon2011.html" title="Sensors on Android @ DroidCon2011" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/11/sensors-on-android-droidcon2011.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMFRX89fCp7ImA9WhRTFUU.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-5206730366902443700</id><published>2011-11-06T17:23:00.001+05:30</published><updated>2011-11-06T17:23:34.164+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-06T17:23:34.164+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Game" /><category scheme="http://www.blogger.com/atom/ns#" term="chocosticks" /><title>Chocosticks</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&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://i.ytimg.com/vi/kZNl0KTdMFM/0.jpg"&gt;&lt;param name="movie" value="http://www.youtube.com/v/kZNl0KTdMFM?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;embed width="320" height="266"  src="http://www.youtube.com/v/kZNl0KTdMFM?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;blockquote class="tr_bq"&gt;
More info at &lt;a href="http://code.google.com/p/chocosticks"&gt;code.google.com/p/chocosticks&lt;/a&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-5206730366902443700?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uSU5aw0y-W956Kv3GEkTCJghlg4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uSU5aw0y-W956Kv3GEkTCJghlg4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/uSU5aw0y-W956Kv3GEkTCJghlg4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uSU5aw0y-W956Kv3GEkTCJghlg4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/iy_DBNyUt-U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/5206730366902443700/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/11/chocosticks.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/5206730366902443700?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/5206730366902443700?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/iy_DBNyUt-U/chocosticks.html" title="Chocosticks" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/11/chocosticks.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4DRH0yfip7ImA9WhRTE08.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-3345324706126496688</id><published>2011-09-30T15:49:00.000+05:30</published><updated>2011-11-03T17:52:55.396+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-03T17:52:55.396+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="AI" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Artificial Intelligence" /><category scheme="http://www.blogger.com/atom/ns#" term="Heuristics" /><title>AI : Heuristics</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: center;"&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Programming artificial 
intelligence into a piece of code is NOT about anticipating every single
 thing that can possibly happen. A heuristic approach is more practical 
to implement. Implementing a heuristic model has an added advantage that
 the system improves every time it is run.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
Missed Part1 of this series? &lt;a href="http://thecodeartist.blogspot.com/2011/01/ai-artificial-or-actual-intelligence.html"&gt;AI: Artificial or Actual intelligence&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;b&gt;Heuristics&lt;/b&gt; (meaning "to find" or "discover")
 refers to techniques for learning, discovery and problem solving. Heuristic methods are used to speed up the process of 
finding a satisfactory solution. When an exhaustive search is 
impractical.&lt;/blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;u&gt;&lt;b&gt;&lt;/b&gt;&lt;/u&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;u&gt;&lt;b&gt;Implementing a heuristic model:&lt;/b&gt;&lt;/u&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;b&gt;1. &lt;/b&gt;Setup a generic system that runs by a "rulebook".&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;The "rulebook" contains &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;set of very simple rules to start with. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;b&gt;2. &lt;/b&gt;Design a "playbook" which is easily extensible.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Use arrays, linked-lists, b-trees, tables, a relational-database,... Anything. Just remember that the "playbook" is going to grow very fast. Eventually it will contain ALL the rules &amp;amp; tactics that exist.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;b&gt;3. &lt;/b&gt;Let the system run-wild.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;At each turn, the system follows the existing rules in the "rulebook". It picks the best move applicable in the current context from the "playbook"&amp;nbsp; At the end of each run, save the moves &amp;amp; the outcome to the "playbook" for reference in the next runs.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Thus the code "learns" the consequences of each move and gradually evolves (into something better) with each run. Care should be taken to formulate the "rulebook". It must be carefully devised to prevent the AI system from performing any illegal moves.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;u&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Additional points of interest:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;ul style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Pruning&lt;/b&gt; : Removing obsolete/duplicate entries from the rulebook.&lt;br /&gt;- Reduces the "rulebook" size. Leads to faster decision making.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Character traits&lt;/b&gt; : Aggressive, defensive, favorite moves etc.&lt;br /&gt;- Useful in games. To provide multiple opponents.&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Realistic AI&lt;/b&gt; : Possible to trick AI into making occasional mistakes.&lt;br /&gt;- Again useful in games. Makes gameplay more realistic &amp;amp; fun.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-3345324706126496688?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2HWYGhaF5FTptzLzsgMWZuVDVto/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2HWYGhaF5FTptzLzsgMWZuVDVto/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2HWYGhaF5FTptzLzsgMWZuVDVto/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2HWYGhaF5FTptzLzsgMWZuVDVto/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/YxsySTYRMGE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/3345324706126496688/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/09/ai-heuristics.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/3345324706126496688?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/3345324706126496688?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/YxsySTYRMGE/ai-heuristics.html" title="AI : Heuristics" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><georss:featurename>Jeevanbheema Nagar Main Rd, HAL III Stage, New Thipasandra, Bengaluru, Karnataka, India</georss:featurename><georss:point>12.968273037893827 77.65063494443893</georss:point><georss:box>12.968031037893827 77.65032644443893 12.968515037893827 77.65094344443894</georss:box><feedburner:origLink>http://thecodeartist.blogspot.com/2011/09/ai-heuristics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIBQ3s7eSp7ImA9WhdVFU0.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-7675200813478700747</id><published>2011-03-17T20:22:00.025+05:30</published><updated>2011-09-20T13:12:32.501+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-20T13:12:32.501+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="keyevents" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="adb" /><title>Simulating keypress events on Android</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://lh5.googleusercontent.com/-XGYesWeOJqw/TYIpi_f7XzI/AAAAAAAAAX4/kqwTmkGaq5g/s1600/power-key-button.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="https://lh5.googleusercontent.com/-XGYesWeOJqw/TYIpi_f7XzI/AAAAAAAAAX4/kqwTmkGaq5g/s1600/power-key-button.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="font-size: small;"&gt;Modern day smart-phones have already begun to migrate from the traditional "a-button-for-every-need" approach to the "huge-display-cum-touchscreen" form-factors. Android phones&amp;nbsp; are no exception. But, traditional buttons are still reqd. for a few oft used functions (power,back,home,menu etc.) And smart-phones continue to have them alongwith the primary touch-based-UI.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Android-OS provides a very easy method to simulate key/button press/release events via software. You might ask why do we need a software to generate the events when a hardware button is already present on the device. Here's why:&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ul style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;During development/testing of the button-drivers itself.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;To implement automated rigorous tests. ( &lt;b&gt;&lt;a href="http://developer.android.com/guide/developing/tools/monkey.html"&gt;MonkeyTest&lt;/a&gt;&lt;/b&gt;? )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;To implement/interface additional custom software keyboards. &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Just because we can!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;The reason why i am doing it today is &lt;b&gt;REASON NUMBER 4&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Now, the basic goal of this exercise is extremely simple:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;Q. How to generate a hardware-button-press event&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WITHOUT actually pressing any key on the device?&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;Let us first understand what happens when a hardware button is pressed. &lt;/span&gt;&lt;span style="font-size: small;"&gt;Here is what happens when you press a button on an Android device:&lt;/span&gt;&lt;/div&gt;
&lt;ol style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;The h/w button triggers an interrupt.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;The ISR of the corresponding driver gets called (in kernel).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;In the ISR, the driver generates an input-event.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Android-framework (in userspace) gets the notification of the event.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Android reads the input-event code &amp;amp; type.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Compares it with the proper "keymap/keylayout" file.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;The proper button is identified.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;To simulate button presses we enter this procedure at STEP3.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Instead of the regular driver generating the input-event, we generate an input-event ourselves using a pre-built userspace binary. This will then be notified to the Android-framework and the rest continues as above.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;So now all depends on the the pre-built userspace binary, which is...&lt;br /&gt;
[ drum-roll... ]&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;...&lt;b&gt;Input&lt;/b&gt;. (How convenient!) The syntax of&lt;b&gt; input&lt;/b&gt; is as follows&lt;b&gt;:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;input &lt;/b&gt;keyevent &amp;lt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;event_code&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Now, before we try to send any keyevent, we need to find out the event-code that maps to the h/w key we want to simulate. The following table summarizes all the supported keycodes in Android:&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="https://lh4.googleusercontent.com/-kb19V3eCj1g/TYIaEklPgmI/AAAAAAAAAXQ/cz1mEj9Wr_s/s1600/Android-input-keycodes.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh4.googleusercontent.com/-kb19V3eCj1g/TYIaEklPgmI/AAAAAAAAAXQ/cz1mEj9Wr_s/s1600/Android-input-keycodes.png" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-family: Verdana,sans-serif; font-size: small;"&gt;Additionally we can look up the keylayout (.kl) file on the device. Personally, I find keylayout a misnomer, as we are not talking about different keyboards here, but different mappings of an input-event-value to its functionality.&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Anyways you can always find the file in &lt;b&gt;system/usr/keylayout/xyz.kl&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;NOTE: &lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Verdana,sans-serif; font-size: small;"&gt;For each keyboard device &lt;b&gt;xyz&lt;/b&gt;, the &lt;b&gt;android.keylayout.xyz&lt;/b&gt; system property must be set. If a keylayout file is not specified, Android will default to&lt;b&gt; /system/usr/keylayout/qwerty.kl&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Now to generate a event of a specific keycode, we simply execute this on the terminal/serial console:&lt;/span&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;input keyevent &amp;lt;keycode&amp;gt;&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;The value of &lt;b&gt;keycode&lt;/b&gt; can be any of the integer values from the above table. In case a serial-console is NOT available on your device, you can always run the command via adb as follows:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;adb shell input keyevent &amp;lt;keycode&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;That's how a hardware-button-press is simulated&lt;/span&gt;&lt;span style="font-size: small;"&gt; in software&lt;/span&gt;&lt;span style="font-size: small;"&gt;!!&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;u style="font-family: Verdana,sans-serif;"&gt;Further Reading: &lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style="font-family: Verdana,sans-serif; text-align: left;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;More on keycodes, keymaps &amp;amp; Android-Input in general:&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://www.netmite.com/android/mydroid/development/pdk/docs/keymaps_keyboard_input.html"&gt;&lt;br /&gt;
Android/development/pdk/docs/keymaps_keyboard_input.html&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Android's Keyevent Class summary&lt;br /&gt;&lt;a href="http://developer.android.com/reference/android/view/KeyEvent.html"&gt;http://developer.android.com/reference/android/view/KeyEvent.html&lt;/a&gt; &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-7675200813478700747?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wCeW-0HBZglYh0JmHLT9fDrfrd8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wCeW-0HBZglYh0JmHLT9fDrfrd8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wCeW-0HBZglYh0JmHLT9fDrfrd8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wCeW-0HBZglYh0JmHLT9fDrfrd8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/ZkG-4ZbHXG0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/7675200813478700747/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/03/simulating-keyevents-on-android-device.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/7675200813478700747?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/7675200813478700747?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/ZkG-4ZbHXG0/simulating-keyevents-on-android-device.html" title="Simulating keypress events on Android" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh5.googleusercontent.com/-XGYesWeOJqw/TYIpi_f7XzI/AAAAAAAAAX4/kqwTmkGaq5g/s72-c/power-key-button.png" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/03/simulating-keyevents-on-android-device.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YBR3wycCp7ImA9WhZTGEs.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-8028268845331164344</id><published>2011-03-17T16:30:00.007+05:30</published><updated>2011-03-23T11:49:16.298+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-23T11:49:16.298+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Quilt" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Patches" /><title>Quilt : This patch can be reverse applied</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Quilt&lt;/b&gt; is a very sweet little tool. Very easy for generating &amp;amp; maintaining a &lt;b&gt;series&lt;/b&gt; of&amp;nbsp; &lt;b&gt;patches&lt;/b&gt; to your code. Anyone involved in even a moderate bit of &lt;b&gt;quilt&lt;/b&gt;ing will often come across this message especially when trying to apply &lt;b&gt;import&lt;/b&gt;ed patches.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;blockquote style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Patch &amp;lt;&lt;b&gt;patch-name here&lt;/b&gt;&amp;gt; can be reverse-applied &lt;/span&gt;&lt;/blockquote&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;What exactly does this message mean?&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Quilt is basically trying to tell us that &lt;b&gt;ALL&lt;/b&gt; the changes in the patch (we are trying to apply) are already present in our code.The term "&lt;b&gt;reverse-applied&lt;/b&gt;" seems to be derived from some other version-control system.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;How-To &lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Resolve this error?...&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;Simply comment the patch file in the series file as follows:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;prev patch file&lt;br /&gt;
#current patch file&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;-- this patch can be reverse-applied.&lt;br /&gt;
next patch file1&lt;br /&gt;
next patch file2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;This effectively means that since all the changes provided by this patch are already present in your existing code, you are ignoring this patch completely and moving on to the next patch in the series.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;Read more about quilt &lt;a href="http://linux.die.net/man/1/quilt"&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;UPDATE:&lt;/b&gt;&lt;/u&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;Also one can use the &lt;a href="http://linux.die.net/man/1/patch"&gt;&lt;b&gt;patch -R&lt;/b&gt;&lt;/a&gt; command to reverse-apply&lt;br /&gt;
(i.e. revert) the patch. This is equivalent to removing the changes made by the patch, without altering the series.&lt;br /&gt;
(i.e. without quilt in the picture.)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;After the patch -R command succeeds, then &lt;b&gt;quilt push&lt;/b&gt; should work well and add the changes back and proceed to the next patch-file in the series.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;Read more about patch &lt;a href="http://linux.die.net/man/1/patch"&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-8028268845331164344?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LUBi54qNPjaTI1BN4t8Uf3qINSE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LUBi54qNPjaTI1BN4t8Uf3qINSE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LUBi54qNPjaTI1BN4t8Uf3qINSE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LUBi54qNPjaTI1BN4t8Uf3qINSE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/KbIpEp06CrY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/8028268845331164344/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/03/quilt-this-patch-can-be-reverse-applied.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/8028268845331164344?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/8028268845331164344?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/KbIpEp06CrY/quilt-this-patch-can-be-reverse-applied.html" title="Quilt : This patch can be reverse applied" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/03/quilt-this-patch-can-be-reverse-applied.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cMQXo8fip7ImA9WhdVFU0.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-9142332612803020465</id><published>2011-01-12T16:27:00.006+05:30</published><updated>2011-09-20T13:21:20.476+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-20T13:21:20.476+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Proximity-sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="Light Sensor" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="Sensors" /><title>Proximity Sensor on Android Gingerbread</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_Z0O1Byloutc/TS1apHo0IOI/AAAAAAAAAQ4/7HCvijZeP3o/s1600/proximity-call.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/_Z0O1Byloutc/TS1apHo0IOI/AAAAAAAAAQ4/7HCvijZeP3o/s200/proximity-call.png" width="200" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;The proximity sensor is common on most smart-phones, the ones that have a touchscreen. This is because the primary function of a proximity sensor is to disable accidental touch events. The most common scenario being- The ear coming in contact with the screen and generating touch events, while on a call.&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;To solve the "&lt;b&gt;I didn't take that stupid picture, my ear did&lt;/b&gt;" issue, device manufacturers came up with the idea of a placing a proximity sensor close to the speaker, which will then detect any object in the vicinity of the speaker. If any object is present (ex. user's ear), then the touch events can be assumed to be accidental &amp;amp; ignored.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;Now there are various technologies for proximity sensing:&lt;/span&gt;&lt;/div&gt;
&lt;ul style="font-family: Verdana,sans-serif;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Electrical (Inductive, Capacitive)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Optical. (IR, Laser)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Magnetic.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Sonar.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Of all these, the most non-intrusive and low-cost modules are the optical proximity sensors. These can detect bodies in the vicinity of the device upto 5cm. This is perfect for use on smart-phones.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Coming to &lt;a href="http://thecodeartist.blogspot.com/2010/12/sensors-on-android-23-gingerbread.html"&gt;Sensors on Android-Gingerbread&lt;/a&gt;, the proximity sensor is often implemented using a light sensor chip. Common ones are ISL29003/23 &amp;amp; GP2A by Intersil &amp;amp; Sharp respectively. Both these sensor-chips are primarily active light sensors, which provide the ambient light intensity in &lt;a href="http://en.wikipedia.org/wiki/Lux"&gt;LUX &lt;/a&gt;units.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;The distance value is measured in centimeters. Note that some proximity sensors only support a binary "close" or "far" measurement.&amp;nbsp; In this case, the sensor should report its maxRange value in the "far" state and a value less than maxRange in the "near" state.&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_Z0O1Byloutc/TS1apHo0IOI/AAAAAAAAAQ4/7HCvijZeP3o/s1600/proximity-call.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_Z0O1Byloutc/TS1Zwksdi1I/AAAAAAAAAQw/8VwY5plJvvY/s1600/proximity-sensorl.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/_Z0O1Byloutc/TS1Zwksdi1I/AAAAAAAAAQw/8VwY5plJvvY/s200/proximity-sensorl.png" width="133" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_Z0O1Byloutc/TS2FjzMNkRI/AAAAAAAAARQ/iYOEWNDLDls/s1600/proximity-threshold.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Let us take an example. Say the device uses a GP2A chip placed close to the speaker facing the user (as shown in the adjoining pic). The normal&amp;nbsp; light response of the GP2A is such that it triggers a proximity-detect interrupt at a distance of approximately 5cms in normal lighting. &lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;This means that when the user receives a call and brings the phone closer to his ear, the ambient-light around the light/proximity-sensor slowly drops down below the threshold &amp;amp; the sensor detects this and switches the state from FAR to NEAR. This event can be detected by any android application which has registered a SensorEventListener.&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_Z0O1Byloutc/TS2FjzMNkRI/AAAAAAAAARQ/iYOEWNDLDls/s1600/proximity-threshold.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="96" src="http://3.bp.blogspot.com/_Z0O1Byloutc/TS2FjzMNkRI/AAAAAAAAARQ/iYOEWNDLDls/s200/proximity-threshold.png" width="200" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;In most Android phones, the proximity sensor is implemented as a boolean-sensor. Its returns just two values "NEAR" &amp;amp; "FAR". &lt;i&gt;&lt;b&gt;Thresholding&lt;/b&gt;&lt;/i&gt; is done on the LUX value i.e. the LUX value of the light sensor is compared with a &lt;i&gt;&lt;b&gt;threshold&lt;/b&gt;&lt;/i&gt;.  A LUX-value more than threshold means the proximity sensor returns "FAR".  Anything less than the threshold value and the sensor&amp;nbsp; returns "NEAR". The actual value of threshold is  custom-defined depending on the sensor-chip in use and its  light-response, coupled with the location &amp;amp; orientation of the chip  on the smart-phone body. &lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;The proximity sensor is implemented very much like the other sensors except on one critical point - &lt;/span&gt;&lt;/div&gt;
&lt;blockquote style="font-family: Verdana,sans-serif;"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Proximity sensor is interrupt-based (not Poll-based). &lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;All the other sensors are polled for at regular intervals, selected by the DELAY parameter used while registering a SensorEventListener. Proximity Sensor is interrupt based (NOT polling). This means that we get a proximity event only when the proximity changes (either &lt;b&gt;NEAR to FAR&lt;/b&gt; or &lt;b&gt;FAR to NEAR&lt;/b&gt;).&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: center;"&gt;
&lt;span style="font-size: small;"&gt;__________________________&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Further Reading:&lt;/span&gt;&lt;/div&gt;
&lt;ul style="font-family: Verdana,sans-serif;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt; &lt;a href="http://thecodeartist.blogspot.com/2010/12/sensors-on-android-23-gingerbread.html"&gt;Complete overview of Sensors of Android Gingerbread&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-9142332612803020465?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bFiF8K6VGVO5xMOcVAtuOAyJ3NM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bFiF8K6VGVO5xMOcVAtuOAyJ3NM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bFiF8K6VGVO5xMOcVAtuOAyJ3NM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bFiF8K6VGVO5xMOcVAtuOAyJ3NM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/UW_3buBIn5o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/9142332612803020465/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/01/proximity-sensor-on-android-gingerbread.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/9142332612803020465?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/9142332612803020465?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/UW_3buBIn5o/proximity-sensor-on-android-gingerbread.html" title="Proximity Sensor on Android Gingerbread" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_Z0O1Byloutc/TS1apHo0IOI/AAAAAAAAAQ4/7HCvijZeP3o/s72-c/proximity-call.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/01/proximity-sensor-on-android-gingerbread.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4HSXg9cCp7ImA9WhdUGE8.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-2672461641575432218</id><published>2011-01-03T11:14:00.006+05:30</published><updated>2011-10-05T19:25:38.668+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-05T19:25:38.668+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="AI" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Artificial Intelligence" /><title>AI : Artificial or Actual Intelligence</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Here is a question for the programmer in you:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
Q. How do you write a program that writes itself ?&lt;/blockquote&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
NOTE: The following article is NOT about &lt;a href="http://en.wikipedia.org/wiki/Quine_%28computing%29"&gt;quines&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Now coming back to the question, let us think for a moment. do we really need a program that can write itself. Or to put it more precisely, In what scenario is a self-modifying piece of code better than one which is not?&lt;br /&gt;
&lt;br /&gt;
The first obvious scenario that comes to mind is that : Catching Run-time Errors.&lt;br /&gt;
Currently there are two schools of thought on the whole run-time issue scene.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Run-Time errors are critical and must and should be identified &amp;amp; fixed.&lt;/li&gt;
&lt;li&gt;There is no such thing as a Run-Time error.&lt;br /&gt;
( There are only Exceptions &lt;b&gt;;)&lt;/b&gt; )&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;ol&gt;&lt;/ol&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_Z0O1Byloutc/TR1vxm1BsfI/AAAAAAAAAQk/KivzwYo0Jis/s1600/agile-test-cycle.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="198" src="http://2.bp.blogspot.com/_Z0O1Byloutc/TR1vxm1BsfI/AAAAAAAAAQk/KivzwYo0Jis/s200/agile-test-cycle.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
The first school of thought is very harsh on developer. It expects developers to foresee the program's future and code in such a manner so as to be able to handle ANY situation that may arise ( however rarely). This also encourages Test-Driven programming which is sloppy to say the least. With every test-cycle discovering a series of "bugs" (that occur once 1 say 10,000 iterations) &amp;amp; adding a series of "minor" patches or fixes for each. By the time the code is considered "ready", its hardly efficient any more. Often the patches outnumber the original code itself.&lt;b style="color: red;"&gt;&lt;span style="font-size: xx-small;"&gt;[1]&lt;/span&gt;&lt;/b&gt; This goes to show that the "ready" code doesn't do its job efficiently, but also more importantly, no longer does it do what it was originally intended to. &lt;i&gt;You don't take a F1 car and add a tanker-trailer to carry gasoline just in case it runs out.&lt;/i&gt; Proper design is a prerequisite and oft ignored phase in most development projects&lt;span style="font-size: xx-small;"&gt; &lt;b style="color: red;"&gt;[2]&lt;/b&gt;&lt;/span&gt;.&lt;/div&gt;
&lt;br /&gt;
In the second school of thought, we find die-hard fans and wannabe fan-boys of&amp;nbsp; languages like JAVA that allow a developer to get away with anything and everything, as long as he feels comfortable doing it the way it is done. A guy trained in this school of thought will firmly believe that-&lt;br /&gt;
&lt;blockquote&gt;
&lt;i&gt;If a tree was going to fall, and you knew it would fall,&lt;br /&gt;
then hey! its not a problem anymore. Its expected behavior!&lt;/i&gt;&amp;nbsp;&lt;/blockquote&gt;
Rather than preventing the tree from falling,&lt;br /&gt;
you gently step aside &amp;amp; wait for it to fall...&lt;br /&gt;
&lt;div style="text-align: right;"&gt;
...and then proceed&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="color: red;"&gt;&lt;span style="font-size: xx-small;"&gt; [3]&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
try {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; tree = forest.tree;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tree.falling() == 1) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TreeFallingException("RUN!");&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.printLine("All iz well");&lt;br /&gt;
&lt;br /&gt;
} catch (TreeFallingException e) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.printLine("RUN! RUN! RUN!");&lt;br /&gt;
&lt;br /&gt;
} catch (Exception err) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.printLine("No tree, But RUN! " + err.WhyToRun());&lt;br /&gt;
&lt;br /&gt;
} finally {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.printLine("THE-END");&lt;br /&gt;
}&lt;/blockquote&gt;
&lt;br /&gt;
As we see, neither approach is perfect and both have their disadvantages.&lt;span style="font-size: large;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;Enter A.I. &lt;/b&gt;...&lt;/span&gt;&lt;br /&gt;
Imagine a platform where you have infinite memory. Now add infinite processing power to your kitty. With these two in your pocket, you can write a program to do pretty much anything, right? So whats the catch you might ask.&lt;br /&gt;
That IS &lt;b&gt;THE&lt;/b&gt; catch? &lt;b&gt;Your program has to be able to do EVERYTHING!&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;
More on this in a latter post.&lt;br /&gt;
&lt;br /&gt;
To wrap-up:&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;Q.&lt;/b&gt; How do you write a program that writes itself ?&lt;br /&gt;
&lt;b&gt;ANS:&lt;/b&gt; Quite simply, &lt;b&gt;You don't! ;-)&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;
Read part2 of this series &lt;a href="http://thecodeartist.blogspot.com/2011/09/ai-heuristics.html"&gt;AI: Heuristics&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;u&gt;Footnotes:&lt;/u&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="color: red;"&gt;&lt;span style="font-size: xx-small;"&gt;[1]&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-size: small;"&gt; Each patch to the applied to the code is the evolving code itself. But developer intervenes individually.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style="color: red;"&gt;&lt;span style="font-size: xx-small;"&gt;[2]&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-size: small;"&gt; Today's average&amp;nbsp;developer, having been exposed to the horrors of coding a poor design, is in a position to understand the problems of not spending enough time in the design phase. But, Its often the tightly constrained project schedules and the uncertainty associated with new-technologies that mean that there is never enough time dedicated to the design-phase.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="color: red;"&gt;&lt;span style="font-size: xx-small;"&gt;[3]&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-size: small;"&gt; Each catch-block added to the&amp;nbsp;code is the evolving code itself. Again here the developer intervenes.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-2672461641575432218?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GJs9I9MQYB0QmMR1L4WWbwVXl1o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GJs9I9MQYB0QmMR1L4WWbwVXl1o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GJs9I9MQYB0QmMR1L4WWbwVXl1o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GJs9I9MQYB0QmMR1L4WWbwVXl1o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/2_mZD4GGIug" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/2672461641575432218/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2011/01/ai-artificial-or-actual-intelligence.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/2672461641575432218?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/2672461641575432218?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/2_mZD4GGIug/ai-artificial-or-actual-intelligence.html" title="AI : Artificial or Actual Intelligence" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_Z0O1Byloutc/TR1vxm1BsfI/AAAAAAAAAQk/KivzwYo0Jis/s72-c/agile-test-cycle.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2011/01/ai-artificial-or-actual-intelligence.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQERX04eCp7ImA9WhRRGE8.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-6151227713622239286</id><published>2010-12-24T16:00:00.003+05:30</published><updated>2011-12-02T17:48:24.330+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-02T17:48:24.330+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Invensense" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Gingerbread" /><category scheme="http://www.blogger.com/atom/ns#" term="Android" /><category scheme="http://www.blogger.com/atom/ns#" term="Sensors" /><title>Sensors on Android Gingerbread</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Android 2.3 (codename Gingerbread) was officially released amidst huge hype and fanfare last week and BOY O BOY!!&amp;nbsp; people sure are queuing-up to have a peek. Sensors were the most hyped about sub-system. &lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
Just google-search "Android Gingerbread" &amp;amp;&lt;span id="main" style="visibility: visible;"&gt;&lt;span id="search" style="visibility: visible;"&gt;&lt;span class="tl"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; you will see a host of results of this pattern:&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;blockquote&gt;
&lt;h3 class="r"&gt;
&lt;i&gt;&lt;span style="font-size: large;"&gt;The big news in Android 2.3 Gingerbread&lt;br /&gt;
Support for new &lt;b&gt;sensors&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/h3&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
Android-Fans sure are blogging everywhere about the enhanced support for "NEW" sensors on gingerbread. But having worked on Android sensors since the days of cupcake, I beg to differ...&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;&lt;span style="font-size: small;"&gt;Gingerbread does NOT support any NEW sensors!&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
Here is what Android has to say in the official Gingerbread &lt;b&gt;&lt;a href="http://developer.android.com/sdk/android-2.3-highlights.html#gaming"&gt;release notes&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;blockquote&gt;
&lt;div style="margin-bottom: 0.75em; margin-top: 1.25em;"&gt;
&lt;b&gt;Native input and sensor events&lt;/b&gt;&lt;/div&gt;
Applications that use native code can now receive and process input and sensor events directly in their native code, which dramatically improves efficiency and responsiveness. &lt;br /&gt;
Native libraries exposed by the platform let applications handle the same types of input events as those available through the framework. Applications can receive events from all supported sensor types and can enable/disable specific sensors and manage event delivery rate and queueing. &lt;br /&gt;
&lt;div style="margin-bottom: 0.75em; margin-top: 1.25em;"&gt;
&lt;b&gt;Gyroscope and other new sensors,&lt;br /&gt;
for improved 3D motion processing&lt;/b&gt;&lt;/div&gt;
Android 2.3 adds API support for several new sensor types, including gyroscope, rotation vector, linear acceleration, gravity, and barometer sensors. Applications can use the new sensors in combination with any other sensors available on the device, to track three-dimensional device motion and orientation change with high precision and accuracy. For example, a game application could use readings from a gyroscope and accelerometer on the device to recognize complex user gestures and motions, such as tilt, spin, thrust, and slice.&lt;/blockquote&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
That &lt;b&gt;IS&lt;/b&gt; quite a mouthful. But stripping-off the marketing-spiel we can say:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Gingerbread provides sensors-support to native C/C++ apps.&lt;/li&gt;
&lt;li&gt;Gingerbread provides more accurate and precise sensor-data.&lt;/li&gt;
&lt;li&gt;Gingerbread provides APIs to recognise complex user gestures.&lt;/li&gt;
&lt;li&gt;Gingerbread supports gyroscope and barometer.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Z0O1Byloutc/TROFZX3WwLI/AAAAAAAAAP8/jjHATwSl-Qg/s1600/Sensor-gb.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_Z0O1Byloutc/TROFZX3WwLI/AAAAAAAAAP8/jjHATwSl-Qg/s320/Sensor-gb.png" width="224" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Real Sensors map 1-to-1 to actual Hardware.&lt;br /&gt;
Data of Virtual Sensors, on the other hand,&lt;br /&gt;
is exported to the apps by performing&lt;br /&gt;
calculations on 1(or more) real sensors.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style="text-align: justify;"&gt;
While points [1], [2], [3] do mention tremendous improvements over FroYo, none of them has to do anything with any new sensors. Moving on to [4] we see the first mention of supposedly new sensors. But, here are two things that most people overlook:&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;div style="text-align: left;"&gt;
&lt;b&gt;- Both Gyroscope and Barometer (i.e. pressure) sensors were already available in previous releases of Android.&lt;br /&gt;
&lt;br /&gt;
- The 4 "NEW" sensors (shown alongside) are just wrapper-APIs around existing hardware. They just provided "easy-to-digest" data.&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
These newly introduced wrapper-APIs process the raw sensor data into a format ready to use by the Android apps. This proves especially useful to the apps doing advanced 3D math. ( &lt;i&gt;read Games&lt;/i&gt; &lt;b&gt;;)&lt;/b&gt; )&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Gyroscope sensor was supported in FroYo and so was Barometer. Since it was early days for Android sensors not much attention was paid to them. Maybe even added as an afterthought to the existing array of Accelerometer,Compass,Orientation.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
With Android apps ( &lt;i&gt;again read Games &lt;/i&gt;&lt;b&gt;;)&lt;/b&gt; ) really pushing them to the limit, the limitations of a "pure" accelerometer device became evident.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;Step-In INVENSENSE...&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.fareastgizmos.com/entry_images/0108/29/invensense-thumb-450x236.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="104" src="http://www.fareastgizmos.com/entry_images/0108/29/invensense-thumb-450x236.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Founded in 2003, InvenSense is based in Sunnyvale, California, Invensense is a market-leader in advanced MEMS gyroscope design. Their latest offering (based on SensorFusion technology) is a MotionProcessing library i.e. &lt;b&gt;&lt;a href="http://www.invensense.com/mems/gyro/documents/articles/120710_InvenSense_Announces_Worlds_First_MotionProcessing_Library_9-Axis_Sensor_Fusion_For_Android_Gingerbread.html"&gt;MPL on Android Gingerbread&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Apart from the rudimentary API which Android provided, Invensense Motion-Processing Library(MPL) sits alongside the Sensor-HAL and provides a feature-rich API to obtain Gestures, Glyphs &amp;amp; Pedometer data from sensors.&lt;br /&gt;
&lt;br /&gt;
All this data is derieved from a combination of Accelerometer/Gyroscope/Compass hardware modules. The MPL processes the individual data and combines them appropriately to overcome the individual limitations of each sensor &amp;amp; provide an overall better stream of precise &amp;amp; accurate (processed)samples. Also Advanced operation/Pattern-matching &amp;amp; count is done by the MPL and any app can then directly obtain data pertaining to gestures or step-counts(pedometer) etc. using the MPL APIs.&lt;br /&gt;
&lt;br /&gt;
Here is a "short" video by David Sachs(Invensense Tech) which explains the advantages of INVENSENSE MPL extensions on Android...&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;object 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://1.gvt0.com/vi/C7JQ7Rpwn2k/0.jpg" height="400" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/C7JQ7Rpwn2k&amp;fs=1&amp;source=uds" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;embed width="480" height="400" src="http://www.youtube.com/v/C7JQ7Rpwn2k&amp;fs=1&amp;source=uds" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
To conclude, one can say that the Sensor sub-system has undergone a huge overhaul&amp;nbsp; in Gingerbread. And one can only hope that what it delivers is well worth all the hyped-up expectations.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
_________________________&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;b&gt;Related Posts:&lt;/b&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://thecodeartist.blogspot.com/2011/01/proximity-sensor-on-android-gingerbread.html"&gt;&lt;b&gt;Proximity Sensor on Android&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-6151227713622239286?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rN1x96Nd5wn2NiTbN5UTq0mX1mk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rN1x96Nd5wn2NiTbN5UTq0mX1mk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rN1x96Nd5wn2NiTbN5UTq0mX1mk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rN1x96Nd5wn2NiTbN5UTq0mX1mk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/lV15hACCkcA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/6151227713622239286/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2010/12/sensors-on-android-gingerbread.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/6151227713622239286?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/6151227713622239286?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/lV15hACCkcA/sensors-on-android-gingerbread.html" title="Sensors on Android Gingerbread" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_Z0O1Byloutc/TROFZX3WwLI/AAAAAAAAAP8/jjHATwSl-Qg/s72-c/Sensor-gb.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2010/12/sensors-on-android-gingerbread.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQFRXc_cSp7ImA9WhRXGU0.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-5211009240716012067</id><published>2010-09-14T11:47:00.006+05:30</published><updated>2011-12-26T19:01:54.949+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-26T19:01:54.949+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Misc." /><title>Bachelor of (Reverse) Engineering</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Just a thought - What makes newly graduated engineers (or "freshers" in layman terms) such bad programmers. Why is it that in the IT industry, experience counts more than anything else! Why is it that companies spend so much in training recently graduated engineers "freshers". More simply put,&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
Q. What is the main difference between a&lt;br /&gt;
"&lt;b&gt;brilliant fresher&lt;/b&gt;" and an "&lt;b&gt;experienced pro&lt;/b&gt;"?&lt;/blockquote&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;The answer lies in the following fact. Most of what is taught in undergraduate courses (BE/B.Tech) is irrelevant to what one actually ends up doing as a "fresher" programmer. No one in his/her right mind would tell a fresher to design the framework of a new module. Also a programmer never has to write fresh code from scratch. The job at hand is, almost always, to fix bugs in existing code and sometimes to add a few "features" to existing software.&lt;br /&gt;
This means the good programmer needs to be:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Good at &lt;u&gt;reading&lt;/u&gt; code quickly.&lt;/li&gt;
&lt;li&gt;Good at &lt;u&gt;identifying&lt;/u&gt; the relevant parts quickly. &lt;/li&gt;
&lt;li&gt;Good at &lt;u&gt;understanding &lt;/u&gt;code quickly.&lt;/li&gt;
&lt;/ul&gt;
It might be surprising to know, but seldom are these emphasized enough. Rarely does any "fresher" ever focus on these aspects. Instead you will always find one totally engrossed in any of the following:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;u&gt;Writing&lt;/u&gt; code as efficiently as possible.&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Writing &lt;/u&gt;it so that it is easier to understand.&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Writing &lt;/u&gt;it in newer languages.&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Writing &lt;/u&gt;code using newer IDEs.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Ask any "fresher" whats so special about him and he is sure to reply that he can &lt;u&gt;write&lt;/u&gt; better code than his peers. Little does he know that &lt;i&gt;&lt;b&gt;writing code is going to be the least of his worries&lt;/b&gt;&lt;/i&gt; (for the next few years atleast).&lt;br /&gt;
&lt;br /&gt;
To drive the point home lets look at the following code-snippet:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
for(j = 0; j &amp;lt; MAX; j++) {&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //some&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //code&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //here&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; //ISSUE #xyzxyz FIX: change order&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i = (j &amp;lt; 2) ? !j : j;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (i) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; //case 0 code&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 1:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; //case 1 code&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 2:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; //case 2 code&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; //rest of the code here&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
}&lt;/code&gt;
&lt;br /&gt;
The above snippet is what one would encounter on an average day.

Note the following line:&lt;br /&gt;
&lt;code&gt;i = (j &amp;lt; &lt;span style="color: magenta;"&gt;2&lt;/span&gt;) ? !j : j;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Can You figure out what the ISSUE could have been.&lt;br /&gt;
And how the one-liner FIX solves it... ;-)&lt;br /&gt;
&lt;br /&gt;
(more on this in later post)&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-5211009240716012067?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_miQXsRygXcGBkCZombz8xXOHlQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_miQXsRygXcGBkCZombz8xXOHlQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_miQXsRygXcGBkCZombz8xXOHlQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_miQXsRygXcGBkCZombz8xXOHlQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/yA1jDJ7lp_8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/5211009240716012067/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2010/09/bachelor-of-reverse-engineering.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/5211009240716012067?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/5211009240716012067?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/yA1jDJ7lp_8/bachelor-of-reverse-engineering.html" title="Bachelor of (Reverse) Engineering" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2010/09/bachelor-of-reverse-engineering.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcMR3k5fSp7ImA9WhRRFks.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-6685918113197939029</id><published>2010-08-10T18:41:00.020+05:30</published><updated>2011-11-30T20:44:46.725+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-30T20:44:46.725+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Misc." /><title>What is NULL?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;first-char&gt;W&lt;/first-char&gt; hat is NULL? A friend of mine recently told me how this question had stumped his teacher in college and left her speechless for quite some time. Inspired by that, I posed myself the following question:&lt;br /&gt;
&lt;blockquote&gt;
Q. In not more than 10 words,&lt;br /&gt;
Define &lt;b&gt;NULL&lt;/b&gt; in the context of a programming language.&lt;/blockquote&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;And i came up with the following few answers:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Null is absolutely Nothing. Zilch.&lt;/li&gt;
&lt;li&gt;Null is something which is NOT defined.&lt;/li&gt;
&lt;li&gt;Null is the return-value of a function which has nothing to return. &lt;b&gt;†&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Null is the value of the pointer which points to nothing&lt;b&gt;. ‡&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Null is the character at the end of a string. &lt;/li&gt;
&lt;li&gt;Null is the character with ASCII-code zero.&lt;/li&gt;
&lt;li&gt; Null is a byte with all its bits set to 0.&lt;/li&gt;
&lt;/ol&gt;
If you have good observation skills then you will notice that the list starts with a very general definition and then moves on to more specific ones.&lt;br /&gt;
&lt;br /&gt;
In fact, [&lt;b&gt;1&lt;/b&gt;] &amp;amp; [&lt;b&gt;2&lt;/b&gt;] are so generic that they are applicable even in other fields (ex. Mathematics).&lt;br /&gt;
&lt;br /&gt;
[&lt;b&gt;3&lt;/b&gt;], [&lt;b&gt;4&lt;/b&gt;], [&lt;b&gt;5&lt;/b&gt;] &amp;amp; [&lt;b&gt;6&lt;/b&gt;] are NOT definitions in the true sense. Rather they are commonly found implementations (or "Use-Cases") of NULL in programming languages.&lt;br /&gt;
&lt;br /&gt;
Finally [&lt;b&gt;7&lt;/b&gt;] gives us a one-line definition of&lt;b&gt; NULL&lt;/b&gt; i.e.&lt;b&gt; &lt;i&gt;a byte with all its bits set to 0&lt;/i&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now with reference to [&lt;b&gt;7&lt;/b&gt;] we can see that-&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Since &lt;b&gt;ASCII-code zero&lt;/b&gt; is a byte with all bits set to 0, [&lt;b&gt;6&lt;/b&gt;] is the exact same definition but just in so many other words.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;[&lt;b&gt;5&lt;/b&gt;] is NOT a definition of NULL. Rather it is a commonly found usage of NULL. One sees NULL terminated strings everywhere. It is so common that even programming-languages that do NOT have any explicit support for NULL, support &lt;a href="http://msdn.microsoft.com/en-us/library/cc230353%28PROT.10%29.aspx"&gt;&lt;b&gt;lpStrZ&lt;/b&gt;&lt;/a&gt; i.e. null-terminated-strings.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;[&lt;b&gt;4&lt;/b&gt;] mentions yet another very common usage of NULL. Pointers are usually used to pass references to data between functions. As a special "use-case" whenever the "sender" function encounters a case wherein it has no (valid) data to pass, it assigns the value NULL to the pointer thereby signaling to the "receiver" function that the pointer reference is invalid.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;[&lt;b&gt;3&lt;/b&gt;] is yet another (not so common) usage of NULL. The following line&lt;code&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #38761d;"&gt;//end of function&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;span style="color: magenta;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;0&lt;/span&gt;&lt;span style="color: magenta;"&gt;)&lt;/span&gt;;&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
found at the end of so many common functions in any given C-code is the line that implements it. By convention, any function that completes execution successfully and has nothing to report (except for the fact that it succeeded) returns a NULL (i.e. zero in this case). In case of errors the functions usually return non-zero values which indicate the kind of error they encounter.  &lt;/li&gt;
&lt;/ul&gt;
Thus, we can clearly see that there is nothing special about NULL. It is just another name for zero. The name NULL signifies the usage the value zero is put to i.e. to state that it points-to/stands-for/holds nothing.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Further reading:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://boredzo.org/pointers"&gt;boredzo.org/pointers&lt;/a&gt;&lt;br /&gt;
" How a function pointer can even be the return value of a function...&lt;br /&gt;
...is &lt;i&gt;really&lt;/i&gt; mind-bending, so stretch your brain a bit so as not to risk injury."&lt;/li&gt;
&lt;li&gt;&lt;a href="http://c-faq.com/null/index.html%20"&gt;c-faq.com/null/index.html &lt;/a&gt;&lt;br /&gt;
20 Qs. 20 straight answers.&lt;br /&gt;
EVERYTHING you ever wondered about NULL pointers.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="color: black; text-align: center;"&gt;
____________ _ _ ____________&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;b&gt;† &lt;/b&gt;If your function returns some data  in some cases and no data in other cases, then define it as a non-void  function and use NULL when you have nothing to return.&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;b&gt;‡&lt;/b&gt;&amp;nbsp; Once a block of memory is freed, any pointers pointing to it must be set to NULL to prevent any accidental access.&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;BONUS&lt;/b&gt;:&amp;nbsp; Here is an even more intriguing question that the one i had started with:&lt;br /&gt;
&lt;blockquote&gt;
Q. What is the data-type of NULL?&lt;br /&gt;
&lt;b&gt;Hint:&lt;/b&gt; NULL is just yet another value like 13, 3.14 or 'c'.&lt;/blockquote&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-6685918113197939029?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JmeA_Q3xYfxlVKP6RV0DxKzekvo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JmeA_Q3xYfxlVKP6RV0DxKzekvo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JmeA_Q3xYfxlVKP6RV0DxKzekvo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JmeA_Q3xYfxlVKP6RV0DxKzekvo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/K8BZLgUuH4E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/6685918113197939029/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2010/08/what-is-null.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/6685918113197939029?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/6685918113197939029?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/K8BZLgUuH4E/what-is-null.html" title="What is NULL?" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2010/08/what-is-null.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQAR349cSp7ImA9Wx9WEko.&quot;"><id>tag:blogger.com,1999:blog-5879050571098780501.post-7126843310973645809</id><published>2010-08-09T09:52:00.019+05:30</published><updated>2011-01-17T18:49:06.069+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-17T18:49:06.069+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Misc." /><title>NULL</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;img alt="" class="aligncenter" height="100" src="http://3.bp.blogspot.com/_Z0O1Byloutc/TF_vDAlxXrI/AAAAAAAAAMI/hyU8klqCcSY/s1600/Empty_set.png" title="NULL" width="100" /&gt;&lt;/div&gt;&lt;blockquote&gt;In the beginning when God created the heavens and the earth,&lt;br /&gt;
the earth was a formless void...&lt;br /&gt;
&lt;br /&gt;
...Then God said, ‘Let there be light’; and there was light. -&lt;a href="http://www.amazon.com/Thru-Bible-Commentary-Vol-ebook/dp/B000SK24TM?ie=UTF8&amp;amp;tag=chi0b-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Genesis 1:1&lt;/a&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5879050571098780501-7126843310973645809?l=thecodeartist.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/o79g9IyxGB0hRx7vZ3g2TIcrvc4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/o79g9IyxGB0hRx7vZ3g2TIcrvc4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/o79g9IyxGB0hRx7vZ3g2TIcrvc4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/o79g9IyxGB0hRx7vZ3g2TIcrvc4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheCodeArtist/~4/F8h7Wxo7vhw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://thecodeartist.blogspot.com/feeds/7126843310973645809/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://thecodeartist.blogspot.com/2010/08/null.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/7126843310973645809?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5879050571098780501/posts/default/7126843310973645809?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TheCodeArtist/~3/F8h7Wxo7vhw/null.html" title="NULL" /><author><name>Chinmay V S</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tvSNu29f4rU/AAAAAAAAAAI/AAAAAAAAAyc/fZ6GJZmlCNc/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_Z0O1Byloutc/TF_vDAlxXrI/AAAAAAAAAMI/hyU8klqCcSY/s72-c/Empty_set.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://thecodeartist.blogspot.com/2010/08/null.html</feedburner:origLink></entry></feed>

