<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rafael Sanches</title>
	<atom:link href="http://blog.rafaelsanches.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rafaelsanches.com</link>
	<description>Good morning to the day;</description>
	<lastBuildDate>Tue, 17 Jan 2012 15:30:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.rafaelsanches.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rafael Sanches</title>
		<link>http://blog.rafaelsanches.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.rafaelsanches.com/osd.xml" title="Rafael Sanches" />
	<atom:link rel='hub' href='http://blog.rafaelsanches.com/?pushpress=hub'/>
		<item>
		<title>CraigsBook for iPad</title>
		<link>http://blog.rafaelsanches.com/2011/08/24/craigsbook-for-ipad/</link>
		<comments>http://blog.rafaelsanches.com/2011/08/24/craigsbook-for-ipad/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 23:01:25 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.rafaelsanches.com/?p=143</guid>
		<description><![CDATA[This app is my wife&#8216;s creation. She did this as a mini project to learn iOS and Objective-C. Please, download on the appstore: http://itunes.apple.com/us/app/craigsbook/id457238829?ls=1&#38;mt=8<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=143&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This app is my <a title="silvia twitter" href="https://twitter.com/scurioni" target="_blank">wife</a>&#8216;s creation. She did this as a mini project to learn iOS and Objective-C. Please, download on the appstore: <a title="craigsbook for iPad" href="http://itunes.apple.com/us/app/craigsbook/id457238829?ls=1&amp;mt=8" target="_blank">http://itunes.apple.com/us/app/craigsbook/id457238829?ls=1&amp;mt=8</a></p>

<a href='http://blog.rafaelsanches.com/2011/08/24/craigsbook-for-ipad/icon/' title='icon'><img data-attachment-id='147' data-orig-size='72,72' data-liked='0'width="72" height="72" src="http://mufumbo.files.wordpress.com/2011/08/icon.png?w=72&#038;h=72" class="attachment-thumbnail" alt="craigsbook icon" title="icon" /></a>
<a href='http://blog.rafaelsanches.com/2011/08/24/craigsbook-for-ipad/mzl-xlugynhk-480x480-75/' title='mzl.xlugynhk.480x480-75'><img data-attachment-id='145' data-orig-size='360,480' data-liked='0'width="112" height="150" src="http://mufumbo.files.wordpress.com/2011/08/mzl-xlugynhk-480x480-75.jpg?w=112&#038;h=150" class="attachment-thumbnail" alt="mzl.xlugynhk.480x480-75" title="mzl.xlugynhk.480x480-75" /></a>
<a href='http://blog.rafaelsanches.com/2011/08/24/craigsbook-for-ipad/mzl-qilecboy-480x480-75/' title='mzl.qilecboy.480x480-75'><img data-attachment-id='144' data-orig-size='360,480' data-liked='0'width="112" height="150" src="http://mufumbo.files.wordpress.com/2011/08/mzl-qilecboy-480x480-75.jpg?w=112&#038;h=150" class="attachment-thumbnail" alt="mzl.qilecboy.480x480-75" title="mzl.qilecboy.480x480-75" /></a>

<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=143&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2011/08/24/craigsbook-for-ipad/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>

		<media:content url="http://mufumbo.files.wordpress.com/2011/08/icon.png?w=72" medium="image">
			<media:title type="html">icon</media:title>
		</media:content>

		<media:content url="http://mufumbo.files.wordpress.com/2011/08/mzl-xlugynhk-480x480-75.jpg?w=112" medium="image">
			<media:title type="html">mzl.xlugynhk.480x480-75</media:title>
		</media:content>

		<media:content url="http://mufumbo.files.wordpress.com/2011/08/mzl-qilecboy-480x480-75.jpg?w=112" medium="image">
			<media:title type="html">mzl.qilecboy.480x480-75</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Analytics lags on Android. How to make it more responsive!</title>
		<link>http://blog.rafaelsanches.com/2011/06/13/google-analytics-lags-on-android-how-to-make-it-responsive/</link>
		<comments>http://blog.rafaelsanches.com/2011/06/13/google-analytics-lags-on-android-how-to-make-it-responsive/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 05:55:44 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[analytics]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[maintainability]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[google analytics]]></category>

		<guid isPermaLink="false">http://blog.rafaelsanches.com/?p=139</guid>
		<description><![CDATA[Google Analytics can be your best friend in order to track your mobile user behavior. Unfortunately the current Android implementation has performance limitations and the most problematic is that it uses SQLite to store your events. Everyone who wants to write a responsive app knows that you can&#8217;t do SQLite operations in the UI Thread. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=139&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Google Analytics can be your best friend in order to track your mobile user behavior. Unfortunately the current Android implementation has performance limitations and the most problematic is that it uses SQLite to store your events.</p>
<p>Everyone who wants to write a responsive app knows that you can&#8217;t do SQLite operations in the UI Thread. Having to wrap the Google Analytics calls into a separated thread can be painful, so I wrote a very simple helper to handle it inside threads. I have many tracking events inside &#8220;button click&#8221; and it was taking about 200ms to execute, it&#8217;s too much on the UI Thread. It&#8217;s also too much if you have &#8220;onCreate&#8221; because it will take long time to open your new activity.</p>
<p>This helper is also very wrong because it maintains a static reference to the context. I do this in order to have better numbers on visit and &#8220;time on site&#8221;. You can just remove the static reference if you don&#8217;t like that.</p>
<p>Notice that my implementation has this: &#8220;Thread.sleep(3000);&#8221;<br />
It means that I don&#8217;t want repetitive Google Analytics SQLite to be competing with my app inserts or gets.</p>
<p>This LAG happens because SQLite uses the internal memory which can be very slow depending on many factors, including concurrent SQLite operations or just internal memory without many space.</p>
<p>I hope it helps someone. Here&#8217;s the complete code:</p>
<pre style="color:#000000;background:#ffffff;"><span style="color:#800000;font-weight:bold;">package</span><span style="color:#004a43;"> com</span><span style="color:#808030;">.</span><span style="color:#004a43;">mufumbo</span><span style="color:#808030;">.</span><span style="color:#004a43;">android</span><span style="color:#808030;">.</span><span style="color:#004a43;">helper</span><span style="color:#800080;">;</span>

<span style="color:#800000;font-weight:bold;">import</span><span style="color:#004a43;"> java</span><span style="color:#808030;">.</span><span style="color:#004a43;">util</span><span style="color:#808030;">.</span><span style="color:#004a43;">concurrent</span><span style="color:#808030;">.</span><span style="color:#004a43;">ExecutorService</span><span style="color:#800080;">;</span>
<span style="color:#800000;font-weight:bold;">import</span><span style="color:#004a43;"> java</span><span style="color:#808030;">.</span><span style="color:#004a43;">util</span><span style="color:#808030;">.</span><span style="color:#004a43;">concurrent</span><span style="color:#808030;">.</span><span style="color:#004a43;">Executors</span><span style="color:#800080;">;</span>

<span style="color:#800000;font-weight:bold;">import</span><span style="color:#004a43;"> android</span><span style="color:#808030;">.</span><span style="color:#004a43;">content</span><span style="color:#808030;">.</span><span style="color:#004a43;">Context</span><span style="color:#800080;">;</span>
<span style="color:#800000;font-weight:bold;">import</span><span style="color:#004a43;"> android</span><span style="color:#808030;">.</span><span style="color:#004a43;">util</span><span style="color:#808030;">.</span><span style="color:#004a43;">Log</span><span style="color:#800080;">;</span>

<span style="color:#800000;font-weight:bold;">import</span><span style="color:#004a43;"> com</span><span style="color:#808030;">.</span><span style="color:#004a43;">google</span><span style="color:#808030;">.</span><span style="color:#004a43;">android</span><span style="color:#808030;">.</span><span style="color:#004a43;">apps</span><span style="color:#808030;">.</span><span style="color:#004a43;">analytics</span><span style="color:#808030;">.</span><span style="color:#004a43;">GoogleAnalyticsTracker</span><span style="color:#800080;">;</span>

<span style="color:#800000;font-weight:bold;">public</span> <span style="color:#800000;font-weight:bold;">class</span> GAHelper <span style="color:#800080;">{</span>
    <span style="color:#bb7977;font-weight:bold;">String</span> activity<span style="color:#800080;">;</span>
    <span style="color:#800000;font-weight:bold;">static</span> GoogleAnalyticsTracker tracker<span style="color:#800080;">;</span>
    <span style="color:#800000;font-weight:bold;">static</span> <span style="color:#bb7977;">int</span> instanceCount <span style="color:#808030;">=</span> <span style="color:#008c00;">0</span><span style="color:#800080;">;</span>
    <span style="color:#bb7977;">long</span> start<span style="color:#800080;">;</span>

    <span style="color:#696969;">// Limit the number of events due to outofmemory exceptions of analytics sdk</span>
    <span style="color:#800000;font-weight:bold;">final</span> <span style="color:#800000;font-weight:bold;">static</span> <span style="color:#bb7977;">int</span> MAX_EVENTS_BEFORE_DISPATCH <span style="color:#808030;">=</span> <span style="color:#008c00;">200</span><span style="color:#800080;">;</span>
    <span style="color:#800000;font-weight:bold;">static</span> <span style="color:#bb7977;">int</span> eventCount <span style="color:#808030;">=</span> <span style="color:#008c00;">0</span><span style="color:#800080;">;</span>

    <span style="color:#800000;font-weight:bold;">static</span> <span style="color:#800000;font-weight:bold;">final</span> ExecutorService tpe <span style="color:#808030;">=</span> Executors<span style="color:#808030;">.</span>newSingleThreadExecutor<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>

    <span style="color:#800000;font-weight:bold;">public</span> GAHelper<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> Context c<span style="color:#808030;">,</span> <span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> activity<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        <span style="color:#800000;font-weight:bold;">this</span><span style="color:#808030;">.</span>activity <span style="color:#808030;">=</span> activity<span style="color:#800080;">;</span>
        instanceCount<span style="color:#808030;">+</span><span style="color:#808030;">+</span><span style="color:#800080;">;</span>
        <span style="color:#800000;font-weight:bold;">if</span> <span style="color:#808030;">(</span>tracker <span style="color:#808030;">=</span><span style="color:#808030;">=</span> <span style="color:#800000;font-weight:bold;">null</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#808030;">@</span>Override
                <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    tracker <span style="color:#808030;">=</span> GoogleAnalyticsTracker<span style="color:#808030;">.</span>getInstance<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    tracker<span style="color:#808030;">.</span>start<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>GOOGLE_ANALYTICS_ID<span style="color:#808030;">,</span> Constants<span style="color:#808030;">.</span>GOOGLE_ANALYTICS_DELAY<span style="color:#808030;">,</span> c<span style="color:#808030;">.</span>getApplicationContext<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        <span style="color:#800080;">}</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> onResume<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        <span style="color:#800000;font-weight:bold;">this</span><span style="color:#808030;">.</span>trackPageView<span style="color:#808030;">(</span><span style="color:#0000e6;">"/"</span><span style="color:#808030;">+</span><span style="color:#800000;font-weight:bold;">this</span><span style="color:#808030;">.</span>activity<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#800000;font-weight:bold;">synchronized</span> <span style="color:#bb7977;">void</span> destroy <span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        instanceCount<span style="color:#808030;">-</span><span style="color:#808030;">-</span><span style="color:#800080;">;</span>
        <span style="color:#800000;font-weight:bold;">if</span> <span style="color:#808030;">(</span>instanceCount <span style="color:#808030;">&lt;</span><span style="color:#808030;">=</span> <span style="color:#008c00;">0</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#808030;">@</span>Override
                <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    Log<span style="color:#808030;">.</span>i<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"destroying GA"</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    <span style="color:#800000;font-weight:bold;">if</span> <span style="color:#808030;">(</span>tracker <span style="color:#808030;">!</span><span style="color:#808030;">=</span> <span style="color:#800000;font-weight:bold;">null</span><span style="color:#808030;">)</span>
                        tracker<span style="color:#808030;">.</span>stop<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    instanceCount <span style="color:#808030;">=</span> <span style="color:#008c00;">0</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        <span style="color:#800080;">}</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">protected</span> <span style="color:#bb7977;">void</span> tick<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800000;font-weight:bold;">throws</span> <span style="color:#bb7977;font-weight:bold;">InterruptedException</span> <span style="color:#800080;">{</span>
        <span style="color:#bb7977;font-weight:bold;">Thread</span><span style="color:#808030;">.</span>sleep<span style="color:#808030;">(</span><span style="color:#008c00;">3000</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        <span style="color:#800000;font-weight:bold;">this</span><span style="color:#808030;">.</span>start <span style="color:#808030;">=</span> <span style="color:#bb7977;font-weight:bold;">System</span><span style="color:#808030;">.</span>currentTimeMillis<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> log <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> l<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        <span style="color:#800000;font-weight:bold;">if</span> <span style="color:#808030;">(</span>Dbg<span style="color:#808030;">.</span>IS_DEBUG<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            Dbg<span style="color:#808030;">.</span>debug<span style="color:#808030;">(</span><span style="color:#0000e6;">"['"</span><span style="color:#808030;">+</span><span style="color:#808030;">(</span><span style="color:#bb7977;font-weight:bold;">System</span><span style="color:#808030;">.</span>currentTimeMillis<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#808030;">-</span>start<span style="color:#808030;">)</span><span style="color:#808030;">+</span><span style="color:#0000e6;">"']["</span><span style="color:#808030;">+</span>eventCount<span style="color:#808030;">+</span><span style="color:#0000e6;">"] Logging on '"</span><span style="color:#808030;">+</span><span style="color:#800000;font-weight:bold;">this</span><span style="color:#808030;">.</span>activity<span style="color:#808030;">+</span><span style="color:#0000e6;">"': "</span><span style="color:#808030;">+</span>l<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
            <span style="color:#800000;font-weight:bold;">if</span> <span style="color:#808030;">(</span>l<span style="color:#808030;">.</span>contains<span style="color:#808030;">(</span><span style="color:#0000e6;">" "</span><span style="color:#808030;">)</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                Log<span style="color:#808030;">.</span>e<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"DO NOT TRACK WITH SPACES: "</span><span style="color:#808030;">+</span>l<span style="color:#808030;">,</span> <span style="color:#800000;font-weight:bold;">new</span> <span style="color:#bb7977;font-weight:bold;">Exception</span><span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
            <span style="color:#800080;">}</span>
        <span style="color:#800080;">}</span>

    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> trackClick<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> button<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        checkDispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            <span style="color:#808030;">@</span>Override
            <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#800000;font-weight:bold;">try</span> <span style="color:#800080;">{</span>
                    tick<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    tracker<span style="color:#808030;">.</span>trackEvent<span style="color:#808030;">(</span>
                            <span style="color:#0000e6;">"clicks"</span><span style="color:#808030;">,</span>  <span style="color:#696969;">// Category</span>
                            activity<span style="color:#808030;">+</span><span style="color:#0000e6;">"-button"</span><span style="color:#808030;">,</span>  <span style="color:#696969;">// Action</span>
                            button<span style="color:#808030;">,</span> <span style="color:#696969;">// Label</span>
                            <span style="color:#008c00;">1</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    log<span style="color:#808030;">(</span><span style="color:#0000e6;">"trackClick:"</span><span style="color:#808030;">+</span>button<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span> <span style="color:#800000;font-weight:bold;">catch</span> <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">Exception</span> e<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    Log<span style="color:#808030;">.</span>e<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"Error tracking"</span><span style="color:#808030;">,</span> e<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span>
        <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> trackEvent <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> category<span style="color:#808030;">,</span> <span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> action<span style="color:#808030;">,</span> <span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> label<span style="color:#808030;">,</span> <span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;">int</span> count<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        checkDispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            <span style="color:#808030;">@</span>Override
            <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#800000;font-weight:bold;">try</span> <span style="color:#800080;">{</span>
                    tick<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    tracker<span style="color:#808030;">.</span>trackEvent<span style="color:#808030;">(</span>
                            category<span style="color:#808030;">,</span>  <span style="color:#696969;">// Category</span>
                            action<span style="color:#808030;">,</span>  <span style="color:#696969;">// Action</span>
                            activity<span style="color:#808030;">+</span><span style="color:#0000e6;">"-"</span><span style="color:#808030;">+</span>label<span style="color:#808030;">,</span> <span style="color:#696969;">// Label</span>
                            <span style="color:#008c00;">1</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    log<span style="color:#808030;">(</span><span style="color:#0000e6;">"trackEvent:"</span><span style="color:#808030;">+</span>category <span style="color:#808030;">+</span> <span style="color:#0000e6;">"#"</span><span style="color:#808030;">+</span>action<span style="color:#808030;">+</span><span style="color:#0000e6;">"#"</span><span style="color:#808030;">+</span>label<span style="color:#808030;">+</span><span style="color:#0000e6;">"#"</span><span style="color:#808030;">+</span>count<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span> <span style="color:#800000;font-weight:bold;">catch</span> <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">Exception</span> e<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    Log<span style="color:#808030;">.</span>e<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"Error tracking"</span><span style="color:#808030;">,</span> e<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span>
        <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> trackPopupView <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> popup<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        checkDispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            <span style="color:#808030;">@</span>Override
            <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#800000;font-weight:bold;">try</span> <span style="color:#800080;">{</span>
                    tick<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    <span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> page <span style="color:#808030;">=</span> <span style="color:#0000e6;">"/"</span><span style="color:#808030;">+</span>activity<span style="color:#808030;">+</span><span style="color:#0000e6;">"/"</span><span style="color:#808030;">+</span>popup<span style="color:#800080;">;</span>
                    tracker<span style="color:#808030;">.</span>trackPageView<span style="color:#808030;">(</span>page<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    log<span style="color:#808030;">(</span><span style="color:#0000e6;">"trackPageView:"</span><span style="color:#808030;">+</span>page<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span> <span style="color:#800000;font-weight:bold;">catch</span> <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">Exception</span> e<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    Log<span style="color:#808030;">.</span>e<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"Error tracking"</span><span style="color:#808030;">,</span> e<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span>
        <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> trackPageView <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">String</span> page<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        checkDispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
        tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            <span style="color:#808030;">@</span>Override
            <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#800000;font-weight:bold;">try</span> <span style="color:#800080;">{</span>
                    tick<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    tracker<span style="color:#808030;">.</span>trackPageView<span style="color:#808030;">(</span>page<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    log<span style="color:#808030;">(</span><span style="color:#0000e6;">"trackPageView:"</span><span style="color:#808030;">+</span>page<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span> <span style="color:#800000;font-weight:bold;">catch</span> <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">Exception</span> e<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    Log<span style="color:#808030;">.</span>e<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"Error tracking"</span><span style="color:#808030;">,</span> e<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span>
        <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> checkDispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
        eventCount<span style="color:#808030;">+</span><span style="color:#808030;">+</span><span style="color:#800080;">;</span>
        <span style="color:#800000;font-weight:bold;">if</span> <span style="color:#808030;">(</span>eventCount <span style="color:#808030;">&gt;</span><span style="color:#808030;">=</span> MAX_EVENTS_BEFORE_DISPATCH<span style="color:#808030;">)</span>
            dispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>

    <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> dispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">{</span>
        eventCount <span style="color:#808030;">=</span> <span style="color:#008c00;">0</span><span style="color:#800080;">;</span>
        tpe<span style="color:#808030;">.</span>submit<span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">new</span> Runnable<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
            <span style="color:#808030;">@</span>Override
            <span style="color:#800000;font-weight:bold;">public</span> <span style="color:#bb7977;">void</span> run<span style="color:#808030;">(</span><span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                <span style="color:#800000;font-weight:bold;">try</span> <span style="color:#800080;">{</span>
                    tick<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    tracker<span style="color:#808030;">.</span>dispatch<span style="color:#808030;">(</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                    log<span style="color:#808030;">(</span><span style="color:#0000e6;">"dispatched"</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span> <span style="color:#800000;font-weight:bold;">catch</span> <span style="color:#808030;">(</span><span style="color:#800000;font-weight:bold;">final</span> <span style="color:#bb7977;font-weight:bold;">Exception</span> e<span style="color:#808030;">)</span> <span style="color:#800080;">{</span>
                    Log<span style="color:#808030;">.</span>e<span style="color:#808030;">(</span>Constants<span style="color:#808030;">.</span>TAG<span style="color:#808030;">,</span> <span style="color:#0000e6;">"Error dispatching"</span><span style="color:#808030;">,</span> e<span style="color:#808030;">)</span><span style="color:#800080;">;</span>
                <span style="color:#800080;">}</span>
            <span style="color:#800080;">}</span>
        <span style="color:#800080;">}</span><span style="color:#808030;">)</span><span style="color:#800080;">;</span>
    <span style="color:#800080;">}</span>
<span style="color:#800080;">}</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=139&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2011/06/13/google-analytics-lags-on-android-how-to-make-it-responsive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
		<item>
		<title>HTC sense ui breaks the way the WebView settings behave</title>
		<link>http://blog.rafaelsanches.com/2011/01/30/htc-sense-breaks-webview-settings/</link>
		<comments>http://blog.rafaelsanches.com/2011/01/30/htc-sense-breaks-webview-settings/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 23:32:31 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://blog.rafaelsanches.com/?p=123</guid>
		<description><![CDATA[I am &#8220;amused&#8221; to discover that HTC sense has changed even the way android breaks to access of a WebView from outside the UI thread. Since I don&#8217;t own a phone with HTC sense, it took me months to understand this and I only fixed the issue thanks to a kind user who sent me [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=123&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am &#8220;amused&#8221; to discover that HTC sense has changed even the way android breaks to access of a WebView from outside the UI thread.</p>
<p>Since I don&#8217;t own a phone with HTC sense, it took me months to understand this and I only fixed the issue thanks to a kind user who sent me logs.</p>
<p>For example, calling this outside from a UI thread works on the normal android SDK&#8217;s:<br />
webSettingsObj.setBuiltInZoomControls(true);</p>
<p>Instead, on HTC Sense phones it breaks here:</p>
<pre style="color:#000000;background:#ffffff;">java<span style="color:#808030;">.</span>lang<span style="color:#808030;">.</span>RuntimeException<span style="color:#800080;">:</span> Can't create handler inside thread that has not called Looper<span style="color:#808030;">.</span>prepare<span style="color:#808030;">(</span><span style="color:#808030;">)</span>
 at android<span style="color:#808030;">.</span>os<span style="color:#808030;">.</span><span style="color:#400000;">Handler</span><span style="color:#808030;">.</span><span style="color:#808030;">(</span><span style="color:#400000;">Handler</span><span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">121</span><span style="color:#808030;">)</span>
 at com<span style="color:#808030;">.</span>htc<span style="color:#808030;">.</span>multitouch<span style="color:#808030;">.</span>MultiTouchDetector<span style="color:#ffffff;background:#dd0000;font-weight:bold;font-style:italic;">$MultiTouchHandler</span><span style="color:#808030;">.</span><span style="color:#808030;">(</span>MultiTouchDetector<span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">180</span><span style="color:#808030;">)</span>
 at com<span style="color:#808030;">.</span>htc<span style="color:#808030;">.</span>multitouch<span style="color:#808030;">.</span>MultiTouchDetector<span style="color:#808030;">.</span><span style="color:#808030;">(</span>MultiTouchDetector<span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">242</span><span style="color:#808030;">)</span>
 at android<span style="color:#808030;">.</span>webkit<span style="color:#808030;">.</span>WebView<span style="color:#ffffff;background:#dd0000;font-weight:bold;font-style:italic;">$HTCMultiTouch</span><span style="color:#808030;">.</span>fnCreateMultiTouchListener<span style="color:#808030;">(</span>WebView<span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">11781</span><span style="color:#808030;">)</span>
 at android<span style="color:#808030;">.</span>webkit<span style="color:#808030;">.</span>WebView<span style="color:#808030;">.</span>enableMultiTouch<span style="color:#808030;">(</span>WebView<span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">10893</span><span style="color:#808030;">)</span>
 at android<span style="color:#808030;">.</span>webkit<span style="color:#808030;">.</span>WebView<span style="color:#808030;">.</span>updateMultiTouchSupport<span style="color:#808030;">(</span>WebView<span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">905</span><span style="color:#808030;">)</span>
 at android<span style="color:#808030;">.</span>webkit<span style="color:#808030;">.</span>WebSettings<span style="color:#808030;">.</span>setBuiltInZoomControls<span style="color:#808030;">(</span>WebSettings<span style="color:#808030;">.</span>java<span style="color:#800080;">:</span><span style="color:#008c00;">474</span><span style="color:#808030;">)</span>
</pre>
<p>Now, I know know that anything that changes the UI shouldn&#8217;t be executed outside of the UI Thread, but still..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=123&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2011/01/30/htc-sense-breaks-webview-settings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
		<item>
		<title>upload using multipart post using httpclient in android</title>
		<link>http://blog.rafaelsanches.com/2011/01/29/upload-using-multipart-post-using-httpclient-in-android/</link>
		<comments>http://blog.rafaelsanches.com/2011/01/29/upload-using-multipart-post-using-httpclient-in-android/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 19:01:40 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://blog.rafaelsanches.com/?p=121</guid>
		<description><![CDATA[A very common caveat, when doing android applications, is fighting to keep the APK size small. Many applications need the ability to upload binary data to their server and when you arrive there you see that the android SDK doesn&#8217;t have the http-client libraries to send multipart posts. The easiest way is to include the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=121&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A very common caveat, when doing android applications, is fighting to keep the APK size small.</p>
<p>Many applications need the ability to upload binary data to their server and when you arrive there you see that the android SDK doesn&#8217;t have the http-client libraries to send multipart posts.</p>
<p>The easiest way is to include the JAR for <a href="http://hc.apache.org/httpcomponents-client-ga/httpmime/index.html"><em>httpmime</em></a> and <a href="http://james.apache.org/mime4j/"><em>apache_mime4j</em></a>, but it takes way too much space; 300kb.</p>
<p>We overcome this by implementing our own HttpEntity. In this way the code is:</p>
<pre style='color:#000000;background:#ffffff;'><span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>class</span> SimpleMultipartEntity <span style='color:#7f0055;font-weight:bold;'>implements</span> HttpEntity {

    <span style='color:#7f0055;font-weight:bold;'>private</span> <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>static</span> <span style='color:#7f0055;font-weight:bold;'>char</span>[] MULTIPART_CHARS = <span style='color:#2a00ff;'>"-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"</span>
        .toCharArray();

    <span style='color:#7f0055;font-weight:bold;'>private</span> <span style='color:#7f0055;font-weight:bold;'>String</span> boundary = <span style='color:#7f0055;font-weight:bold;'>null</span>;

    <span style='color:#7f0055;font-weight:bold;'>ByteArrayOutputStream</span> out = <span style='color:#7f0055;font-weight:bold;'>new</span> <span style='color:#7f0055;font-weight:bold;'>ByteArrayOutputStream</span>();
    <span style='color:#7f0055;font-weight:bold;'>boolean</span> isSetLast = <span style='color:#7f0055;font-weight:bold;'>false</span>;
    <span style='color:#7f0055;font-weight:bold;'>boolean</span> isSetFirst = <span style='color:#7f0055;font-weight:bold;'>false</span>;

    <span style='color:#7f0055;font-weight:bold;'>public</span> SimpleMultipartEntity() {
        <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>StringBuffer</span> buf = <span style='color:#7f0055;font-weight:bold;'>new</span> <span style='color:#7f0055;font-weight:bold;'>StringBuffer</span>();
        <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>Random</span> rand = <span style='color:#7f0055;font-weight:bold;'>new</span> <span style='color:#7f0055;font-weight:bold;'>Random</span>();
        <span style='color:#7f0055;font-weight:bold;'>for</span> (<span style='color:#7f0055;font-weight:bold;'>int</span> i = 0; i &amp;lt; 30; i++) {
            buf.append(MULTIPART_CHARS[rand.nextInt(MULTIPART_CHARS.length)]);
        }
        <span style='color:#7f0055;font-weight:bold;'>this</span>.boundary = buf.toString();

    }

    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> writeFirstBoundaryIfNeeds(){
        <span style='color:#7f0055;font-weight:bold;'>if</span>(!isSetFirst){
            <span style='color:#7f0055;font-weight:bold;'>try</span> {
                out.write((<span style='color:#2a00ff;'>"--"</span> + boundary + <span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>).getBytes());
            } <span style='color:#7f0055;font-weight:bold;'>catch</span> (<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span> e) {
                Log.e(Constants.TAG, e.getMessage(), e);
            }
        }
        isSetFirst = <span style='color:#7f0055;font-weight:bold;'>true</span>;
    }

    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> writeLastBoundaryIfNeeds() {
        <span style='color:#7f0055;font-weight:bold;'>if</span>(isSetLast){
            <span style='color:#7f0055;font-weight:bold;'>return</span> ;
        }
        <span style='color:#7f0055;font-weight:bold;'>try</span> {
            out.write((<span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>--"</span> + boundary + <span style='color:#2a00ff;'>"--</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>).getBytes());
        } <span style='color:#7f0055;font-weight:bold;'>catch</span> (<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span> e) {
            Log.e(Constants.TAG, e.getMessage(), e);
        }
        isSetLast = <span style='color:#7f0055;font-weight:bold;'>true</span>;
    }

    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> addPart(<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> key, <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> value) {
        writeFirstBoundaryIfNeeds();
        <span style='color:#7f0055;font-weight:bold;'>try</span> {
            out.write((<span style='color:#2a00ff;'>"Content-Disposition: form-data; name=</span><span style='color:#2a00ff;'>\"</span><span style='color:#2a00ff;'>"</span> +key+<span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>).getBytes());
            out.write(<span style='color:#2a00ff;'>"Content-Type: text/plain; charset=UTF-8</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>.getBytes());
            out.write(<span style='color:#2a00ff;'>"Content-Transfer-Encoding: 8bit</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>.getBytes());
            out.write(value.getBytes());
            out.write((<span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>--"</span> + boundary + <span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>).getBytes());
        } <span style='color:#7f0055;font-weight:bold;'>catch</span> (<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span> e) {
            Log.e(Constants.TAG, e.getMessage(), e);
        }
    }

    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> addPart(<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> key, <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> fileName, <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>InputStream</span> fin){
        addPart(key, fileName, fin, <span style='color:#2a00ff;'>"application/octet-stream"</span>);
    }

    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> addPart(<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> key, <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> fileName, <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>InputStream</span> fin, <span style='color:#7f0055;font-weight:bold;'>String</span> type){
        writeFirstBoundaryIfNeeds();
        <span style='color:#7f0055;font-weight:bold;'>try</span> {
            type = <span style='color:#2a00ff;'>"Content-Type: "</span>+type+<span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>;
            out.write((<span style='color:#2a00ff;'>"Content-Disposition: form-data; name=</span><span style='color:#2a00ff;'>\"</span><span style='color:#2a00ff;'>"</span>+ key+<span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\"</span><span style='color:#2a00ff;'>; filename=</span><span style='color:#2a00ff;'>\"</span><span style='color:#2a00ff;'>"</span> + fileName + <span style='color:#2a00ff;'>"</span><span style='color:#2a00ff;'>\"</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>).getBytes());
            out.write(type.getBytes());
            out.write(<span style='color:#2a00ff;'>"Content-Transfer-Encoding: binary</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>\r</span><span style='color:#2a00ff;'>\n</span><span style='color:#2a00ff;'>"</span>.getBytes());

            <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>byte</span>[] tmp = <span style='color:#7f0055;font-weight:bold;'>new</span> <span style='color:#7f0055;font-weight:bold;'>byte</span>[4096];
            <span style='color:#7f0055;font-weight:bold;'>int</span> l = 0;
            <span style='color:#7f0055;font-weight:bold;'>while</span> ((l = fin.read(tmp)) != -1) {
                out.write(tmp, 0, l);
            }
            out.flush();
        } <span style='color:#7f0055;font-weight:bold;'>catch</span> (<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span> e) {
            Log.e(Constants.TAG, e.getMessage(), e);
        } <span style='color:#7f0055;font-weight:bold;'>finally</span> {
            <span style='color:#7f0055;font-weight:bold;'>try</span> {
                fin.close();
            } <span style='color:#7f0055;font-weight:bold;'>catch</span> (<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span> e) {
                Log.e(Constants.TAG, e.getMessage(), e);
            }
        }
    }

    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> addPart(<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>String</span> key, <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>File</span> value) {
        <span style='color:#7f0055;font-weight:bold;'>try</span> {
            addPart(key, value.getName(), <span style='color:#7f0055;font-weight:bold;'>new</span> <span style='color:#7f0055;font-weight:bold;'>FileInputStream</span>(value));
        } <span style='color:#7f0055;font-weight:bold;'>catch</span> (<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>FileNotFoundException</span> e) {
            Log.e(Constants.TAG, e.getMessage(), e);
        }
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>long</span> getContentLength() {
        writeLastBoundaryIfNeeds();
        <span style='color:#7f0055;font-weight:bold;'>return</span> out.toByteArray().length;
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> Header getContentType() {
        <span style='color:#7f0055;font-weight:bold;'>return</span> <span style='color:#7f0055;font-weight:bold;'>new</span> BasicHeader(<span style='color:#2a00ff;'>"Content-Type"</span>, <span style='color:#2a00ff;'>"multipart/form-data; boundary="</span> + boundary);
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>boolean</span> isChunked() {
        <span style='color:#7f0055;font-weight:bold;'>return</span> <span style='color:#7f0055;font-weight:bold;'>false</span>;
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>boolean</span> isRepeatable() {
        <span style='color:#7f0055;font-weight:bold;'>return</span> <span style='color:#7f0055;font-weight:bold;'>false</span>;
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>boolean</span> isStreaming() {
        <span style='color:#7f0055;font-weight:bold;'>return</span> <span style='color:#7f0055;font-weight:bold;'>false</span>;
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> writeTo(<span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>OutputStream</span> outstream) <span style='color:#7f0055;font-weight:bold;'>throws</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span> {
        outstream.write(out.toByteArray());
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> Header getContentEncoding() {
        <span style='color:#7f0055;font-weight:bold;'>return</span> <span style='color:#7f0055;font-weight:bold;'>null</span>;
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>void</span> consumeContent() <span style='color:#7f0055;font-weight:bold;'>throws</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span>,
    UnsupportedOperationException {
        <span style='color:#7f0055;font-weight:bold;'>if</span> (isStreaming()) {
            <span style='color:#7f0055;font-weight:bold;'>throw</span> <span style='color:#7f0055;font-weight:bold;'>new</span> UnsupportedOperationException(
            <span style='color:#2a00ff;'>"Streaming entity does not implement #consumeContent()"</span>);
        }
    }

    @Override
    <span style='color:#7f0055;font-weight:bold;'>public</span> <span style='color:#7f0055;font-weight:bold;'>InputStream</span> getContent() <span style='color:#7f0055;font-weight:bold;'>throws</span> <span style='color:#7f0055;font-weight:bold;'>IOException</span>,
    UnsupportedOperationException {
        <span style='color:#7f0055;font-weight:bold;'>return</span> <span style='color:#7f0055;font-weight:bold;'>new</span> <span style='color:#7f0055;font-weight:bold;'>ByteArrayInputStream</span>(out.toByteArray());
    }

}
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=121&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2011/01/29/upload-using-multipart-post-using-httpclient-in-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
		<item>
		<title>server-side calls are better for Ad serving. Downside of AFMA/AdMob.</title>
		<link>http://blog.rafaelsanches.com/2011/01/13/server-side-call-adsense-admob/</link>
		<comments>http://blog.rafaelsanches.com/2011/01/13/server-side-call-adsense-admob/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 19:47:36 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[revenue]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://mufumbo.wordpress.com/?p=100</guid>
		<description><![CDATA[Ad networks that offer server-side calls gives us a big advantage. We can simply get a image + link and print on a android WebView. Due to limitations of the android framework it&#8217;s the only way to have non-intrusive ads inside a WebView. Specially when the WebView must be layout_height=&#8221;fill_parent&#8221;, for a correct scrolling and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=100&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ad networks that offer server-side calls gives us a big advantage. We can simply get a image + link and print on a android WebView.</p>
<p>Due to limitations of the android framework it&#8217;s the only way to have non-intrusive ads inside a WebView. Specially when the WebView must be layout_height=&#8221;fill_parent&#8221;, for a correct scrolling and zoom control. </p>
<p>JavaScript ads are not an option, since the only work around is to inject JavaScript into the WebView which prevents me from working with JavaScript ads that are based on a  inline include. </p>
<p>Advantages of the server-side call instead of SDK:<br />
- <strong>Reduce APK size</strong>: I can implement my own WebView to print ads. AdMob SDK takes 140kb, Google AFMA takes 40kb, so 30% of my app is taken from ads sdk&#8217;s.<br />
- AFMA SDK is <strong>slow</strong>: rendering the adsense javascript is slow. I feel my app freezing and coming back after rendering adsense. Admob is much faster.<br />
- The developer have total <strong>control</strong> to optimize it.</p>
<p>FYI: After the death of Quattro, the best network that is offering server-side calls is Millenial Media.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=100&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2011/01/13/server-side-call-adsense-admob/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
		<item>
		<title>Using native twitter app Intent to share on android</title>
		<link>http://blog.rafaelsanches.com/2010/06/18/using-native-twitter-app-intent-to-share-on-android/</link>
		<comments>http://blog.rafaelsanches.com/2010/06/18/using-native-twitter-app-intent-to-share-on-android/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 18:36:52 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://mufumbo.wordpress.com/?p=93</guid>
		<description><![CDATA[A quick hack in order to launch the twitter native app without popping up the Intent selection for sharing stuff. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=93&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been <em>googling</em> to find the Twitter native app intent that enables to share through it directly, but I couldn&#8217;t find any. </p>
<p><strong>ATTENTION</strong>: This is just a hack. It&#8217;s better to just open the android popup with the Intent.ACTION_SEND intent. </p>
<p>I didn&#8217;t had time to test other ways, but the only way to launch the twitter PostActivity directly was to get the ActivityInfo instance of it. Please, give me feedback if you know a better way. </p>
<p>What this code does is to query all activities that match with the Intent.ACTION_SEND and then it searches for the &#8220;com.twitter.android.PostActivity&#8221; intent. </p>
<pre style='color:#000000;background:#ffffff;'>try{
    intent = <span style='color:#7f0055;font-weight:bold;'>new</span> Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, message);
    intent.setType(<span style='color:#2a00ff;'>"text/plain"</span>);
    <span style='color:#7f0055;font-weight:bold;'>final</span> PackageManager pm = context.getPackageManager();
    <span style='color:#7f0055;font-weight:bold;'>final</span> <span style='color:#7f0055;font-weight:bold;'>List</span> activityList = pm.queryIntentActivities(intent, 0);
        <span style='color:#7f0055;font-weight:bold;'>int</span> len =  activityList.size();
    <span style='color:#7f0055;font-weight:bold;'>for</span> (<span style='color:#7f0055;font-weight:bold;'>int</span> i = 0; i &lt; len; i++) {
        <span style='color:#7f0055;font-weight:bold;'>final</span> ResolveInfo app = activityList.get(i);
        <span style='color:#7f0055;font-weight:bold;'>if</span> (<span style='color:#2a00ff;'>"com.twitter.android.PostActivity"</span>.equals(app.activityInfo.name)) {
            <span style='color:#7f0055;font-weight:bold;'>final</span> ActivityInfo activity=app.activityInfo;
            <span style='color:#7f0055;font-weight:bold;'>final</span> ComponentName name=<span style='color:#7f0055;font-weight:bold;'>new</span> ComponentName(activity.applicationInfo.packageName, activity.name);
            intent=<span style='color:#7f0055;font-weight:bold;'>new</span> Intent(Intent.ACTION_SEND);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
            intent.setComponent(name);
            intent.putExtra(Intent.EXTRA_TEXT, message);
            context.startActivity(intent);
            <span style='color:#7f0055;font-weight:bold;'>break</span>;
        }
    }
}
catch(<span style='color:#7f0055;font-weight:bold;'>final</span> ActivityNotFoundException e) {
    Log.i(<span style='color:#2a00ff;'>"mufumbo"</span>, <span style='color:#2a00ff;'>"no twitter native"</span>,e );
}
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=93&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2010/06/18/using-native-twitter-app-intent-to-share-on-android/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
		<item>
		<title>RSS parsing optimization for bandwidth and processing time with SAX and httpclient &#8211; pooling scripts</title>
		<link>http://blog.rafaelsanches.com/2009/10/18/rss-parsing-optimization-for-bandwidth-processing-time-sax-httpclient/</link>
		<comments>http://blog.rafaelsanches.com/2009/10/18/rss-parsing-optimization-for-bandwidth-processing-time-sax-httpclient/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 15:55:43 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[maintainability]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[httpclient]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[SAX]]></category>

		<guid isPermaLink="false">http://mufumbo.wordpress.com/?p=88</guid>
		<description><![CDATA[RSS parsing optimization for bandwidth and processing time with SAX and httpclient - useful for pooling scripts<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=88&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My server was having a constant income traffic of 1.7mb/s for a service that download RSS from the internet and process them. Basically it need to return the last updates of multiple RSS feeds. It&#8217;s a very basic pooling system, but it was downloading too much data for just 15.000 active users. The growth wasn&#8217;t looking very feasible..</p>
<p>I was using the <a href="https://rome.dev.java.net/">ROME</a> java library to parse the XML. So far so good, the problem was that it downloads the whole feed and process it all. With my application scope I don&#8217;t need to download the whole RSS, just the new entries that i didn&#8217;t downloaded yet.</p>
<p>The solution was to use a custom SAX RSS parser, looping through the &#8220;&#8221; tags and identifying &#8220;&#8221;. In this way i can parse item per item, and identify if the current item is not updated, so I can <strong>abort</strong> the http connection and stop the download of the feed. I wish that ROME had an option to do that, like &#8220;stop processing when &#8216;publishedDate&#8217; minor than..&#8221;.</p>
<p>The impact on bandwidth usage and processing time was impressive:<br />
<img src="http://www.mufumbo.com/misc/screenshots/rss-optimization-bandwidth.png" alt="" /><br />
<img src="http://www.mufumbo.com/misc/screenshots/rss-optimization-processingtime.png" alt="" /></p>
<p>If someone is interested I can post and explain the java class. It&#8217;s compatible with com.sun.syndication.feed.synd and uses the SyndEntry and SyndFeed interfaces.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=88&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2009/10/18/rss-parsing-optimization-for-bandwidth-processing-time-sax-httpclient/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>

		<media:content url="http://www.mufumbo.com/misc/screenshots/rss-optimization-bandwidth.png" medium="image" />

		<media:content url="http://www.mufumbo.com/misc/screenshots/rss-optimization-processingtime.png" medium="image" />
	</item>
		<item>
		<title>My first public android app &#8211; craigslist notification</title>
		<link>http://blog.rafaelsanches.com/2009/09/17/android-app-craigslist-notification/</link>
		<comments>http://blog.rafaelsanches.com/2009/09/17/android-app-craigslist-notification/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 18:16:56 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[android app]]></category>
		<category><![CDATA[android market]]></category>
		<category><![CDATA[craigslist]]></category>
		<category><![CDATA[craigslist alerts]]></category>
		<category><![CDATA[craigslist android app]]></category>
		<category><![CDATA[craigslist notification]]></category>

		<guid isPermaLink="false">http://mufumbo.wordpress.com/?p=67</guid>
		<description><![CDATA[Description of my first public android app in the market. 
It's named "craigslist notification" and it sends alerts when new stuff is posted on craigslist.org<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=67&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://craigslist-notification.mufumbo.com/"><br />
<img src="http://craigslist-notification.mufumbo.com/screenshot/icon.png" border="0" alt="logo" /></a><a title="Open in Market" href="http://www.cyrket.com/package/com.mufumbo.craigslist.notification.android"></a><a title="Open in Market" href="http://www.cyrket.com/package/com.mufumbo.craigslist.notification.android"><img class="qrcode" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=100x100&amp;chl=market://search?q=pname:com.mufumbo.craigslist.notification.android" border="0" alt="" /></a></p>
<p>This application alert the users when new stuff is posted to craigslist. In this way they can get the best deals as soon as they are registered.</p>
<p>The application is totally free and doesn&#8217;t use ads either in current or future versions. There is no form of monetization associated with this application. I am using my new server that i am renting from hetzner.<br />
The application does not require registration and does not store information about its usage on the server.</p>
<h3>Features</h3>
<ul>
<li>Enable the user to create notifications for certain keywords;</li>
<li>Allow to have all filtering that craigslist.org has;</li>
<li>Has all cities that craigslist.org has;</li>
<li>Preferences menu for configuring the location and network options;</li>
<li>Mark posts as favorite to read at a later time;</li>
<li>The relevant posts are downloaded on the phone, so they can be read later without network;</li>
<li>Faster navigation, since relevant posts are downloaded in batch;</li>
</ul>
<h3>Technical details</h3>
<ul>
<li>It periodically checks for new posts;</li>
<li>In each check it download *only* the updated data, which should be<br />
small after the initial download;</li>
<li> If no update is available it does not download anything at all. This proves to use less bandwidth than a normal navigation app, since:
<ul>
<li>Only relevant data is downloaded;</li>
<li>It never download duplicated data two times;</li>
<li>It&#8217;s not like RSS feeds that it&#8217;s the phone downloading and pooling the feeds every time.<br />
The phone only donwload the updated data one and do it just one time.</li>
</ul>
</li>
</ul>
<p><a name="bandwidthusage"></a></p>
<h3>Bandwidth usage</h3>
<ul>
<li>For example, a download of 100 new posts takes 50kb of<br />
internet bandwidth.</li>
<li>The daily bandwidth will depend on the number of<br />
notifications that you are monitoring and the number of times that<br />
your notifications get updated.</li>
<li>To reduce bandwidth, try to be specific in your notifications.</li>
<li>For example: try to use &#8220;honda civic&#8221; instead of &#8220;car&#8221;</li>
</ul>
<div class="ss">
		<a name="screenshots"></a></p>
<h1>Screenshots</h1>
<ul>
<li>
<h3>Main screen &#8211; notification list</h3>
<p>				Main screen. This is where your notifications are listed: </p>
<p>				<img src="http://craigslist-notification.mufumbo.com/screenshot/notification-list.png">
			</li>
<li>
<h3>Posts listing</h3>
<p>				When you click on one notification, you go to the post listing.<br /> <br />
				Notice that you can edit the previously configured notification by clicking on this menu item.<br />
				<img src="http://craigslist-notification.mufumbo.com/screenshot/announce-list.png">
			</li>
<li>
<h3>Post detail</h3>
<p>				Once you click on one post you will see this screen which displays the post details. <br /> <br />
				You are not required to be connected to the network to see the already downloaded posts. </br><br />
				Notice that you can mark posts as favorite to read them later. The favorite page is accessed from the main menu.<br />
				<img src="http://craigslist-notification.mufumbo.com/screenshot/announce-detail.png">
			</li>
<li>
<h3>Notification</h3>
<p>				When there are new posts the app displays a notification on your phone. This can be disabled in the preferences.<br />
				<img src="screenshot/notification-update.png">
			</li>
</ul></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=67&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2009/09/17/android-app-craigslist-notification/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>

		<media:content url="http://craigslist-notification.mufumbo.com/screenshot/icon.png" medium="image">
			<media:title type="html">logo</media:title>
		</media:content>

		<media:content url="http://chart.apis.google.com/chart?cht=qr&#38;chs=100x100&#38;chl=market://search?q=pname:com.mufumbo.craigslist.notification.android" medium="image" />

		<media:content url="http://craigslist-notification.mufumbo.com/screenshot/notification-list.png" medium="image" />

		<media:content url="http://craigslist-notification.mufumbo.com/screenshot/announce-list.png" medium="image" />

		<media:content url="http://craigslist-notification.mufumbo.com/screenshot/announce-detail.png" medium="image" />
	</item>
		<item>
		<title>reading java-style properties file in PHP</title>
		<link>http://blog.rafaelsanches.com/2009/08/05/reading-java-style-properties-file-in-php/</link>
		<comments>http://blog.rafaelsanches.com/2009/08/05/reading-java-style-properties-file-in-php/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 04:46:37 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[caveats]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[java properties]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php propers class]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[protieperties in php]]></category>

		<guid isPermaLink="false">http://mufumbo.wordpress.com/?p=63</guid>
		<description><![CDATA[explain how i managed to read a php property file. The properties file is a key=value separated by \n and is very used to hold configuration in java. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=63&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very strange that PHP only support the &#8220;<a href="http://us.php.net/manual/en/function.parse-ini-string.php">parse_ini_string</a>&#8221; as configuration function. I don&#8217;t like it at all! It has problems handling quotes, new lines, and other caveats.</p>
<p>The only benefit of <a href="http://us.php.net/manual/en/function.parse-ini-string.php">parse_ini_string</a> against Java Properties file is that it can handle &#8220;arrays&#8221;, but I don&#8217;t think that&#8217;s a benefit anyways. I had some trouble because I was wanting to use <strong>properties file in php</strong> for translations, since I only found buggy versions on the net I had build my own:</p>
<pre style="color:#000000;background:#ffffff;"><span style="color:#7f0055;background:#ffffe8;">&lt;?php</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;">function</span><span style="color:#000000;background:#ffffe8;"> parse_properties</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$txtProperties</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> {</span>
<span style="color:#000000;background:#ffffe8;"> $result</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> array</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>

<span style="color:#000000;background:#ffffe8;"> $lines</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> split</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#2a00ff;background:#ffffe8;">\n</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> $txtProperties</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> $key</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#2a00ff;background:#ffffe8;"> ""</span><span style="color:#000000;background:#ffffe8;">;</span>

<span style="color:#000000;background:#ffffe8;"> $isWaitingOtherLine</span><span style="color:#000000;background:#ffffe8;"> = </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">false</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> foreach</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$lines </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">as </span><span style="color:#000000;background:#ffffe8;">$i</span><span style="color:#000000;background:#ffffe8;">=&gt;</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">) </span><span style="color:#000000;background:#ffffe8;">{</span>

<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> if</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> |</span><span style="color:#000000;background:#ffffe8;">| </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#000000;background:#ffffe8;">$isWaitingOtherLine &amp;&amp; </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strpos</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#2a00ff;background:#ffffe8;">"#"</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">= </span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span> <span style="color:#7f0055;background:#ffffe8;font-weight:bold;">continue</span><span style="color:#000000;background:#ffffe8;">;</span>

<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> if</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#000000;background:#ffffe8;">$isWaitingOtherLine</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> {</span>
<span style="color:#000000;background:#ffffe8;"> $key</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> substr</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strpos</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#2a00ff;background:#ffffe8;">'='</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> $value </span><span style="color:#000000;background:#ffffe8;">= </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">substr</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strpos</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#2a00ff;background:#ffffe8;">'='</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> + </span><span style="color:#000000;background:#ffffe8;">1</span><span style="color:#000000;background:#ffffe8;">, </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strlen</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$line</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> }</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> else</span><span style="color:#000000;background:#ffffe8;"> {</span>
<span style="color:#000000;background:#ffffe8;"> $value</span><span style="color:#000000;background:#ffffe8;"> .</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> $line</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> }</span>

<span style="color:#3f7f59;background:#ffffe8;"> /* Check if ends with single '\' */</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> if</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strrpos</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$value</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#2a00ff;background:#ffffe8;">\\</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">) </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">= </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strlen</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$value</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">-</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strlen</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#2a00ff;background:#ffffe8;">\\</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">) </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;"> $value</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> substr</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$value</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> 0</span><span style="color:#000000;background:#ffffe8;">, </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">strlen</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$value</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">-</span><span style="color:#000000;background:#ffffe8;">1</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#2a00ff;background:#ffffe8;">\n</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> $isWaitingOtherLine </span><span style="color:#000000;background:#ffffe8;">= </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">true</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> }</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> else </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;"> $isWaitingOtherLine</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> false</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> }</span>

<span style="color:#000000;background:#ffffe8;"> $result</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">$key</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;"> =</span><span style="color:#000000;background:#ffffe8;"> $value</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> unset</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$lines</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">$i</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;"> }</span>

<span style="color:#7f0055;background:#ffffe8;font-weight:bold;"> return</span><span style="color:#000000;background:#ffffe8;"> $result</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#7f0055;background:#ffffe8;">?&gt;</span></pre>
<p>This function can be used to create a <em>php properties class</em>. It should have the same behavior as the <strong>Java properties</strong>, so it should handle &#8221; quotes and \ for new lines.</p>
<p>Sorry for the bad identation, wordpress hasn&#8217;t been very nice. Let me know if it have bugs <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=63&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2009/08/05/reading-java-style-properties-file-in-php/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
		<item>
		<title>Retrieve driving directions from google maps with server-side HTTP calls and show results with static maps for WAP</title>
		<link>http://blog.rafaelsanches.com/2009/07/23/server-side-driving-direction-with-google-maps-api-with-php-for-wap-and-web/</link>
		<comments>http://blog.rafaelsanches.com/2009/07/23/server-side-driving-direction-with-google-maps-api-with-php-for-wap-and-web/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 08:32:34 +0000</pubDate>
		<dc:creator>mufumbo</dc:creator>
				<category><![CDATA[maps]]></category>
		<category><![CDATA[driving directions]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google apis]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[server-side]]></category>
		<category><![CDATA[WAP]]></category>

		<guid isPermaLink="false">http://mufumbo.wordpress.com/?p=53</guid>
		<description><![CDATA[In this post I explain how i've managed to retrieve driving directions from google maps with server-side HTTP calls and show results with static maps for WAP. This is not compliant with google terms of services, but it works. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=53&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Edit may 2010: Google has released the directions API. <a href="http://code.google.com/apis/maps/documentation/directions/">Documentation is available here</a>.</p>
<p>Mobile phones are not famous for supporting javascript. A problem arises when you need to use google API to retrieve the driver directions for a mobile site, or when you just don&#8217;t want your site to be overloaded with the complete maps toolkit to show a simple map.</p>
<p>Google provides a good <a href="http://gmaps-samples.googlecode.com/svn/trunk/gdirections/directions-static.html">directions-static demo</a> but, unfortunately, it&#8217;s javascript-only. They don&#8217;t have any example or documentation about how to generate the directions through server side HTTP call.</p>
<p>The driving direction API doesn&#8217;t seem to be 100%. I wasn&#8217;t able to find examples of how to use the directions API with google maps API-V3 javascript, it seems that <em>it&#8217;s not ready yet</em>. I&#8217;ve founded <a href="http://code.google.com/p/gmaps-api-issues/issues/detail?id=235">this issue tracking</a> in <a style="text-decoration:none;color:#000000;" href="http://code.google.com/p/gmaps-api-issues/">gmaps-api-issues</a> (by the way, the most voted issue) that <em>says that there isn&#8217;t support for google maps directions through server side http calls</em>.</p>
<p><em>Putting all together</em>: I have decided to check what HTTP calls the directions API of google maps API-V2 does and to use it in the server side. I don&#8217;t know if it&#8217;s forbidden in the terms of service, <strong>but</strong> <strong>it works</strong>!</p>
<p>Basically, my PHP server-side is doing the exact same thing that the google <a href="http://gmaps-samples.googlecode.com/svn/trunk/gdirections/directions-static.html">directions-static demo</a> is doing in javascript (checkout the source code of the page). It retrieves the answer from the server and write the coordinates information in the  static maps URL.</p>
<p>Note that HttpHelper::doGET downloads the string, you can substitute that part with CURL or fopen. Here is the code to make the HTTP calls to get the driving directions and to create the static map image link:</p>
<pre style="color:#000000;background:#ffffff;"><span style="color:#7f0055;background:#ffffe8;">&lt;?php</span>
<span style="color:#7f0055;background:#ffffe8;font-weight:bold;">class</span><span style="color:#000000;background:#ffffe8;"> GoogleGeo </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">public</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">static</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">function</span><span style="color:#000000;background:#ffffe8;"> buildStaticMap</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$center</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$markers</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">array</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$width</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">400</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$height</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">400</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$zoom</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">12</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">null</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">""</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">foreach</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$markers</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">as</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$marker</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">'|'</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">urlencode</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$marker</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$width</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">&gt;</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">640</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$width</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">640</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$center</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#000000;background:#ffffe8;">$center</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"&amp;center="</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$center</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"&amp;markers="</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$strMarkers</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$zoom</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">&gt;</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#000000;background:#ffffe8;">$zoom</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"&amp;zoom=</span><span style="color:#2a00ff;background:#ffffe8;">$zoom</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">}</span>

<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">""</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">foreach</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Directions'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Routes'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Steps'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">as</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$step</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">                </span><span style="color:#000000;background:#ffffe8;">$lat</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$step</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Point'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'coordinates'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">1</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">                </span><span style="color:#000000;background:#ffffe8;">$lon</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$step</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Point'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'coordinates'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">                </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"|"</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">                </span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$lat</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#2a00ff;background:#ffffe8;">","</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$lon</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">if</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">!</span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">empty</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">                </span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"|"</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Directions'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Routes'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'End'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'coordinates'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">1</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#2a00ff;background:#ffffe8;">","</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Directions'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'Routes'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'End'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#2a00ff;background:#ffffe8;">'coordinates'</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">[</span><span style="color:#000000;background:#ffffe8;">0</span><span style="color:#000000;background:#ffffe8;">]</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">                </span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"&amp;path=rgb:0x0000ff,weight:5|"</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$steps</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">            </span><span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">}</span>

<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$staticMap</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"http://maps.google.com/staticmap?maptype=mobile&amp;size="</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">$width</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#2a00ff;background:#ffffe8;">"x</span><span style="color:#2a00ff;background:#ffffe8;">$height</span><span style="color:#2a00ff;background:#ffffe8;">&amp;maptype=roadmap&amp;key="</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">GOOGLE_MAPS_KEY</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#2a00ff;background:#ffffe8;">"&amp;sensor=false</span><span style="color:#2a00ff;background:#ffffe8;">$strMarkers</span><span style="color:#2a00ff;background:#ffffe8;">$center</span><span style="color:#2a00ff;background:#ffffe8;">$zoom</span><span style="color:#2a00ff;background:#ffffe8;">$steps</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">return</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$staticMap</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#000000;background:#ffffe8;">}</span>

<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">public</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">static</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">function</span><span style="color:#000000;background:#ffffe8;"> retrieveDirections </span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$from</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$to</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">{</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$params</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">array</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#2a00ff;background:#ffffe8;">'key'</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">&gt;</span><span style="color:#000000;background:#ffffe8;"> GOOGLE_MAPS_KEY</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">'output'</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">&gt;</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">'json'</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">'q'</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;">&gt;</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"from: </span><span style="color:#2a00ff;background:#ffffe8;">$from</span><span style="color:#2a00ff;background:#ffffe8;"> to: </span><span style="color:#2a00ff;background:#ffffe8;">$to</span><span style="color:#2a00ff;background:#ffffe8;">"</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$url</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"http://maps.google.com/maps/nav"</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$result</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> HttpHelper</span><span style="color:#000000;background:#ffffe8;">::</span><span style="color:#000000;background:#ffffe8;">doGET</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$url</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$params</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#000000;background:#ffffe8;">$result</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> json_decode</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">$result</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">true</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">        </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">return</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$result</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#000000;background:#ffffe8;">}</span>
<span style="color:#7f0055;background:#ffffe8;">?&gt;</span></pre>
<p>A <strong>example</strong> how to use this code is:</p>
<pre style="color:#000000;background:#ffffff;"><span style="color:#7f0055;background:#ffffe8;">&lt;?php</span>
<span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">.</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#3f7f59;background:#ffffe8;">/* FROM and TO coordinates */</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#000000;background:#ffffe8;">$markers</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#7f0055;background:#ffffe8;font-weight:bold;">array</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#2a00ff;background:#ffffe8;">"37.262568,-121.962232,redr"</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"37.229898,-121.971853,blueg"</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#3f7f59;background:#ffffe8;">/* Get the driving directions from google api */</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> GoogleGeo</span><span style="color:#000000;background:#ffffe8;">::</span><span style="color:#000000;background:#ffffe8;">retrieveDirections</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#2a00ff;background:#ffffe8;">"485 Alberto Way, Suite 210. Los Gatos, CA 95032"</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#2a00ff;background:#ffffe8;">"14109 Winchester Bl, Los Gatos, CA"</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#3f7f59;background:#ffffe8;">/* Create the map image url with the directions coordinates */</span>
<span style="color:#000000;background:#ffffe8;">    </span><span style="color:#000000;background:#ffffe8;">$staticMap</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">=</span><span style="color:#000000;background:#ffffe8;"> GoogleGeo</span><span style="color:#000000;background:#ffffe8;">::</span><span style="color:#000000;background:#ffffe8;">buildStaticMap</span><span style="color:#000000;background:#ffffe8;">(</span><span style="color:#000000;background:#ffffe8;">null</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$markers</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">640</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">240</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> null</span><span style="color:#000000;background:#ffffe8;">,</span><span style="color:#000000;background:#ffffe8;"> </span><span style="color:#000000;background:#ffffe8;">$directions</span><span style="color:#000000;background:#ffffe8;">)</span><span style="color:#000000;background:#ffffe8;">;</span>
<span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">.</span><span style="color:#000000;background:#ffffe8;">.</span>
<span style="color:#7f0055;background:#ffffe8;">?&gt;</span></pre>
<p>In this way you will have <strong>$staticMap</strong> with a value similar to the image urls in the <a href="http://gmaps-samples.googlecode.com/svn/trunk/gdirections/directions-static.html">directions-static demo</a>. In this case it will be:</p>
<p>http://maps.google.com/staticmap?maptype=mobile&#038;size=640&#215;240&#038;maptype=roadmap&#038;key=YOUR_GOOGLE_KEY&#038;sensor=false&#038;markers=37.262568%2C-121.962232%2Credr|37.229898%2C-121.971853%2Cblueg&#038;path=rgb:0x0000ff,weight:5|37.22898,-121.97104|37.22818,-121.97112|37.22597,-121.97231|37.22892,-121.98063|37.23713,-121.97714|37.26301,-121.96088|37.262282,-121.961628</p>
<p>The variable <strong>$directions</strong> will contain a array with the complete direction steps, so you can easily loop through it and print it out on your WAP application.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mufumbo.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mufumbo.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mufumbo.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mufumbo.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mufumbo.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mufumbo.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mufumbo.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mufumbo.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.rafaelsanches.com&amp;blog=3694990&amp;post=53&amp;subd=mufumbo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.rafaelsanches.com/2009/07/23/server-side-driving-direction-with-google-maps-api-with-php-for-wap-and-web/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6cde839a3b5ec5fcac5ec8ad8e0f7bb7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mufumbo</media:title>
		</media:content>
	</item>
	</channel>
</rss>
