<?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"
	>

<channel>
	<title>Free Android CakePHP GMaps Articles</title>
	<atom:link href="http://www.balistupa.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.balistupa.com/blog</link>
	<description>Bali Stupa Blog</description>
	<pubDate>Mon, 31 Aug 2009 07:32:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>How to print javascript object properties</title>
		<link>http://www.balistupa.com/blog/2009/08/how-to-print-javascript-object-properties/</link>
		<comments>http://www.balistupa.com/blog/2009/08/how-to-print-javascript-object-properties/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 07:32:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[html]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=88</guid>
		<description><![CDATA[Sometime we need to print the structure data that return by a function. I was work on a task for google map and need to print object properties of Placemarks object on javascript. I need to analyze what kind of structure data return by geocoding function. The code below is a short function to print [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime we need to print the structure data that return by a function. I was work on a task for google map and need to print object properties of Placemarks object on javascript. I need to analyze what kind of structure data return by geocoding function. The code below is a short function to print object properties in javascript</p>
<blockquote><p>function isObject(obj) {<br />
return obj.constructor == Object;<br />
}</p>
<p>function print_object(object, level){<br />
var tab = &#8220;&#8221;;<br />
if(level &gt; 0){<br />
for(i = 0; i &lt; level; i++) tab += &#8220;\t&#8221;;<br />
}<br />
var str = &#8220;&#8221;;<br />
for(prop in object) {<br />
if(!isObject(object[prop])) str += tab + prop + &#8221; value :&#8221; + object[prop] + &#8220;\n&#8221;;<br />
else str += tab + prop + &#8220;\n&#8221; + print_object(object[prop], level + 1);<br />
}<br />
return str;<br />
}</p></blockquote>
<p>and how to use this function is really simple approach</p>
<blockquote><p>address = addresses.Placemark[0];<br />
alert(print_object(address, 0));</p></blockquote>
<p>in this scenario, i would like to print first placemark object return by geocoding function. Parameter level is use to make nice print view using tab character.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F08%2Fhow-to-print-javascript-object-properties%2F';
  addthis_title  = 'How+to+print+javascript+object+properties';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/08/how-to-print-javascript-object-properties/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to do GROUP BY HAVING in CakePHP</title>
		<link>http://www.balistupa.com/blog/2009/08/how-to-do-group-by-having-in-cakephp/</link>
		<comments>http://www.balistupa.com/blog/2009/08/how-to-do-group-by-having-in-cakephp/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 04:23:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[cakephp]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=86</guid>
		<description><![CDATA[Before June 2008, there is no clean implementation for GROUP BY. commonly people code with CakePHP will put GROUP BY sintak on conditions, something like this
$this-&#62;Product-&#62;find(&#8217;all&#8217;, array(&#8216;conditions&#8217; =&#62; &#8216;1=1 GROUP BY Product.category_id&#8217;));
Now CakePhp have a clean sintak for GROUP BY by new additional paramater on find function. We can use &#8216;group&#8217; to define GROUP BY [...]]]></description>
			<content:encoded><![CDATA[<p>Before June 2008, there is no clean implementation for GROUP BY. commonly people code with CakePHP will put GROUP BY sintak on conditions, something like this</p>
<p><span>$this-&gt;Product-&gt;find(&#8217;all&#8217;, array(</span><span>&#8216;conditions&#8217; =&gt; &#8216;1=1 <strong class="highlight">GROUP</strong> <strong class="highlight">BY</strong> Product.category_id&#8217;));</span></p>
<p>Now CakePhp have a clean sintak for GROUP BY by new additional paramater on find function. We can use &#8216;group&#8217; to define GROUP BY on cakephp. For example</p>
<p>$this-&gt;Product-&gt;find(&#8217;all&#8217;, array(&#8217;fields&#8217; =&gt; array(&#8217;Product.category_id&#8217;, &#8216;COUNT(Product.hotel_id) as total&#8217;), &#8216;<strong>group</strong>&#8216; =&gt; array(&#8217;Product.category_id&#8217;)));</p>
<p>How if we want to have HAVING sintak on query? i ussually use this solution for new cakephp</p>
<p>$this-&gt;Product-&gt;find(&#8217;all&#8217;, array(&#8217;fields&#8217; =&gt; array(&#8217;Product.category_id&#8217;, &#8216;COUNT(Product.hotel_id) as total&#8217;), &#8216;group&#8217; =&gt; array(&#8217;Product.category_id <strong>HAVING</strong> COUNT(Product.hotel_id) &gt; 1&#8242;)));</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F08%2Fhow-to-do-group-by-having-in-cakephp%2F';
  addthis_title  = 'How+to+do+GROUP+BY+HAVING+in+CakePHP';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/08/how-to-do-group-by-having-in-cakephp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Passing data or parameter to another Activity Android</title>
		<link>http://www.balistupa.com/blog/2009/08/passing-data-or-parameter-to-another-activity-android/</link>
		<comments>http://www.balistupa.com/blog/2009/08/passing-data-or-parameter-to-another-activity-android/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 04:34:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[android]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=83</guid>
		<description><![CDATA[Sometime we need to pass data or parameter to another Activity on Android. Only one activity is active at once. An activity open new activity for result and opened activity need parameter to set their interface or another option based on request. So it is important a system can handle sending and retrieve parameter between [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime we need to pass data or parameter to another Activity on Android. Only one activity is active at once. An activity open new activity for result and opened activity need parameter to set their interface or another option based on request. So it is important a system can handle sending and retrieve parameter between two Activity.</p>
<p>To open an activity and wait for a result, we can use this sintax</p>
<blockquote><p>Intent newIntent = new Intent(this.getApplicationContext(), ActivityClass2.class);<br />
startActivityForResult(newIntent, 0);</p></blockquote>
<p>ActivityClass2 is the class name of activity that we need to create and then open it from current activity. startActivityForResult is a method to run newActivity. Later we can have the result by add this function on current Activity<span id="more-83"></span></p>
<blockquote><p>protected void onActivityResult(int requestCode, int resultCode, Intent data)</p></blockquote>
<p>First to send a data or parameter to newActivity we can use this sintax</p>
<blockquote><p><strong>Bundle bundle = new Bundle();<br />
bundle.putString(&#8221;param1&#8243;, &#8220;test&#8221;);<br />
</strong><br />
Intent newIntent = new Intent(this.getApplicationContext(), ActivityClass2.class);<br />
<strong>newIntent.putExtras(bundle);</strong><br />
startActivityForResult(newIntent, 0);</p></blockquote>
<p>On ActivityClass2, we can read this parameter using this sintax</p>
<blockquote><p>Bundle bundle = this.getIntent().getExtras();<br />
String param1 = bundle.getString(&#8221;param1&#8243;);</p></blockquote>
<p>be carefull to use param1, because it can be null if we didn&#8217;t set it.</p>
<p>So it is very easy to send or passing data or parameter between two activity in Android. One last thing is to return a value for startActivityForResult, we can add this line code to close ActivityClass2 and return focus to opener plus send data to opener activity.</p>
<blockquote><p>Bundle bundle = new Bundle();<br />
bundle.putString(&#8221;status&#8221;, &#8220;OK&#8221;);<br />
Intent mIntent = new Intent();<br />
mIntent.putExtras(bundle);<br />
setResult(RESULT_OK, mIntent);<br />
finish();</p></blockquote>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F08%2Fpassing-data-or-parameter-to-another-activity-android%2F';
  addthis_title  = 'Passing+data+or+parameter+to+another+Activity+Android';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/08/passing-data-or-parameter-to-another-activity-android/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Forcing inner join on belongTo and hasOne</title>
		<link>http://www.balistupa.com/blog/2009/07/forcing-inner-join-on-belongto-and-hasone/</link>
		<comments>http://www.balistupa.com/blog/2009/07/forcing-inner-join-on-belongto-and-hasone/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 07:13:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[cakephp]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=81</guid>
		<description><![CDATA[By default, belongsTo and hasOne using LEFT JOIN relation between parent and child table or model. We can forcing the relationship to use either INNER JOIN or LEFT JOIN based on our need. Cakephp has add new option when binding model, name type: value is LEFT or INNER.
For example we have parent table Author and [...]]]></description>
			<content:encoded><![CDATA[<p>By default, belongsTo and hasOne using LEFT JOIN relation between parent and child table or model. We can forcing the relationship to use either INNER JOIN or LEFT JOIN based on our need. Cakephp has add new option when binding model, name type: value is LEFT or INNER.</p>
<p>For example we have parent table Author and hasOne Post, we can set INNER JOIN relation by default on model class or in controller using bindModel. In this example the hasOne relation set on model class</p>
<blockquote><p>&lt;?php<br />
class Author extends AppModel {<br />
var $name = &#8216;Author&#8217;;<br />
var $hasOne = array(’Post’=&gt;array(’type’=&gt;’INNER’));<br />
}<br />
?&gt;</p></blockquote>
<p>and running on controller</p>
<blockquote><p>$this-&gt;Author-&gt;find(&#8217;all&#8217;);</p></blockquote>
<p>cakephp will generate query for author table.</p>
<blockquote><p>SELECT `Author`.`id`, `Author`.`name`, `Post`.`id`, `Post`.`post_id`, `Post`.`title` FROM `authors` AS `Author` INNER JOIN `posts` AS `Post` ON (`Post`.`post_id` = `Author`.`id`) WHERE 1 = 1</p></blockquote>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Fforcing-inner-join-on-belongto-and-hasone%2F';
  addthis_title  = 'Forcing+inner+join+on+belongTo+and+hasOne';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/forcing-inner-join-on-belongto-and-hasone/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Find a data in mysql Array field</title>
		<link>http://www.balistupa.com/blog/2009/07/find-a-data-in-mysql-array-field/</link>
		<comments>http://www.balistupa.com/blog/2009/07/find-a-data-in-mysql-array-field/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 06:01:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[mysql]]></category>

		<category><![CDATA[query tips]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=78</guid>
		<description><![CDATA[I want to show you a situation that probably happen to you when build a mysql query. The situation can be vary but basically same condition. For example we have places table to store all beautiful places around the world. And a categories table to classify our places data. The rule is a place can [...]]]></description>
			<content:encoded><![CDATA[<p>I want to show you a situation that probably happen to you when build a mysql query. The situation can be vary but basically same condition. For example we have places table to store all beautiful places around the world. And a categories table to classify our places data. The rule is a place can be put on one or some categories. To achieve this function we just add a field into places table that save category id list.</p>
<p>So places table will have id, name, categories fields. and categories table have id, name. We want to save category list into categories field on places table. The data will look like this &#8216;2,3,4,5,6,7,8&#8242;. A question will come to your mind about how to grab or find a matching id inside this categories, for example we want to show all place with category id 5.</p>
<p>We cannot use LIKE in this example because it cannot match perfectly on many digit number. So i found a solution that easy to do. The query to find all data inside mysql Array field is</p>
<blockquote><p>SELECT * FROM places WHERE FIND_IN_SET(5, categories)</p></blockquote>
<p>Another solution is by adding new table to save category list for place. But my solution look nice, right?</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Ffind-a-data-in-mysql-array-field%2F';
  addthis_title  = 'Find+a+data+in+mysql+Array+field';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/find-a-data-in-mysql-array-field/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to install eclipse for android on windows?</title>
		<link>http://www.balistupa.com/blog/2009/07/how-to-install-eclipse-for-android-on-windows/</link>
		<comments>http://www.balistupa.com/blog/2009/07/how-to-install-eclipse-for-android-on-windows/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 04:30:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[android]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=75</guid>
		<description><![CDATA[You can use any text editor to write a java code for android, and then compile using JDK tools. Create android package (APK) using android sdk tools and then install and run application on emulator. But we need a tool to automatic all android development process. One android IDE that commonly used by android developer [...]]]></description>
			<content:encoded><![CDATA[<p>You can use any text editor to write a java code for android, and then compile using JDK tools. Create android package (APK) using android sdk tools and then install and run application on emulator. But we need a tool to automatic all android development process. One android IDE that commonly used by android developer is eclipse. Using eclipse you can have an integrated development environment for android through Android plugin, such as</p>
<ul>
<li>write or code java source for android application</li>
<li>good overview for your project inside project manager</li>
<li>user friendly interface to create new android project</li>
<li>compile and debugging is as easy as desktop application development</li>
<li>nice java source code editor with high text editing functionality for developer</li>
<li>setting emulator also easy with good overview using DDMS perspective</li>
<li>run android application inside emulator with simple click</li>
</ul>
<p>There are many more advantage using eclipse as your IDE for android. Believe me it makes you enjoy coding android with their nice interface and automatic process.</p>
<p><span id="more-75"></span><strong>Installing eclipse for android</strong></p>
<ol>
<li>Install JRE or JDK, but i suggest you to install JDK as we will develop java application. Read last article about <a href="http://www.balistupa.com/blog/2009/07/how-to-install-android-sdk-on-windows/">installing jdk for android</a>.</li>
<li>Download Eclipse IDE for Java Developers at http://www.eclipse.org/downloads/. Its about 92 MB.</li>
<li>Extract the zip file into a folder for example D:\ANDROID after downloaded</li>
<li>at this step you will have D:\ANDROID\eclipse folder</li>
<li>run D:\ANDROID\eclipse\eclipse.exe. On first time you will asked for workspace directory. It is a directory where you want your android project to be stored. For now just create new folder WORKSPACE in D:\ANDROID</li>
<li>install android sdk, you can read on <a href="http://www.balistupa.com/blog/2009/07/how-to-install-android-sdk-on-windows/">installing android sdk</a> article.</li>
<li>Now you need to connect eclipse and android sdk</li>
<li>on eclipse GUI, select Windows &gt; Preferences menu on top.</li>
<li>select android and then locate your SDK Location, on my machine is D:\ANDROID\android-sdk, and then click apply</li>
<li>on eclipse GUI, select Help &gt; Software Updates. some eclipse version maybe different menu location or name</li>
<li>click Available software tabs and then click Add site</li>
<li>You can try use this Location : https://dl-ssl.google.com/android/eclipse/ or http://dl-ssl.google.com/android/eclipse/. and then click OK</li>
<li>check the checkbox before https://dl-ssl.google.com/android/eclipse/ or http://dl-ssl.google.com/android/eclipse/ and then click Finish</li>
<li>It will direct you to download interface, wait until finish</li>
<li>at the end you will need to run plugins installation, just follow the step on interface.</li>
</ol>
<p>At this point you already have a ready IDE for creating android application. Have fun and keep reading on my article about using eclipse to create android application.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Fhow-to-install-eclipse-for-android-on-windows%2F';
  addthis_title  = 'How+to+install+eclipse+for+android+on+windows%3F';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/how-to-install-eclipse-for-android-on-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to install android sdk on windows?</title>
		<link>http://www.balistupa.com/blog/2009/07/how-to-install-android-sdk-on-windows/</link>
		<comments>http://www.balistupa.com/blog/2009/07/how-to-install-android-sdk-on-windows/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 03:22:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[android]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=72</guid>
		<description><![CDATA[For whom that doesn&#8217;t know yet the android, it is a new platform that basically run on gphone mobile device. GPhone stand for Google Phone, i think google want to spread their business to mobile device technology. But android is not for gphone only, at least nokia will have android on their device in future. [...]]]></description>
			<content:encoded><![CDATA[<p>For whom that doesn&#8217;t know yet the android, it is a new platform that basically run on gphone mobile device. GPhone stand for Google Phone, i think google want to spread their business to mobile device technology. But android is not for gphone only, at least nokia will have android on their device in future. So for developer it is a good market to make an application run on android platform. Best thing is android give developer a software development kit (SDK) that based on java programming language. And this SDK is open to all developer and has big community. This article is about installing android sdk on your windows machine.</p>
<p>First of all you need a java library installed on your machine. It can be a JRE or JDK, but i suggest you to install JDK as we want to develop a java application on our machine.</p>
<p><span id="more-72"></span><strong>Installing JDK for android</strong></p>
<ol>
<li> go to http://java.sun.com/javase/downloads/index.jsp</li>
<li>find Java SE Development (JDK) section. The latest JDK version at the moment is JDK 6 Update 14</li>
<li>Click on Download Button</li>
<li>Run the executable installation file after download finished</li>
</ol>
<p>Note : you can use J2EE, but J2SE is enough for android.</p>
<p><strong>Installing android SDK</strong></p>
<ol>
<li>download <strong>http://developer.android.com/sdk/1.5_r3/index.html</strong> based on your Operating System platform. In my machine i use Windows so i download <strong>android-sdk-windows-1.5_r3.zip</strong></li>
<li>extract <strong>android-sdk-windows-1.5_r3.zip</strong> into a folder for example <strong>D:\android-sdk</strong></li>
<li>add <strong>D:\android-sdk\tools</strong> into PATH environmental variables on your system. You can find it on Control Panels &gt; Systems</li>
<li>please restart your computer</li>
</ol>
<p>At this point you have an android sdk that installed on your machine. You are ready to use android sdk and run using their great android emulator. You can coding using your text editor and compile using JDK and then create Android Package using Android SDK and then run it using android emulator. But i suggest you to use eclipse because it is more easier to build android application using eclipse automatic process.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Fhow-to-install-android-sdk-on-windows%2F';
  addthis_title  = 'How+to+install+android+sdk+on+windows%3F';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/how-to-install-android-sdk-on-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why does findViewById return null?</title>
		<link>http://www.balistupa.com/blog/2009/07/why-does-findviewbyid-return-null/</link>
		<comments>http://www.balistupa.com/blog/2009/07/why-does-findviewbyid-return-null/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 05:10:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[android]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=69</guid>
		<description><![CDATA[I have been confusing about this problem when doing a project using google map. I believe some of you have this problem also. The problem is simple about a findViewById function on Activity or View always returning Null value. I have the following code on my layout
&#60;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&#62;
&#60;RelativeLayout xmlns:android=&#8221;http://schemas.android.com/apk/res/android&#8221;
android:layout_width=&#8221;fill_parent&#8221;
android:layout_height=&#8221;fill_parent&#8221;&#62;
&#60;com.google.android.maps.MapView
android:id=&#8221;@+id/mapView&#8221;
android:layout_width=&#8221;fill_parent&#8221;
android:layout_height=&#8221;fill_parent&#8221;
android:enabled=&#8221;true&#8221;
android:clickable=&#8221;true&#8221;
android:apiKey=&#8221;0QGdlm3NNz0KF5zSUTn5FvObCU2EUn7Dim25Sjw&#8221;
/&#62;
&#60;Button id=&#8221;@+id/btnViewPOI&#8221;
android:layout_width=&#8221;wrap_content&#8221;
android:layout_height=&#8221;wrap_content&#8221;
android:layout_alignParentBottom=&#8221;true&#8221;
android:layout_alignParentRight=&#8221;true&#8221;
android:visibility=&#8221;visible&#8221;
android:text=&#8221;List&#8221; /&#62;
&#60;/RelativeLayout&#62;
on my Activity class, [...]]]></description>
			<content:encoded><![CDATA[<p>I have been confusing about this problem when doing a project using google map. I believe some of you have this problem also. The problem is simple about a <strong>findViewById</strong> function on Activity or View always returning Null value. I have the following code on my layout</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;RelativeLayout xmlns:android=&#8221;http://schemas.android.com/apk/res/android&#8221;<br />
android:layout_width=&#8221;fill_parent&#8221;<br />
android:layout_height=&#8221;fill_parent&#8221;&gt;</p>
<p>&lt;com.google.android.maps.MapView<br />
android:id=&#8221;@+id/mapView&#8221;<br />
android:layout_width=&#8221;fill_parent&#8221;<br />
android:layout_height=&#8221;fill_parent&#8221;<br />
android:enabled=&#8221;true&#8221;<br />
android:clickable=&#8221;true&#8221;<br />
android:apiKey=&#8221;0QGdlm3NNz0KF5zSUTn5FvObCU2EUn7Dim25Sjw&#8221;<br />
/&gt;</p>
<p>&lt;Button id=&#8221;@+id/btnViewPOI&#8221;<br />
android:layout_width=&#8221;wrap_content&#8221;<br />
android:layout_height=&#8221;wrap_content&#8221;<br />
android:layout_alignParentBottom=&#8221;true&#8221;<br />
android:layout_alignParentRight=&#8221;true&#8221;<br />
android:visibility=&#8221;visible&#8221;<br />
android:text=&#8221;List&#8221; /&gt;</p>
<p>&lt;/RelativeLayout&gt;</p></blockquote>
<p><span id="more-69"></span>on my Activity class, i was try to find a reference to button btnViewPOI. Here is a part of the code in my Activity class</p>
<blockquote><p>@Override<br />
public void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
setContentView(R.layout.main);</p>
<p>final Button btnViewPOI = (Button) findViewById(R.id.btnViewPOI);<br />
if(btnViewPOI == null) Log.d(&#8221;null&#8221;, &#8220;is null&#8221;);</p></blockquote>
<p>And i always get null value for btnViewPOI. I spend a day to figure out the problem and almost give up, but thanks god that i notice if the layout parser did not understand the attribute id, we must use a complete android:id. And i change it and its work, no more returning a null value.</p>
<p>The code for my button in layout xml file should look like this</p>
<blockquote><p>&lt;Button<br />
<strong>android:id</strong>=&#8221;@+id/btnViewPOI&#8221;<br />
android:layout_width=&#8221;wrap_content&#8221;<br />
android:layout_height=&#8221;wrap_content&#8221;<br />
android:layout_alignParentBottom=&#8221;true&#8221;<br />
android:layout_alignParentRight=&#8221;true&#8221;<br />
android:visibility=&#8221;visible&#8221;<br />
android:text=&#8221;List&#8221; /&gt;</p></blockquote>
<p>So i try to summary the important thing to remember if findViewById return a null value:</p>
<ol>
<li>if you use xml based layout, you must add this line before run findViewById.<br />
setContentView(R.layout.main);</li>
<li>the id that you can use is only the id that define on your layout for each activity. To check the id you can find it on R class</li>
<li>remember to use complete <strong>android:id</strong> to define an id to a view</li>
</ol>
<p>That all, i hope that you can solve the problem when findViewById return a null value.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Fwhy-does-findviewbyid-return-null%2F';
  addthis_title  = 'Why+does+findViewById+return+null%3F';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/why-does-findviewbyid-return-null/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to change cakephp layout?</title>
		<link>http://www.balistupa.com/blog/2009/07/how-to-change-cakephp-layout/</link>
		<comments>http://www.balistupa.com/blog/2009/07/how-to-change-cakephp-layout/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 08:30:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[cakephp]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=65</guid>
		<description><![CDATA[The cakephp concept is MVC, Model-View-Controller. This three part will divide the area for database, business logic and design part. MVC give a good system to make a clean code for designer, database analyst and programmer. Design work will not interfere the business logic work, cakephp try to limit this thing.
A layout or html output [...]]]></description>
			<content:encoded><![CDATA[<p>The cakephp concept is MVC, Model-View-Controller. This three part will divide the area for database, business logic and design part. MVC give a good system to make a clean code for designer, database analyst and programmer. Design work will not interfere the business logic work, cakephp try to limit this thing.</p>
<p>A layout or html output is construct inside main layout and view for each actions. Main layout is a basic layout for your website. We can have some layout for different output type such as html, xml, rss, or etc. For each type we can have different layout as needed. For example registration page will have different layout with homepage.</p>
<p>By default cakephp use all layouts in folder <strong>cake\libs\view\layouts</strong> if you are not define your layout. You can override cakephp default layout by create ctp file in folder <strong>app/views/layouts</strong>. The default layout named as <strong>default.ctp</strong>. How to change this cakephp layout for certain controller action?</p>
<p>Simple create new ctp file inside <strong>app/views/layouts</strong>, for example <strong>mylayout.ctp</strong>. And then inside action function on controller put this code</p>
<blockquote><p>$this-&gt;layout = &#8216;mylayout&#8217;;</p></blockquote>
<p>or you can set folder path for the layout, for example we have layout file saved on <strong>app/views/layouts/xml/mylayout.ctp</strong>. you can set the path using this code</p>
<blockquote><p>$this-&gt;layoutPath = &#8216;xml&#8217;;</p></blockquote>
<p>so the complete code for changing the layout is</p>
<blockquote><p>$this-&gt;layoutPath = &#8216;xml&#8217;;<br />
$this-&gt;layout = &#8216;mylayout&#8217;;</p></blockquote>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Fhow-to-change-cakephp-layout%2F';
  addthis_title  = 'How+to+change+cakephp+layout%3F';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/how-to-change-cakephp-layout/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Create RSS using cakephp</title>
		<link>http://www.balistupa.com/blog/2009/07/create-rss-using-cakephp/</link>
		<comments>http://www.balistupa.com/blog/2009/07/create-rss-using-cakephp/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 07:21:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[cakephp]]></category>

		<guid isPermaLink="false">http://www.balistupa.com/blog/?p=61</guid>
		<description><![CDATA[It is easy to add RSS into your website using cakephp. Cakephp has a built in library to code or create a RSS output to your visitor. For you that doesn&#8217;t know yet RSS, it is a web 3.0 capability to communicate between two website about new update on one website. Its stand for Really [...]]]></description>
			<content:encoded><![CDATA[<p>It is easy to add RSS into your website using cakephp. Cakephp has a built in library to code or create a RSS output to your visitor. For you that doesn&#8217;t know yet RSS, it is a web 3.0 capability to communicate between two website about new update on one website. Its stand for Really Simple Syndication. The purpose is  to give a standard output about new change on your website. For example a blog can have RSS to publish their latest post or article.</p>
<p>i will explain a method to add RSS capability into your cakephp website. In this example we have posts controller for our blog post and we want to create RSS for post table. The rss url will look like this</p>
<p><strong>http://www.yoursite.com/posts/rss</strong> or change routing for <strong>http://www.yoursite.com/rss</strong> into posts controller and rss action.</p>
<p><span id="more-61"></span>The implementation will explain in 4 step, so here we are</p>
<ol>
<li>open app/config/routes.php, add this line and then save<br />
Router::connect(&#8217;/rss&#8217;, array(&#8217;controller&#8217; =&gt; &#8216;posts&#8217;, &#8216;action&#8217; =&gt; &#8216;rss&#8217;));</li>
<li>open app/controller/posts_controller.php and create new method or action<br />
function rss(){<br />
$this-&gt;set(&#8217;posts&#8217;, $this-&gt;paginate(&#8217;Post&#8217;));<br />
}</li>
<li>create app/views/posts/rss.ctp, and paste this lines<br />
&lt;?php<br />
echo $rss-&gt;items($posts, &#8216;transformRSS&#8217;);<br />
function transformRSS($post) {<br />
return array(<br />
&#8216;title&#8217; =&gt; $post['Post']['title'],<br />
&#8216;link&#8217; =&gt; array(&#8217;action&#8217; =&gt; &#8217;show&#8217;, $post['Post']['id']),<br />
&#8216;guid&#8217; =&gt; array(&#8217;action&#8217; =&gt; &#8217;show&#8217;, $post['Post']['id']),<br />
&#8216;description&#8217; =&gt; $post['Post']['text'],<br />
&#8216;author&#8217; =&gt; $post['User']['username'],<br />
&#8216;pubDate&#8217; =&gt; $post['Post']['created']<br />
);<br />
}<br />
?&gt;</li>
<li>at this point your RSS is ready. check by open URL http://www.yoursite.com/posts/rss or http://www.yoursite.com/rss</li>
</ol>
<p>As i said, adding or create rss using cakephp is relatively simple to do.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fwww.balistupa.com%2Fblog%2F2009%2F07%2Fcreate-rss-using-cakephp%2F';
  addthis_title  = 'Create+RSS+using+cakephp';
  addthis_pub    = '';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://www.balistupa.com/blog/2009/07/create-rss-using-cakephp/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
