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

<channel>
	<title>dijexi.com</title>
	<atom:link href="http://www.dijexi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dijexi.com</link>
	<description>free programming tutorial, tips and tricks on php, codeigniter, delphi, dotnet, ajax and more..</description>
	<lastBuildDate>Fri, 13 Jan 2012 23:21:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Ayo Membuat MP3 Player Sederhana di Android</title>
		<link>http://www.dijexi.com/2012/01/ayo-membuat-mp3-player-sederhana-di-android/</link>
		<comments>http://www.dijexi.com/2012/01/ayo-membuat-mp3-player-sederhana-di-android/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 23:20:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Delphi]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/?p=1454</guid>
		<description><![CDATA[Ini cuma aplikasi sederhana cara memainkan MP3 di SDCARD, dengan menampilkan daftar lagu MP3 pada sebuah ListView. Buat proyek baru dengan nama MP3Player di Eclipse. Activity utama kita bernama Mp3PlayerActivity. Layout Pertama-tama definisikan layout untuk menampilkan daftar lagu. Pakai saja ListView untuk menyederhanakan program. Nanti kalau sudah mahir boleh pakai list yang lebih cantik tampilannya. [...]]]></description>
			<content:encoded><![CDATA[<p>Ini cuma aplikasi sederhana cara memainkan MP3 di SDCARD, dengan menampilkan daftar lagu MP3 pada sebuah ListView.</p>
<p>Buat proyek baru dengan nama MP3Player di Eclipse. Activity utama kita bernama Mp3PlayerActivity.</p>
<h1>Layout</h1>
<p>Pertama-tama definisikan layout untuk menampilkan daftar lagu. Pakai saja ListView untuk menyederhanakan program. Nanti kalau sudah mahir boleh pakai list yang lebih cantik tampilannya. Jadi bikin dulu layout baru namanya daftarlagu.xml.</p>
<p>&lt;?xml version=<em>&#8220;1.0&#8243;</em> encoding=<em>&#8220;utf-8&#8243;</em>?&gt;</p>
<p>&lt;LinearLayout</p>
<p>xmlns:android=<em>&#8220;http://schemas.android.com/apk/res/android&#8221;</em></p>
<p>android:orientation=<em>&#8220;vertical&#8221;</em></p>
<p>android:layout_width=<em>&#8220;match_parent&#8221;</em></p>
<p>android:layout_height=<em>&#8220;match_parent&#8221;</em>&gt;</p>
<p>&lt;ListView android:id=<em>&#8220;@id/android:list&#8221;</em></p>
<p>android:layout_width=<em>&#8220;fill_parent&#8221;</em></p>
<p>android:layout_height=<em>&#8220;fill_parent&#8221;</em></p>
<p>android:layout_weight=<em>&#8220;1&#8243;</em></p>
<p>android:drawSelectorOnTop=<em>&#8220;false&#8221;</em></p>
<p>/&gt;</p>
<p>&lt;TextView android:id=<em>&#8220;@id/android:empty&#8221;</em></p>
<p>android:layout_width=<em>&#8220;fill_parent&#8221;</em></p>
<p>android:layout_height=<em>&#8220;fill_parent&#8221;</em></p>
<p>android:text=<em>&#8220;tidak ada lagu SD Card&#8221;</em></p>
<p>/&gt;</p>
<p>&lt;/LinearLayout&gt;</p>
<p>ListView yang cukup simple, yang akan menampilkan text “tidak ada lagi di SD card” ketika tidak ada items ditemukan di ListView.</p>
<p>Lalu bikin lagi file XML untuk menampilkan setiap file MP3 yang akan dimunculkan di ListView, kasi nama misalnya viewlagu.xml.</p>
<p>&lt;?xml version=<em>&#8220;1.0&#8243;</em> encoding=<em>&#8220;utf-8&#8243;</em>?&gt;</p>
<p>&lt;?xml version=<em>&#8220;1.0&#8243;</em> encoding=<em>&#8220;utf-8&#8243;</em>?&gt;</p>
<p>&lt;TextView android:id=<em>&#8220;@+id/text1&#8243;</em> xmlns:android=<em>&#8220;http://schemas.android.com/apk/res/android&#8221;</em></p>
<p>android:layout_width=<em>&#8220;wrap_content&#8221;</em></p>
<p>android:layout_height=<em>&#8220;wrap_content&#8221;</em>/&gt;</p>
<h1>Activity</h1>
<p>Kemudian buka file MP3PlayerActivity.java yang sudah otomatis dibuat pada saat create project sebelumnya. Edit file tersebut sehingga lengkap seperti sebagai berikut:</p>
<p><strong>package</strong> com.vitraining;</p>
<p><strong>import</strong> java.io.File;</p>
<p><strong>import</strong> java.io.FilenameFilter;</p>
<p><strong>import</strong> java.io.IOException;</p>
<p><strong>import</strong> java.util.ArrayList;</p>
<p><strong>import</strong> java.util.List;</p>
<p><strong>import</strong> android.app.ListActivity;</p>
<p><strong>import</strong> android.media.MediaPlayer;</p>
<p><strong>import</strong> android.media.MediaPlayer.OnCompletionListener;</p>
<p><strong>import</strong> android.os.Bundle;</p>
<p><strong>import</strong> android.util.Log;</p>
<p><strong>import</strong> android.view.View;</p>
<p><strong>import</strong> android.widget.ArrayAdapter;</p>
<p><strong>import</strong> android.widget.ListView;</p>
<p><strong>public</strong> <strong>class</strong> Mp3PlayerActivity <strong>extends</strong> ListActivity {</p>
<p><strong>private</strong> <strong>static</strong> <strong>final</strong> String <em>MEDIA_PATH</em> = <strong>new</strong> String(&#8220;/sdcard/&#8221;);</p>
<p><strong>private</strong> List&lt;String&gt; songs = <strong>new</strong> ArrayList&lt;String&gt;();</p>
<p><strong>private</strong> MediaPlayer mp = <strong>new</strong> MediaPlayer();</p>
<p><strong>private</strong> <strong>int</strong> currentPosition = 0;</p>
<p>@Override</p>
<p><strong>public</strong> <strong>void</strong> onCreate(Bundle icicle) {</p>
<p><strong>super</strong>.onCreate(icicle);</p>
<p>setContentView(R.layout.<em>daftarlagu</em>);</p>
<p>updateDaftarLagu();</p>
<p>}</p>
<p><strong>public</strong> <strong>void</strong> updateDaftarLagu() {</p>
<p>File home = <strong>new</strong> File(<em>MEDIA_PATH</em>);</p>
<p><strong>if</strong> (home.listFiles(<strong>new</strong> Mp3Filter()).length &gt; 0) {</p>
<p><strong>for</strong> (File file : home.listFiles(<strong>new</strong> Mp3Filter())) {</p>
<p>songs.add(file.getName());</p>
<p>}</p>
<p>ArrayAdapter&lt;String&gt; songList = <strong>new</strong> ArrayAdapter&lt;String&gt;(<strong>this</strong>, R.layout.<em>viewlagu</em>, songs);</p>
<p>setListAdapter(songList);</p>
<p>}</p>
<p>}</p>
<p>@Override</p>
<p><strong>protected</strong> <strong>void</strong> onListItemClick(ListView l, View v, <strong>int</strong> position, <strong>long</strong> id) {</p>
<p>currentPosition = position;</p>
<p>playSong(<em>MEDIA_PATH</em> + songs.get(position));</p>
<p>}</p>
<p><strong>private</strong> <strong>void</strong> playSong(String songPath) {</p>
<p><strong>try</strong> {</p>
<p>mp.reset();</p>
<p>mp.setDataSource(songPath);</p>
<p>mp.prepare();</p>
<p>mp.start();</p>
<p>// Setup listener so next song starts automatically</p>
<p>mp.setOnCompletionListener(<strong>new</strong> OnCompletionListener() {</p>
<p><strong>public</strong> <strong>void</strong> onCompletion(MediaPlayer arg0) {</p>
<p>nextSong();</p>
<p>}</p>
<p>});</p>
<p>} <strong>catch</strong> (IOException e) {</p>
<p>Log.<em>v</em>(getString(R.string.<em>app_name</em>), e.getMessage());</p>
<p>}</p>
<p>}</p>
<p><strong>private</strong> <strong>void</strong> nextSong() {</p>
<p><strong>if</strong> (++currentPosition &gt;= songs.size()) {</p>
<p>// Last song, just reset currentPosition</p>
<p>currentPosition = 0;</p>
<p>} <strong>else</strong> {</p>
<p>// Play next song</p>
<p>playSong(<em>MEDIA_PATH</em> + songs.get(currentPosition));</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p><strong>class</strong> Mp3Filter <strong>implements</strong> FilenameFilter {</p>
<p><strong>public</strong> <strong>boolean</strong> accept(File dir, String name) {</p>
<p><strong>return</strong> (name.endsWith(&#8220;.mp3&#8243;));</p>
<p>}</p>
<p>}</p>
<p>Import package-package yang diperlukan. Di Eclipse, arahkan ke class yang dibilang error, lalu pilih import &lt;nama package&gt;.</p>
<p>Lakukan proses build (Project à Build Project) agar layout dikenali disini.</p>
<p>Function onCreate() gunanya untuk menampilkan view daftarlagu yang sudah kita buat sebelumnya. Kemudian memanggil function updateDaftarLagu().</p>
<p>Function updateDaftarLagu()  gunanya untuk membaca semua file yang ada di SD Card sesuai filter yang telah didefinisikan sebelumnya (yaitu class MP3Filter). Setiap file lagu yang ditemukan, nama filenya disimpan di variable songs. Kemudian dibentuk ListAdapter yang datanya berasal dari variable songs dan layoutnya dari viewlagu yang sudah didefinisikan di atas.</p>
<p>Ketika item di ListView di-click maka program menjalankan function playSong().</p>
<p>Function playSong()  gunanya untuk memainkan file MP3. Terlebih dahulu object variable mp di reset(), kemudian di-set file data nya dengan setDataSource(), di prepare(), dan di start(). Ketika selesai memainkan suatu lagu, program menjalankan function nextSong(). Ini dilakukan pada function setOnCompleteListener().</p>
<p>Function nextSong()  gunanya untuk  memajukan index variable songs dan memainkan lagu pada index tersebut.</p>
<p>Class Mp3Filter gunanya untuk meng-accept() file hanya jika ber-extension MP3.</p>
<h1>Membuat emulasi SD Card</h1>
<p>Agar bias jalan seperti di device, kita perlu bikin SD Card di emulator. Masuk ke folder android-sdk/tools, dan jalankan.</p>
<p>./mksdcard 128M /tmp/sd.img</p>
<p>Selanjutnya masuk ke menu Eclipse Run à Run Configurations… Pilih nama project yaitu MP3Player.</p>
<p>Di Tab Target, tambahkan di bagian Additional Emulator Command Line Options: “–sdcard /tmp/sd.img”</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2012/01/run-configuration.png"><img class="alignnone size-medium wp-image-1456" title="run-configuration" src="http://www.dijexi.com/wp-content/uploads/2012/01/run-configuration-300x238.png" alt="" width="300" height="238" /></a></p>
<p>Lalu klik Run disitu untuk menjalankan emulator.</p>
<p>Awalnya program menampilkan pesan “tidak ada lagu di SC Card”. Gimana cara mengisi SD Card dengan file MP3?</p>
<p>Masuk ke android-sdk/platform-tools, dan jalankan</p>
<p>Adb push &lt;sumber&gt; /mnt/sdcard</p>
<p>Misalnya</p>
<p>adb push /Users/akhmaddanielsembiring/Documents/etc/lagu/Gigi\ -\ 11\ Januari.mp3 /mnt/sdcard</p>
<p>Jalankan ulang program di emulator, hasilnya kira-kira seperti ini.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2012/01/run-emulator.png"><img title="run-emulator" src="http://www.dijexi.com/wp-content/uploads/2012/01/run-emulator-300x284.png" alt="" width="300" height="284" /></a></p>
<p>Pingin tau lebih detail tentang pemrograman Android? Koneksi ke server, web services, JSON, GPS, Mapping Google maps? Ikuti training<a href="http://www.vitraining.com/courses"> Android di VITRAINING.</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-program-animasi/" rel="bookmark">09. Program Animasi</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-cara-membuat-aplikasi-media-player/" rel="bookmark">07. Aplikasi Media Player</a></li><li><a href="http://www.dijexi.com/2009/06/seri-tutorial-delphi-programming/" rel="bookmark">Seri Tutorial Delphi Programming</a></li><li><a href="http://www.dijexi.com/2009/07/best-video-softwares-audio-softwares-3d-softwares/" rel="bookmark">Best Video Softwares, Audio Softwares, 3D Softwares</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-penggunaan-grafik-dan-multimedia/" rel="bookmark">17. Grafik dan Multimedia</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2012%2F01%2Fayo-membuat-mp3-player-sederhana-di-android%2F&amp;linkname=Ayo%20Membuat%20MP3%20Player%20Sederhana%20di%20Android"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2012/01/ayo-membuat-mp3-player-sederhana-di-android/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Import Existing Project Directory Into SVN Repository</title>
		<link>http://www.dijexi.com/2011/07/how-to-import-existing-project-directory-into-svn-repository/</link>
		<comments>http://www.dijexi.com/2011/07/how-to-import-existing-project-directory-into-svn-repository/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 05:45:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/?p=1452</guid>
		<description><![CDATA[You can import an existing project directory (with contents) into an SVn repository, and use the current location as your version controlled working copy. Here is how to do it: Suppose that your non-versioned project sources are in /home/user/aproject, and your repository is ready at http://server/repos. First, create an empty directory somewhere outside of your [...]]]></description>
			<content:encoded><![CDATA[<p><!--StartFragment-->You can import an existing project directory (with contents) into an SVn repository, and use the current location as your version controlled working copy.</p>
<p>Here is how to do it:</p>
<p>Suppose that your non-versioned project sources are in /home/user/aproject, and your repository is ready at http://server/repos.</p>
<p>First, create an empty directory somewhere outside of your project tree, say, /tmp/empty. Import that empty directory in your subversion repository.</p>
<pre>cd /tmp/empty</pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal;">svn import . http://server/repos/aproject</span></pre>
<p>Then, go into your existing non-versioned project directory. Now checkout the repository location you created in step 1.</p>
<pre>cd /home/user/aproject</pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal;">svn checkout http://server/repos/aproject .</span></pre>
<p>Do not forget the trailing dot at the previous command. This will add the .svn files to your existing project directory, but it will not do anything else, so your existing files are safe.</p>
<p>Next, add the directory with your files to the repository</p>
<pre>svn add *</pre>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal;">svn commit -m 'initial commit'</span></pre>
<p>Done.<!--EndFragment--></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2011/06/guide-to-installing-3rd-party-jars-in-maven/" rel="bookmark">Guide to installing 3rd party JARs in Maven</a></li><li><a href="http://www.dijexi.com/2010/01/adempiere-how-to-import-report-line-set-for-balance-sheet/" rel="bookmark">Adempiere &ndash; How to Import Report Line Set for Balance Sheet</a></li><li><a href="http://www.dijexi.com/2010/01/adempiere-how-to-import-report-line-set/" rel="bookmark">Adempiere &ndash; How to Import Report Line Set for Profit and Loss</a></li><li><a href="http://www.dijexi.com/2009/07/mengakses-active-directory-dari-delphi/" rel="bookmark">Mengakses Active Directory dari Delphi</a></li><li><a href="http://www.dijexi.com/2010/07/how-to-send-email-on-java-application-using-javamail-api/" rel="bookmark">How to Send Email on Java Application using JavaMail API</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2011%2F07%2Fhow-to-import-existing-project-directory-into-svn-repository%2F&amp;linkname=How%20to%20Import%20Existing%20Project%20Directory%20Into%20SVN%20Repository"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2011/07/how-to-import-existing-project-directory-into-svn-repository/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Guide to installing 3rd party JARs in Maven</title>
		<link>http://www.dijexi.com/2011/06/guide-to-installing-3rd-party-jars-in-maven/</link>
		<comments>http://www.dijexi.com/2011/06/guide-to-installing-3rd-party-jars-in-maven/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 09:32:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Funambol]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jbilling]]></category>
		<category><![CDATA[add external jar]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2011/06/guide-to-installing-3rd-party-jars-in-maven/</guid>
		<description><![CDATA[Often times you will have 3rd party JARs that you need to put in your local repository for use in your builds. The JARs must be placed in the local repository in the correct place in order for it to be correctly picked up by Maven. To make this easier, and less error prone, we [...]]]></description>
			<content:encoded><![CDATA[<p>Often times you will have 3rd party JARs that you need to put in your local repository for use in your builds. The JARs must be placed in the local repository in the correct place in order for it to be correctly picked up by Maven. To make this easier, and less error prone, we have provide a goal in the install plug-in which should make this relatively painless. </p>
<p>To install a JAR in the local repository use the following command:</p>
<blockquote><p>mvn install:install-file -Dfile=&lt;path-to-file&gt; -DgroupId=&lt;group-id&gt; \ -DartifactId=&lt;artifact-id&gt; -Dversion=&lt;version&gt; -Dpackaging=&lt;packaging&gt;</p>
</blockquote>
<p>&#160;</p>
<p>For example, to install jbilling_api.jar (API for connecting to JBilling application), use the following command:</p>
<blockquote><p>mvn install:install-file -Dfile=/opt/jbilling_api.jar -DgroupId=jbilling \ -DartifactId=jbilling -Dversion=2.0 -Dpackaging=jar</p>
</blockquote>
<p>Then, on the project’s POM file, add the following external dependency, so that Maven will include this jar while compiling: </p>
<blockquote><p>&lt;dependencies&gt; </p>
<p>…</p>
<p>&#160;&#160; &lt;dependency&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;groupId&gt;jbilling&lt;/groupId&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;artifactId&gt;jbilling&lt;/artifactId&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;version&gt;2.0&lt;/version&gt;       <br />&#160;&#160;&#160; &lt;/dependency&gt; </p>
<p>… </p>
<p>&lt;/dependencies&gt; </p>
</blockquote>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:01fe9c3d-a785-4bbf-839a-75fe97155096" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/maven" rel="tag">maven</a>,<a href="http://technorati.com/tags/java" rel="tag">java</a>,<a href="http://technorati.com/tags/add+external+jar" rel="tag">add external jar</a>,<a href="http://technorati.com/tags/jbilling" rel="tag">jbilling</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/12/netbeans-ide-6-8-released/" rel="bookmark">NetBeans IDE 6.8 Released</a></li><li><a href="http://www.dijexi.com/2009/06/adempiere-opensource-erp-installation/" rel="bookmark">001 Adempiere Opensource ERP Installation</a></li><li><a href="http://www.dijexi.com/2009/09/guide-to-implementing-business-intelligence-3-business-intelligence-tools-solutions/" rel="bookmark">Guide To Implementing Business Intelligence - 3. Business Intelligence Tools &amp; Solutions</a></li><li><a href="http://www.dijexi.com/2010/02/funambol-mobile-open-source-book-released/" rel="bookmark">Funambol Mobile Open Source Book Released</a></li><li><a href="http://www.dijexi.com/2009/07/codeigniter-tutorial-creating-accounting-application-part-1-setting-up-the-environment/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 1 Setting Up the Environment</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2011%2F06%2Fguide-to-installing-3rd-party-jars-in-maven%2F&amp;linkname=Guide%20to%20installing%203rd%20party%20JARs%20in%20Maven"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2011/06/guide-to-installing-3rd-party-jars-in-maven/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Engaging Customers with Facebook Applications</title>
		<link>http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/</link>
		<comments>http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 07:40:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Internet Marketing]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/</guid>
		<description><![CDATA[Image via Wikipedia With the rapid advancement in the Internet and its increasing user presence, the medium has become a preferred means of communicating directly with customers. Among the most popular activities on the Internet is the voracious usage of social networking sites. With its open architecture and wide range of functionalities, Facebook stands as [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 1em; width: 310px; display: block; float: left" class="zemanta-img"><a href="http://bit.ly/fb-traffic-dijexi"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" alt="Picture of notebook screen with Facebook and F..." src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/27/Facebook_and_Firefox.jpg/300px-Facebook_and_Firefox.jpg" width="300" height="200" /></a>
<p style="font-size: 0.8em" class="zemanta-img-attribution">Image via <a href="http://commons.wikipedia.org/wiki/File:Facebook_and_Firefox.jpg">Wikipedia</a></p>
</p></div>
<p>With the rapid advancement in the Internet and its increasing user presence, the medium has become a preferred means of communicating directly with customers. Among the most popular activities on the Internet is the voracious usage of social networking sites. </p>
<p>With its open architecture and wide range of functionalities, Facebook stands as the number one social networking site. There are many reasons for this cult followership of Facebook. The ease of use and dissemination of content, tagging of friends and related users on shared items is yet another great Facebook feature. Facebook also allows creation of secured groups and publicly available fan pages regarding your own brands. </p>
<p>The Facebook applications are its most popular components. Facebook has an open platform for web developers and programmers to create different applications to run applications from within its framework. </p>
<h3>What is new about Facebook applications? </h3>
<p>Until the option of applications was incorporated, the Facebook features were more about conventional social media usage, such as adding friends and creating groups pertaining to common interests and affiliations. </p>
<p> <span id="more-1374"></span>
<p>Applications initiated by Facebook expanded the function of the site toward more interesting features, which included social gaming, where you could include friends and even unknown participants from around the world. The big leap happened when Facebook opened its programming platform to developers around the world, who could develop applications and submit it to Facebook. These applications are made live for public usage once they are certified by Facebook. </p>
<h3>How do applications help brand marketing? </h3>
<p>On an average, a user would spend no more than a few seconds on the homepage or any other text rich section of a website. Similarly, on Facebook, text-based sections have their own limitations when it comes to holding attention of the users on the same page. That is where rich content and applications come into play. </p>
<p>A game, such as Scrabulous or UNO, on Facebook can engage a user for hours. Social games like Farmville have brought about a new genre of Social Gaming, which is the latest buzzword in gaming circles. </p>
<p>For a brand, a Facebook application can serve as an effective tool to gather and engage captive audience for a longer stretch of time. Users hooked on a particular game or application on Facebook will stay with it until the completion of the game. Brands have smartly used the opportunity to insert their logos and branding very subtly in the game. Subtle messages like these are known to give more brand recall and attitude change compared to intrusive advertisements. </p>
<p>Much to the delight of a marketer, Facebook provides usage stats of subscribers, which gives insight into the profile of users that the brand attracts. This can be compared with the intended target audience of the brand, and campaign modifications can be done based on the findings. Unlike most surveys that are based on sample estimate, what you get to see here is a summary based on each and every user who has added the application. </p>
<h3>Developing Applications for Your Brand</h3>
<p>Unlike most other participative aspects of social media, developing applications for Facebook requires adequate programming knowledge. Facebook has its own set of guidelines for the creation and submission of applications. Developers working on the Facebook framework must be updated with the guidelines defined by the site for any application to run. Brand owners need to avail services of a developer who knows all the steps that go into the creation of successful Facebook applications to ensure that their brand makes its presence through one of the most engaging options available in online media. </p>
<p>Get more information here for the best Facebook training available: <a title="http://bit.ly/fb-traffic-dijexi" href="http://bit.ly/fb-traffic-dijexi">http://bit.ly/fb-traffic-dijexi</a></p>
<div style="margin-top: 10px; height: 15px" class="zemanta-pixie"><img style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=a4e19b39-ec34-4208-9743-2a8e451567e8" /></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/11/face-your-customers-with-facebook/" rel="bookmark">Face Your Customers with Facebook</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/" rel="bookmark">Facebook and Social Media - The Next Marketing Opportunity</a></li><li><a href="http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/" rel="bookmark">Official Presence on Facebook &ndash; Opportunities and Pitfalls</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/" rel="bookmark">Facebook and Consumer Learning Process</a></li><li><a href="http://www.dijexi.com/2009/07/best-wordpress-plugin-for-facebook/" rel="bookmark">Best WordPress Plugin for Facebook</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F11%2Fengaging-customers-with-facebook-applications%2F&amp;linkname=Engaging%20Customers%20with%20Facebook%20Applications"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Official Presence on Facebook &#8211; Opportunities and Pitfalls</title>
		<link>http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/</link>
		<comments>http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 07:36:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Internet Marketing]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/</guid>
		<description><![CDATA[Image by Getty Images via @daylife The Internet, as a medium, has opened the doors to a wide range of communication possibilities with customers. The interactive characteristic of the medium also makes it possible for a customer to publish his response to a vast audience. Social networking sites, particularly Facebook, which is getting increasingly popular [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 1em; width: 160px; display: block; float: left" class="zemanta-img"><a href="http://www.daylife.com/image/00SFeXk4OT1Vn?utm_source=zemanta&amp;utm_medium=p&amp;utm_content=00SFeXk4OT1Vn&amp;utm_campaign=z1"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" alt="SAN FRANCISCO - NOVEMBER 15:  Facebook founder..." src="http://cache.daylife.com/imageserve/00SFeXk4OT1Vn/150x104.jpg" width="150" height="104" /></a>
<p style="font-size: 0.8em" class="zemanta-img-attribution">Image by <a href="http://www.daylife.com/source/Getty_Images">Getty Images</a> via <a href="http://www.daylife.com/">@daylife</a></p>
</p></div>
<p>The Internet, as a medium, has opened the doors to a wide range of communication possibilities with customers. The interactive characteristic of the medium also makes it possible for a customer to publish his response to a vast audience. Social networking sites, particularly Facebook, which is getting increasingly popular around the world, have given customers an equal opportunity to communicate as loudly as you about your brand, in a public forum open to the whole world. </p>
<p>On the brighter side, there is a great opportunity to acquire direct and unadulterated feedback from customers, without the need of expensive and time-consuming surveys and research processes. Directly redressing customer queries on the medium itself can help increase brand loyalty.&#160; However, as a brand owner, you need to realize the speed and potential of the medium to do good as well as harm.&#160; </p>
<p> <span id="more-1373"></span><br />
<h3>Facebook Opportunity for Your Brand </h3>
<p>There are enough reasons for a brand to be on one of the most happening mediums. A significant amount of conversation that happens on Facebook, or for that matter on other social platforms like Twitter, carries references to brands, with customer&#8217;s attitude toward these clearly seen through them. </p>
<p>The fact is that whether you are there on Facebook, it is very likely that someone or the other from your customer base may be making a mention about you. Your brand presence during such a situation is important to either thank the customer for any accolades or gracefully respond and address any grievances posted by the customers and win back their confidence in your brand. </p>
<p>On a proactive note, sustained brand presence on Facebook also helps you create your own band of customers, including those interested in you. This gives you one point access to disburse any firsthand brand information in a single click, without spending a dime more. </p>
<p>Today, brands – both big and small – have a presence on Facebook. Some of them use it with more innovation than the rest. </p>
<h3>Brand Pitfalls on Facebook </h3>
<p>Traditional marketers are used to broadcast, which is an extremely formal means of communication, where customers voices are barely heard back. Coming from this background, many a time, marketers find it difficult to adjust and converse in the language demanded by social networking sites, which are much informal in nature. </p>
<p>There have been instances where brand owners trying to enforce rules and guidelines of discussion on Facebook fan pages have faced the immediate wrath of users, which had an adverse impact on the brand. </p>
<p>The lesson from this is very clear, the brand must try to avoid any pitfalls on Facebook; marketers must know the responsiveness and energy levels of the users and be one among them, rather than one above. </p>
<h3>Word of Caution – World of opportunity in Facebook </h3>
<p>For every scary story of a brand goof up on Facebook, there are many cases of success, where even small household brands have grown in popularity through effective use of the medium. </p>
<p>Two golden rules to be followed while using Facebook, which can yield good results in the long run, are as follows: </p>
<p>Do not be a big brother – be a cheerful friend to your customers. The big brother attitude, which worked fine in traditional media, can kill your brand on Facebook. Any showdown of brand arrogance or one-upmanship is given a bitter response by its customers in the same medium. For a brand to succeed, it has to be a friend, who is fun to speak with.   <br />Do not advertise, converse – Blatant advertising, or use of social networks for incessant spamming with interruptive advertising, is a sure recipe for disaster. You will find your brand page getting isolated on Facebook. </p>
<p>There are many ethics to be followed on Facebook and social media, which can be easily grasped through active participation in the medium itself. A company must ensure that its trained representatives have marked presence on Facebook and social networking avenues as true online custodians for the brand. For many companies, it also makes sense to engage an agency that is experienced in handling brand reputations on Facebook and online avenues. </p>
<p>Get more information here for the best Facebook training available:&#160; <a title="http://bit.ly/fb-traffic-dijexi" href="http://bit.ly/fb-traffic-dijexi">http://bit.ly/fb-traffic-dijexi</a></p>
<div style="margin-top: 10px; height: 15px" class="zemanta-pixie"><img style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=a4e19b39-ec34-4208-9743-2a8e451567e8" /></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/" rel="bookmark">Engaging Customers with Facebook Applications</a></li><li><a href="http://www.dijexi.com/2009/07/best-wordpress-plugin-for-facebook/" rel="bookmark">Best WordPress Plugin for Facebook</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/" rel="bookmark">Facebook and Social Media - The Next Marketing Opportunity</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/" rel="bookmark">Facebook and Consumer Learning Process</a></li><li><a href="http://www.dijexi.com/2010/11/face-your-customers-with-facebook/" rel="bookmark">Face Your Customers with Facebook</a></li></ul></div><p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7773800616131770";
/* horizontal */
google_ad_slot = "1931057994";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F11%2Fofficial-presence-on-facebook-opportunities-and-pitfalls%2F&amp;linkname=Official%20Presence%20on%20Facebook%20%26ndash%3B%20Opportunities%20and%20Pitfalls"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Autoblogging All About?</title>
		<link>http://www.dijexi.com/2010/11/what-is-autoblogging-all-about/</link>
		<comments>http://www.dijexi.com/2010/11/what-is-autoblogging-all-about/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 23:31:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Internet Marketing]]></category>
		<category><![CDATA[autoblogging]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/11/what-is-autoblogging-all-about/</guid>
		<description><![CDATA[Autoblogging is simply a methodology for automating blog content. Traditionally, when you set up a blog you then either create the content by hand yourself, or you hire a freelancer to create the content for you. Either way it is both time consuming or expensive. But with autoblogging and the Massive Passive Profits system, you [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 1em; width: 310px; display: block; float: left" class="zemanta-img"><a href="http://commons.wikipedia.org/wiki/File:Wordpress_default_theme.png"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" alt="A screenshot of the default WordPress theme." src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Wordpress_default_theme.png/300px-Wordpress_default_theme.png" width="300" height="276" /></a>
<p style="font-size: 0.8em" class="zemanta-img-attribution"></p></div>
<p>Autoblogging is simply a methodology for automating blog content. Traditionally, when you set up a blog you then either create the content by hand yourself, or you hire a freelancer to create the content for you. Either way it is both time consuming or expensive. But with autoblogging and the Massive Passive Profits system, you simply set up the blog once, set up the automated content stream and the blog updates itself on auto-pilot generating passive income for you while you focus on doing other things. </p>
<p>But isn’t autoblogging a &#8216;black hat&#8217; technique that will get your site banned? I can hear you asking that question and I will tell you that if you set up your blogs properly following a proven method such as Massive Passive Profits your sites will not get banned and you will finally start generating some real passive income from blogging. </p>
<p> <span id="more-1375"></span>
</p>
<p>What is Massive Passive Profits? It’s a mass deploy autoblogging format that automates the creation of WordPress multiuser sites and content. No longer do you have to sweat about your sites getting banned, and WordPress multi-user platform saves time and effort of logging in and out of and maintaining multiple blogs. With this elegant solution, autoblogging becomes a complete no-brainer and you are free to point and click to create and launch new blogs on the fly and watch you bank account grow as you add new blogs. </p>
<p>With autoblogging your blogs will generate income in much the same way as a traditional, hand written blog, but because they are so quick to set up, and effortless to maintain you can focus on generating a large quantity of blogs and on generating traffic to those blogs. </p>
<p>You would begin by doing your keyword research to find profitable niches, install WordPress, add then follow along with Massive Passive Profits to set up your niche blogging empire. </p>
<p>Now bear in mind that these are not going to be pretty, award-winning blogs that you’ll be inviting your family members to visit. What you will be doing, is gathering up and providing useful content around your chosen topic to your blog visitors that are searching for information on your topic. You’ll choose ads and CPA offers that will appeal to those visitors and eventually these blogs will start generating cash for you automatically. </p>
<p>Setting up an autoblogging empire does not take a lot of time or effort, and once everything is set up and humming along you can move on to other projects while your little blog farm continues to produce month in and month out. </p>
<p>So, if you are willing to invest just a little bit of time to set up the Massive Passive Profits system you will soon see lifestyle-altering income streams flowing in from you ever growing autoblogging empire. </p>
<p>Ready to get the details about Massive Passive Profits? Check out <a href="http://akhdaniel.massivpa.hop.clickbank.net/">http://akhdaniel.massivpa.hop.clickbank.net</a>&#160; to get all of the details and sign up before the doors close and you lose out on a sweet opportunity to generate passive income from niche blogs that you can set up in a flash. </p>
<div style="margin-top: 10px; height: 15px" class="zemanta-pixie"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" class="zemanta-pixie-img" alt="Enhanced by Zemanta" src="http://img.zemanta.com/zemified_e.png?x-id=1bed3cca-f914-426b-a3ab-62d4bb82acf7" /></a></div>
<div id="crp_related"> </div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F11%2Fwhat-is-autoblogging-all-about%2F&amp;linkname=What%20is%20Autoblogging%20All%20About%3F"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/11/what-is-autoblogging-all-about/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Face Your Customers with Facebook</title>
		<link>http://www.dijexi.com/2010/11/face-your-customers-with-facebook/</link>
		<comments>http://www.dijexi.com/2010/11/face-your-customers-with-facebook/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 07:32:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Internet Marketing]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/11/face-your-customers-with-facebook/</guid>
		<description><![CDATA[Image by Getty Images via @daylife Communicating effectively with customers and delivering the right message to the right people has been one of the major challenges for any marketer since day one. Since early days of marketing, various forms of communication medium have been evolving with developments in technology as well as its consumers. For [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 1em; width: 160px; display: block; float: left" class="zemanta-img"><a href="http://www.daylife.com/image/0g9j9Wh7jH3oa?utm_source=zemanta&amp;utm_medium=p&amp;utm_content=0g9j9Wh7jH3oa&amp;utm_campaign=z1"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" alt="SAN FRANCISCO - NOVEMBER 15:  Facebook founder..." src="http://cache.daylife.com/imageserve/0g9j9Wh7jH3oa/150x100.jpg" width="150" height="100" /></a>
<p style="font-size: 0.8em" class="zemanta-img-attribution">Image by <a href="http://www.daylife.com/source/Getty_Images">Getty Images</a> via <a href="http://www.daylife.com/">@daylife</a></p>
</p></div>
<p>Communicating effectively with customers and delivering the right message to the right people has been one of the major challenges for any marketer since day one. Since early days of marketing, various forms of communication medium have been evolving with developments in technology as well as its consumers. </p>
<p>For a long time in the history of marketing communication, media remained the stronghold of newsmakers and advertisers and communication was mostly one way from the marketer to the reader. However, the trend of this inequality of voice was broken with the advent of the Internet and further developments within that medium itself. </p>
<h3>Internet and Quantum Change in Media </h3>
<p>The Internet brought about a sea change in the science and practice of mass communication and hence the process of marketing itself. But much before common users could take control of the content on the World Wide Web, the way we see it today, there was a time when content creation was the forte of those well-versed in HTML programming and web scripting languages. However, with the advent of services, such as blogs and social networking sites, the power of mass communication moved to the common user on the Internet. </p>
<p> <span id="more-1372"></span><br />
<h3>Facebook – Front-Runner in Social Media Phenomenon </h3>
<p>With 500 million users worldwide, and the numbers growing steeply, Facebook is emerging as one of the strongest mediums, with users getting totally involved in creating more and more content on the website. At any given point in time, millions of conversations take place, with precious customer-related information seeping through each of these, in the most natural way. </p>
<h3>Customer Insight… Really </h3>
<p>Even before the first television spot or a newspaper advertisement goes live, any company serious about its brand spends a great deal of effort and money on gathering information and insight into what their customers really want and how they seek to accomplish those needs. A lot of money is spent on brand research that delves into the awareness levels of the brand vis-a-vis competition. </p>
<p>This information can be readily accessed freely floating on a social networking platform, such as Facebook. All the answers that a brand may want to seek are hidden in the conversations happening through wall comments, photographs, tags, fan pages, and many such avenues through the same platform of Facebook. </p>
<p>All of this information is first hand, with honest responses. </p>
<h3>Coming Face to Face With Customers </h3>
<p>Users on Facebook form fan pages and groups pertaining to their interests and form conversations around topics and brands of their interests. Here are some tips with how a new age brand manager can keep a tab and also build his brand on Facebook. </p>
<p>Do a Brand search on Facebook – Conducting a search on Facebook with the terms related to your brand or that of your competition throws up results that include customers associating with the brand and various discussions, fan pages, where the brand features. Going through these conversations can reveal the opinion of the customers about your brand. </p>
<p>Creating a Fan page: If you are confident that your brand has the capability of attracting positive response and drawing fans, it is time you create a fan page for your brand and watch users “liking” the page and enroll for the same. The fan page can serve as an excellent platform to directly engage with customers and create a strong bond. </p>
<p>Create branded applications: Applications can range from entertaining games with your brand to useful tools related to your product. </p>
<p>The possibilities provided by Facebook to reach out to customers are endless, and all of this can be done at minimal cost with maximum impact. But while doing all of this as a marketer, you need to remember that the customer and you are on a level playing field, with both having equal opportunity to express. The customer is free to share his positive as well as negative experiences with your brand, which can influence other customers watching your brand carefully. </p>
<p>This is where you need dedicated efforts of professionals who understand the dynamics of the medium, which is very different from what conventional media marketers are generally used to. Facebook can hence help you come face to face with your customers. It becomes extremely important for you to know how this medium and conversations should be managed. </p>
<p>Get more information here for the best Facebook training available: <a title="http://bit.ly/fb-traffic-dijexi" href="http://bit.ly/fb-traffic-dijexi">http://bit.ly/fb-traffic-dijexi</a></p>
<div style="margin-top: 10px; height: 15px" class="zemanta-pixie"><img style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=a4e19b39-ec34-4208-9743-2a8e451567e8" /></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/" rel="bookmark">Official Presence on Facebook &ndash; Opportunities and Pitfalls</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/" rel="bookmark">Facebook and Social Media - The Next Marketing Opportunity</a></li><li><a href="http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/" rel="bookmark">Engaging Customers with Facebook Applications</a></li><li><a href="http://www.dijexi.com/2009/07/best-wordpress-plugin-for-facebook/" rel="bookmark">Best WordPress Plugin for Facebook</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/" rel="bookmark">Facebook and Consumer Learning Process</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F11%2Fface-your-customers-with-facebook%2F&amp;linkname=Face%20Your%20Customers%20with%20Facebook"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/11/face-your-customers-with-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook and Consumer Learning Process</title>
		<link>http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/</link>
		<comments>http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 07:20:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Internet Marketing]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/</guid>
		<description><![CDATA[Image via CrunchBase &#160; A great deal of successful marketing today depends on closely understanding consumer behavior. As a marketer, you may always be curious to understand what excites or motivates your customers into buying either your products or those of your competitor.&#160; Depending on the buying and consumption cycle of your product, there can [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 1em; width: 260px; display: block; float: left" class="zemanta-img"><a href="http://bit.ly/fb-traffic-dijexi" target="_blank"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" alt="Image representing Facebook as depicted in Cru..." src="http://www.crunchbase.com/assets/images/resized/0004/2816/42816v1-max-250x250.png" width="250" height="114" /></a>
<p style="font-size: 0.8em" class="zemanta-img-attribution">Image via <a href="http://www.crunchbase.com/">CrunchBase</a></p>
</p></div>
<p>&#160;</p>
<p>A great deal of successful marketing today depends on closely understanding consumer behavior. As a marketer, you may always be curious to understand what excites or motivates your customers into buying either your products or those of your competitor.&#160; Depending on the buying and consumption cycle of your product, there can be several factors that will determine the sales conversion ratio for your product. </p>
<h3>Toward Right Learning </h3>
<p>A successful sale happens when your customer understands his need and is convinced that your product can satisfy that need in a reliable way.&#160; Both these steps happen through a process, which is known as learning. Hence as a marketer, your job begins by ensuring that the customer perceives his need and, more importantly, finds the solution in your product </p>
<h3>Right Learning and Right Conversations </h3>
<p>At this very moment, you may be reading this article on your laptop or desktop. Remember the day when you had decided to buy your first computer. You must have considered many factors before finalizing which computer to purchase.&#160; One of the important decision points for a buyer is his circle of reference. It is natural for you, as a buyer, to discuss with your informed friends about the best brand. Positive references from friends and acquaintances help one make a decision. </p>
<p> <span id="more-1371"></span>
</p>
<h3>How has Facebook changed all of this? </h3>
<p>Research has shown that buyers do a great deal of product research on the Internet and most of the time choose to purchase the product either online or offline. The power of the Internet as a research and information resource has been realized to a great extent by customers worldwide. </p>
<p>The basics of consumer behavior, learning, reference groups, and buying decisions have remained exactly the same. But what has changed significantly is the speed with which everything happens. Technology has brought down the barriers in global communication. Social networking sites, and more importantly the rising popularity of Facebook, bears a strong testimony to the growing power of the Internet as a mode of communication and a source of information. </p>
<h3>Before and After Facebook </h3>
<p>Like we discussed, most of the learning before the proliferation of Facebook and social media happened through advertisements on television.&#160; During the days of conventional media dominance, marketing was driven by the power to broadcast. Marketing communication was primarily unidirectional through blaring advertisements and press releases. </p>
<p>Word of mouth happened on a one-on-one basis, where the conversation would begin and end around a small group of people. </p>
<p>Today, a search on your favorite brand on Facebook may reveal many conversations about the brand, which may depict user’s positive or negative experiences with the brand. Unlike the clandestine brand gossip of earlier days, the Facebook era ensures that conversations are documented and made easily available through social networking sites. </p>
<p>Brands trying to ignore this new medium find themselves in a state similar to an ostrich, with its head buried in sand, thinking the world cannot see it. The real image of the brand in people’s minds shows up aloud these days through conversations on Facebook. </p>
<h3>Facebook and Online Reputation </h3>
<p>The power of Facebook, as discussed, has extended the scope of Word of Mouth beyond the good old conversation between friends. Today, each and every Facebook user is free to publish his views on your brand. The true effect of this happens whenever these conversations appear in searches and influence people’s opinion about the brand image. </p>
<p>This is where online reputation, primarily on a widely accepted medium like Facebook, matters. </p>
<h3>In a nutshell..</h3>
<p>Managing a positive image of your brand requires you to expand your reach, more than what you would do in case of conventional media. The conversational nature of social networking sites, such as Facebook, demands a different approach. Unlike one-time broadcast by the conventional medium, Facebook stores each and every conversation and makes it available through the search option for anyone who is curious to know more about your brand. </p>
<p>That is the reason why it is a critical part of any brand plan to feature positively on social networking sites, such as Facebook. Engaging consultants who have experience in managing brands through the new era of social networks is a growing practice that can help brands manage the new wave. </p>
<p>Get more information here for the best Facebook training available: <a title="http://bit.ly/fb-traffic-dijexi" href="http://bit.ly/fb-traffic-dijexi">http://bit.ly/fb-traffic-dijexi</a></p>
<div style="margin-top: 10px; height: 15px" class="zemanta-pixie"><img style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=a4e19b39-ec34-4208-9743-2a8e451567e8" /></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/07/best-wordpress-plugin-for-facebook/" rel="bookmark">Best WordPress Plugin for Facebook</a></li><li><a href="http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/" rel="bookmark">Engaging Customers with Facebook Applications</a></li><li><a href="http://www.dijexi.com/2010/11/face-your-customers-with-facebook/" rel="bookmark">Face Your Customers with Facebook</a></li><li><a href="http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/" rel="bookmark">Official Presence on Facebook &ndash; Opportunities and Pitfalls</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/" rel="bookmark">Facebook and Social Media - The Next Marketing Opportunity</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F11%2Ffacebook-and-consumer-learning-process%2F&amp;linkname=Facebook%20and%20Consumer%20Learning%20Process"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook and Social Media &#8211; The Next Marketing Opportunity</title>
		<link>http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/</link>
		<comments>http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 07:20:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Internet Marketing]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/</guid>
		<description><![CDATA[&#160; Marketing as an activity is all about reaching the right customers with the right products, and the result sought is delighted customers who are more than willing to open their purses wide enough to boost your revenues. For many years, marketers stalked their target customers through various means and by trying to get their [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/11/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="Funny Facebook Captcha :) " border="0" alt="Funny Facebook Captcha :) " align="right" src="http://www.dijexi.com/wp-content/uploads/2010/11/image_thumb.png" width="244" height="138" /></a> Marketing as an activity is all about reaching the right customers with the right products, and the result sought is delighted customers who are more than willing to open their purses wide enough to boost your revenues. For many years, marketers stalked their target customers through various means and by trying to get their message across to spread awareness about their wares. </p>
<h3>Traditional Means of Communication </h3>
<p>Traditionally, marketing communications were conducted via print, broadcast and such traditional media through disruptive advertising, where advertisements appear in between the content of interest for the customer. </p>
<p>Traditional media does give a large reach to a marketer with its programming of mass appeal. However, the wastage is equally high, since a large portion of the audience would belong to a different segment than the one that is to be targeted by the marketer. </p>
<p> <span id="more-1370"></span><br />
<h3>Enter Social Media and the Internet </h3>
<p>The revolution stirred by the internet as a medium took place because of the fact that it is highly personalized and provides more content on-demand than any other available medium. Social sites proliferated far and wide in their usage for a few simple reasons: </p>
<p>The power to create and distribute content is equally available to every user, irrespective of him/her being a customer or a marketer. In the earlier forms of media, that power rested with the editorial staff of the channel or the advertiser, but hardly ever with the user.   <br />The medium is completely personalized, and a user can create or join groups and further create content based on what he/she likes.    <br />Opinions are free and fair. This is one reason why social media is of utmost concern to marketers, since buying decisions are no more influenced as much by advertisements. The traditional word-of-mouth marketing approach has grown leaps and bounds on social networks. </p>
<h3>Facebook – At the Center of Social Media </h3>
<p>With 500 million (and growing) unique users worldwide, Facebook is the number one social networking site in terms of activity and subscriptions. What started as a garage initiative by Mark Zuckerberg has now become the biggest phenomenon on the internet. </p>
<p>A user interface that allows for quick communication and the ability to create fan pages and groups at the click of a mouse button are what make Facebook extremely popular. Another important reason for its immense popularity is the wide variety of social applications that have been developed and made available within the Facebook environment. </p>
<p>These applications can allow users and friends to do joint activities like playing games that run endlessly, sharing photos, videos, and web links, and many more. </p>
<h3>How does this help a marketer? </h3>
<p>Traditionally, media plans were drawn to include television channels, publications, or any other media that can grab maximum eyeballs and effectively reach a selected target audience. The science of segmentation and targeting has become only more accurate in the case of social media. </p>
<p>Facebook provides a wide variety of avenues to communicate with the audience, which opens up an entirely different world of possibilities to have a fruitful dialogue with customers. Some of these methods used popularly by marketers are: </p>
<p>Advertising: The first opportunity, which is the most obvious one, is advertising on Facebook. The difference, however, is the fact that you can create your own advertisement in a matter of minutes and also specify the details of your target group in terms of demographics and types of discussions where you want your advertisement to appear.    <br />Fan Pages: Facebook allows every brand, as well as individual users, to create fan pages for their favorite celebrities and their own homegrown businesses. Large brands have also created their official pages on Facebook that have a huge, immediate fan following around the world. The fan page has immense utility to convey first hand information about the brand and also to collect immediate and frank feedback from your customers.    <br />Branded applications: One of the most effective ways to engage a user toward your brand is by creating an application; this could be a game or a contest, with your branding coming across subtly through it. </p>
<p>What makes Facebook even more exciting is the way it allows you to target your communication sharply just to the customer segment you want to attract. It also provides analytics and page insights that give good feedback and measurement on the activity done. </p>
<p>The options provided by Facebook can be creatively explored and used judiciously for bringing about maximum benefits to any brand. </p>
<p>However, while doing all this, you need to be aware of the fact that customers have an equal say and have the ability to respond immediately to any of your actions with a thumbs up or a thumbs down. Availing the service of a social media consultant to work out a social media strategy may be required so that your efforts will not be in vain. </p>
<p>Get more information here for the best Facebook training available: <a title="http://bit.ly/fb-traffic-dijexi" href="http://bit.ly/fb-traffic-dijexi">http://bit.ly/fb-traffic-dijexi</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/" rel="bookmark">Engaging Customers with Facebook Applications</a></li><li><a href="http://www.dijexi.com/2010/11/official-presence-on-facebook-opportunities-and-pitfalls/" rel="bookmark">Official Presence on Facebook &ndash; Opportunities and Pitfalls</a></li><li><a href="http://www.dijexi.com/2010/11/face-your-customers-with-facebook/" rel="bookmark">Face Your Customers with Facebook</a></li><li><a href="http://www.dijexi.com/2010/11/facebook-and-consumer-learning-process/" rel="bookmark">Facebook and Consumer Learning Process</a></li><li><a href="http://www.dijexi.com/2009/07/best-wordpress-plugin-for-facebook/" rel="bookmark">Best WordPress Plugin for Facebook</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F11%2Ffacebook-and-social-media-the-next-marketing-opportunity%2F&amp;linkname=Facebook%20and%20Social%20Media%20%26%238211%3B%20The%20Next%20Marketing%20Opportunity"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/11/facebook-and-social-media-the-next-marketing-opportunity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing Web Based POS Application Using Ruby on Rails on Debian 5</title>
		<link>http://www.dijexi.com/2010/09/developing-web-based-pos-application-using-ruby-on-rails-on-debian-5/</link>
		<comments>http://www.dijexi.com/2010/09/developing-web-based-pos-application-using-ruby-on-rails-on-debian-5/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 03:01:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Debian 5]]></category>
		<category><![CDATA[Developing]]></category>
		<category><![CDATA[point of sales]]></category>
		<category><![CDATA[Web Applications]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/09/developing-web-based-pos-application-using-ruby-on-rails-on-debian-5/</guid>
		<description><![CDATA[In this article we will learn how to begin developing web applications using Ruby on Rails. First we setup the development environment, then develop a simple CRUD (create, read, update, delete) application using MySQL database, and deploy the application to Apache web server. An an example, we will develop a very simple point of sales [...]]]></description>
			<content:encoded><![CDATA[</p>
<p>In this article we will learn how to begin developing web applications using Ruby on Rails. First we setup the development environment, then develop a simple CRUD (create, read, update, delete) application using MySQL database, and deploy the application to Apache web server. An an example, we will develop a very simple point of sales (POS) application that consists only 3 tables: orders, order_details, and items.</p>
<p>&#160;</p>
<h2>Ruby on Rails Installation</h2>
<p>Install Ruby if it’s not installed yet on your system:</p>
<blockquote><p><font face="Courier"># apt-get install&#160; ruby1.8 ruby1.8-dev</font></p>
<p>&#160;</p>
</blockquote>
<p>Install Ruby Gem package management directly from Rubyforge since we need the newer version than version 1.3.1 that is shipped with Debian 5:</p>
<p> <span id="more-1366"></span><br />
<blockquote>
<p><font face="Courier"># wget </font><a title="http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz" href="http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz"><font face="Courier">http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz</font></a></p>
<p><font face="Courier"># tar xfz rubygems-1.3.7.tgz</font></p>
<p><font face="Courier"># cd rubygems-1.3.7.tgz</font></p>
<p><font face="Courier"># ruby setup.rb</font></p>
<p><font face="Courier"># ln -s /usr/bin/gem1.8 /usr/bin/gem</font> </p>
<p>&#160;</p>
</blockquote>
<p>Install Ruby on rails version 2.3.8 using gem command:</p>
<blockquote><p><font face="Courier"># gem install -v=2.3.8 rails</font></p>
<p>&#160;</p>
</blockquote>
<p>&#160;</p>
<h2>Start Developing the Application</h2>
<p>We are going to put our application on /opt/rubyapp or whatever directory you like. </p>
<blockquote><p><font face="Courier"># cd /opt</font></p>
<p><font face="Courier"># mkdir rubyapp</font></p>
<p>&#160;</p>
</blockquote>
<p>On that directory, run rails command to create a new application skeleton. We are going to create a simple POS application and we call it simplepos.</p>
<blockquote><p><font face="Courier"># rails simplepos</font></p>
<p>&#160;</p>
</blockquote>
<p>Rails will create the application skeleton on the directory name we specified. Go to that directory and run the server.</p>
<blockquote><p><font face="Courier"># cd simplepos</font></p>
<p><font face="Courier"># ruby script/server</font></p>
<p>&#160;</p>
</blockquote>
<p>Ruby on Rails server will start and we can access it from <a href="http://yourserver-ip:3000">http://yourserver-ip:3000</a>, like the following:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb.png" width="504" height="337" /></a> </p>
<p>&#160;</p>
<p><em>Note: I once found a conflicting port 3000 on Debian 5, which was used by Dr WEB application. Simply stop that service or change the port in order that Rails application to start correctly.</em></p>
<p>You can see that the default database driver is SQL lite. We need to change this to MySQL. Edit the config/database.yml:</p>
<blockquote><p><font face="Courier New">development:        <br />&#160; adapter: mysql         <br />&#160; database: simplepos_development         <br />&#160; user: root         <br />&#160; password: 1234         <br />&#160; pool: 5         <br />&#160; timeout: 5000 </font></p>
<p><font face="Courier New"># Warning: The database defined as &quot;test&quot; will be erased and        <br /># re-generated from your development database when you run &quot;rake&quot;.         <br /># Do not set this db to the same as development or production.         <br />test:         <br />&#160; adapter: mysql         <br />&#160; database: simplepos_test         <br />&#160; user: root         <br />&#160; password: 1234         <br />&#160; pool: 5         <br />&#160; timeout: 5000 </font></p>
<p><font face="Courier New">production:        <br />&#160; adapter: mysql         <br />&#160; database: simplepos_production         <br />&#160; user: root         <br />&#160; password: 1234         <br />&#160; pool: 5         <br />&#160; timeout: 5000</font></p>
<p><font face="Courier New"></font></p>
</blockquote>
<p>Adjust the user name and password according to your system. Then run this command to create all the databases defined on the config file:</p>
<blockquote><p><font size="2" face="Courier New"># rake db:create:all</font></p>
<p>&#160;</p>
</blockquote>
<p>&#160;</p>
<p>Run the server again (ruby script/server) and make sure that our database is now MySQL:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb1.png" width="504" height="333" /></a> </p>
<p>&#160;</p>
<h2>The Application Design</h2>
<p>Our application is quite simple. It contains only 3 tables</p>
<ul>
<li><strong>orders</strong> for storing sales transactions with the following fields:</li>
<ul>
<li>number</li>
<li>order_date</li>
</ul>
<li><strong>items</strong> for storing items to be sold the following fields:</li>
<ul>
<li>number</li>
<li>name</li>
<li>description</li>
<li>unit_price</li>
</ul>
<li><strong>order_details</strong> for storing order details with the following fields:</li>
<ul>
<li>order_id</li>
<li>item_id</li>
<li>qty</li>
<li>unit_price</li>
<li>amount</li>
</ul>
</ul>
<p>Here is the relation of the 3 tables:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb2.png" width="520" height="222" /></a> </p>
<p>&#160;</p>
<h2>Creating Model , Controller, and View using Scaffold for Orders Data</h2>
<p>Let’s move on to coding. Rails provides us a very powerful scaffolding script that allows us to easily create the model, view, and controller, and even the tables related to the model.</p>
<p>First, create the Order model. Here we follow the Rails convention: model use singular word.</p>
<blockquote><p><font face="Courier New"># ruby script/generate scaffold Order number:integer order_date:date</font></p>
<p><font face="Courier New"></font></p>
</blockquote>
<p>Rails will create our Order model, view, and controller. Take a look on simplepos/app folder. Next create the database table according to the fields that we sepcified on the scaffold above:</p>
<blockquote><p><font face="Courier New"># rake db:migrate</font></p>
<p><font face="Courier New"></font></p>
</blockquote>
<p>Now, run the server again (ruby script/server) and test the CRUD functionality for the Order data by entering the URL address: <a href="http://yourserver-ip:3000/orders">http://yourserver-ip:3000/orders</a>. We can see the list orf orders on the index page, a new order creation link, along with edit, update, and delete link if there’s an order already.</p>
<p>Listing orders:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb3.png" width="450" height="417" /></a> </p>
<p>Adding new order:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb4.png" width="450" height="417" /></a> </p>
<p>Order created:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb5.png" width="450" height="417" /></a> </p>
<p>List the orders on the order list:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb6.png" width="450" height="417" /></a> </p>
<p>Editing the order:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb7.png" width="450" height="417" /></a> </p>
<p>Deleting the order:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb8.png" width="469" height="294" /></a> </p>
<p>What have we have is a complete CRUD application for Orders table created automatically by Rails scaffolding.</p>
<p>&#160;</p>
<h2>Creating Model , Controller, and View using Scaffold for Items Data</h2>
<p>Now create the model, controller, view, and table for items data, using the same steps as above.</p>
<blockquote><p><font face="Courier New"># ruby script/generate scaffold Item number:integer name:string description:text unit_price:decimal</font></p>
</blockquote>
<p>Then create the database table according to the fields that we specified on the scaffold above:</p>
<blockquote><p><font face="Courier New"># rake db:migrate</font></p>
<p><font face="Courier New"></font></p>
</blockquote>
<p>And try to run the items CRUD by pointing to URL <a href="http://yourserver-ip:3000/items">http://yourserver-ip:3000/items</a> . You should be able to list, create, edit, and delete the items data now. This is the example of creating new item form.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb9.png" width="446" height="670" /></a> </p>
<p>&#160;</p>
<h2>Validating Data</h2>
<p>If we need to validate data entered by the user, then we can easily edit the model and add validations to the fields. For example, we need to validate the existence of number and&#160; order_date fields on orders table. Also we need to validate whether total_amount field is a number or not. Edit the app/model/order.rb file and add the following bold lines:</p>
<blockquote><p><font face="Courier New">class Order &lt; ActiveRecord::Base       <br /></font><font face="Courier New"><strong>&#160;&#160; validates_presence_of :number, :order_date&#160; </strong>        <br />end</font></p>
</blockquote>
<p>Stop and start the server again, and let’s enter the wrong data according to the validation rule.</p>
<p>Entering a blank number, order_date.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb10.png" width="450" height="417" /></a> </p>
<p>Of course, we could also add the validation to Items data by editing the app/model/item.rb file, by adding the following bold lines:</p>
<blockquote><p><font face="Courier">class Item &lt; ActiveRecord::Base       <br />&#160;&#160; </font><font face="Courier"><strong>validates_presence_of :number, :name, :unit_price         <br />&#160;&#160; validates_numericality_of :unit_price</strong>        <br />end</font></p>
</blockquote>
<p>Try to create a blank number, name, unit_price on item data:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image11.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb11.png" width="466" height="440" /></a> </p>
<p>&#160;</p>
<h2>Creating Order Details MVC and Set the Relation</h2>
<p>Order details is the place where we stored the actual sales transaction. It will record the items purchased on a particular order number. So it has a relation to items table and orders table as well, both for a “belongs to” relationship. So the relations will be:</p>
<ul>
<li>orders has many order_details</li>
<li>items has many order_details</li>
<li>order_details belongs to orders and items</li>
</ul>
<ul>Let’s create the MVC for this order details using the same steps as before:</ul>
<ul>
<blockquote>
<p><font face="Courier New"># ruby script/generate scaffold OrderDetail order:references item:references qty:integer unit_price:decimal amount:decimal</font></p>
</blockquote>
<p>Note that we used references data type for order and item on OrderDetail model. This will make Rails to create a relationship between OrderDetail and Order and Item model (ie OrderDetails belongs to Order and Item). It will also create a reference column on the order_details table, which is order_id and items_id. </p>
<p>Then create the database table according to the fields that we specified on the scaffold above:</p>
<blockquote><p><font face="Courier New"># rake db:migrate</font></p>
<p><font face="Courier New"></font>&#160;</p>
</blockquote>
<p> And take a look at the generated order_details table:</ul>
<blockquote><p><font face="Courier New">mysql&gt; explain order_details;       <br />+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+        <br />| Field&#160;&#160;&#160;&#160;&#160; | Type&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Null | Key | Default | Extra&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+        <br />| id&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | int(11)&#160;&#160;&#160;&#160;&#160;&#160; | NO&#160;&#160; | PRI | NULL&#160;&#160;&#160; | auto_increment |        <br /><strong>| order_id&#160;&#160; | int(11)&#160;&#160;&#160;&#160;&#160;&#160; | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |         <br />| item_id&#160;&#160;&#160; | int(11)&#160;&#160;&#160;&#160;&#160;&#160; | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |</strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />| qty&#160;&#160;&#160;&#160;&#160;&#160;&#160; | int(11)&#160;&#160;&#160;&#160;&#160;&#160; | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />| unit_price | decimal(10,0) | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />| amount&#160;&#160;&#160;&#160; | decimal(10,0) | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />| created_at | datetime&#160;&#160;&#160;&#160;&#160; | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />| updated_at | datetime&#160;&#160;&#160;&#160;&#160; | YES&#160; |&#160;&#160;&#160;&#160; | NULL&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |        <br />+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+        <br />8 rows in set (0.00 sec)</font></p>
</blockquote>
<p>&#160;</p>
<p><em>Note: created_at and updated_at are auto generated columns when we create the scaffolding.</em></p>
<p>Let’s define this relations to the models. First edit the order model (app/model/order.rb) and add the following bold lines:</p>
<blockquote><p><font face="Courier">class Order &lt; ActiveRecord::Base       <br />&#160;&#160; validates_presence_of :number, :order_date        <br />&#160;&#160; </font><font face="Courier"><strong>has_many :order_details         <br /></strong>end</font></p>
</blockquote>
<p> And to the item model (app/model/item.rb)</p>
<blockquote><p><font face="Courier">class Item &lt; ActiveRecord::Base       <br />&#160;&#160; validates_presence_of :number, :name, :unit_price        <br />&#160;&#160; validates_numericality_of :unit_price        <br /></font><font face="Courier"><strong>&#160;&#160; has_many :order_details         <br /></strong>end</font></p>
</blockquote>
<p>Also check the order detail model (app/model/order_detail.rb) has the relationship already because we specify that order and items are references when do the scaffolding.</p>
<blockquote><p><font face="Courier">class OrderDetail &lt; ActiveRecord::Base       <br />&#160; belongs_to :order        <br />&#160; belongs_to :item        <br />end</font></p>
</blockquote>
<p>&#160;</p>
<h2>Edit routes.rb</h2>
<p>We also need to edit the config/routes.rb so that the URL for order and order details also have a relationship information that order has many order_details. Modify the file so it looks like the following:</p>
<blockquote><p><font face="Courier">ActionController::Routing::Routes.draw do |map|       <br />&#160; map.resources :items </font></p>
<p><strong><font face="Courier">&#160; map.resources :orders, :has_many =&gt; :order_details</font></strong></p>
<p><font face="Courier">&#8230;.</font></p>
</blockquote>
<p>It will enable us to access the order details data below the order URL like this: <a href="http://yourserver:3000/orders/1/order_detail">http://yourserver:3000/orders/1/order_detail</a></p>
<p>&#160;</p>
<h2>Adding Order Detail Form </h2>
<p>We need to add the detail form below the Order show page so that we can add item details for a particular Order.</p>
<p>Add these bold lines just below the Date field of the Order:</p>
<blockquote><p><font face="Courier">&#8230;</font></p>
<p><font size="1" face="Courier">&lt;p&gt;       <br />&#160; &lt;b&gt;Order date:&lt;/b&gt;        <br />&#160; &lt;%=h @order.order_date %&gt;        <br />&lt;/p&gt;</font></p>
<p><font face="Courier"><strong>&lt;h1&gt;Order details&lt;/h1&gt;         <br />&lt;table&gt;          <br />&lt;tr&gt;          <br />&#160;&#160; &lt;th&gt;Item&lt;/th&gt;          <br />&#160;&#160; &lt;th&gt;Qty&lt;/th&gt;          <br />&#160;&#160; &lt;th&gt;Unit Price&lt;/th&gt;          <br />&#160;&#160; &lt;th&gt;Amount&lt;/th&gt;          <br />&lt;/tr&gt;          <br /></strong></font></p>
<p><font face="Courier"><strong>&lt;%= render :partial =&gt; @order.order_details %&gt;</strong></font></p>
<p><font face="Courier"><strong>&lt;% form_for [@order, OrderDetail.new] do |f| %&gt;         <br />&lt;tr&gt;          <br />&#160;&#160; &lt;td&gt;&lt;%= f.label :item_id, &quot;item&quot; %&gt;&lt;/td&gt;          <br />&#160;&#160; &lt;td&gt;&lt;%= f.label :qty, &quot;Qty&quot; %&gt;&lt;/td&gt;          <br />&lt;/tr&gt;          <br />&lt;tr&gt;          <br />&#160;&#160; &lt;td&gt;&lt;%= f.select :item_id, @items.map {|u| [u.name,u.id %&gt;&lt;/td&gt;          <br />&#160;&#160; &lt;td&gt;&lt;%= f.text_field :qty %&gt;&lt;/td&gt;          <br />&lt;/tr&gt;          <br />&lt;tr&gt;          <br />&#160;&#160; &lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;%= f.submit &quot;add detail&quot; %&gt;&lt;/td&gt;          <br />&lt;/tr&gt;          <br />&lt;% end %&gt;          <br />&lt;/table&gt;</strong></font></p>
<p><font face="Courier">...</font></p>
</blockquote>
<p>&#160;</p>
<p>We need to create a new file under app/views/order_details, called app/views/order_details/_order_detail.html.erb. This file is required by the <em>:render=&gt;partial </em>line above and is a partial template file used to render each order detail lines for an Order.</p>
<p>&#160;</p>
<blockquote><p><font face="Courier">&lt;% div_for order_detail do %&gt;       <br />&lt;tr&gt;        <br />&#160;&#160; &lt;td&gt;&lt;%=h order_detail.item.name %&gt;&lt;/td&gt;        <br />&#160;&#160; &lt;td&gt;&lt;%=h order_detail.qty %&gt;&lt;/td&gt;        <br />&#160;&#160; &lt;td&gt;&lt;%=h order_detail.unit_price %&gt;&lt;/td&gt;        <br />&#160;&#160; &lt;td&gt;&lt;%=h order_detail.amount %&gt;&lt;/td&gt;        <br />&lt;/tr&gt;        <br />&lt;% end %&gt;</font></p>
</blockquote>
<p>&#160;</p>
<p>Then, we create a form for order details of an order ( form_for [@order, OrderDetail.new] do |f| ). After this, f variable will be related to order_details, but when submitted it will go to&#160; /orders/&lt;id&gt;/order_details.</p>
<p>On that form, we use select() helper function to render a selection box that is populated with all items data that we have where users can pick an item from. Using @items.map we create an array that is required by the select() as its option values.</p>
<p>Next, edit app/controller/orders_controller.rb file so that it provides us with @items object that we used on the select() above.</p>
<blockquote><p><font face="Courier">def show       <br />&#160; @order = Order.find(params[:id])        <br />&#160; <strong>@items = Item.find(:all) </strong></font></p>
<p><font face="Courier">&#160; respond_to do |format|       <br />&#160;&#160;&#160; format.html # show.html.erb        <br />&#160;&#160;&#160; format.xml&#160; { render :xml =&gt; @order }        <br />&#160; end        <br />end</font> </p>
</blockquote>
<p>&#160;</p>
<p>Modify app/controller/order_details_controller.rb so that it contains only one create method (delete all other methods generated by the scaffolding process). This is invoked when we create a new order_detail record.</p>
<p>&#160;</p>
<blockquote><p><font size="2" face="Courier">class OrderDetailsController &lt; ApplicationController       <br />&#160;&#160; def create        <br />&#160;&#160;&#160;&#160;&#160; @order = Order.find(params[:order_id])        <br />&#160;&#160;&#160;&#160;&#160; @order_detail = @order.order_details.create!(params[:order_detail])        <br />&#160;&#160;&#160;&#160;&#160; item = Item.find(params[:order_detail][:item_id])        <br />&#160;&#160;&#160;&#160;&#160; qty = params[:order_detail][:qty]        <br />&#160;&#160;&#160;&#160;&#160; @order_detail.update_attributes(:amount=&gt;item.unit_price.to_i * qty.to_i , :unit_price=&gt;item.unit_price)        <br />&#160;&#160;&#160;&#160;&#160; redirect_to @order        <br />&#160;&#160; end        <br />end</font></p>
</blockquote>
<p>&#160;</p>
<p>On this method, first we find the order identified by an ID (params[:order_id]) which is a parameter posted by the order detail form.</p>
<p>Found the Order, we create an OrderDetail record by calling @order.order_details.create!() method. This is possible because we have declared that an order can have many order_details.</p>
<p>Next we find the item that is being selected by the user, to find out its unit_price and calculate the order detail amount. Then we update the attributes of order_details using these values.</p>
<p>After all processes are done, we redirect back to the order URL (redirect_to @order).</p>
<p>&#160;</p>
<p>It’s time now to try our modified application, go to Order URL and click Show link. We will have a new look of the form:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image12.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb12.png" width="450" height="417" /></a> </p>
<p>Try to add items on the order and check the unit price and amount. </p>
<p>&#160;</p>
<h2>Calculating Order’s Total Amount </h2>
<p>It’s time to calculate the total amount of an order which is the sum of amounts of all order_details that it has.</p>
<p>This is easily calculated using the relation that we have set before (order has many order_details). After defining that relation, we will be able to call order.order_details.sum(colname) and get the total value of colname on the order_details table where order_id is the order that we are looking at.</p>
<p>So, we can edit add/model/order.rb to add a new method total_amount that will return the sum of column amount on the table that it has many (order_details):</p>
<blockquote><p><font face="Courier">class Order &lt; ActiveRecord::Base       <br />&#160;&#160; validates_presence_of :number, :order_date, :total_amount        <br />&#160;&#160; validates_numericality_of :total_amount        <br />&#160;&#160; has_many :order_details </font></p>
<p><font face="Courier"><strong>&#160;&#160; def total_amount         <br />&#160;&#160;&#160;&#160;&#160; self.order_details.sum(:amount)          <br />&#160;&#160; end          <br /></strong>end</font></p>
</blockquote>
<p>Now we can use that method from our views. Edit the app/views/orders/index.html.erb:</p>
<blockquote><p><font size="1" face="Courier">&lt;h1&gt;Listing orders&lt;/h1&gt; </font></p>
<p><font size="1" face="Courier">&lt;table&gt;       <br />&#160; &lt;tr&gt;        <br />&#160;&#160;&#160; &lt;th&gt;Number&lt;/th&gt;        <br />&#160;&#160;&#160; &lt;th&gt;Order date&lt;/th&gt;        <br /></font><font size="1"><font face="Courier"><strong>&#160;&#160;&#160; &lt;th&gt;Total amount&lt;/th&gt;           <br /></strong>&#160; &lt;/tr&gt; </font></font></p>
<p><font size="1" face="Courier">&lt;% @orders.each do |order| %&gt;       <br />&#160; &lt;tr&gt;        <br />&#160;&#160;&#160; &lt;td&gt;&lt;%=h order.number %&gt;&lt;/td&gt;        <br />&#160;&#160;&#160; &lt;td&gt;&lt;%=h order.order_date %&gt;&lt;/td&gt;        <br /></font><font size="1"><font face="Courier"><strong>&#160;&#160;&#160; &lt;td&gt;&lt;%=h order.total_amount %&gt;&lt;/td&gt;           <br /></strong>&#160;&#160;&#160; &lt;td&gt;&lt;%= link_to &#8216;Show&#8217;, order %&gt;&lt;/td&gt;          <br />&#160;&#160;&#160; &lt;td&gt;&lt;%= link_to &#8216;Edit&#8217;, edit_order_path(order) %&gt;&lt;/td&gt;          <br />&#160;&#160;&#160; &lt;td&gt;&lt;%= link_to &#8216;Destroy&#8217;, order, :confirm =&gt; &#8216;Are you sure?&#8217;, :method =&gt; :delete %&gt;&lt;/td&gt;          <br />&#160; &lt;/tr&gt;          <br />&lt;% end %&gt;          <br />&lt;/table&gt;</font></font></p>
</blockquote>
<p>Here is the look of the modified index pages:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image13.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb13.png" width="416" height="374" /></a> </p>
<p>And also the app/views/orders/show.html.erb:</p>
<blockquote><p><font size="1" face="Courier">&lt;p&gt;       <br />&#160; &lt;b&gt;Number:&lt;/b&gt;        <br />&#160; &lt;%=h @order.number %&gt;        <br />&lt;/p&gt; </font></p>
<p><font size="1" face="Courier">&lt;p&gt;       <br />&#160; &lt;b&gt;Order date:&lt;/b&gt;        <br />&#160; &lt;%=h @order.order_date %&gt;        <br />&lt;/p&gt; </font></p>
<p><font size="1" face="Courier"><strong>&lt;p&gt;         <br />&#160; &lt;b&gt;Total amount:&lt;/b&gt;          <br />&#160; &lt;%=h @order.total_amount %&gt;          <br />&lt;/p&gt;</strong></font></p>
<p><font size="1" face="Courier">. . . </font></p>
</blockquote>
<p>Here is the look of the modified show page:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image14.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb14.png" width="433" height="417" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<h2>Decorating and Layout</h2>
<p>&#160;</p>
<h4>Per model layout</h4>
<p>As part of the scaffolding process, Rails generates a layout template for each model that we created. It is located on app/views/layouts directory. For example, we change the layout of the Items data, which is the app/views/layouts/items.html.erb.</p>
<blockquote><p><font face="Courier">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;       <br />&#160;&#160;&#160;&#160;&#160;&#160; &quot;</font><a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;"><font face="Courier">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</font></a><font face="Courier">&gt; </font></p>
<p><font face="Courier">&lt;html xmlns=&quot;</font><a href="http://www.w3.org/1999/xhtml&quot;"><font face="Courier">http://www.w3.org/1999/xhtml&quot;</font></a><font face="Courier"> xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;       <br />&lt;head&gt;        <br />&#160; &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;        <br />&#160; &lt;title&gt;Items: &lt;%= controller.action_name %&gt;&lt;/title&gt;        <br />&#160; &lt;%= stylesheet_link_tag &#8216;scaffold&#8217; %&gt;        <br />&lt;/head&gt;        <br />&lt;body&gt; </font></p>
<p><font face="Courier">&lt;p style=&quot;color: green&quot;&gt;&lt;%= notice %&gt;&lt;/p&gt; </font></p>
<p><font face="Courier">&lt;%= yield %&gt; </font></p>
<p><font face="Courier">&lt;/body&gt;       <br />&lt;/html&gt;</font></p>
</blockquote>
<p>As you can see, it’s a regular HTML file with a special tag that comes from Rails, which are&#160;&#160;&#160; &lt;%= stylesheet_link_tag &#8216;scaffold&#8217; %&gt;&#160; and <font face="Courier">&lt;%= yield %&gt;. </font>The first tag is how Rails application link a CSS file, in this case scaffold.css. Rails automatically search this file on public/stylesheets directory on our application folder. </p>
<p>The next tag is &lt;%= yield %&gt;. This is a Rails variable that contains the data generated by the view. So everything that we write on the view files will be contained in this variable and rendered on this layout file.</p>
<p>Let’s modify the body background color for Items data only, so change the body tag to &lt;body style=&quot;background-color:#aaa&quot;&gt;. We should see the background color for Items listing, edit, create, and update page will be changed.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/09/image15.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/09/image_thumb15.png" width="434" height="401" /></a> </p>
<h4>Global application layout</h4>
<p>If you’d like to change the layout globally for each model pages, then you will need to create a new file called app/views/layouts/application.html.erb, and delete&#160; all other layout files generated by the scaffold. You can copy from another layout file exists as a template, then do the layout adjustments on that file and rename it to application.html.erb.</p>
<p>Having only application.html.erb will make Rails to use that file as the layout for the application. So you have to delete all other layout files, otherwise Rails will use that file instead.</p>
<h4>The CSS, image, and Javascript files location</h4>
<p>On your application directory, there’s a directory named public. This is where we store all public resources, like CSS, images, and Javascript files.</p>
<p>Rails provides us with some helper functions to generate the proper path for accessing these things, for example image_tag() to access images on public/images, stylesheet_link_tag() to access CSS files, and javascript_include_tag() to access Javascript files.</p>
<p>&#160;</p>
<h2>The Default Welcome Page</h2>
<p>When pointing our browser to <a href="http://yourserver-ip:3000/">http://yourserver-ip:3000/</a> we will get the Ruby on Rails welcome page by default. We can change this default behaviour by editing the config/routes.rb file. Look at the map.root :controller =&gt; &quot;welcome&quot; line, and uncomment that line.</p>
<blockquote><p><font face="Courier"></font></p>
<p><font face="Courier">&#8230;</font></p>
<p><font face="Courier">map.root :controller =&gt; &quot;welcome&quot;</font> </p>
<p>&#8230;</p>
<p>&#160;</p>
</blockquote>
<p>It means that our application’s default controller is called welcome, which is not exist right now.</p>
<p>Next step, we need to delete public/index.html file.</p>
<blockquote><p><font face="Courier"># rm public/index.html</font></p>
<p><font face="Courier"></font></p>
</blockquote>
<p>&#160;</p>
<p>Then, we need to create that controller, simply by&#160; running script/generate again but this time with controller parameter and not scaffold as we have used before.</p>
<blockquote><p><font face="Courier"># ruby script/generate controller welcome index</font></p>
<p><font face="Courier"></font></p>
</blockquote>
<p>The command tells Rails to create for us a controller named welcome with a method index. Beside that Rails will also create a view file on app/views/welcome/index.html.erb that we can customize right away.</p>
<p>Let’s modify app/views/welcome/index.html.erb&#160; so that it will show us a main menu for our application :</p>
<blockquote><p><font face="Courier">&lt;h1&gt;Welcome to Simple POS&lt;/h1&gt; </font></p>
<p><font face="Courier">&lt;ul&gt;       <br />&#160;&#160; &lt;li&gt;&lt;%= link_to &quot;Orders&quot; , orders_path %&gt;&lt;/li&gt;        <br />&#160;&#160; &lt;li&gt;&lt;%= link_to &quot;Manage Items&quot; , items_path %&gt;&lt;/li&gt;        <br />&lt;/ul&gt;</font></p>
</blockquote>
<p>Here we use another Rails helper function link_to() which will create a HTML &lt;a href&gt; tag, which will display a link text as specified by the first parameter, and will jump to the URL that we specified in it’s second parameter.</p>
<p>We also use orders_path and items_path, which are the helper functions that is automatically generated by the scaffolding process to go to the index page (listing) of the order and item data.</p>
<p>The link can also be referred as these:</p>
<blockquote><p><font face="Courier">&#160;&#160; &lt;%= link_to &quot;Orders&quot; , :controller=&gt;&quot;orders&quot;, :action=&gt;&quot;index&quot; %&gt;</font></p>
<p><font face="Courier">       <br /></font></p>
</blockquote>
<p>&#160;</p>
<p>&#160;</p>
<h2>Testing the Application</h2>
<p>Rails provides us a test suite for testing out our application programmatically. This will make us easier to test all functionality of our application without testing it manually by entering data on the user interface pages.</p>
<p>For example, it we need to test the application functionalities, run this comman:</p>
<blockquote><p><font face="Courier New"># rake test:functionals</font></p>
<p><font face="Courier New"></font></p>
</blockquote>
<p>We can see the test results and&#160; will be notified if something not expected exists.</p>
<p>&#160;</p>
<h2>Deploying Into Apache Web Server</h2>
<p>Install modrails aka Passenger to be used by Apache web server:</p>
<pre>gem install passenger</pre>
<p>Then type:</p>
<pre><kbd>passenger-install-apache2-module</kbd></pre>
<p>Then follow the instructions on that script.</p>
<ul><kbd><font face="Verdana"></font></kbd></ul>
<p><kbd></kbd></p>
</p>
<h4>Deploying on name based virtual host:</h4>
<p>Add a virtual host entry to your Apache configuration file. Make sure that the following conditions are met:</p>
<ul>
<li>The virtual host’s document root must point to your Ruby on Rails application’s <em>public </em>folder. </li>
<li>The Apache per-directory permissions must allow access to this folder. </li>
<li>MultiViews must be disabled for this folder. </li>
</ul>
<p>For example:</p>
<pre><tt>&lt;VirtualHost *:80&gt;
    ServerName <a href="http://www.simpleblog.com">www.simpleblog.com
</a>    DocumentRoot /opt/rubyapp/simpleblog/public
    &lt;Directory /opt/rubyapp/simpleblog/public&gt;
        Allow from all
        Options -MultiViews
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</tt></pre>
<p>You may also need to tweak your file/folder permissions. Make sure that the following folders are readable and executable by Apache:</p>
<ul>
<li>
<p>this <em>public</em> folder. </p>
</li>
<li>
<p>the application’s <em>config</em> folder. </p>
</li>
<li>
<p>all parent folders. That is, /opt/rubyapp/simpleblog , /opt and /opt/rubyapp/must also be readable and executable by Apache. </p>
<p>Then restart Apache. The application has now been deployed.</p>
</li>
</ul>
<h4>Deploying to a sub URI:</h4>
<p>Suppose that you already have a virtual host:</p>
<pre><tt>&lt;VirtualHost *:80&gt;
    ServerName <a href="http://www.yoursite.com">www.yoursite.com
</a>    DocumentRoot /www/yoursite
    &lt;Directory /www/yoursite&gt;
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</tt></pre>
<p>And you want your Ruby on Rails application to be accessible from the URL <em><a href="http://www.yoursite.com/simpleblog">http://www.yoursite.com/simpleblog</a></em>.</p>
<p>To do this, make a symlink from your Ruby on Rails application’s <em>public</em> folder to a directory in the document root. For example:</p>
<pre><tt>ln -s /opt/rubyapp/simpleblog/public /www/yoursite/simpleblog</tt></pre>
<p>Next, add a <a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#RailsBaseURI">RailsBaseURI</a> option to the virtual host configuration, and also make sure that:</p>
<ul>
<li>
<p>The Apache per-directory permissions allow access to this folder. </p>
</li>
<li>
<p>MultiViews is disabled for this folder. </p>
</li>
</ul>
<p>For example (notice the lines in bold):</p>
<pre><tt>&lt;VirtualHost *:80&gt;
    ServerName <a href="http://www.yoursite.nl">www.yoursite.nl
</a>    DocumentRoot /www/yoursite
    &lt;Directory /www/yoursite&gt;
        Allow from all
    &lt;/Directory&gt;

<strong>    RailsBaseURI /simpleblog
    &lt;Directory /www/yoursite/simpleblog&gt;
        Options -MultiViews
    &lt;/Directory&gt;</strong>
&lt;/VirtualHost&gt;</tt></pre>
<p>Then restart Apache. The application has now been deployed.</p>
<p>&#160;</p>
<h4>Deploying to a port based virtual host</h4>
<p>What if you want to access your application using a port number, like <a href="http://yoursite.com:9000">http://yoursite.com:9000</a>. To do this, use Apache’s port based virtual host.</p>
<p>Add Listen directive to ports.conf or httpd.conf:</p>
<blockquote>
<p><font size="2" face="Courier New">Listen 9000</font></p>
<p>&#160;</p>
</blockquote>
<p>&#160;</p>
<p>Then add a virtual host entry to your Apache configuration file. Make sure that the following conditions are met: </p>
<ul>
<li>The virtual host’s document root must point to your Ruby on Rails application’s <em>public </em>folder. </li>
<li>The Apache per-directory permissions must allow access to this folder. </li>
<li>MultiViews must be disabled for this folder. </li>
</ul>
<ul>For example:</ul>
<blockquote>
<p><font size="2" face="Courier New">&lt;VirtualHost *:9000&gt;<br />
      <br />&#160;&#160; ServerName <a href="http://www.yoursite.com">www.yoursite.com</a> </p>
<p>&#160;&#160;&#160;&#160;&#160; DocumentRoot /opt/rubyapp/simpleblog/public </p>
<p>&#160;&#160;&#160;&#160;&#160; &lt;Directory /opt/rubyapp/simpleblog/public&gt; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AllowOverride all </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Options -MultiViews </p>
<p>&#160;&#160;&#160;&#160;&#160; &lt;/Directory&gt; </p>
<p>&lt;/VirtualHost&gt;</font></p>
</blockquote>
<ul></ul>
<ul>Also, delete or comment out the NameVirtualHost * directive on your httpd.conf.</ul>
<p>Then restart Apache. The application has now been deployed.</p>
<h3></h3>
<p>&#160;</p>
<h2>Resources</h2>
<ul>
<li><a href="http://rubyonrails.org">http://rubyonrails.org</a> </li>
<li><a href="http://www.railscasts.com">http://www.railscasts.com</a> </li>
<li><a title="http://www.modrails.com" href="http://www.modrails.com">http://www.modrails.com</a> </li>
</ul>
<ul></ul>
<ul></ul>
<p>Akhmad Daniel Sembiring<br />
  <br />akhmad.daniel[at]gmail.com </p>
<p>vitraining.com -CEO</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:11bdb8ed-6bee-4ac5-99ae-eb0488fae311" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Developing" rel="tag">Developing</a>,<a href="http://technorati.com/tags/Web+Applications" rel="tag">Web Applications</a>,<a href="http://technorati.com/tags/Ruby+on+Rails" rel="tag">Ruby on Rails</a>,<a href="http://technorati.com/tags/Debian+5" rel="tag">Debian 5</a>,<a href="http://technorati.com/tags/Point+of+Sales" rel="tag">Point of Sales</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/12/netbeans-ide-6-8-released/" rel="bookmark">NetBeans IDE 6.8 Released</a></li><li><a href="http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/" rel="bookmark">Show the List of Installed Packages on Ubuntu or Debian</a></li><li><a href="http://www.dijexi.com/2010/11/engaging-customers-with-facebook-applications/" rel="bookmark">Engaging Customers with Facebook Applications</a></li><li><a href="http://www.dijexi.com/2009/07/best-free-development-tools-and-editors-software/" rel="bookmark">Best Free Development Tools and Editors Software</a></li><li><a href="http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/" rel="bookmark">How to Use Tor Project Anonymous IP with Curl PHP on Linux</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F09%2Fdeveloping-web-based-pos-application-using-ruby-on-rails-on-debian-5%2F&amp;linkname=Developing%20Web%20Based%20POS%20Application%20Using%20Ruby%20on%20Rails%20on%20Debian%205"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/09/developing-web-based-pos-application-using-ruby-on-rails-on-debian-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introduction to PHP AGI (Asterisk Gateway Interface)</title>
		<link>http://www.dijexi.com/2010/08/introduction-to-php-agi-asterisk-gateway-interface/</link>
		<comments>http://www.dijexi.com/2010/08/introduction-to-php-agi-asterisk-gateway-interface/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 07:48:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[VOIP]]></category>
		<category><![CDATA[php agi]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/08/introduction-to-php-agi-asterisk-gateway-interface/</guid>
		<description><![CDATA[The (AGI) Asterisk Gateway Interface is an interface for adding functionality to Asterisk with many different programming languages. Perl, PHP, C, Pascal, Bourne Shell, or any other programming language that you like. To use AGI, create an extension on extension.conf, with this format (example extension number 5151): exten =&#62; 5151,1,AGI(test.php) &#160; Then place the script [...]]]></description>
			<content:encoded><![CDATA[<p>The (AGI) Asterisk Gateway Interface is an interface for adding functionality to Asterisk with many different programming languages. Perl, PHP, C, Pascal, Bourne Shell, or any other programming language that you like.</p>
<p>To use AGI, create an extension on extension.conf, with this format (example extension number 5151):</p>
<blockquote><p>exten =&gt; 5151,1,AGI(test.php)     </p>
</blockquote>
<p>&#160;</p>
<p>Then place the script (for example in PHP, test.php) on the specified AGI folder in asterisk.conf, for example in /var/lib/asterisk/agi-bin.</p>
<p>The script should be executable, so you must first chmod +x to the script. </p>
<p>As an example, let create simple AGI application that fetch the web for a currency data and speak it to the caller. To simplify our self, we are going to use PHP and PHPAGI library. </p>
<p> <span id="more-1333"></span>
<p>The web service URL that we are going to fetch is located at <a title="http://www.webservicex.com/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&amp;ToCurrency=IDR" href="http://www.webservicex.com/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&amp;ToCurrency=IDR">http://www.webservicex.com/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&amp;ToCurrency=IDR</a></p>
<p>This will return the conversion rate in XML format of the FromCurrency to the ToCurrency. For simplicity we make it hard coded now. You can change the values for the both parameters.</p>
<p>Before we begin, first download latest version of PHP AGI library from <a title="http://sourceforge.net/projects/phpagi/" href="http://sourceforge.net/projects/phpagi/">http://sourceforge.net/projects/phpagi/</a>, extract, and put phpagi.php, phpagi-asmanager.php, and phpagi-fastagi.php files on /var/lib/asterisk/agi-bin.</p>
<p>Also, you need to install Fextival text to speech so that Asterisk can answer the caller using the text that we supply.</p>
<p>Let’s create a new PHP script and save it on /var/lib/asterisk/agi-bin as curr.php. Here is the source code:</p>
<blockquote><p>#!/usr/bin/php -q     <br />&lt;? </p>
<p>set_time_limit(30);     <br />//load PHP AGI      <br />require(&#8216;phpagi.php&#8217;);      <br />$agi = new AGI(); </p>
<p>//answer the call     <br />$agi-&gt;answer(); </p>
<p>//fetch the web service and store the result into $curr     <br />$fromCurrency=&quot;USD&quot;;      <br />$toCurrency=&quot;IDR&quot;;      <br />$res=file_get_contents(&quot;<a href="http://www.webservicex.com/CurrencyConvertor.asmx/ConversionRate?FromCurrency=">http://www.webservicex.com/CurrencyConvertor.asmx/ConversionRate?FromCurrency=</a>$fromCurrency&amp;ToCurrency=$toCurrency&quot;);      <br />$xml = new SimpleXMLElement($res);      <br />$curr=$xml[0]; </p>
<p>$agi-&gt;text2wav(&quot;Currency rate from $fromCurrency to $toCurrency is&quot;);     <br />$agi-&gt;say_number($curr);      <br />$agi-&gt;text2wav(&quot;Thank you&quot;);      <br />$agi-&gt;hangup(); </p>
<p>?&gt;</p>
</blockquote>
<p>&#160;</p>
<p>A few thing to consider on the above code:</p>
<p>First we set the allowable processing time limit to 30 seconds, and load the PHP AGI library, then we instantiate the <em>$agi</em> variable. Then we answer the call using <em>$agi-&gt;answer().</em></p>
<p>Then we fetch the currency data from the web service URL, and store the data into <em>$res</em> variable which is an XML string. We convert it into XML object by using <em>SimpleXMLElement</em>, and get the conversion value which is stored on <em>$xml[0]</em> and store it into <em>$curr </em>variable. You may inspect the XML structure by calling print_r($xml).</p>
<p>Next we call <em>$agi-&gt;text2wav()</em> that will say anything supplied into it’s parameter. And we call <em>$agi-&gt;say_number($curr)</em>. At the end, we say thank you and hang up the phone by <em>$agi-&gt;hangup()</em>.</p>
<p>Now edit /etc/asterisk/extension.conf and add the following lines under the context that your phone can access, for example Internal context.</p>
<blockquote><p>[Internal]     <br />exten =&gt; 5151,1,AGI(curr.php)</p>
</blockquote>
<p>&#160;</p>
<p>Call the extension number 5151 from your phone, and you will get replied by the system telling you the currency rate between USD and IDR.. But don’t get surprised with the big value, this is Indonesia :( </p>
<p>Further PHP AGI functions that might interest you are:</p>
<ol>
<li><a href="http://phpagi.sourceforge.net/phpagi2/docs/phpAGI/AGI.html#get_data">get_data</a> to get DTMF data for you application to process, like the IVR menu</li>
<li><a href="http://phpagi.sourceforge.net/phpagi2/docs/phpAGI/AGI.html#parse_callerid">parse_callerid</a> to parse and get the caller ID information&#160; </li>
<li><a href="http://phpagi.sourceforge.net/phpagi2/docs/phpAGI/AGI.html#record_file">record_file</a> to record caller’s voice</li>
</ol>
<p>For further information and consultation, you may contact me directly:</p>
<p>Akhmad Daniel Sembiring   <br />akhmad.daniel[at]gmail.com    <br />vitraining.com – CEO</p>
<p>&#160;</p>
<p>Further reading:</p>
<ol>
<li><a title="http://www.voip-info.org/wiki/view/Asterisk+AGI" href="http://www.voip-info.org/wiki/view/Asterisk+AGI">http://www.voip-info.org/wiki/view/Asterisk+AGI</a></li>
<li><a title="http://sourceforge.net/projects/phpagi/" href="http://sourceforge.net/projects/phpagi/">http://sourceforge.net/projects/phpagi/</a></li>
<li><a href="http://www.asterisk.org">http://www.asterisk.org</a> </li>
</ol>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/" rel="bookmark">How to install Asterisk 1.6 on Ubuntu</a></li><li><a href="http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/" rel="bookmark">Setup Kannel SMS Gateway on Ubuntu</a></li><li><a href="http://www.dijexi.com/2009/07/best-free-development-tools-and-editors-software/" rel="bookmark">Best Free Development Tools and Editors Software</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-point-of-sales/" rel="bookmark">15. Aplikasi Point of Sales</a></li><li><a href="http://www.dijexi.com/2009/07/best-free-browsers-instant-messengers-remote-file-management-shell-and-linux-emulation-software/" rel="bookmark">Best Free Browsers, Instant Messengers, Remote File Management, Shell and Linux Emulation Software</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F08%2Fintroduction-to-php-agi-asterisk-gateway-interface%2F&amp;linkname=Introduction%20to%20PHP%20AGI%20%28Asterisk%20Gateway%20Interface%29"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/08/introduction-to-php-agi-asterisk-gateway-interface/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating GPS Tracker Application on J2ME Phones</title>
		<link>http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/</link>
		<comments>http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 04:49:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GPS Tracking System]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me gps tracking system]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/</guid>
		<description><![CDATA[This article describes how to create the J2ME tracking application to be installed on J2ME capable phones with an internal GPS receiver. The application will utilize the Location API available on GPS enabled phones, read the GPS location data at a specified interval, send the data via HTTP connection to a specified server. Here is [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes how to create the J2ME tracking application to be installed on J2ME capable phones with an internal GPS receiver. The application will utilize the Location API available on GPS enabled phones, read the GPS location data at a specified interval, send the data via HTTP connection to a specified server.</p>
<p>Here is the application looks like.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/08/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/08/image_thumb1.png" width="262" height="507" /></a> </p>
<p> <span id="more-1332"></span>
<p>To simulate the GPS events on the device, let’s create an XML file to be loaded to the emulator:</p>
<blockquote><p>&lt;waypoints&gt;     <br />&#160; &lt;waypoint time=&quot;0&quot; latitude=&quot;-6.10&quot; longitude=&quot;107.36&quot; altitude=&quot;100&quot; /&gt;      <br />&#160; &lt;waypoint time=&quot;10000&quot; latitude=&quot;-6.54&quot; longitude=&quot;108.38&quot; altitude=&quot;0&quot; /&gt;      <br />&lt;/waypoints&gt;</p>
</blockquote>
<p>&#160;</p>
<p>Save it into a file. Then load into the emulator from menu View- External Events Generator. Browse for the script file and press the Start button.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/08/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/08/image_thumb2.png" width="514" height="480" /></a> </p>
<p>Here is the source code for the middlet. The filename is TrackMe.java.</p>
<blockquote><p>/*     <br /> * To change this template, choose Tools | Templates      <br /> * and open the template in the editor.      <br /> */ </p>
<p>package gpstracking; </p>
<p>import javax.microedition.io.*;     <br />import javax.microedition.midlet.*;      <br />import javax.microedition.lcdui.*;      <br />import javax.microedition.location.*;      <br />import java.util.Date;      <br />import java.util.Calendar; </p>
<p>public class TrackMe extends MIDlet implements CommandListener,      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; LocationListener { </p>
<p>&#160;&#160;&#160; private LocationProvider locationProvider = null;     <br />&#160;&#160;&#160; private Display display;      <br />&#160;&#160;&#160; private Form form;      <br />&#160;&#160;&#160; private Command exit = new Command(&quot;Exit&quot;, Command.EXIT, 1);      <br />&#160;&#160;&#160; private Command start = new Command(&quot;Start&quot;, Command.SCREEN, 1);      <br />&#160;&#160;&#160; private Command stop = new Command(&quot;Stop&quot;, Command.SCREEN, 1);      <br />&#160;&#160;&#160; private TextField unitId =      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new TextField(&quot;Unit ID/IMEI&quot;, &quot;067442957992&quot;, 50,      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextField.ANY);      <br />&#160;&#160;&#160; private String unitIdstr = &quot;067442957992&quot;;      <br />&#160;&#160;&#160; private TextField interval =      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new TextField(&quot;Update Interval(min)&quot;, &quot;1&quot;, 5,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TextField.NUMERIC);      <br />&#160;&#160;&#160; private int sec = 60;      <br />&#160;&#160;&#160; private StringItem info = new StringItem(&quot;Location:&quot;, &quot;unknown&quot;); </p>
<p>&#160;&#160;&#160; public TrackMe() {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; display = Display.getDisplay(this);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form = new Form(&quot;GPS Tracking Indonesia&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.addCommand(exit);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.addCommand(start);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.setCommandListener(this);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.append(unitId);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.append(interval);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.append(info); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; locationProvider = LocationProvider.getInstance(null);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Exception e) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; exit();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void locationUpdated(LocationProvider provider, Location location) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (location != null &amp;&amp; location.isValid()) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QualifiedCoordinates qc =       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; location.getQualifiedCoordinates(); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HttpConnection connection = null;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {      </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String url = &quot;http://server-address/up.php?&quot;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;unit=&quot; + unitIdstr      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;&amp;lat=&quot; + qc.getLatitude()      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;&amp;lon=&quot; + qc.getLongitude();      </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(url);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; connection = (HttpConnection) Connector.open(url);      </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; info.setText(      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;Lat: &quot; + qc.getLatitude() + &quot;\n&quot;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;Lon: &quot; + qc.getLongitude() + &quot;\n&quot;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;Alt: &quot; + qc.getAltitude() + &quot;\n&quot;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;Server Response: &quot;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + connection.getResponseMessage());      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; connection.close();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Exception e) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } finally {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; connection.close();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Exception io) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; io.printStackTrace();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; static public String urlEncode(String sUrl) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; StringBuffer urlOK = new StringBuffer();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &lt; sUrl.length(); i++) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; char ch = sUrl.charAt(i);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; switch (ch) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &#8216;&lt;&#8217;:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(&quot;%3C&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &#8216;&gt;&#8217;:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(&quot;%3E&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &#8216;/&#8217;:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(&quot;%2F&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &#8216; &#8216;:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(&quot;%20&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &#8216;:&#8217;:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(&quot;%3A&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case &#8216;-&#8217;:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(&quot;%2D&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; default:      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; urlOK.append(ch);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return urlOK.toString();      <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void providerStateChanged(LocationProvider provider,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int newState) {      <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void commandAction(Command c, Displayable s) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (c == exit) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; exit();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (c == start) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.removeCommand(start);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; unitIdstr = (unitId.getString() != null)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ? unitId.getString() : &quot;123&quot;;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sec = (interval.getString() != null)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ? Integer.parseInt(interval.getString()) : 5; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Start querying GPS data :     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; locationProvider.setLocationListener(TrackMe.this, sec, -1, -1);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.addCommand(stop);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (c == stop) {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.removeCommand(stop); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Stop querying GPS data :     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; locationProvider.setLocationListener(null, -1, -1, -1);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.addCommand(start);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void startApp() {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; display.setCurrent(form);      <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void pauseApp() {     <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void destroyApp(boolean forced) {     <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void exit() {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; destroyApp(false);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; notifyDestroyed();      <br />&#160;&#160;&#160; }      <br />}</p>
</blockquote>
<p>&#160;</p>
<p>Some things that’s important on the above source code:</p>
<p><u>locationProvider = LocationProvider.getInstance(null)</u></p>
<p>This is where we instantiate the <em>locationProvider</em> object to be able to query the GPS location from the device.</p>
<p><u>locationProvider.setLocationListener(TrackMe.this, sec, -1, -1)</u></p>
<p>This will set the listener that will process the location update information sent by the <em>LocationProvider</em>. The provider will update the listener for the current GPS location at every <em>sec</em> seconds.</p>
<p><u>public void locationUpdated(LocationProvider provider, Location location)</u></p>
<p>This is the implemetation of the <em>locationUpdated</em> method of the <em>LocationListener</em>. This will be called on the interval set at the <em>setLocationListener</em>.</p>
<p><u>QualifiedCoordinates qc = location.getQualifiedCoordinates()</u></p>
<p>This is called every time the locationUpdated is invoked. This will store the location information into the QualifiedCoordinates qc variable where later we can set the latitude and longitude to be sent to out server.</p>
<p><u>locationProvider.setLocationListener(null, -1, -1, -1)</u></p>
<p>This will stop the <em>LocationProvider </em>to send the location information to the listener.</p>
<p><u>connection = (HttpConnection) Connector.open(url)</u></p>
<p>This is how we send data to the server using HTTP GET. The data is already encoded on the <em>url</em>, which including the latitude and longitude along with the unit that are sending the data. Later we can see the connection result by setting the <em>info</em>’s text using info.setText() method.    </p>
<p><u>static public String urlEncode(String sUrl)</u> </p>
<p>This is our own function to encode a string to a HTML encoded so that we can send it as a parameter of HTTP GET.</p>
<p>&#160;</p>
<p>Real live example GPS Tracking System complete application can be viewed at <a href="http://www.GpsTrackingIndonesia.com">www.GpsTrackingIndonesia.com</a>.</p>
<p>If You need any further information or consultation, contact me directly:</p>
<p>Akhmad Daniel Sembiring</p>
<p>vitraining.com – CEO</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/08/j2me-current-date-and-time/" rel="bookmark">J2ME Current date and Time</a></li><li><a href="http://www.dijexi.com/2009/12/netbeans-ide-6-8-released/" rel="bookmark">NetBeans IDE 6.8 Released</a></li><li><a href="http://www.dijexi.com/2009/10/funambol-for-blackberry-like-capabilities-on-cheap-handsets/" rel="bookmark">Funambol for BlackBerry-like capabilities on cheap handsets</a></li><li><a href="http://www.dijexi.com/2009/07/setup-google-adsense-for-search-in-wordpress/" rel="bookmark">Setup Google AdSense for Search in WordPress</a></li><li><a href="http://www.dijexi.com/2009/07/codeigniter-tutorial-creating-accounting-application-part-1-setting-up-the-environment/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 1 Setting Up the Environment</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F08%2Fcreating-gps-tracker-application-on-j2me-phones%2F&amp;linkname=Creating%20GPS%20Tracker%20Application%20on%20J2ME%20Phones"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>J2ME Current date and Time</title>
		<link>http://www.dijexi.com/2010/08/j2me-current-date-and-time/</link>
		<comments>http://www.dijexi.com/2010/08/j2me-current-date-and-time/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 03:53:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me date and time]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/08/j2me-current-date-and-time/</guid>
		<description><![CDATA[This simple J2ME application shows you how to get the current date ant time in J2ME and do the formatting of what format you want it to. Like core Java, J2ME too use the same java.util package to show the current date as well as current time on the screen. The middlet we create here [...]]]></description>
			<content:encoded><![CDATA[<p>This simple J2ME application shows you how to get the current date ant time in J2ME and do the formatting of what format you want it to. Like core Java, J2ME too use the same <i>java.util</i> package to show the current date as well as current time on the screen.</p>
<p>The middlet we create here will show the current date and time when we started it. Each time we press the start button, the it will display the current date and time the button pressed. Here is the look of the finished application:</p>
<p> <span id="more-1326"></span>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/08/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/08/image_thumb.png" width="262" height="509" /></a> </p>
<p>Here is the source code of the middlet.</p>
<p>&#160;</p>
<p>import java.util.*;   <br />import javax.microedition.lcdui.*;    <br />import javax.microedition.midlet.*; </p>
<p>/**   <br /> * @author daniel    <br /> */    <br />public class ShowDateTime extends MIDlet implements CommandListener { </p>
<p>&#160;&#160;&#160; private Display disp;   <br />&#160;&#160;&#160; private Date d;    <br />&#160;&#160;&#160; Calendar c = Calendar.getInstance();    <br />&#160;&#160;&#160; String time;    <br />&#160;&#160;&#160; private DateField currentDate;    <br />&#160;&#160;&#160; private Command start, exit;    <br />&#160;&#160;&#160; private Form form;    <br />&#160;&#160;&#160; private int index; </p>
<p>&#160;&#160;&#160; public ShowDateTime() {   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form = new Form(&quot;Data and Time&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; d = new Date();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; start = new Command(&quot;start&quot;, Command.SCREEN, 1);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; exit = new Command(&quot;Exit&quot;, Command.EXIT, 0);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; currentDate = new DateField(&quot;&quot;, DateField.DATE_TIME);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; currentDate.setDate(d);    <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void startApp() {   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.append(&quot;CURRENT TIME IS: &quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; index = form.append(currentDate);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.addCommand(start);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.addCommand(exit);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.setCommandListener(this);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; disp = Display.getDisplay(this);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; disp.setCurrent(form);    <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void pauseApp() {   <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void destroyApp(boolean unconditional) {   <br />&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160; public void commandAction(Command cmd, Displayable s) {   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (cmd == exit) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; notifyDestroyed();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else if (cmd == start) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; d = new Date();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; c.setTime(d);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; time =&#160; c.get(Calendar.YEAR)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;-&quot; + c.get(Calendar.MONTH)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;-&quot; + c.get(Calendar.DATE)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot; &quot; + c.get(Calendar.HOUR_OF_DAY)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;:&quot; + c.get(Calendar.MINUTE)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + &quot;:&quot; + c.get(Calendar.SECOND);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; form.append( time);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; }    <br />}</p>
<p>&#160;</p>
<p>Akhmad Daniel Sembiring</p>
<p>vitraining.com – CEO</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/" rel="bookmark">Creating GPS Tracker Application on J2ME Phones</a></li><li><a href="http://www.dijexi.com/2009/09/how-gps-works/" rel="bookmark">How GPS Works</a></li><li><a href="http://www.dijexi.com/2009/07/5-simple-basic-steps-to-create-facebook-application/" rel="bookmark">5 Simple Basic Steps to Create Facebook Application</a></li><li><a href="http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/" rel="bookmark">MySQL Backup with phpMyBackupPro</a></li><li><a href="http://www.dijexi.com/2009/08/codeigniter-library-to-create-google-maps-encoded-polylines/" rel="bookmark">CodeIgniter Library to Create Google Maps Encoded Polylines</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F08%2Fj2me-current-date-and-time%2F&amp;linkname=J2ME%20Current%20date%20and%20Time"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/08/j2me-current-date-and-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Asterisk 1.6 on Ubuntu</title>
		<link>http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/</link>
		<comments>http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 02:10:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Delphi]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/</guid>
		<description><![CDATA[1. Required Packages Install all the required packages: $ apt-get install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev libxml2-dev &#160; 2. Compile and Install DAHDI Driver Since we are going to use Digium TDM400 board, then we need to [...]]]></description>
			<content:encoded><![CDATA[</p>
<h3>1. Required Packages</h3>
<p>Install all the required packages:</p>
<p>$ apt-get install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev libxml2-dev</p>
<p>&#160;</p>
<h3>2. Compile and Install DAHDI Driver</h3>
<p>Since we are going to use Digium TDM400 board, then we need to install DAHDI driver. First, get the system kernel name:</p>
<p>$ uname –r </p>
<p>This will results your kernel version number. </p>
<p>Install the kernel header according to your system kernel</p>
<p>$ apt-get install linux-headers-&lt;version&gt;</p>
<p>&#160;</p>
<p>Create a symbolic link to /usr/src/linux-2.6</p>
<p>$ ln -s /usr/src/linux-headers-&lt;version&gt; /usr/src/linux-2.6</p>
<p> <span id="more-1323"></span>
<p>Download and extract the DAHDI driver to /usr/src </p>
<p>$ cd /usr/src/</p>
<p>$ wget http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-completecurrent.tar.gz</p>
<p>$ tar -zxvf dahdi-linux-complete-current.tar.gz</p>
<p>$ cd dahdi-linux-complete-X.X.X+X.X.X</p>
<p>&#160;</p>
<p>Compile the driver</p>
<p>$ make</p>
<p>$ make install</p>
<p>$ make config </p>
<p>Note: Executing ‘make config’ will install an init script and symlinks which will allow you to start and stop DAHDI as a service.</p>
<p>&#160;</p>
<h3>3. Install asterisk</h3>
<p>Download asterisk source distribution and put it on /usr/src. In this article I used asterisk version 1.6.2.9, you can download the newest version as you wish. </p>
<p>$ cd /usr/src</p>
<p>$ wget http://www.asterisk.org/downloads/asterisk/releases/asterisk-1.6.2.9.tar.gz</p>
<p>$ tar xvfpz asterisk-1.6.2.9.tar.gz</p>
<p>$ cd asterisk-1.6.2.9.tar.gz</p>
<p>&#160;</p>
<p>Compile the source code</p>
<p>$ ./configure</p>
<p>$ make menuselect</p>
<p>Make sure that you are able to select chan_dahdi under the Channel Drivers menu. If not, then you need to check the installation step of DAHDI driver.</p>
<p>$ make </p>
<p>$ make install</p>
<p>&#160;</p>
<p>&#160;</p>
<h3>4. Configure /etc/dahdi/system.conf and start the driver</h3>
<p>In this example, FXO module is at Port 4 and FXS module is at Port 2 on the Digium TDM400 card. So the board arrangements are:</p>
<ul>
<li>FXS Green board = to be connected to a telephone handset, plug it into the bank #2 on the main board </li>
<li>FXO Orange board&#160; = to be connected to telephone line, plug it into the bank #4 on the main board </li>
<li>Power Supply = to be connected to PC power connector, for supplying FXS line </li>
</ul>
<p>After plugging the FXO and FXS boards, then:</p>
<ul>
<li>Connect a normal telephone handset to port #2. </li>
<li>Connect a telephone / PSTN analog line to port #4. </li>
</ul>
<p>&#160;</p>
<p>Note: Plugging an FXS port (the green module, port #2) into the PSTN may destroy the module and the card due to voltage being introduced into a system that wants to produce voltage, not receive it!</p>
<p>Note: Be sure to connect your computer’s power supply to the Molex connector on the TDM400 if you have FXS modules, as it is used to supply the voltage needed to drive the ring generator on the FXS ports</p>
<p>Next, Edit file /etc/dahdi/system.conf add the following lines:</p>
<p>fxoks=2    <br />fxsks=4     <br />loadzone=us     <br />defaultzone=us     <br />echocanceller=mg2,1-4</p>
<p>DAHDI uses modular echo cancellers that are configured per channel. The echo cancellers are compiled and installed as part of the dahdilinux package. You can specify the echo canceller to be used for each channel. The default behavior is for there to be no echo canceller on any channel. So, it is very important that you specify one in the system.conf file if you do not have hardware echo cancellers and need echo cancellation.</p>
<p>Then start the driver using this command</p>
<p>$ /etc/init.d/dahdi start</p>
<p>&#160;</p>
<p>After loading the drivers for your hardware, you can verify their state with the use of </p>
<p>$ /sbin/dahdi_cfg -vv</p>
<p>&#160;</p>
<p>Check the module loading using dmesg command:</p>
<p>$ dmesg</p>
<p>[ 1604.956854] dahdi: Telephony Interface Registered on major 196    <br />[ 1604.956861] dahdi: Version: 2.3.0.1     <br />[ 1604.979673] ACPI: PCI Interrupt 0000:00:05.0[A] -&gt; GSI 16 (level, low) -&gt; IRQ 20     <br />[ 1604.979778] PCI: Setting latency timer of device 0000:00:05.0 to 64     <br />[ 1604.979796] Freshmaker version: 73     <br />[ 1604.980163] Freshmaker passed register test     <br />[ 1605.476297] Module 0: Not installed     <br />[ 1606.357479] Module 1: Installed &#8212; AUTO FXS/DPO     <br />[ 1606.357567] Module 2: Not installed     <br />[ 1606.555044] Module 3: Installed &#8212; AUTO FXO (FCC mode)     <br />[ 1606.564781] Found a Wildcard TDM: Wildcard TDM400P REV I (2 modules)     <br />[ 1606.757915] dahdi: Registered tone zone 0 (United States / North America)     <br />[ 1606.801141] dahdi_echocan_mg2: Registered echo canceler &#8216;MG2&#8242;</p>
<p>&#160;</p>
<h3>5. Configure chan_dahdi.conf</h3>
<p>Edit file /etc/asterisk/chan_dahdi.conf. This will instruct Asterisk to use the TDM400 card configured previously.</p>
<p>The following is a sample configuration for a TDM422E card. You can place this at the bottom of your chan_dahdi.conf file.</p>
<p>;General options    <br />usecallerid = yes     <br />hidecallerid = no     <br />callwaiting = yes     <br />threewaycalling = yes     <br />transfer = yes     <br />echocancel = yes     <br />echocancelwhenbridged = yes     <br />rxgain = 0.0     <br />txgain = 0.0     <br />;FXS Modules     <br />group = 1     <br />signalling = fxo_ks     <br />context = Internal     <br />channel = 1-2     <br />;FXO Modules     <br />group = 2     <br />echocancel = yes     <br />signalling = fxs_ks     <br />context = Incoming     <br />channel = 3-4</p>
<p>&#160;</p>
<h3>6. Setting up Voicemail and a basic dial plan</h3>
<p>Open and edit voicemail.conf and find the following line at the bottom:</p>
<p>[default]    <br />1234 =&gt; 4242,Mark Spencer,root@localhost     </p>
<p>In this example, 1234 is the mailbox number, 4242 is the password, Mark Spencer is the person’s name, and root@localhost is his email address.</p>
<p>You can add extensions by adding the following:</p>
<p>1000 =&gt; 12345,Ujang,ujang@abc.com    <br />2000 =&gt; 12345,Bayu,bayu@xyz.com</p>
<p>Next, open and edit /etc/asterisk/extensions.conf, which contains a large, complex sample dial plan. In this step, you will configure a basic dial plan to enable you to    <br />send and receive calls. Go to the bottom of the file and add the following lines:</p>
<p>[Internal]     <br />exten =&gt; 1000,1,Dial(DAHDI/1,20,rt)     <br />exten =&gt; 1000,2,Voicemail(1000,u)     <br />exten =&gt; 1000,102,Voicemail(1000,b)     <br />exten =&gt; 2000,1,Dial(DAHDI/2,20,rt)     <br />exten =&gt; 2000,2,Voicemail(2000,u)     <br />exten =&gt; 2000,102,Voicemail(2000,b)     <br />exten =&gt; 8500,1,VoiceMailMain     <br />exten =&gt; 8501,1,MusicOnHold     <br />exten =&gt; _9.,1,Dial(DAHDI/g2/www${EXTEN:1})     <br />exten =&gt; _9.,2,Congestion     <br />[Incoming]     <br />exten =&gt; s,1,Answer     <br />exten =&gt; s,2,Dial(DAHDI/g1,20,rt)     <br />exten =&gt; s,3,Voicemail(1000,u)     <br />exten =&gt; s,103,Voicemail(1000,b)     </p>
<p>In this example there are two internal extensions (1000 and 2000), a number to check voicemail (8500), a number to listen to music-on-hold, (8501), and a prefix to dial to get an outside line (9). It is also configured to accept incoming calls over the FXO, rings phones 1 and 2, and route to voicemail box 1000.</p>
<p>&#160;</p>
<h3>7. Testing</h3>
<p>Start asterisk as standalone application first:</p>
<p>$ asterisk –cvvvv</p>
<p>This will run asterisk in console mode and a lot of debugging messages for you to find out if something going wrong.</p>
<p>Dial tone should be present on phones connected to the FXS ports. Test your configuration by placing an outgoing call, placing a call from extension 1 to 2, or receiving an incoming call. Successful completion of these tasks indicates your configuration is working properly.</p>
<p>Quit asterisk using CTRL-C. If everything Ok, then you can start asterisk as a service.</p>
<p>$ /etc/init.d/asterisk start</p>
<p>&#160;</p>
<p>&#160;</p>
<p>If you need any further information or consultation, please contact me directly:</p>
<p>Akhmad Daniel Sembiring</p>
<p>vitraining.com – CEO, akhmad.daniel[at]gmail.com, 6281320379277</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/" rel="bookmark">Show the List of Installed Packages on Ubuntu or Debian</a></li><li><a href="http://www.dijexi.com/2010/08/introduction-to-php-agi-asterisk-gateway-interface/" rel="bookmark">Introduction to PHP AGI (Asterisk Gateway Interface)</a></li><li><a href="http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/" rel="bookmark">How to Use Tor Project Anonymous IP with Curl PHP on Linux</a></li><li><a href="http://www.dijexi.com/2011/06/guide-to-installing-3rd-party-jars-in-maven/" rel="bookmark">Guide to installing 3rd party JARs in Maven</a></li><li><a href="http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/" rel="bookmark">Setup Kannel SMS Gateway on Ubuntu</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F08%2Fhow-to-install-asterisk-1-6-on-ubuntu%2F&amp;linkname=How%20to%20install%20Asterisk%201.6%20on%20Ubuntu"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Send Email on Java Application using JavaMail API</title>
		<link>http://www.dijexi.com/2010/07/how-to-send-email-on-java-application-using-javamail-api/</link>
		<comments>http://www.dijexi.com/2010/07/how-to-send-email-on-java-application-using-javamail-api/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 03:33:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[javamail]]></category>
		<category><![CDATA[sending email]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/07/how-to-send-email-on-java-application-using-javamail-api/</guid>
		<description><![CDATA[This article explain how to use JavaMail API for sending email through our Java application. This will cover simple email, HTML email, and email with attachments. The required JavaMail API can found here. Put it on a directory accessible by CLASSPATH setting. It&#8217;s a good idea to read the JavaMail FAQ. Simple Email This test [...]]]></description>
			<content:encoded><![CDATA[<p>This article explain how to use JavaMail API for sending email through our Java application. This will cover simple email, HTML email, and email with attachments.</p>
<p>The required JavaMail API can found <a href="http://java.sun.com/products/javamail/">here</a>. Put it on a directory accessible by CLASSPATH setting. It&#8217;s a good idea to read the <a href="http://java.sun.com/products/javamail/FAQ.html">JavaMail FAQ</a>.</p>
<p> <span id="more-1322"></span><br />
<h2>Simple Email</h2>
<p>This test application is used for sending simple email.</p>
<pre>import javax.mail.*;
import javax.mail.internet.*;

import java.util.Properties;

class SimpleMail {
    public static void main(String[] args) throws Exception{
      Properties props = new Properties();
      props.setProperty(&quot;mail.transport.protocol&quot;, &quot;smtp&quot;);
      props.setProperty(&quot;mail.host&quot;, &quot;mail.server.com&quot;);
      props.setProperty(&quot;mail.user&quot;, &quot;mailuser&quot;);
      props.setProperty(&quot;mail.password&quot;, &quot;mailpwd&quot;);

      Session mailSession = Session.getDefaultInstance(props, null);
      Transport transport = mailSession.getTransport();

      MimeMessage message = new MimeMessage(mailSession);
      message.setSubject(&quot;Testing simple email by JavaMail API&quot;);
      message.setContent(&quot;This is just a test&quot;, &quot;text/plain&quot;);
      message.addRecipient(Message.RecipientType.TO,
           new InternetAddress(&quot;rhoma@irama.org&quot;));

      transport.connect();
      transport.sendMessage(message,
          message.getRecipients(Message.RecipientType.TO));
      transport.close();
    }
}</pre>
<p>&#160;</p>
<h2>HTML Email</h2>
<p>This application is a sample of sending HTML email using JavaMail API.</p>
<pre>import javax.mail.*;
import javax.mail.internet.*;

import java.util.Properties;

class SimpleHTMLMail {
    public static void main(String[] args) throws Exception{
      Properties props = new Properties();
      props.setProperty(&quot;mail.transport.protocol&quot;, &quot;smtp&quot;);
      props.setProperty(&quot;mail.host&quot;, &quot;mail.server.com&quot;);
      props.setProperty(&quot;mail.user&quot;, &quot;mailuser&quot;);
      props.setProperty(&quot;mail.password&quot;, &quot;mailpwd&quot;);

      Session mailSession = Session.getDefaultInstance(props, null);
      Transport transport = mailSession.getTransport();

      MimeMessage message = new MimeMessage(mailSession);
      message.setSubject(&quot;Testing JavaMail HTML email&quot;);
      message.setContent
         (&quot;This is just a test &lt;b&gt;HOW TO&lt;b&gt; send HTML email&quot;,                 &quot;text/html; charset=ISO-8859-1&quot;);
      message.addRecipient(Message.RecipientType.TO,
         new InternetAddress(&quot;rhoma@irama.org&quot;));

      transport.connect();
      transport.sendMessage(message,
         message.getRecipients(Message.RecipientType.TO));
      transport.close();
    }
}</pre>
<h2>Email with Attachments</h2>
<p>This is a sample application for sending email with attachment using JavaMail API. Note that you will also need additional Jar for this, the Java Activation Framework, JAF, which can be downloaded <a href="http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp" target="_blank">here</a>.</p>
<pre>import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.FileDataSource;
import javax.activation.DataHandler;

import java.util.Properties;

class SimpleMailWithAttachment {
    public static void main(String[] args) throws Exception{
      boolean debug = false;
      Properties props = new Properties();
      props.setProperty(&quot;mail.transport.protocol&quot;, &quot;smtp&quot;);
      props.setProperty(&quot;mail.host&quot;, &quot;mymail.server.org&quot;);
      props.setProperty(&quot;mail.user&quot;, &quot;emailuser&quot;);
      props.setProperty(&quot;mail.password&quot;, &quot;&quot;);

      Session mailSession = Session.getDefaultInstance(props, null);
      mailSession.setDebug(debug);
      Transport transport = mailSession.getTransport();

      MimeMessage message = new MimeMessage(mailSession);
      message.setSubject(&quot;Testing javamail with attachment&quot;);

      MimeBodyPart textPart = new MimeBodyPart();
      textPart.setContent(&quot;&lt;h1&gt;Check attachment&lt;/h1&gt;&quot;, &quot;text/html&quot;);

      MimeBodyPart attachFilePart = new MimeBodyPart();
      FileDataSource fds =
          new FileDataSource(&quot;SimpleMailWithAttachment.java&quot;);
      attachFilePart.setDataHandler(new DataHandler(fds));
      attachFilePart.setFileName(fds.getName());

      Multipart mp = new MimeMultipart();
      mp.addBodyPart(textPart);
      mp.addBodyPart(attachFilePart);

      message.setContent(mp);
      message.addRecipient(Message.RecipientType.TO,
          new InternetAddress(&quot;elvis@presley.org&quot;));

      transport.connect();
      transport.sendMessage(message,
          message.getRecipients(Message.RecipientType.TO));
      transport.close();
    }
}</pre>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2ca7d2a8-7aeb-4cc0-828e-0188b37e802b" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/sending+email" rel="tag">sending email</a>,<a href="http://technorati.com/tags/java" rel="tag">java</a>,<a href="http://technorati.com/tags/javamail" rel="tag">javamail</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/" rel="bookmark">Show the List of Installed Packages on Ubuntu or Debian</a></li><li><a href="http://www.dijexi.com/2009/12/netbeans-ide-6-8-released/" rel="bookmark">NetBeans IDE 6.8 Released</a></li><li><a href="http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/" rel="bookmark">Creating GPS Tracker Application on J2ME Phones</a></li><li><a href="http://www.dijexi.com/2010/08/j2me-current-date-and-time/" rel="bookmark">J2ME Current date and Time</a></li><li><a href="http://www.dijexi.com/2009/10/funambol-for-blackberry-like-capabilities-on-cheap-handsets/" rel="bookmark">Funambol for BlackBerry-like capabilities on cheap handsets</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F07%2Fhow-to-send-email-on-java-application-using-javamail-api%2F&amp;linkname=How%20to%20Send%20Email%20on%20Java%20Application%20using%20JavaMail%20API"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/07/how-to-send-email-on-java-application-using-javamail-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Use Tor Project Anonymous IP with Curl PHP on Linux</title>
		<link>http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/</link>
		<comments>http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 23:38:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[browsing anonymously]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[hide ip]]></category>
		<category><![CDATA[Tor]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/</guid>
		<description><![CDATA[This article explains how to utilize Tor project in our own PHP application using Curl Library. Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis. We start by [...]]]></description>
			<content:encoded><![CDATA[<p>This article explains how to utilize <a href="http://www.torproject.org/" target="_blank">Tor project</a> in our own PHP application using Curl Library. </p>
<p>Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis. </p>
<p>We start by installing and configuring Tor and the necessary software then we create a simple application that fetch a website address anonymously.</p>
<p> <span id="more-1321"></span><br />
<h3>Download and Install Tor</h3>
<p>First thing, we need to download and install Tor application into our system. Click the <a href="http://www.torproject.org/easy-download.html.en" target="_blank">download page</a> to get the correct software for you, either Windows, Apple, or Linux bundle. In this example I use Linux system so I choose Linux.</p>
<p>My system use Debian etch, so I simply use apt-get to install it. But I need to configure my /etc/apt/source.list:</p>
<pre>deb     http://deb.torproject.org/torproject.org etch main</pre>
<p>Then I add the gpg key used to sign the packages by running the following commands at the command prompt: </p>
<pre>gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -</pre>
<p>&#160;</p>
<p>I refresh my sources and install Tor by running the following commands at the command prompt:&#160; </p>
<pre>apt-get update
apt-get install tor tor-geoipdb</pre>
<p>&#160;</p>
<h3>Install Polipo </h3>
<p>For TOR to run well we need at least Polipo version 1.0.4. Debian etch package for polipo is still on version === so I need to download the source code from <a href="http://www.pps.jussieu.fr/~jch/software/polipo/">Polipo&#160; website</a>. I put the source code at /usr/src/polipo-1.0.4.</p>
<p>I need to compile Polipo by typing make at the command prompt. </p>
<blockquote>
<p><font size="2" face="Courier New">cd /usr/src/polipo-1.0.4/<br />
      <br /></font><font size="2" face="Courier New">make</font></p>
</blockquote>
<p>When successful we will get polipo executable on that directory. We can place it&#160; on /opt/polipo directory or whichever you like.</p>
<p>Before running polipo <b>we will need to configure Polipo to use Tor</b>. Grab the <a href="https://svn.torproject.org/svn/torbrowser/trunk/build-scripts/config/polipo.conf">Polipo&#160; configuration for Tor</a> and put it in place of your current polipo config file (e.g. /etc/polipo/config or ~/.polipo). Then we run polipo to use that configuration file: </p>
<blockquote>
<p><font size="2" face="Courier New">/opt/polipo/polipo -c /etc/polipo/config&#160; daemonise=true&#160; logFile=&quot;/var/log/polipo.log&quot;</font></p>
</blockquote>
<p>On that command, I run polipo with config file located at /etc/polipo/config in daemon&#160; mode and with a log file. Later you can put this line at /etc/rc.local to run polipo automatically on system start. </p>
<h3>Configure Application to use TOR </h3>
<p>After successfully installing Tor and Polipo, we need to configure our applications to use them.&#160; </p>
<p>For PHP CURL library we need to add an option to Curl to use a HTTP Proxy to access&#160; the internet. The option is CURLOPT_PROXY which contains the Proxy address and port. This proxy address is our Polipo proxy server, which is located at 127.0.0.1 on port 8118. </p>
<p>Here is an example code.</p>
<pre>&lt;? $url = 'http://www.foo.bar/curl_receive_vars.html'; <font size="2" face="Courier New">$postfields = array ('username' =&gt; 'Myname',    'emailaddress' =&gt; </font><a href="mailto:'myaddress@foo.bar'"><font size="2" face="Courier New">'myaddress@foo.bar'</font></a><font size="2" face="Courier New">);
if (!$curld = curl_init()) {
    echo &quot;Could not initialize cURL session.\n&quot;;
    exit;
} 

/* Prepare for the POST operation. */
curl_setopt($curld, CURLOPT_POST, true);

/* Give cURL the variable names &amp; values to POST. */
curl_setopt($curld, CURLOPT_POSTFIELDS, $postfields);

/* The URL to which to POST the data. */
curl_setopt($curld, CURLOPT_URL, $url);

/* Indicate that we want the output returned into a variable. */
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true); </font><font size="2" face="Courier New">/* Set the proxy to our Polipo. */  </font><strong><font size="2" face="Courier New">curl_setopt($curld, CURLOPT_PROXY, &quot;http://127.0.0.1:8118/&quot;);</font></strong><strong><font size="2" face="Courier New"></font></strong><font size="2" face="Courier New">/* Do it. */
$output = curl_exec($curld);

echo &quot;Received data: &lt;hr&gt;$output&lt;hr&gt;\n&quot;;

/* Clean up. */
 curl_close($curld); </font><font size="2" face="Courier New"> ?&gt;
 </font></pre>
<p>The above code will fetch data from URL specified but the server will not know our real IP but the IP addresses of the Tor networks instead.</p>
<h3>Additional Step&#160; </h3>
<p>Set up Tor on web browser. </p>
<p>You should use Tor with Firefox and Torbutton, for best safety. Simply install the <a href="https://addons.mozilla.org/firefox/2275/">Torbutton plugin</a>, restart your Firefox, and you&#8217;re all set:&#160; </p>
<p><img border="1" alt="Torbutton plugin for Firefox" src="http://www.torproject.org/img/screenshot-torbutton.png" width="161" height="78" />&#160;</p>
<p>After that you can browse the internet using Firefox anonymously. </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c6595ea0-cde3-48fa-ad0b-32b5456f55d3" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/tor" rel="tag">tor</a>,<a href="http://technorati.com/tags/linux" rel="tag">linux</a>,<a href="http://technorati.com/tags/ubuntu" rel="tag">ubuntu</a>,<a href="http://technorati.com/tags/debian" rel="tag">debian</a>,<a href="http://technorati.com/tags/php" rel="tag">php</a>,<a href="http://technorati.com/tags/hide+ip" rel="tag">hide ip</a>,<a href="http://technorati.com/tags/browsing+anonymously" rel="tag">browsing anonymously</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/07/how-to-browse-internet-anonymously/" rel="bookmark">How To Browse Internet Anonymously</a></li><li><a href="http://www.dijexi.com/2011/07/how-to-import-existing-project-directory-into-svn-repository/" rel="bookmark">How to Import Existing Project Directory Into SVN Repository</a></li><li><a href="http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/" rel="bookmark">How to install Asterisk 1.6 on Ubuntu</a></li><li><a href="http://www.dijexi.com/2009/07/lowongan-kerja-junior-programmer-dan-senior-web-programmer/" rel="bookmark">Lowongan Kerja : Junior Programmer dan Senior Web Programmer</a></li><li><a href="http://www.dijexi.com/2009/06/how-to-change-upload-file-size-on-a-windows-localhost/" rel="bookmark">How to change upload file size on a Windows localhost</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F06%2Fhow-to-use-tor-project-anonymous-ip-with-curl-php-on-linux%2F&amp;linkname=How%20to%20Use%20Tor%20Project%20Anonymous%20IP%20with%20Curl%20PHP%20on%20Linux"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setup Kannel SMS Gateway on Ubuntu</title>
		<link>http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/</link>
		<comments>http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/#comments</comments>
		<pubDate>Wed, 05 May 2010 09:48:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kannel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[setup sms gateway kannel ubuntu]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/</guid>
		<description><![CDATA[This are the required steps to setup Kannel as an SMS Gateway on Ubuntu. Here we use a simple GSM modem attached to USB port 0, using Enfora modem. You can use other standard AT command modems actually. Enable the SMS Box Edit file /etc/default/kannel , uncomment the START_SMSBOX line to enable the SMS Box [...]]]></description>
			<content:encoded><![CDATA[<p>This are the required steps to setup Kannel as an SMS Gateway on Ubuntu. Here we use a simple GSM modem attached to USB port 0, using Enfora modem. You can use other standard AT command modems actually.</p>
<h3>Enable the SMS Box</h3>
<p>Edit file /etc/default/kannel , uncomment the START_SMSBOX line to enable the SMS Box</p>
<p>sudo vi /etc/default/kannel</p>
<blockquote><p>START_WAPBOX=1     <br />START_SMSBOX=1</p>
<p>&#160;</p>
</blockquote>
<h3>Add kannel user to dialout group </h3>
<p>This will enable kannel user (user who run kannel process as) to use the /dev/ttyUSB0 device that is necessary when we are using USB GMS modems.</p>
<p> <span id="more-1320"></span>
<p>sudo vi /etc/group</p>
<blockquote><p>…</p>
<p>dialout:x:20:daniel<strong>,kannel</strong></p>
<p>… </p>
</blockquote>
<p>&#160;</p>
<h3>Configure Kannel</h3>
<p>Edit /etc/kannel/kannel.conf file to configure the <strong>smsbox-port</strong>, <strong>smsbox group</strong>, <strong>smsc group</strong>, and <strong>modems <strong>group</strong></strong>. These lines on bold below is the additional lines compared to the default Kannel Ubuntu setup. </p>
<p>sudo vi /etc/kannel/kannel.conf</p>
<blockquote><p>#     <br /># Sample configuration file for Kannel bearerbox on Debian.      <br /># See the documentation for explanations of fields.      <br /># </p>
<p># HTTP administration is disabled by default. Make sure you set the     <br /># password if you enable it. </p>
<p>group = core     <br />admin-port = 13000      <br />admin-password = bar      <br />admin-deny-ip = &quot;*.*.*.*&quot;      <br />admin-allow-ip = &quot;&quot;      <br />wapbox-port = 13002      <br />wdp-interface-name = &quot;*&quot;      <br />log-file = &quot;/var/log/kannel/bearerbox.log&quot;      <br />box-deny-ip = &quot;*.*.*.*&quot;      <br />box-allow-ip = &quot;127.0.0.1&quot;      <br /><strong>smsbox-port = 13003 </strong></p>
<p>group = wapbox     <br />bearerbox-host = localhost      <br />log-file = &quot;/var/log/kannel/wapbox.log&quot; </p>
<p><strong>####### SMS box setup       <br />group = smsbox        <br />bearerbox-host = localhost        <br />log-file = &quot;/var/log/kannel/smsbox.log&quot; </strong></p>
<p><strong><strong>#######</strong> SMSC / GSM modem setup, using enfora modem defined below        <br />group = smsc        <br />smsc = at        <br />modemtype = enfora        <br />device = /dev/ttyUSB0 </strong></p>
<p><strong>####### enfora modem definition       <br />group = modems        <br />id = enfora        <br />name = &quot;Enfora&quot;        <br />detect-string = &quot;Enfora&quot;        <br />init-string = &quot;AT+CNMI=1,2,0,1,0&quot;        <br />speed = 115200 </strong><strong>       <br /></strong></p>
<p><strong><strong>#######</strong> SMS services definition, what to do when an SMS is recieved        <br />group = sms-service        <br />keyword = smsemail        <br />get-url = &quot;http://localhost/SMSServlet/SMSServlet?sender=%p&amp;message=%a&quot;        <br />max-messages = 1 </strong></p>
<p><strong>group = sms-service       <br />keyword = default        <br />text = default reply        <br />max-messages = 0</strong></p>
<p><strong></strong></p>
</blockquote>
<p>&#160;</p>
<h3>Run Kannel</h3>
<p>Run kannel SMS Gateway using this command:</p>
<p>sudo /etc/init.d/kannel restart</p>
<p>Then see the the bearerbox.log file to inspect if there’s something wrong:</p>
<p>sudo tail –f /var/log/kannel/bearerbox.log</p>
<p><font size="1">2010-05-05 16:25:02 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK     <br />2010-05-05 16:25:02 [5121] [6] INFO: AT2[/dev/ttyUSB0]: closing device      <br />2010-05-05 16:25:02 [5121] [6] INFO: AT2[/dev/ttyUSB0]: speed is 115200      <br />2010-05-05 16:25:02 [5121] [6] INFO: AT2[/dev/ttyUSB0]: opening device      <br />2010-05-05 16:25:02 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened      <br />2010-05-05 16:25:02 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened      <br />2010-05-05 16:25:02 [5121] [6] INFO: AT2[/dev/ttyUSB0]: init device      <br />2010-05-05 16:25:02 [5121] [6] INFO: AT2[/dev/ttyUSB0]: speed set to 115200      <br />2010-05-05 16:25:02 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; ATZ^M      <br />2010-05-05 16:25:02 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:02 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT&amp;F^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; ATE0^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT+IFC=2,2^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT+CPIN?^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; +CPIN: READY      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT+CMGF=0^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT+CSMS=?^M      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; +CSMS: (0,1)      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:03 [5121] [6] INFO: AT2[/dev/ttyUSB0]: Phase 2+ is supported      <br />2010-05-05 16:25:03 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT+CSMS=1^M      <br />2010-05-05 16:25:04 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; +CSMS: 1,1,1      <br />2010-05-05 16:25:04 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:04 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &#8211;&gt; AT+CNMI=1,2,0,1,0^M      <br />2010-05-05 16:25:04 [5121] [6] DEBUG: AT2[/dev/ttyUSB0]: &lt;&#8211; OK      <br />2010-05-05 16:25:04 [5121] [6] INFO: AT2[/dev/ttyUSB0]: AT SMSC successfully opened.</font></p>
<p>&#160;</p>
<p>The info line &quot;AT SMSC successfully opened&quot; indicates that the SMSC modem is working well.</p>
<h3>Test the SMS Service</h3>
<p>Now try to send an SMS from your mobile phone to the number attached to the GSM modem. In this example we send &quot;SMSEMAIL ON&quot; message to be processed by the process.php file located on <a href="http://localhost">http://localhost</a>.</p>
<p>Look at the smsbox.log file:</p>
<p>sudo tail -f /var/log/kannel/smsbox.log</p>
<p>When an SMS is received, the log will shows similar to this:</p>
<p>……</p>
<p><font size="1">2010-05-05 16:30:23 [5236] [4] INFO: Starting to service &lt;Smsemail on&gt; from &lt;+6281320379277&gt; to &lt;1234&gt;     <br />2010-05-05 16:30:23 [5236] [8] DEBUG: Thread 8 (gwlib/fdset.c:poller) maps to pid 5236.      <br />2010-05-05 16:30:23 [5236] [4] DEBUG: Started thread 8 (gwlib/fdset.c:poller)      <br />2010-05-05 16:30:23 [5236] [9] DEBUG: Thread 9 (gwlib/http.c:write_request_thread) maps to pid 5236.      <br />2010-05-05 16:30:23 [5236] [9] DEBUG: Parsing URL `http://localhost/SMSServlet/SMSServlet?sender=%2B6281320379277&amp;message=Smsemail+on&#8217;:      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Scheme: http://      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Host: localhost      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Port: 80      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Username: (null)      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Password: (null)      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Path: /SMSServlet/SMSServlet      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Query: sender=%2B6281320379277&amp;message=Smsemail+on      <br />2010-05-05 16:30:23 [5236] [9] DEBUG:&#160;&#160; Fragment: (null)      <br />2010-05-05 16:30:23 [5236] [9] DEBUG: HTTP: Opening connection to `localhost:80&#8242; (fd=27).      <br />2010-05-05 16:30:23 [5236] [9] DEBUG: Socket connecting      <br />2010-05-05 16:30:23 [5236] [4] DEBUG: Started thread 9 (gwlib/http.c:write_request_thread)      <br />2010-05-05 16:40:53 [5309] [8] DEBUG: Get info about connecting socket      <br />2010-05-05 16:40:53 [5309] [8] DEBUG: HTTP: Sending request:      <br />2010-05-05 16:40:53 [5309] [8] DEBUG: Octet string at 0x8155a70:      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; len:&#160; 134      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; size: 1024      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; immutable: 0      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 47 45 54 20 2f 53 4d 53 53 65 72 76 6c 65 74 2f&#160;&#160; GET /SMSServlet/      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 53 4d 53 53 65 72 76 6c 65 74 3f 73 65 6e 64 65&#160;&#160; SMSServlet?sende      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 72 3d 25 32 42 36 32 38 31 33 32 30 33 37 39 32&#160;&#160; r=%2B62813203792      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 37 37 26 6d 65 73 73 61 67 65 3d 53 6d 73 65 6d&#160;&#160; 77&amp;message=Smsem      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 61 69 6c 2b 6f 6e 20 48 54 54 50 2f 31 2e 31 0d&#160;&#160; ail+on HTTP/1.1.      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 0a 48 6f 73 74 3a 20 39 34 2e 32 32 39 2e 31 37&#160;&#160; .Host: 127.0.0      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 31 2e 37 3a 38 30 38 30 0d 0a 55 73 65 72 2d 41&#160;&#160; .1:80..User-A      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 67 65 6e 74 3a 20 4b 61 6e 6e 65 6c 2f 31 2e 34&#160;&#160; gent: Kannel/1.4      <br />2010-05-05 16:40:53 [5309] [8] DEBUG:&#160;&#160; data: 2e 31 0d 0a 0d 0a&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .1&#8230;.      <br />2010-05-05 16:40:53 [5309] [8] DEBUG: Octet string dump ends.      <br />2010-05-05 16:40:54 [5309] [8] DEBUG: HTTP: Status line: &lt;HTTP/1.1 200 OK&gt;      <br />2010-05-05 16:40:54 [5309] [8] DEBUG: HTTP: Received response:      <br />2010-05-05 16:40:54 [5309] [8] DEBUG: Octet string at 0&#215;8157090:      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; len:&#160; 131      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; size: 1024      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; immutable: 0      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 53 65 72 76 65 72 3a 20 41 70 61 63 68 65 2d 43&#160;&#160; Server: Apache-C      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 6f 79 6f 74 65 2f 31 2e 31 0d 0a 43 6f 6e 74 65&#160;&#160; oyote/1.1..Conte      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74&#160;&#160; nt-Type: text/ht      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 6d 6c 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67&#160;&#160; ml..Content-Leng      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 74 68 3a 20 32 30 0d 0a 44 61 74 65 3a 20 57 65&#160;&#160; th: 20..Date: We      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 64 2c 20 30 35 20 4d 61 79 20 32 30 31 30 20 30&#160;&#160; d, 05 May 2010 0      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 39 3a 34 31 3a 34 34 20 47 4d 54 0d 0a 0d 0a 55&#160;&#160; 9:41:44 GMT<strong>&#8230;.U</strong>      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 70 64 61 74 65 20 53 75 63 63 65 73 73 66 75 6c&#160;&#160; <strong>pdate Successful</strong>      <br />2010-05-05 16:40:54 [5309] [8] DEBUG:&#160;&#160; data: 6c 0d 0a&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; l..      <br />2010-05-05 16:40:54 [5309] [8] DEBUG: Octet string dump ends.      <br />2010-05-05 16:40:54 [5309] [5] DEBUG: message length 18, sending 1 messages      <br />2010-05-05 16:40:54 [5309] [0] DEBUG: Got ACK (0) of 27e7a8ed-6611-40fc-8d54-53f8d70cec3d      <br />2010-05-05 16:40:54 [5309] [0] DEBUG: No client &#8211; multi-send or ACK to pull-reply      <br />2010-05-05 16:41:14 [5309] [8] DEBUG: HTTP: Server closed connection, destroying it &lt;localhost:80&gt;&lt;0x8155fa8&gt;&lt;fd:27&gt;.</font> </p>
<p>In a short time, you will receive the reply from SMS Gateway number containing Update Successfull message (the reply got from <a href="http://localhost/SMSServlet/SMSServlet">http://localhost/SMSServlet/SMSServlet</a>&#160; ).</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4ed376c7-eac2-48fa-a2af-4627608a267c" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/setup+sms+gateway+kannel+ubuntu" rel="tag">setup sms gateway kannel ubuntu</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/" rel="bookmark">Show the List of Installed Packages on Ubuntu or Debian</a></li><li><a href="http://www.dijexi.com/2010/08/introduction-to-php-agi-asterisk-gateway-interface/" rel="bookmark">Introduction to PHP AGI (Asterisk Gateway Interface)</a></li><li><a href="http://www.dijexi.com/2009/06/how-to-change-upload-file-size-on-a-windows-localhost/" rel="bookmark">How to change upload file size on a Windows localhost</a></li><li><a href="http://www.dijexi.com/2009/07/020-workflow-initial-client-setup-review/" rel="bookmark">020 Workflow: Initial Client Setup Review</a></li><li><a href="http://www.dijexi.com/2009/07/002-initial-client-setup/" rel="bookmark">010 Initial Client Setup</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F05%2Fsetup-kannel-sms-gateway-on-ubuntu%2F&amp;linkname=Setup%20Kannel%20SMS%20Gateway%20on%20Ubuntu"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>CodeIgniter Tutorial: [Creating Accounting Application] Part 5 The Mainpage</title>
		<link>http://www.dijexi.com/2010/05/codeigniter-tutorial-creating-accounting-application-part-5-the-mainpage/</link>
		<comments>http://www.dijexi.com/2010/05/codeigniter-tutorial-creating-accounting-application-part-5-the-mainpage/#comments</comments>
		<pubDate>Tue, 04 May 2010 02:31:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[accounting system]]></category>
		<category><![CDATA[main controller]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/05/codeigniter-tutorial-creating-accounting-application-part-5-the-mainpage/</guid>
		<description><![CDATA[Well I’m sorry, it’s been so long for this part to come.. I had been working very hard on some clients and don’t have enough time to write. Here’s what I had been done if you’re curious :) : http://maps.GpsTrackingIndonesia.com, www.SunberryCorp.com, www.mypushme.com, www.kulacak.com, www.web2trace.com, www.pushmeportal.com, … The fun is almost all of them was written [...]]]></description>
			<content:encoded><![CDATA[<p>Well I’m sorry, it’s been so long for this part to come.. I had been working very hard on some clients and don’t have enough time to write. Here’s what I had been done if you’re curious :) : <a href="http://maps.GpsTrackingIndonesia.com">http://maps.GpsTrackingIndonesia.com</a>, <a href="http://www.SunberryCorp.com">www.SunberryCorp.com</a>, <a href="http://www.mypushme.com">www.mypushme.com</a>, <a href="http://www.kulacak.com">www.kulacak.com</a>, <a href="http://www.web2trace.com">www.web2trace.com</a>, <a href="http://www.pushmeportal.com">www.pushmeportal.com</a>, … The fun is almost all of them was written with CodeIgniter :).</p>
<p>Ok, let’s start with the easiest one first. We will create a simple menu page that contains links to other modules on the system. We put it on the Mainpage controller class. </p>
<p>Look at the Mainpage.php controller file. There is a function on it named exactly the same with the filename: Mainpage(). This should be exactly the same including the case. This is the constructor or initialization function of the class. Each time the class is called or instantiate, this function is called automatically. We put some initialization lines inside it:</p>
<p> <span id="more-1317"></span>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">function</span> Mainpage<span class="br0">&#40;</span><span class="br0">&#41;</span>&nbsp;<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp;parent::<span class="me2">Controller</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;&nbsp; <br />
&nbsp; &nbsp; &nbsp;<span class="re0">$this</span>-&gt;<span class="me1">load</span>-&gt;<span class="me1">helper</span><span class="br0">&#40;</span><span class="st0">&#8216;url&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
<p>The line <strong>parent::Controller() </strong>calls the constructor function of this class’s parent constructor which is the CodeIgniter’s Controller class so that it has all the properties and method of it’s parent.</p>
<p>Then, we load a helper library that contains helper functions related to URL handling such as site_url() to return the site’s URL that we are working on. Other functions on this helper are: anchor(), base_url(), uri_string(), etc. You can check it all on the user guide <a title="http://localhost/acct/user_guide/helpers/url_helper.html" href="http://localhost/user_guide/helpers/url_helper.html">http://localhost/user_guide/helpers/url_helper.html</a>.</p>
<p>Again, look at the Mainpage.php file. We added a new function called <strong>index()</strong>. This function is analogous to the index.html file in static web page. It’s called by default when we point our browser to the Mainpage controller, ie: <a href="http://localhost/index.php/Mainpage">http://localhost/index.php/Mainpage</a>.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">public</span> <span class="kw2">function</span> index<span class="br0">&#40;</span><span class="br0">&#41;</span> <br />
<span class="br0">&#123;</span> <br />
&nbsp; &nbsp; <span class="re0">$this</span>-&gt;<span class="me1">load</span>-&gt;<span class="me1">view</span><span class="br0">&#40;</span><span class="st0">&#8216;header&#8217;</span><span class="br0">&#41;</span>; <br />
&nbsp; &nbsp; <span class="re0">$this</span>-&gt;<span class="me1">load</span>-&gt;<span class="me1">view</span><span class="br0">&#40;</span><span class="st0">&quot;main_menu&quot;</span><span class="br0">&#41;</span>; <br />
&nbsp; &nbsp; <span class="re0">$this</span>-&gt;<span class="me1">load</span>-&gt;<span class="me1">view</span><span class="br0">&#40;</span><span class="st0">&#8216;footer&#8217;</span><span class="br0">&#41;</span>; <br />
&nbsp; &nbsp; <span class="kw1">return</span>; <br />
<span class="br0">&#125;</span></div>
<p>On the function, we load view files. Here we divide the view into 3 pieces: header, main_menu, and footer. They are basically just regular PHP files dealing with display templates. This will make us easier to manage the look of our application later.</p>
<p>All of the view files should be located under <strong>system/application/views</strong> folder on CodeIgniter file structure. So we need to create all of them:</p>
<p>The <strong>header.php</strong> view file, contains the opening HTML tags, HEAD, TITLE and start of BODY. Later we can add CSS link definition here: </p>
<div class="dean_ch" style="white-space: wrap;">&lt;p&gt;&lt;!DOCTYPE HTML <span class="kw2">PUBLIC</span> <span class="st0">&quot;-//W3C//DTD HTML 3.2 Final//EN&quot;</span>&gt;</p>
<p>&lt;html&gt; &nbsp;<br />
&lt;head&gt;&lt;/p&gt;&lt;p&gt;&lt;title&gt;Cashbook application&lt;/title&gt; <br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;/p&gt;</div>
<p>&#160;</p>
<p>The <strong>footer.php</strong> view file, just a closing BODY and HTML tag, but you can later add your copyright notice, timestamps, etc:&#160;&#160; </p>
<p>&#160;</p>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
<p>And the <strong>main_menu.php</strong> view file. Here we write a list of links to modules that we are going to develop later:</p>
<div class="dean_ch" style="white-space: wrap;">&lt;p&gt;&lt;p&gt;Cash Book&lt;/p&gt;</p>
<p>&lt;ul&gt;</p>
<p>&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Cashbook/addNew/receive&quot;</span>,<span class="st0">&quot;Cash Receive Entry&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span> &nbsp;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Cashbook/addNew/out&quot;</span>,<span class="st0">&quot;Cash Out Entry&quot;</span><span class="br0">&#41;</span> <span class="kw2">?&gt;</span></p>
<p>&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Cashbook/viewReport&quot;</span>,<span class="st0">&quot;Cash Book Report&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span> &nbsp;<br />
&lt;/ul&gt; &lt;/p&gt;<br />
&lt;p&gt;&lt;p&gt;Bank Book&lt;/p&gt; &nbsp;<br />
&lt;ul&gt;</p>
<p>&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Bankbook/addNew/receive&quot;</span>,<span class="st0">&quot;Bank Receive Entry&quot;</span><span class="br0">&#41;</span>;?&gt;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Bankbook/addNew/out&quot;</span>,<span class="st0">&quot;Bank Out Entry&quot;</span><span class="br0">&#41;</span>;?&gt;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Bankbook/viewReport&quot;</span>,<span class="st0">&quot;Bank Book Report&quot;</span><span class="br0">&#41;</span>;?&gt;<br />
&lt;/ul&gt; &lt;/p&gt;</p>
<p>&lt;p&gt;&lt;p&gt;Manual Journal&lt;/p&gt; &nbsp;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Journal/addNew&quot;</span>,<span class="st0">&quot;Manual Journal Entry&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span><br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Journal/viewReport&quot;</span>,<span class="st0">&quot;Manual Journal Report&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span><br />
&lt;/ul&gt; &lt;/p&gt;<br />
&lt;p&gt;&lt;p&gt;Report&lt;/p&gt;<br />
&lt;ul&gt; &nbsp;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Mainpage/trialBalance&quot;</span>,<span class="st0">&quot;Trial Balance&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span></p>
<p>&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Mainpage/balanceSheet&quot;</span>,<span class="st0">&quot;Balance Sheet&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span> &nbsp;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Mainpage/profitLoss&quot;</span>,<span class="st0">&quot;Profit and Loss&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span></p>
<p>&lt;/ul&gt; &lt;/p&gt;</p>
<p>&lt;p&gt;&lt;p&gt;Posting and COA&lt;/p&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Mainpage/doPosting&quot;</span>,<span class="st0">&quot;Post transaction&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span><br />
&lt;li&gt;&lt;?=anchor<span class="br0">&#40;</span><span class="st0">&quot;Coa/listCoa&quot;</span>,<span class="st0">&quot;Chart of Account Setting&quot;</span><span class="br0">&#41;</span><span class="kw2">?&gt;</span><br />
&lt;/ul&gt;&lt;/p&gt;</div>
<p>As we can see above, we call a helper function anchor(). This function will create a standard HTML anchor link based on your local site URL. So for example, if we call it <strong>achor(“Mainpage/trialBalance”, “Trial Balance”)</strong> then it will return this string:</p>
<p>&lt;a href=”http://localhost/Mainpage/trialBalance”&gt; Trial Balance &lt;/a&gt;</p>
<p>assumed that you have configured your site URL as <a href="http://localhost/">http://localhost/</a> on the config.php file.</p>
<p>Now we can run our application by pointing the browser to <a href="http://localhost">http://localhost</a> and it should return something like the following:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2010/05/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2010/05/image_thumb.png" width="404" height="484" /></a> </p>
<p>Congratulation! </p>
<p>Next we will begin to code the COA module.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c2efec71-3808-442a-9518-d1db80ef5dca" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/codeigniter" rel="tag">codeigniter</a>,<a href="http://technorati.com/tags/main+controller" rel="tag">main controller</a>,<a href="http://technorati.com/tags/accounting+system" rel="tag">accounting system</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/07/codeigniter-tutorial-creating-accounting-application-part-1-setting-up-the-environment/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 1 Setting Up the Environment</a></li><li><a href="http://www.dijexi.com/2009/09/codeigniter-tutorial-creating-accounting-application-part-4-preparing-to-code/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 4 Preparing to Code</a></li><li><a href="http://www.dijexi.com/2009/08/codeigniter-tutorial-creating-accounting-application-part-2-the-application-specification-and-uml-diagrams/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 2 The Application Specification and UML Diagrams</a></li><li><a href="http://www.dijexi.com/2009/08/codeigniter-tutorial-creating-accounting-application-part-3-er-diagram-and-creating-database/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 3 ER Diagram and Creating Database</a></li><li><a href="http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/" rel="bookmark">CodeIgniter: koneksi ke port MySQL tertentu selain 3306</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F05%2Fcodeigniter-tutorial-creating-accounting-application-part-5-the-mainpage%2F&amp;linkname=CodeIgniter%20Tutorial%3A%20%5BCreating%20Accounting%20Application%5D%20Part%205%20The%20Mainpage"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/05/codeigniter-tutorial-creating-accounting-application-part-5-the-mainpage/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Show the List of Installed Packages on Ubuntu or Debian</title>
		<link>http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/</link>
		<comments>http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 07:07:40 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Installed Packages]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[Show]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/</guid>
		<description><![CDATA[The command we need to use to list the packages currently installed in Ubuntu or Debian is dpkg &#8211;get-selections. For example: # dpkg --get-selections acpi install acpi-support-base install acpid install adduser install apache2 install apache2-mpm-prefork install apache2-utils install apache2.2-common install apt install apt-utils install aptitude install autoconf install automake install automake1.4 install autotools-dev install avahi-daemon [...]]]></description>
			<content:encoded><![CDATA[<p>The command we need to use to list the packages currently installed in Ubuntu or Debian is dpkg &#8211;get-selections. For example:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:43374872-820e-4a2d-99b6-9d85863a5f57" class="wlWriterEditableSmartContent">
<pre class="brush: bash"># dpkg --get-selections
acpi                                            install
acpi-support-base                               install
acpid                                           install
adduser                                         install
apache2                                         install
apache2-mpm-prefork                             install
apache2-utils                                   install
apache2.2-common                                install
apt                                             install
apt-utils                                       install
aptitude                                        install
autoconf                                        install
automake                                        install
automake1.4                                     install
autotools-dev                                   install
avahi-daemon                                    install
bacula-common                                   install
bacula-fd                                       install
base-files                                      install
base-passwd                                     install
bash                                            install
bind9-host                                      install
binutils                                        install

…
</pre>
</div>
<p>&#160;</p>
<p>It will return a long list showing all the installed packages. To filter to specific list of packages, for example we only need to show java packages, combine it with grep, for example:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:11cbddbb-5e63-4785-8d0f-f46fc65d247f" class="wlWriterEditableSmartContent">
<pre class="brush: bash"># dpkg --get-selections|grep java
java-common                                     install
java-gcj-compat                                 install
java-gcj-compat-headless                        install
libbcel-java                                    install
liblog4j1.2-java                                install
liblog4j1.2-java-gcj                            install
libmx4j-java                                    install
libpg-java                                      install
libregexp-java                                  install
sun-java6-bin                                   install
sun-java6-jdk                                   install
sun-java6-jre                                   install
</pre>
</div>
<p>We can find the locations of the files within a package from the list by using the dpkg -L command, such as:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:708c1ae9-703d-48ec-beaf-b5336d9c63e2" class="wlWriterEditableSmartContent">
<pre class="brush: bash"># dpkg -L sun-java6-jdk|more
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/sun-java6-jdk
/usr/share/doc/sun-java6-jdk/changelog.Debian.gz
/usr/share/doc/sun-java6-jdk/copyright
/usr/share/doc/sun-java6-jdk/README.alternatives
/usr/share/doc/sun-java6-jdk/README.html
/usr/share/menu
/usr/share/menu/sun-java6-jdk
/usr/share/applications
/usr/share/applications/sun-java6-jconsole.desktop
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/sun-java6-jdk
/usr/share/doc-base
/usr/share/doc-base/sun-java6-jdk-readme
/usr/lib
/usr/lib/jvm
/usr/lib/jvm/java-6-sun-1.6.0.12
/usr/lib/jvm/java-6-sun-1.6.0.12/include
/usr/lib/jvm/java-6-sun-1.6.0.12/include/linux
/usr/lib/jvm/java-6-sun-1.6.0.12/include/linux/jni_md.h
/usr/lib/jvm/java-6-sun-1.6.0.12/include/linux/jawt_md.h
/usr/lib/jvm/java-6-sun-1.6.0.12/include/jni.h
/usr/lib/jvm/java-6-sun-1.6.0.12/include/jdwpTransport.h

…
</pre>
</div>
</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d70453f3-f121-47be-9a4e-be700a6127e0" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Show" rel="tag">Show</a>,<a href="http://technorati.com/tags/List" rel="tag">List</a>,<a href="http://technorati.com/tags/Installed+Packages" rel="tag">Installed Packages</a>,<a href="http://technorati.com/tags/Ubuntu" rel="tag">Ubuntu</a>,<a href="http://technorati.com/tags/Debian" rel="tag">Debian</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2010/06/how-to-use-tor-project-anonymous-ip-with-curl-php-on-linux/" rel="bookmark">How to Use Tor Project Anonymous IP with Curl PHP on Linux</a></li><li><a href="http://www.dijexi.com/2010/05/setup-kannel-sms-gateway-on-ubuntu/" rel="bookmark">Setup Kannel SMS Gateway on Ubuntu</a></li><li><a href="http://www.dijexi.com/2010/08/how-to-install-asterisk-1-6-on-ubuntu/" rel="bookmark">How to install Asterisk 1.6 on Ubuntu</a></li><li><a href="http://www.dijexi.com/2009/06/how-to-change-upload-file-size-on-a-windows-localhost/" rel="bookmark">How to change upload file size on a Windows localhost</a></li><li><a href="http://www.dijexi.com/2010/09/developing-web-based-pos-application-using-ruby-on-rails-on-debian-5/" rel="bookmark">Developing Web Based POS Application Using Ruby on Rails on Debian 5</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F03%2Fshow-the-list-of-installed-packages-on-ubuntu-or-debian%2F&amp;linkname=Show%20the%20List%20of%20Installed%20Packages%20on%20Ubuntu%20or%20Debian"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/03/show-the-list-of-installed-packages-on-ubuntu-or-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Funambol Mobile Open Source Book Released</title>
		<link>http://www.dijexi.com/2010/02/funambol-mobile-open-source-book-released/</link>
		<comments>http://www.dijexi.com/2010/02/funambol-mobile-open-source-book-released/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 08:31:00 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[Funambol]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[packt publisher]]></category>
		<category><![CDATA[sample]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2010/02/funambol-mobile-open-source-book-released/</guid>
		<description><![CDATA[This book explains almost all about syncing your email and other data with mobile devices using Funambol 7.1 Provide push email capabilities and synchronization services for mobile devices and PC software using Funambol Develop your own Funambol extensions Many examples explaining all functionalities provided by the Funambol platform An easy reading for system administrators and [...]]]></description>
			<content:encoded><![CDATA[<p>This book explains almost all about syncing your email and other data with mobile devices using Funambol 7.1 <a href="http://www.packtpub.com/funambol-mobile-open-source/book/mid/mid%2F040210jbpvg5?utm_source=dijexi.com&amp;utm_medium=affiliate&amp;utm_content=blog&amp;utm_campaign=mdb_002333" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://www.dijexi.com/wp-content/uploads/2010/02/image1.png" width="193" height="244" /></a></p>
<ul>
<li>Provide push email capabilities and synchronization services for mobile devices and PC software using Funambol </li>
<li>Develop your own Funambol extensions </li>
<li>Many examples explaining all functionalities provided by the Funambol platform </li>
<li>An easy reading for system administrators and developers who want to keep in sync enterprise data</li>
</ul>
<p>&#160;</p>
<h3 align="center"><a href="http://www.packtpub.com/funambol-mobile-open-source/book/mid/mid%2F040210jbpvg5?utm_source=dijexi.com&amp;utm_medium=affiliate&amp;utm_content=blog&amp;utm_campaign=mdb_002333" target="_blank">Click here for this book’s home page.</a></h3>
<p>&#160;</p>
<h2><a name="indetail">In Detail</a></h2>
<p>Funambol is a free and open source mobile synchronization server that provides push email, address book and calendar (PIM) data synchronization, and device management for wireless devices. Are you looking to sync your email and other data with mobile devices for easy access? This book will show you how to do that via the Internet cloud.</p>
<p>With the help of this complete, practical guide you will learn how to access your email, calendar, contacts, important notes a lot more easily and quickly using Funambol. You will be able to sync a large number of online applications with your mobile devices. You will also be able to develop, deploy, and manage any mobile project.</p>
<p>This book will show you how to provide a full-featured PIM synchronization and push email service with Funambol.    <br />You will start by installing Funambol on a personal computer, and then move on to acquire detailed information on the Funambol architecture and the network requirements for deploying it. You will cover several components of Funambol such as Data Synchronization Server, Device Management, Client Plugins, and more. </p>
<p>As you reach the end of the book, you will delve deeper to explore the wide range of possibilities of the Funambol platform beyond the immediate needs of personal data synchronization and mobile email. The book is also a great starting point for anyone who aims to extend Funambol. This book was targeted at version 7.1 of Funambol, but is also applicable to version 8. </p>
<p>&#160;</p>
<p align="center"><a href="http://www.packtpub.com/article/funambol-mobile-open-source-table-of-contents">Read the full Table of Contents for Funambol Mobile Open Source</a></p>
<p align="center"><a href="http://www.packtpub.com/files/1540-funambol-sample-chapter-5-funambol-e-mail.pdf" target="_blank">Read the sample Content for Funambol Mobile Open Source</a></p>
<p> <span id="more-1312"></span>  <br /> <br />
<h2>What you will learn from this book</h2>
<ul>
<li>Install the server on both Linux and Windows environment, and learn how to start/stop Funambol services </li>
<li>Sync your data with other devices and get notified of new emails or other personal data changes </li>
<li>Start synchronization automatically to receive changes made with another application or device using push synchronization </li>
<li>Connect to the Data Synchronization Service using Funambol administration tool </li>
<li>Synchronize all different devices with a central PIM database and email system using the different push mechanisms </li>
<li>Access a database on a separate machine instead of the local database by configuring Funambol </li>
<li>Restrict access to specific users, add new users, and track registered users using the Funambol Administration Tool </li>
<li>Set up and start the PIM Connector and PIM Listener Service, and learn how it works in a complex scenario using a Windows Mobile phone </li>
<li>Develop a custom connector to access an external data source by following a simple tutorial-styled example</li>
</ul>
<h2>Approach</h2>
<p>The book is composed of two parts. The first part will take you through the steps required to fully understand and deploy Funambol to provide PIM synchronization and push email solution to your mobile users. This is done step-by-step, starting from a simple personal usage scenario to a more complex environment that must serve thousands of users. All components of the platform are smoothly introduced and explained, starting from the functionality they provide. The second part of the book is more informative and will assist you in building Funambol extensions. In particular, it contains an easy-to-follow tutorial that will allow you to write a Funambol connector in a few easy steps. </p>
<h2>Who this book is written for</h2>
<p>If you are looking forward to install and get started with Funambol, this book is for you. You need to have a technical background and be confident with a bit of code tweaking, but not a developer.    <br />General server administration skills are assumed and familiarity with Java will be a benefit in places. </p>
<hr />
<h2>Author(s)</h2>
<p><b>Stefano Fornari</b></p>
<p>Stefano Fornari is a co-founder and CTO of Funambol, Inc., the leading provider of open source mobile cloud sync and push email solutions for billions of phones. Stefano had several years of software development experience before starting the Funambol open source project in 2003. He was one of the main contributors of the project and was also the project manager. Today, Stefano is in charge of the engineering team of Funambol. Prior to his development work on Funambol, Fornari was the chief architect at Stigma Online where he played a key role in the development of the company’s flagship portal product, SolWeb Intra. He has also held positions at Compaq, where he was an advisor on wireless technologies in PDAs, and at Art Technology Group (ATG) as a consultant. He holds an M.S. Degree in Computer Science.</p>
</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b5ac5579-4ffe-43cb-b805-3d02f5325c3d" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/funambol" rel="tag">funambol</a>,<a href="http://technorati.com/tags/book" rel="tag">book</a>,<a href="http://technorati.com/tags/sample" rel="tag">sample</a>,<a href="http://technorati.com/tags/packt+publisher" rel="tag">packt publisher</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/10/funambol-for-blackberry-like-capabilities-on-cheap-handsets/" rel="bookmark">Funambol for BlackBerry-like capabilities on cheap handsets</a></li><li><a href="http://www.dijexi.com/2009/07/wordpress-mobile-blogging-using-blackberry/" rel="bookmark">WordPress Mobile Blogging Using BlackBerry</a></li><li><a href="http://www.dijexi.com/2009/08/free-online-video-format-conversion-sites/" rel="bookmark">Free Online Video Format Conversion Sites</a></li><li><a href="http://www.dijexi.com/2009/07/best-free-development-tools-and-editors-software/" rel="bookmark">Best Free Development Tools and Editors Software</a></li><li><a href="http://www.dijexi.com/2009/07/best-free-browsers-instant-messengers-remote-file-management-shell-and-linux-emulation-software/" rel="bookmark">Best Free Browsers, Instant Messengers, Remote File Management, Shell and Linux Emulation Software</a></li></ul></div><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2010%2F02%2Ffunambol-mobile-open-source-book-released%2F&amp;linkname=Funambol%20Mobile%20Open%20Source%20Book%20Released"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2010/02/funambol-mobile-open-source-book-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

