<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>It's me Jefri</title>
 <link href="http://jefri-p.com/" rel="self"/>
 <link href="http://jefri-p.com"/>
 <updated>2019-02-05T13:52:28+00:00</updated>
 <id>http://jefri-p.com</id>
 <author>
   <name>Jefri Pakpahan</name>
   <email></email>
 </author>

 
 <entry>
   <title>Importing database (Oracle) to Solr</title>
   <link href="http://jefri-p.com/2019/02/importing-database-oracle-to-solr"/>
   <updated>2019-02-05T03:10:15+00:00</updated>
   <id>http://jefri-p.com/2019/02/importing-database-oracle-to-solr</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://lucene.apache.org/solr/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;/assets/solr.png&quot; alt=&quot;Solr&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Solr adalah platform open source untuk search yang dibuat di atas Apache Lucene.&lt;/p&gt;

&lt;p&gt;Jika ada memiliki data di database (MySQL, PostgreSQL, Oracle, MsSQL).&lt;/p&gt;

&lt;p&gt;Disini kita akan coba import data Oracle menggunakan fitur Solr yakni Data Import Handler (DIH)
&lt;!--more--&gt;&lt;br /&gt;
Saya asumsikan Anda sudah menginstall Oracle 11g, Solr (7.4.0), dan Java (dalam hal ini Java 8).&lt;/p&gt;

&lt;h2 id=&quot;konfigurasi-datasource-database-oracle&quot;&gt;Konfigurasi Datasource Database Oracle&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html&quot;&gt;Download&lt;/a&gt; dan copy file jar Oracle Database JDBC driver ke server Solr Anda (semisal /solr/solr-6.4.0/server/).
    &lt;blockquote&gt;
      &lt;p&gt;Jika Anda menggunakan JDK 6 maka gunakan jar ojdbc6.jar, sebaliknya jika Anda menggunakan JDK 7 &amp;amp; JDK 8 gunakan ojdbc7.jar karna akan error jika salah menggunakan library.&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;Konfigurasikan Solr &lt;a href=&quot;https://gist.githubusercontent.com/jefrip/8c3fa95bb84ddc5d3a19a76d0df33f5e/raw/a24bf9a09df54cb86d58ec33e8f6f99eb340d320/schema.xml&quot;&gt;schema.xml&lt;/a&gt; (asumsi folder solr Anda berada pada direktori &lt;code class=&quot;highlighter-rouge&quot;&gt;/solr/solr-6.4.0/server/solr/&lt;/code&gt;) maka buat lah folder baru untuk configset (config, data, lib) pada &lt;code class=&quot;highlighter-rouge&quot;&gt;/solr/solr-6.4.0/server/solr/configsets/oracle_configs/conf&lt;/code&gt;. Tambahkan field-field apa saja yang akan di index ke dalam Solr&lt;/li&gt;
  &lt;li&gt;Konfigurasikan Oracle data source ke dalam Solr file &lt;a href=&quot;https://gist.githubusercontent.com/jefrip/abaea5ce2141459d5ecb9f92a4c77ef5/raw/e19a1b66d330471063c1142dc37cdf29925291b5/data-config.xml&quot;&gt;data-config.xml&lt;/a&gt; pada &lt;code class=&quot;highlighter-rouge&quot;&gt;/solr/solr-6.4.0/server/solr/configsets/oracle_configs/conf&lt;/code&gt; data source kurang lebih berisi informasi koneksi ke data source Oracle, username, password. data-config.xml juga berisi query Anda mengambil data dari Oracle yang akan di import ke Solr.&lt;/li&gt;
  &lt;li&gt;Konfigurasikan file solrconfig.xml dan karena kita menggunakan schema.xml maka didalamnya harus ada informasi requestHandler org.apache.solr.handler.dataimport.DataImportHandler, schemaFactory ClassicIndexSchemaFactory juga dalam solrconfig.xml kita sertakan unique id, semisal dalam hal ini menggunakan uuid generator.&lt;/li&gt;
  &lt;li&gt;Restart Solr server untuk mereload lib dan konfigurasi yang sudah kita taruh &lt;code class=&quot;highlighter-rouge&quot;&gt;bin/solr restart&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;menjalankan-data-import-di-solr&quot;&gt;Menjalankan data import di Solr&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Buka &lt;a href=&quot;http://localhost:8983/solr/&quot;&gt;http://localhost:8983/solr/&lt;/a&gt; Anda akan di arahkan ke Solr Admin Console.&lt;/li&gt;
  &lt;li&gt;Pilih menu data import pada Solr Admin Console, ada di URL &lt;code class=&quot;highlighter-rouge&quot;&gt;/dataimport&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Pada menu data import pilih &lt;code class=&quot;highlighter-rouge&quot;&gt;full-import&lt;/code&gt; ceklis &lt;code class=&quot;highlighter-rouge&quot;&gt;clean, commit&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Klik tombol &lt;code class=&quot;highlighter-rouge&quot;&gt;Execute&lt;/code&gt; maka Anda akan otomatis melakukan import data dari Oracle ke Solr.&lt;/li&gt;
  &lt;li&gt;Jika sudah selesai mengimport data Anda dapat melihat hasil import data Anda melalui menu &lt;code class=&quot;highlighter-rouge&quot;&gt;Query&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Selamat mencoba.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Belajar Pandas</title>
   <link href="http://jefri-p.com/2018/09/belajar-pandas"/>
   <updated>2018-09-21T03:10:15+00:00</updated>
   <id>http://jefri-p.com/2018/09/belajar-pandas</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;https://pandas.pydata.org&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;/assets/pandas.png&quot; alt=&quot;Pandas&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Beberapa waktu lalu berawal dari keingintahuan saya untuk mengolah data csv yang agak besar, rasanya agak lebih mudah menggunakan Python untuk mengolah data csv yang cukup besar. Saya memulai belajar menggunakan Python (Python 3) dan ternyata cukup mudah hampir mirip seperti PHP yang selama ini saya gunakan.&lt;/p&gt;

&lt;p&gt;Jadi beberapa hal yang harus saya lakukan adalah generate data dummy, dan mengolahnya. Dikarenakan saya baru saja mencoba ‘Python’ mungkin beberapa percobaan akan jadi catatan saya di blog ini, terutama penggunaan Pandas yang saya rasa sangat powerful dan cepat sekali dalam pengolahan data csv untuk ukuran data yang lumayan besar.
&lt;!--more--&gt;
Pastikan Anda sudah menginstall Pandas dengan cara :
Install melalui Anaconda&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;conda install pandas
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Atau install melalui pip&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip install --upgrade pandas
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Pada blog saya kali ini akan menggunakan data yang berasal dari dataset dki jakarta pada laman http://data.jakarta.go.id/dataset/jumlahrtrwperkelurahandkijakarta. Bentuk data yang kita gunakan berbentuk csv &lt;a href=&quot;https://gist.githubusercontent.com/jefrip/86276aeb5aa3bffa384124574dae3535/raw/7b17f82a5a02a9d87514f6c7415bc9a92e57bb30/Data-Jumlah-RT-RW-per-Kelurahan_2013-2017.csv&quot;&gt;Data-Jumlah-RT-RW-per-Kelurahan_2013-2017.csv&lt;/a&gt;.&lt;/p&gt;

&lt;h4 id=&quot;struktur-data-pandas&quot;&gt;Struktur data Pandas&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;Series (Array 1 Dimensi)&lt;/li&gt;
  &lt;li&gt;Dataframe (Array 2 Dimensi)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Untuk memulai/membaca file csv pada Pandas sangat mudah sekali&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;import pandas as pd
df = pd.read_csv('Data-Jumlah-RT-RW-per-Kelurahan_2013-2017.csv')
print(df)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;df akan berisi sebuah Dataframe / array 2 dimensi yang akan bisa kita olah/ubah ke series, contoh output seperti berikut :&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;      tahun         nama_provinsi    ...    jumlah_rt jumlah_rw
0      2013  PROVINSI DKI JAKARTA    ...           29         5
1      2013  PROVINSI DKI JAKARTA    ...           31         5
2      2013  PROVINSI DKI JAKARTA    ...           15         3
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Kita akan melihat data unik(distict dalam SQL) kolom kabupaten_kota :&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;available_kabkota = df['nama_kabupaten_kota'].unique()
print(available_kabkota)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Maka output yang dihasilkan adalah :&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;['KAB.ADM.KEP.SERIBU' 'JAKARTA PUSAT' 'JAKARTA UTARA' 'JAKARTA BARAT' 'JAKARTA SELATAN' 'JAKARTA TIMUR']
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;group-by-split-apply-combine&quot;&gt;Group By: split-apply-combine&lt;/h4&gt;
&lt;p&gt;Jika kita ingin menghitung record suatu kolom tertentu kita gunakan fungsi size()&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;count_kabkota = df.groupby(['nama_kabupaten_kota']).size().reset_index(name='counts')
print(count_kabkota)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Outputnya :&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  nama_kabupaten_kota  counts
0       JAKARTA BARAT     280
1       JAKARTA PUSAT     220
2     JAKARTA SELATAN     325
3       JAKARTA TIMUR     325
4       JAKARTA UTARA     155
5  KAB.ADM.KEP.SERIBU      30
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Untuk penjumlahan suatu kolom terhadap kolom tertentu, semisal kita ingin total pada kolom jumlah_rt terhadap kolom nama_kabupaten_kota, nama_kecamatan, nama_kelurahan&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rt = df.groupby(['nama_kabupaten_kota','nama_kecamatan','nama_kelurahan'])['jumlah_rt'].sum().reset_index()
print(rt)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Outputnya sebagai berikut :&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    nama_kabupaten_kota     nama_kecamatan         nama_kelurahan  jumlah_rt
0         JAKARTA BARAT         CENGKARENG       CENGKARENG BARAT        906
1         JAKARTA BARAT         CENGKARENG       CENGKARENG TIMUR       1132
2         JAKARTA BARAT         CENGKARENG           DURI KOSAMBI        843
3         JAKARTA BARAT         CENGKARENG                  KAPUK       1110
4         JAKARTA BARAT         CENGKARENG     KEDAUNG KALI ANGKE        494
5         JAKARTA BARAT         CENGKARENG             RAWA BUAYA        700
6         JAKARTA BARAT  GROGOL PETAMBURAN                 GROGOL        570
7         JAKARTA BARAT  GROGOL PETAMBURAN               JELAMBAR        695
8         JAKARTA BARAT  GROGOL PETAMBURAN          JELAMBAR BARU        674
9         JAKARTA BARAT  GROGOL PETAMBURAN  TANJUNG DUREN SELATAN        463
10        JAKARTA BARAT  GROGOL PETAMBURAN    TANJUNG DUREN UTARA        450
11        JAKARTA BARAT  GROGOL PETAMBURAN                 TOMANG        870
12        JAKARTA BARAT  GROGOL PETAMBURAN          WIJAYA KUSUMA        635
13        JAKARTA BARAT         KALI DERES              KALIDERES        908
14        JAKARTA BARAT         KALI DERES                  KAMAL        510
15        JAKARTA BARAT         KALI DERES             PEGADUNGAN        945
16        JAKARTA BARAT         KALI DERES                SEMANAN        583
17        JAKARTA BARAT         KALI DERES             TEGAL ALUR        822
18        JAKARTA BARAT        KEBON JERUK              DURI KEPA        685
19        JAKARTA BARAT        KEBON JERUK            KEBON JERUK        665
20        JAKARTA BARAT        KEBON JERUK         KEDOYA SELATAN        365
21        JAKARTA BARAT        KEBON JERUK           KEDOYA UTARA        660
22        JAKARTA BARAT        KEBON JERUK             KELAPA DUA        300
23        JAKARTA BARAT        KEBON JERUK       SUKABUMI SELATAN        390
24        JAKARTA BARAT        KEBON JERUK         SUKABUMI UTARA        515
25        JAKARTA BARAT          KEMBANGAN                  JOGLO        570
26        JAKARTA BARAT          KEMBANGAN      KEMBANGAN SELATAN        388
27        JAKARTA BARAT          KEMBANGAN        KEMBANGAN UTARA        590
28        JAKARTA BARAT          KEMBANGAN         MERUYA SELATAN        420
29        JAKARTA BARAT          KEMBANGAN           MERUYA UTARA        630
..                  ...                ...                    ...        ...
237       JAKARTA UTARA      KELAPA GADING    KELAPA GADING BARAT       1084
238       JAKARTA UTARA      KELAPA GADING    KELAPA GADING TIMUR       1211
239       JAKARTA UTARA      KELAPA GADING         PEGANGSAAN DUA       1262
240       JAKARTA UTARA               KOJA                   KOJA        735
241       JAKARTA UTARA               KOJA                  LAGOA       1110
242       JAKARTA UTARA               KOJA     RAWA BADAK SELATAN        545
243       JAKARTA UTARA               KOJA       RAWA BADAK UTARA        595
244       JAKARTA UTARA               KOJA           TUGU SELATAN        475
245       JAKARTA UTARA               KOJA             TUGU UTARA       1070
246       JAKARTA UTARA         PADEMANGAN                  ANCOL        346
247       JAKARTA UTARA         PADEMANGAN       PADEMANGAN BARAT       1073
248       JAKARTA UTARA         PADEMANGAN       PADEMANGAN TIMUR        767
249       JAKARTA UTARA        PENJARINGAN            KAMAL MUARA        224
250       JAKARTA UTARA        PENJARINGAN            KAPUK MUARA        500
251       JAKARTA UTARA        PENJARINGAN              PEJAGALAN       1125
252       JAKARTA UTARA        PENJARINGAN            PENJARINGAN       1210
253       JAKARTA UTARA        PENJARINGAN                  PLUIT       1251
254       JAKARTA UTARA      TANJUNG PRIOK           KEBON BAWANG        980
255       JAKARTA UTARA      TANJUNG PRIOK               PAPANGGO        635
256       JAKARTA UTARA      TANJUNG PRIOK           SUNGAI BAMBU        520
257       JAKARTA UTARA      TANJUNG PRIOK           SUNTER AGUNG       1400
258       JAKARTA UTARA      TANJUNG PRIOK            SUNTER JAYA       1116
259       JAKARTA UTARA      TANJUNG PRIOK          TANJUNG PRIOK        790
260       JAKARTA UTARA      TANJUNG PRIOK                WARAKAS        920
261  KAB.ADM.KEP.SERIBU    KEP. SERIBU SLT                P. PARI         70
262  KAB.ADM.KEP.SERIBU    KEP. SERIBU SLT              P. TIDUNG        145
263  KAB.ADM.KEP.SERIBU    KEP. SERIBU SLT         P. UNTUNG JAWA         45
264  KAB.ADM.KEP.SERIBU    KEP. SERIBU UTR             P. HARAPAN         75
265  KAB.ADM.KEP.SERIBU    KEP. SERIBU UTR              P. KELAPA        155
266  KAB.ADM.KEP.SERIBU    KEP. SERIBU UTR            P. PANGGANG        145
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Sekian.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Yii 2.0 + Jasig phpCAS</title>
   <link href="http://jefri-p.com/2015/02/yii-2-0-jasig-phpcas"/>
   <updated>2015-02-03T03:18:36+00:00</updated>
   <id>http://jefri-p.com/2015/02/yii-2-0-jasig-phpcas</id>
   <content type="html">&lt;p&gt;Setelah di posting sebelumnya tentang &lt;a href=&quot;https://staff.blog.ui.ac.id/jefri.p/2014/09/my-yii-environment/&quot;&gt;Yii Environtment&lt;/a&gt;, di kantor saya yakni PPSI yang baru berubah menjadi DSTI sudah menggunakan Single Sign On melalui phpCAS. Beberapa aplikasi baru diharapkan menggunakan SSO untuk login akun JUITA (akun UI). Yii 2.0 adalah framework yang saya pilih untuk SSO menggunakan library phpCAS, caranya pun cukup mudah.&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;1. Pastikan Anda mempunyai Composer (&lt;a href=&quot;https://staff.blog.ui.ac.id/jefri.p/2014/05/instalasi-composer-lewat-phar-php-archive/&quot;&gt;cara instalasi Composer&lt;/a&gt;) dan sudah menginstalasi Yii 2.0 Framework (baik basic ataupun advanced, disini saya mengunduh aplikasi &lt;a href=&quot;https://github.com/yiisoft/yii2/releases/download/2.0.2/yii-basic-app-2.0.2.tgz&quot;&gt;Yii 2.0 basic app&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;2. Jangan lupa lakukan perintah composer &lt;code&gt;php composer.phar global require &quot;fxp/composer-asset-plugin:1.0.0-beta4&quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;3. Tambahkan library phpCAS pada file composer.json seperti berikut (punya saya) :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;s2&quot;&gt;&quot;require&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;php&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;=5.4.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yiisoft/yii2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yiisoft/yii2-bootstrap&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yiisoft/yii2-swiftmailer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;jasig/phpcas&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.3.3&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;lalu lakukan &lt;code&gt;composer update&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;4. Sekarang tinggal setting &lt;strong&gt;casHost&lt;/strong&gt;, &lt;strong&gt;casPort&lt;/strong&gt; dan &lt;strong&gt;casContext&lt;/strong&gt; dari CAS server, pada config/params.php tambahkan (contoh) :&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;'casHost'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'sso.ui.ac.id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;'casPort'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;443&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;'casContext'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'cas'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;* nb : Dibutuhkan hak akses aplikasi ke cas server dibutuhkan agar dapat mengakses CAS server.&lt;/p&gt;
&lt;p&gt;5. Contoh controller/action untuk login ke CAS server&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://own.ui.ac.id/git/snippets/1&quot; title=&quot;Snippet SiteController&quot; target=&quot;_blank&quot;&gt;Snippet SiteController&lt;/a&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c1&quot;&gt;// Enable debugging
&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;\phpCAS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setDebug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Initialize phpCAS
&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;\phpCAS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CAS_VERSION_2_0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Yii&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'casHost'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Yii&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'casPort'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Yii&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'casContext'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;\phpCAS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setNoCasServerValidation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;\phpCAS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;forceAuthentication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\phpCAS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Anda akan diminta login SSO, setelah login maka akan muncul username Anda.&lt;/p&gt;
&lt;p&gt;Sekian.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>My Yii Environment</title>
   <link href="http://jefri-p.com/2014/09/my-yii-environment"/>
   <updated>2014-09-29T02:27:34+00:00</updated>
   <id>http://jefri-p.com/2014/09/my-yii-environment</id>
   <content type="html">&lt;p&gt;Saya baru dalam hal mengembangkan aplikasi web dengan Yii Framework, tetapi sudah menemukan tools dasar untuk pengembangan aplikasi web. Berikut tools yang saya gunakan, diantaranya :&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;Yii 1.1&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Yii PHP Framework (&lt;a href=&quot;https://github.com/yiisoft/yii/releases/download/1.1.15/yii-1.1.15.022a51.tar.gz&quot; title=&quot;Yii Framework 1.1.15.022a51&quot;&gt;yii-1.1.15.022a51&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;- Versi terakhir dari Yii Framework 1.1&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://yiibooster.clevertech.biz/&quot; title=&quot;Yii Booster&quot;&gt;Yii Booster&lt;/a&gt; 4.0.1 (Menggunakan Twitter Bootstrap 3.1.1 dan min butuh PHP 5.4) atau versi lama Yii Booster 3.1.1 (Menggunakan Twitter Bootstrap 2.3.2 kompatibel dengan PHP 5.3)&lt;/p&gt;
&lt;p&gt;- Untuk keperluan template, Form, dan (the awesome) Gii versi bootstrap. (btw saya fans Twitter Bootstrap :D)&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/extension/yii-user/&quot; title=&quot;Yii user&quot;&gt;Yii-User&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;- Untuk keperluan manajemen user/login&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.yiiframework.com/extension/rights/&quot; title=&quot;Yii Rights&quot;&gt;Rights&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- Untuk manajemen role atau hak akses terhadap suatu controller atau action.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;Yii 2&lt;/strong&gt; &lt;/h3&gt;
&lt;p&gt;*akan diupdate kalau sudah mencoba,hehe..&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;- Yii Framework 2.0 dapat di install melalui 2 cara yakni :&lt;/p&gt;
&lt;p&gt;  -- Install dari Composer (&lt;a href=&quot;http://www.yiiframework.com/download/#yii2&quot;&gt;Yii 2.0&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;  -- Install dari download github (&lt;a href=&quot;https://github.com/yiisoft/yii2/releases/download/2.0.2/yii-basic-app-2.0.2.tgz&quot;&gt;Yii 2.0.2 Basic App&lt;/a&gt;, &lt;a href=&quot;https://github.com/yiisoft/yii2/releases/download/2.0.2/yii-advanced-app-2.0.2.tgz&quot;&gt;Yii 2.0.2 Advanced App&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Next post cara mudah menggunakan tools diatas..&lt;/p&gt;
&lt;p&gt;Sekian.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Instalasi Composer lewat Phar (PHP archive)</title>
   <link href="http://jefri-p.com/2014/05/instalasi-composer-lewat-phar-php-archive"/>
   <updated>2014-05-12T02:51:10+00:00</updated>
   <id>http://jefri-p.com/2014/05/instalasi-composer-lewat-phar-php-archive</id>
   <content type="html">&lt;h2&gt;Pendahuluan&lt;/h2&gt;
&lt;p&gt;Untuk beberapa alasan saya membutuhkan Composer untuk menginstall paket PHP dibanding &lt;a href=&quot;http://pear.php.net/&quot;&gt;PEAR&lt;/a&gt;. Composer mempunyai repository yaitu &lt;a href=&quot;https://packagist.org/&quot;&gt;packagist&lt;/a&gt;, Packagist di ibaratkan mirip Maven pada Java hanya saja Packagist khusus PHP dan menyediakan banyak paket PHP yang sangat lengkap. Saat tulisan ini ditulis terdapat sekitar 29.662 Paket &lt;a href=&quot;https://packagist.org/statistics&quot;&gt;https://packagist.org/statistics&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;h2&gt;Instalasi&lt;/h2&gt;
&lt;p&gt;Kebutuhan sistem :&lt;/p&gt;
&lt;p&gt;- Composer membutuhkan PHP &amp;gt;= 5.3.2.&lt;/p&gt;
&lt;p&gt;Unduh Composer &lt;a href=&quot;https://getcomposer.org/download/&quot;&gt;https://getcomposer.org/download/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Pada Linux :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;curl -sS https://getcomposer.org/installer | php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Akan menghasilkan composer.phar, Anda dapat menjalankan dengan perintah &lt;code&gt;php composer.phar &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Atau bila ingin menjadi shortcut &lt;code&gt;mv composer.phar /usr/local/bin/composer&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;sehingga tinggal menjalankan &lt;code&gt;composer&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Untuk pengguna Windows hanya tinggal mengunduh dan instal file &lt;a href=&quot;https://getcomposer.org/Composer-Setup.exe&quot;&gt;Composer-Setup.exe&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Tulisan berikutnya akan menginstall paket PHP lewat Composer.&lt;/p&gt;
&lt;p&gt;See ya&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Error MySQL : mysql_connect(): Headers and client library minor version mismatch</title>
   <link href="http://jefri-p.com/2014/04/error-mysql-mysql_connect-headers-and-client-library-minor-version-mismatch"/>
   <updated>2014-04-09T22:59:32+00:00</updated>
   <id>http://jefri-p.com/2014/04/error-mysql-mysql_connect-headers-and-client-library-minor-version-mismatch</id>
   <content type="html">&lt;p&gt;Beberapa waktu lalu sedang ramai-ramainya bug OpenSSL CVE-2014-0160 aka HeartBleed yang ditulis oleh rekan saya JP (&lt;a href=&quot;https://staff.blog.ui.ac.id/jp/2014/04/10/galat-heartbleed-pada-openssl/&quot; title=&quot;galat-heartbleed-pada-openssl&quot; target=&quot;_blank&quot;&gt;https://staff.blog.ui.ac.id/jp/2014/04/10/galat-heartbleed-pada-openssl/&lt;/a&gt;), Sehingga mengharuskan upgrade pada sisi server. Namun diwaktu itu juga mysql pada sistem pun ikut terupgrade ke versi MySQL 5.6.17-1~dotdeb.1 yang menyebabkan error : &lt;strong&gt;mysql_connect(): Headers and client library minor version mismatch&lt;/strong&gt;.&lt;!--more--&gt;&lt;/p&gt;
&lt;h2&gt;Permasalahan :&lt;/h2&gt;
&lt;p&gt;Ternyata setelah ditelusuri error ini terjadi dikarenakan PHP yang sudah terkompilasi dengan sistem terhubung dengan MySQL versi lama sebelum ditingkatkan ke versi yang lebih baru.&lt;/p&gt;
&lt;h2&gt;Cara Mengatasi&lt;/h2&gt;
&lt;p&gt;Cara mudah untuk mengatasi error ini adalah dengan install php5-mysqlnd :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo apt-get install php5-mysqlnd&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Terima kasih untuk bapak &lt;a href=&quot;https://staff.blog.ui.ac.id/t.a.sabastian/&quot;&gt;Tonny&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Referensi : &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;http://stackoverflow.com/questions/10759334/headers-and-client-library-minor-version-mismatch&quot; target=&quot;_blank&quot;&gt;http://stackoverflow.com/questions/10759334/headers-and-client-library-minor-version-mismatch&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;http://www.dotdeb.org/2014/04/04/about-the-mysql_connect-headers-and-client-library-minor-version-mismatch-warning-2/&quot;&gt;http://www.dotdeb.org/2014/04/04/about-the-mysql_connect-headers-and-client-library-minor-version-mismatch-warning-2/&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Mengakali instal aplikasi yang membutuhkan iOS 7.0 agar kompatibel dengan iOS 6 kebawah</title>
   <link href="http://jefri-p.com/2013/12/mengakali-instal-aplikasi-yang-membutuhkan-ios-7-0-agar-kompatibel-dengan-ios-6-kebawah"/>
   <updated>2013-12-09T00:40:44+00:00</updated>
   <id>http://jefri-p.com/2013/12/mengakali-instal-aplikasi-yang-membutuhkan-ios-7-0-agar-kompatibel-dengan-ios-6-kebawah</id>
   <content type="html">&lt;p&gt;Seperti judulnya saya sempat stuck karena tidak bisa menginstal aplikasi yang saya inginkan, dikarenakan membutuhkan minimal iOS 7.0. Saya adalah penggemar produk Apple namun karena keterbatasan dana jadi hanya mempunyai produk yang low end(jadul), smartphone yang saya punya adalah iPhone 3GS yang mana maksimal hanya sampai iOS 6.1.3 (sudah lumayan lemot).&lt;/p&gt;
&lt;p&gt;Cara Mengakali instal aplikasi yang membutuhkan iOS 7.0 agar kompatibel dengan iOS 6 kebawah adalah :&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;1. Unduh aplikasi yang Anda inginkan yang minimal iOS 7.0 menggunakan iTunes dengan login Anda melalui PC (ingat PC)&lt;/p&gt;
&lt;p&gt;2. Setelah selesai mengunduh di iTunes PC Anda, buka Appstore di iPhone Anda dan cari Aplikasi yang ingin Anda unduh tersebut (nanti akan ada tanda bahwa anda pernah mengunduhnya). Lalu klik tanda download tersebut akan ada konfirmasi kurang lebih seperti berikut :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&quot;Download an older version of this app?&quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The current version requires iOS 7.0 or later, but you can download the last compatible version.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;3. Pada box konfirmasi Klik &lt;strong&gt;Download&lt;/strong&gt; dan taraaa... Aplikasi akan diunduh dan diinstall.&lt;/p&gt;
&lt;p&gt;NB : saya belum ketemu aplikasi yang mempunyai masalah dengan iOS 6 kebawah, mungkin saja gagal jika aplikasi hanya di khususkan iOS 7.0 keatas saja.&lt;/p&gt;
&lt;p&gt;Semoga Bermanfaat.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Kohana Framework 3.x : Error zlib output compression</title>
   <link href="http://jefri-p.com/2013/12/kohana-framework-3-x-error-zlib-output-compression"/>
   <updated>2013-12-08T20:31:15+00:00</updated>
   <id>http://jefri-p.com/2013/12/kohana-framework-3-x-error-zlib-output-compression</id>
   <content type="html">&lt;h2&gt;PROBLEM&lt;/h2&gt;
&lt;p&gt;Error message&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&quot;ob_end_flush() [&lt;a href=&quot;ref.outcontrol&quot;&gt;ref.outcontrol&lt;/a&gt;]: failed to delete buffer zlib output compression&quot;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Error terjadi pada saat saya menggunakan fungsi $response-&amp;gt;send_file() , header file berubah alhasil file menjadi korup.&lt;/p&gt;
&lt;p&gt;Saya cek php.ini zlib.output_compression = On&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Sudah mencoba yang disarankan &lt;a href=&quot;http://code.iviable.com/2011/11/09/zlib-output_compression-with-ini_set-doesnt-work-as-expected/&quot; target=&quot;_blank&quot;&gt;http://code.iviable.com/2011/11/09/zlib-output_compression-with-ini_set-doesnt-work-as-expected/&lt;/a&gt; tetapi tetap tidak dapat jalan.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;SOLUSI&lt;/h2&gt;
&lt;p&gt;File system\classes\Kohana\Response.php dapat di patch pada line 506 - 510 &lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ob_get_level&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Flush all output buffers
&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ob_end_flush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Diganti dengan patch dari &lt;a href=&quot;https://github.com/bcosca/fatfree/issues/262#issuecomment-13414180&quot; target=&quot;_blank&quot;&gt;https://github.com/bcosca/fatfree/issues/262#issuecomment-13414180&lt;/a&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;array_diff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ob_list_handlers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'default output handler'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;ob_clean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Atau jika tidak menggunakan kompresi dapat diubah php.ini menjadi&lt;/p&gt;
&lt;p&gt;zlib.output_compression = Off&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Weka Tutorial - Perkenalan, Membaca dan Membuat ARFF</title>
   <link href="http://jefri-p.com/2013/10/weka-tutorial-perkenalan-membaca-dan-membuat-arff"/>
   <updated>2013-10-21T20:11:18+00:00</updated>
   <id>http://jefri-p.com/2013/10/weka-tutorial-perkenalan-membaca-dan-membuat-arff</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/assets/weka.png&quot; alt=&quot;weka&quot; width=&quot;375&quot; height=&quot;260&quot; class=&quot;aligncenter size-full wp-image-280&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Akhir-akhir ini saya sedang bermain-main dengan Weka, baik versi GUI ataupun library untuk menggunakan fungsi-fungsi Weka (Instances, Filter, Classification, Clustering, dll). Supaya tidak lupa saya akan menuliskan satu persatu penggunaan library Weka (&lt;a href=&quot;https://github.com/jefrip/WekaTutorial/raw/master/libs/weka-3.7.3.jar&quot;&gt;weka-3.7.3.jar&lt;/a&gt;) yang sudah pernah saya lakukan.&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Weka dalam penggunaannya menggunakan file ARFF (Attribute-Relation File Format) adalah file yang digunakan Weka yang berisi 1 atau lebih instances dari atribut. Dalam file ARFF biasanya terdapat @RELATION namarelasi untuk menamakan relasi sebuah file ARFF, @ATTRIBUTE untuk penamaan setiap atribut baik numeric, nominal, string dan date. sedangkan @DATA pada setiap line untuk merepresentasikan sebuah instances. (Penjelasan lengkapnya ada &lt;a href=&quot;http://weka.wikispaces.com/ARFF+%28stable+version%29&quot;&gt;disini&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;Langkah pertama yang terpenting dalam Weka adalah membaca file ARFF / membuat instances sebelum akan diproses klasifikasi, kluster atau hal lainnya.&lt;/p&gt;
&lt;h2&gt;Membaca File ARFF&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;weka.core.Instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.BufferedReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.FileReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Membaca file iris.arff menggunakan BufferedReader&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;BufferedReader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BufferedReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FileReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/data/iris.arff&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Membuat Instances dengan data dari file iris.arff&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Instances&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Set Class Index untuk memberitahu kelas dari target, yang akan digunakan klasifikasi. kelas target berada pada atribut terakhir.&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setClassIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;numAttributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;File iris.arff dapat ditemukan pada folder Weka\data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;Membuat Instances format ARFF&lt;/h2&gt;
&lt;p&gt;Sedangkan untuk membuat sebuah instances berikut contoh untuk dataset iris :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;makeInstance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Membuat Attribute List&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Membuat 4 Attribute&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sepallength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sepallength&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sepalwidth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sepalwidth&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;petallength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;petallength&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;petalwidth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;petalwidth&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Membuat attribute kelas target&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;classVal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ArrayList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;classVal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Iris-setosa&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;classVal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Iris-versicolor&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;classVal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Iris-virginica&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Memasukkan Attribute ke Attribute List&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sepallength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sepalwidth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;petallength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;petalwidth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Attribute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;class&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;classVal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Instances baru dengan nama relasi &quot;iris&quot; dengan atributList dan index 0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Instances&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;iris&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attributeList&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Set Class Index untuk memberitahu kelas dari target, yang akan digunakan klasifikasi. kelas target berada pada atribut terakhir.&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setClassIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;numAttributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Membuat dan tambah kan Attribute ke instance&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Instance&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inst_co&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DenseInstance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;numAttributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Men set nilai dari Attribute:&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;inst_co&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sepallength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;6.9&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;inst_co&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sepalwidth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;inst_co&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;petallength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;5.1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;inst_co&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;petalwidth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;2.3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//menambahkan instances dari instance inst_co&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inst_co&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;===== Instance dataset =====&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Hasil dari instances yang dibuat manual :&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;@relation iris
@attribute sepallength numeric
@attribute sepalwidth numeric
@attribute petallength numeric
@attribute petalwidth numeric
@attribute class {Iris-setosa,Iris-versicolor,Iris-virginica}

@data

6.9,3.1,5.1,2.3,?&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;Menyimpan instance ke file arff&lt;/h2&gt;
&lt;p&gt;Anda dapat menyimpan instances yang sudah di buat ke file arff dengan menggunakan fungsi BufferedWriter di java.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;BufferedWriter&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BufferedWriter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FileWriter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;data/iris_create.arff&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instances&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;flush&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Sekarang cukup mudah bukan membuat sebuah instances baru melalui java. thx weka wikispaces :D&lt;/p&gt;
&lt;p&gt;Berikut file source code dan library sudah saya upload ke &lt;a href=&quot;https://github.com/jefrip/WekaTutorial&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;References : &lt;/h2&gt;
&lt;p&gt;- &lt;a href=&quot;http://weka.wikispaces.com/ARFF+%28stable+version%29&quot;&gt;http://weka.wikispaces.com/ARFF+%28stable+version%29&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Instances-ARFF%20File&quot;&gt;http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Instances-ARFF%20File&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;http://weka.wikispaces.com/Programmatic+Use&quot;&gt;http://weka.wikispaces.com/Programmatic+Use&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;http://weka.wikispaces.com/Save+Instances+to+an+ARFF+File&quot;&gt;http://weka.wikispaces.com/Save+Instances+to+an+ARFF+File&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Aplikasi RESTful (GIS Service) menggunakan Slim Framework</title>
   <link href="http://jefri-p.com/2013/08/aplikasi-restful-gis-service-menggunakan-slim-framework"/>
   <updated>2013-08-29T00:42:05+00:00</updated>
   <id>http://jefri-p.com/2013/08/aplikasi-restful-gis-service-menggunakan-slim-framework</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;/assets/slim.png&quot;&gt;&lt;img src=&quot;/assets/slim.png&quot; alt=&quot;slim&quot; width=&quot;134&quot; height=&quot;71&quot; class=&quot;aligncenter size-full&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Beberapa waktu lalu seorang teman (Edwin) membuatkan webservice (SOAP) dengan menggunakan java (http://210.247.242.106/GISService/Service?wsdl) tentang database provinsi, kecamatan dan desa di Indonesia yang didapatkan dari Panji09 pada thread di &lt;a href=&quot;http://www.kaskus.co.id/thread/518298ae8227cf927f000003/sharedatabase-wilayah-indonesia&quot;&gt;kaskus&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Kali ini saya mencoba untuk membuat webservice (REST) sederhana dengan menggunakan Slim Framework. &lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;h1&gt;&lt;strong&gt;Apa itu REST?&lt;/strong&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Representational_state_transfer&quot; title=&quot;REST&quot; target=&quot;_blank&quot;&gt;REST adalah Representational State Transfer&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;- REST menggunakan protokol HTTP (Create, Read, Update, Delete) dengan metode POST, GET, PUT, DELETE.&lt;/p&gt;
&lt;p&gt;- REST alternatif dari RPC atau webservice SOAP, WSDL dll.&lt;/p&gt;
&lt;p&gt;- REST sebenarnya bukanlah sebuah standar, hanya sebuah Architectural style bukan seperti SOAP menggunakan protokol.&lt;/p&gt;
&lt;h1&gt;&lt;strong&gt;Kenapa Slim Framework?&lt;/strong&gt;&lt;/h1&gt;
&lt;p&gt;- Karena mirip dengan &lt;a href=&quot;http://www.sinatrarb.com&quot; title=&quot;Sinatra&quot; target=&quot;_blank&quot;&gt;Sinatra&lt;/a&gt; (Ruby).&lt;/p&gt;
&lt;p&gt;- Slim menggunakan PHP &amp;gt;= 5.3.0.&lt;/p&gt;
&lt;p&gt;- Ukurannya relatif kecil.&lt;/p&gt;
&lt;p&gt;- Mudah dipelajari.&lt;/p&gt;
&lt;h1&gt;&lt;strong&gt;Fitur&lt;/strong&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;    Powerful router&lt;/p&gt;
&lt;p&gt;        Standard and custom HTTP methods&lt;/p&gt;
&lt;p&gt;        Route parameters with wildcards and conditions&lt;/p&gt;
&lt;p&gt;        Route redirect, halt, and pass&lt;/p&gt;
&lt;p&gt;        Route middleware&lt;/p&gt;
&lt;p&gt;    Template rendering with custom views&lt;/p&gt;
&lt;p&gt;    Flash messages&lt;/p&gt;
&lt;p&gt;    Secure cookies with AES-256 encryption&lt;/p&gt;
&lt;p&gt;    HTTP caching&lt;/p&gt;
&lt;p&gt;    Logging with custom log writers&lt;/p&gt;
&lt;p&gt;    Error handling and debugging&lt;/p&gt;
&lt;p&gt;    Middleware and hook architecture&lt;/p&gt;
&lt;p&gt;    Simple configuration&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Contoh penggunaan slim dengan koneksi ke database lewat PDO :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Slim/Slim.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'db.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;\Slim\Slim&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;registerAutoloader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Slim\Slim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'mode'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'production'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'log.writer'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Slim\Extras\Log\DateTimeFileWriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'path'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'./logs'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'name_format'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Y-m-d'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'message_format'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'%label% - %date% - %message%'&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;contentType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;application/json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/getProvinsis'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'getProvinsis'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/getKabupatens/:id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'getKabupatens'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/getKecamatans/:id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'getKecamatans'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/getDesas/:id'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'getDesas'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Only invoked if mode is &quot;production&quot;
&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;configureMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'production'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'log.enable'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'log.level'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Slim\Log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;WARN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'debug'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Only invoked if mode is &quot;development&quot;
&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;configureMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'development'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'log.enable'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'log.level'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;\Slim\Log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;DEBUG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;s1&quot;&gt;'debug'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;notFound&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'notFound coy'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//All Functions goes here
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getProvinsis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;global&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;select * FROM provinsi ORDER BY id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;etag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'getProvinsis'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getConnection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$provinsis&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fetchAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PDO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;FETCH_OBJ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$provinsis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;\PDOException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'{&quot;error&quot;:{&quot;text&quot;:'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'}}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getKabupatens&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SELECT * FROM kabupaten WHERE id_prov = :id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getConnection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;prepare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;bindParam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$kabupatens&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fetchAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$kabupatens&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;\PDOException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'{&quot;error&quot;:{&quot;text&quot;:'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'}}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getKecamatans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SELECT * FROM kecamatan WHERE id_kabupaten = :id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getConnection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;prepare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;bindParam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$kecamatans&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fetchAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$kecamatans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;\PDOException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'{&quot;error&quot;:{&quot;text&quot;:'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'}}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getDesas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;SELECT * FROM desa WHERE id_kecamatan = :id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getConnection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;prepare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;bindParam&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$desas&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fetchAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$desas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;\PDOException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'{&quot;error&quot;:{&quot;text&quot;:'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'}}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2&gt;Download &lt;/h2&gt;
&lt;p&gt;Anda dapat mendownload source code di &lt;a href=&quot;https://github.com/jefrip/GISService&quot;&gt;https://github.com/jefrip/GISService&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Referensi : &lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;https://github.com/edwinkun/GISService&quot;&gt;https://github.com/edwinkun/GISService&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href=&quot;http://coenraets.org/blog/2011/12/restful-services-with-jquery-php-and-the-slim-framework/&quot;&gt;http://coenraets.org/blog/2011/12/restful-services-with-jquery-php-and-the-slim-framework/&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Membuat Grafik menggunakan HTML (SVG)</title>
   <link href="http://jefri-p.com/2013/07/membuat-grafik-menggunakan-html-svg"/>
   <updated>2013-07-16T21:45:41+00:00</updated>
   <id>http://jefri-p.com/2013/07/membuat-grafik-menggunakan-html-svg</id>
   <content type="html">&lt;p&gt;Beberapa waktu lalu iseng-iseng ingin membuat grafik untuk keperluan kerjaan, sempat mikir buat pakai fusionchart (grafik berbasis flash berlisensi alias bayar). Waktu tugas kuliah pernah pake fusionchart, lumayan mudah menggunakannya tapi gw hindarin sesuatu yang berbasis flash (except youtube, mdh2an nanti ga berbasis flash :D) karna flash ternyata kurang bagus dan banyak makan resource CPU ampe bikin PC hang *curhat* gmn klo smartphone, bisa meledak *lebay dan kebetulan library d3js gratis seperti library reveal.js yang saya gunakan untuk &lt;a href=&quot;https://staff.blog.ui.ac.id/jefri.p/2013/05/selamat-tinggal-powerpoint/&quot; title=&quot;selamat-tinggal-powerpoint&quot; target=&quot;_blank&quot;&gt;mengganti powerpoint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Seperti biasa siapa lagi yang ditanya klo bukan ke mbah gugel. Sempat nyoba beberapa seperti &lt;a href=&quot;http://www.chartjs.org/&quot; title=&quot;chart.JS&quot; target=&quot;_blank&quot;&gt;Chart.Js&lt;/a&gt; bagus sih tapi terlalu simpel kurang interaktif dan kurang greget gitu,hehe..&lt;/p&gt;
&lt;p&gt;Akhirnya ketemu sama 1 library javascript yaitu &lt;a href=&quot;http://d3js.org/&quot; title=&quot;d3.js&quot; target=&quot;_blank&quot;&gt;D3.js&lt;/a&gt; menurut keterangan websitenya :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://d3js.org/&quot;&gt;&lt;img src=&quot;/assets/d3js.png&quot; alt=&quot;d3js&quot; width=&quot;968&quot; height=&quot;456&quot; class=&quot;aligncenter size-full wp-image-231&quot; /&gt;&lt;/a&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yes this is what i want! Terlebih saat melihat &lt;a href=&quot;https://github.com/mbostock/d3/wiki/Gallery&quot; title=&quot;D3js examples gallery&quot; target=&quot;_blank&quot;&gt;contoh-contoh grafiknya&lt;/a&gt;, banyak sekali, menantang dan cukup gereget lihatnya. Sehingga pilihan hati gw jatuh kepada d3.js :D, tapi cinta tetep buat si pacar *lho*.&lt;/p&gt;
&lt;p&gt;D3.js menggunakan syntax SVG dalam HTML dan mendukung banyak browser desktop bahkan mobile, berikut link tabel-tabel terhadap &lt;a href=&quot;http://caniuse.com/svg&quot; target=&quot;_blank&quot;&gt;dukungan SVG pada HTML&lt;/a&gt;. Pertama nyoba sih agak susah, tapi dari contoh-contohnya cukup mudah kebetulan saya hanya menggunakan Basic Chart saja.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bl.ocks.org/mbostock/3883245&quot; title=&quot;Line Chart&quot; target=&quot;_blank&quot;&gt;Line Chart&lt;/a&gt; menggunakan data dari format JSON :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;font&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sans-serif&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nc&quot;&gt;.axis&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;nc&quot;&gt;.axis&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;fill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;stroke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;shape-rendering&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;crispEdges&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nc&quot;&gt;.x.axis&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nc&quot;&gt;.line&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;fill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;stroke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;steelblue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;py&quot;&gt;stroke-width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1.5px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;d3.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;960&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseDate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%d-%b-%y&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;xAxis&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;axis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;orient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;bottom&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;yAxis&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;axis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;orient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;left&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;body&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;svg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;width&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;height&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;g&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;transform&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;translate(&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;,&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;data.json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;domain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;domain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;g&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;class&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;x axis&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;transform&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;translate(0,&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;xAxis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;g&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;class&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;y axis&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;yAxis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;text&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;transform&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;rotate(-90)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;y&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;dy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;.71em&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;text-anchor&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;end&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Price ($)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;svg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;path&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;datum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;class&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;line&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;att&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/pre&amp;gt;line&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;;
&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;https://gist.github.com/jefrip/6017698/raw/196fae11bff5bb8ff4424ad22a936b126dd25ba5/data.json&quot; title=&quot;data.json&quot; target=&quot;_blank&quot;&gt;data.json&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hasilnya &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/linechart.png&quot;&gt;&lt;img src=&quot;/assets/linechart-300x157.png&quot; alt=&quot;linechart&quot; width=&quot;300&quot; height=&quot;157&quot; class=&quot;aligncenter size-medium wp-image-225&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;beberapa troubleshooting yg pernah saya dapatkan adalah pada format date, php menghasilkan timestamp sedangkan d3.js menggunakan unix epoch (unix epoch = timestamp * 1000).&lt;/p&gt;
&lt;p&gt;Dilain kesempatan grafik akan dibuat lebih interaktif.&lt;/p&gt;
&lt;p&gt;See ya..&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Install Apache Maven pada Windows</title>
   <link href="http://jefri-p.com/2013/05/install-apache-maven-pada-windows"/>
   <updated>2013-05-23T01:43:40+00:00</updated>
   <id>http://jefri-p.com/2013/05/install-apache-maven-pada-windows</id>
   <content type="html">&lt;p&gt;Maven adalah sebuah build automation tool untuk java (selengkapnya &lt;a href=&quot;http://en.wikipedia.org/wiki/Apache_Maven&quot; target=&quot;_blank&quot;&gt;http://en.wikipedia.org/wiki/Apache_Maven&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;Sebuah project membutuhkan maven jika terdapat sebuah file xml, untuk maven 1 biasanya bernama project.xml sedangkan untuk maven 2 bernama pom.xml berisi informasi sebuah projek dan detil konfigurasi maven. Project Object Model adalah sebuah unit fundamental kerja di maven. Berikut cara untuk menginstall di windows :&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;1. Prequirement :&lt;/p&gt;
&lt;p&gt;- JDK (yang di pakai JDK jdk1.6.0_41, dapat mendownload di &lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/downloads/index.html&quot; target=&quot;_blank&quot;&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;2. Download Apache Maven di &lt;a href=&quot;http://maven.apache.org/download.cgi&quot; title=&quot;Download Apache Maven&quot; target=&quot;_blank&quot;&gt; http://maven.apache.org/download.cgi&lt;/a&gt; (penulis mendownload Maven 3.0.5 (Binary zip)) dan ekstrak apache-maven-3.0.5-bin.zip ke C:\maven, sehingga directory apache maven menjadi C:\maven\apache-maven-3.0.5&lt;/p&gt;
&lt;p&gt;4. Tambahkan environment variable (Saya tambahkan ke User Variables) yaitu : JAVA_HOME (direktori JDK Anda), M2_HOME (direktori apache maven), dan Path.&lt;/p&gt;
&lt;pre&gt;

JAVA_HOME = C:\Program Files\Java\jdk1.6.0_41

M2_HOME = C:\maven\apache-maven-3.0.5

Path = %JAVA_HOME%\bin;%M2_HOME%\bin

&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;/assets/maven_path.png&quot;&gt;&lt;img src=&quot;/assets/maven_path-258x300.png&quot; alt=&quot;maven_path&quot; width=&quot;258&quot; height=&quot;300&quot; class=&quot;aligncenter size-medium wp-image-194&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4. Jalankan
&lt;pre&gt;mvn --version&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;/assets/mvn_version.png&quot;&gt;&lt;img src=&quot;/assets/mvn_version-300x153.png&quot; alt=&quot;mvn_version&quot; width=&quot;300&quot; height=&quot;153&quot; class=&quot;aligncenter size-medium wp-image-197&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Yak maven sudah terinstal :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Selamat tinggal Powerpoint...</title>
   <link href="http://jefri-p.com/2013/05/selamat-tinggal-powerpoint"/>
   <updated>2013-05-07T00:16:21+00:00</updated>
   <id>http://jefri-p.com/2013/05/selamat-tinggal-powerpoint</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;/assets/reveal-js.png&quot;&gt;&lt;img class=&quot;aligncenter size-medium wp-image-178&quot; alt=&quot;reveal-js&quot; src=&quot;/assets/reveal-js-300x123.png&quot; width=&quot;300&quot; height=&quot;123&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Sudah Bertahun-tahun orang-orang (termasuk saya) menggunakan Powerpoint sebagai software untuk membuat presentasi baik untuk urusan pendidikan, bisnis, dan lainnya. Mungkin bagi sebagian orang tidak masalah menggunakan Powerpoint jika mempunyai lisensi microsoft office (kebetulan kampus saya mengadakan kerja sama dengan microsoft), bagaimana jika tidak mempunyai lisensi?mungkin dapat menggunakan software gratisan Libre Office ataupun Open Office. Namun seiring jalannya waktu kita membutuhkan kemudahan, bukan hanya dalam membuat tapi dalam mempersiapkan. Semisal jika ingin menggunakan Libre Office / Open Office harus diinstal terlebih dahulu dan lumayan memakan ruang harddisk.&lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Seiring dengan perkembangan jaman dan teknologi web (HTML 5, CSS 3) yang semakin maju setiap orang pasti mempunyai minimal 1 browser (yang saya maksud bukan IE :?:) semisal Firefox, chrome, netscape dll. Sekarang presentasi pun dapat dilakukan lewat browser, kok bisa?ya bisa, minimal hanya dengan mengetahui sedikit syntax HTML Anda pun dapat membuat presentasi via browser. Framework yang dapat dipakai adalah &lt;a title=&quot;reveal.js&quot; href=&quot;https://github.com/hakimel/reveal.js&quot; target=&quot;_blank&quot;&gt;reveal.js&lt;/a&gt; dan apabila ingin presentasi yang unik seperti Prezi dapat menggunakan &lt;a title=&quot;impress.js&quot; href=&quot;https://github.com/bartaz/impress.js/&quot; target=&quot;_blank&quot;&gt;impress.js&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Penggunaannya cukup mudah cukup download (&lt;a href=&quot;https://github.com/hakimel/reveal.js/archive/master.zip&quot; target=&quot;_blank&quot;&gt;reveal.js&lt;/a&gt;), extract dan ubah file index.html sesuai yang Anda inginkan.&lt;/p&gt;
&lt;p&gt;Fitur reveal.js :&lt;/p&gt;
&lt;p&gt;- Selain menggunakan HTML dapat menggunakan &lt;a href=&quot;http://daringfireball.net/projects/markdown/syntax&quot; title=&quot;markdown syntax&quot; target=&quot;_blank&quot;&gt;Markdown Syntax&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;- Transition Styles yang disediakan Cube, Page, Concave, Zoom, Linear, Fade, None, Default.&lt;/p&gt;
&lt;p&gt;- Slide dapat di ekspor ke PDF.&lt;/p&gt;
&lt;p&gt;- Themes ada 6 yang disediakan default, beige, sky, night, serif, simple atau dapat membuat sendiri.&lt;/p&gt;
&lt;p&gt;- Fragment Styles&lt;/p&gt;
&lt;p&gt;Sebelum mencoba dapat melihat contoh-contoh presentasi dari reveal.js di &lt;a href=&quot;https://github.com/hakimel/reveal.js/wiki/Example-Presentations&quot; title=&quot;Example-Presentations&quot; target=&quot;_blank&quot;&gt;https://github.com/hakimel/reveal.js/wiki/Example-Presentations&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Selamat mencoba :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Iseng-iseng : Script PHP untuk menghitung umur</title>
   <link href="http://jefri-p.com/2013/04/iseng-iseng-script-php-untuk-menghitung-umur"/>
   <updated>2013-04-04T21:40:49+00:00</updated>
   <id>http://jefri-p.com/2013/04/iseng-iseng-script-php-untuk-menghitung-umur</id>
   <content type="html">&lt;p&gt;Iseng-iseng lagi memikirkan cara menghitung umur seseorang hasil dari mysql datetime, gampang-gampang susah.&lt;/p&gt;
&lt;p&gt;Nemu dari om gugel cara yang simple (tapi kurang tepat)&lt;/p&gt;
&lt;pre&gt;

$tgl = date('Y-m-d', strtotime($tgl_lahir));

$umur = floor(time() - strtotime($tgl))/(60*60*24*365);

echo $umur;

&lt;/pre&gt;
&lt;p&gt;Mengurangi unix time sekarang dengan unix time dari $tgl_lahir (format dari mysql datetime 'Y-m-d H:i:s'), kurang tepat karena membagi selisih unix time dengan asumsi pertahun ada 365 hari, sedangkan dalam setahun terkadang 366 hari.&lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Cara yang lebih tepat :&lt;/p&gt;
&lt;p&gt;Masih dari om gugel&lt;/p&gt;
&lt;pre&gt;

$date1 = new DateTime(date('Y-m-d', strtotime($tgl_lahir)));

$date2 = new DateTime(date('Y-m-d'));

$interval = $date1-&amp;gt;diff($date2);

echo &quot;difference &quot; . $interval-&amp;gt;y . &quot; years, &quot; . $interval-&amp;gt;m.&quot; months, &quot;.$interval-&amp;gt;d.&quot; days &quot;;

&lt;/pre&gt;
&lt;p&gt;namun fungsi dari php &lt;strong&gt;DateTime::diff&lt;/strong&gt; hanya dapat berjalan pada PHP 5 &amp;gt;= 5.3.0&lt;/p&gt;
&lt;p&gt;Lalu saya membuat yang dapat berjalan untuk PHP 4 ke atas&lt;/p&gt;
&lt;pre&gt;

list($thn_skrg, $bln_skrg, $tgl_skrg) = explode('-', date('Y-m-d'));

list($thn_lhr, $bln_lhr, $tgl_lhr) = explode('-', date('Y-m-d', strtotime($tgl_lahir)));

$umur = $thn_skrg - $thn_lhr;

		

if($bln_skrg &amp;lt; $bln_lhr)

 $umur--;

else if(($bln_skrg == $bln_lhr) &amp;amp;&amp;amp; ($tgl_skrg &amp;lt; $tgl_lhr))

 $umur--;

echo $umur;

&lt;/pre&gt;
&lt;p&gt;Meskipun agak panjang, namun hasil pemikiran sendiri. :D&lt;/p&gt;
&lt;p&gt;Bacaan :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php&quot; target=&quot;_blank&quot;&gt;http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Pentingnya Database Connection Pooling</title>
   <link href="http://jefri-p.com/2013/02/pentingnya-database-connection-pooling"/>
   <updated>2013-02-19T01:02:28+00:00</updated>
   <id>http://jefri-p.com/2013/02/pentingnya-database-connection-pooling</id>
   <content type="html">&lt;p&gt;Beberapa saat lalu saya memikirkan betapa pentingnya resource pada server database, dulu sewaktu saya duduk dibangku kuliah pada saat mengerjakan project/tugas belum terlalu memikirkan hal tersebut.  Jika aplikasi kita tergantung pada database otomatis kita harus selalu terkoneksi ke database, entah untuk query select, insert, update atau delete.&lt;br /&gt;
Connection Pooling adalah suatu metode untuk menjaga supaya koneksi database terbuka sehingga dapat digunakan kembali, karena membuka koneksi ke database adalah proses yang &quot;Mahal&quot;, jadi pooling menjaga koneksi tetap aktif.&lt;!--more--&gt;&lt;a class=&quot;thumbnail&quot; href=&quot;/assets/Database_connection_pooling.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-244&quot; alt=&quot;Database_connection_pooling&quot; src=&quot;/assets/Database_connection_pooling.jpg&quot; width=&quot;340&quot; height=&quot;125&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Keuntungan Connection Pooling :&lt;br /&gt;
- Mempercepat response time (pada saat membuka koneksi)&lt;br /&gt;
- Penggunaan kembali resource database&lt;br /&gt;
- Penggunaan memory lebih hemat&lt;/p&gt;
&lt;p&gt;Connection Pooling biasanya populer di kalangan pengguna Java (Application Server), banyak library yang tersedia untuk dapat menggunakan fitur ini, contohnya :&lt;br /&gt;
- &lt;a href=&quot;http://commons.apache.org/dbcp/&quot; target=&quot;_blank&quot;&gt;Commons Database Connection Pooling (Commons DBCP)&lt;/a&gt;&lt;br /&gt;
- &lt;a href=&quot;http://www.mchange.com/projects/c3p0&quot; target=&quot;_blank&quot;&gt;C3P0 - JDBC3 Connection and Statement Pooling&lt;/a&gt;&lt;br /&gt;
- &lt;a href=&quot;http://jolbox.com/&quot; target=&quot;_blank&quot;&gt;BoneCP&lt;/a&gt;&lt;br /&gt;
Saya sangat tertatik dengan BoneCP, dikarenakan pada website &lt;a href=&quot;http://jolbox.com/dynamic-benchmark.html&quot; target=&quot;_blank&quot;&gt;http://jolbox.com/dynamic-benchmark.html&lt;/a&gt; disertakan benchmark dengan beberapa Database Connection Pooling seperti diatas, dan hasilnya WOW. Jika sempat saya akan membuat aplikasi kecil menggunakan &lt;a href=&quot;http://www.playframework.com/&quot; target=&quot;_blank&quot;&gt;PlayFramework!&lt;/a&gt; dengan Database Connection Pooling menggunakan library diatas.&lt;/p&gt;
&lt;p&gt;Saya adalah seorang penggemar programming PHP, namun sayang sekali PHP tidak mendukung untuk Pooling Connection, PHP hanya mendukung Persistent Connection.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Persistent Connection != Connection Pooling.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Saat saya sedang mencari, ternyata Oracle mendukung Pooling untuk PHP dengan nama &lt;a title=&quot;About Database Resident Connection Pooling&quot; href=&quot;http://docs.oracle.com/cd/B28359_01/server.111/b28310/manproc002.htm&quot; target=&quot;_blank&quot;&gt;Database Resident Connection Pooling&lt;/a&gt;. Di website tersebut ditulis :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;DRCP complements middle-tier connection pools that share connections between threads in a middle-tier process. In addition, DRCP enables sharing of database connections across middle-tier processes on the same middle-tier host and even across middle-tier hosts. This results in significant reduction in key database resources needed to support a large number of client connections, thereby reducing the database tier memory footprint and boosting the scalability of both middle-tier and database tiers. Having a pool of readily available servers also has the additional benefit of reducing the cost of creating and tearing down client connections.&lt;br /&gt;
&lt;strong&gt;DRCP is especially relevant for architectures with multi-process single threaded application servers (such as PHP/Apache) that cannot perform middle-tier connection pooling. &lt;/strong&gt;The database can still scale to tens of thousands of simultaneous connections with DRCP.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yup DRCP memberikan solusi Pooling bagi PHPers :D&lt;br /&gt;
Berikut sedikit perbandingan jika menggunakan DRCP dibanding dengan Dedicated Server dan Shared server dari situs tersebut :&lt;br /&gt;
Dedicated Server&lt;br /&gt;
Memory used = 5000 X (400 KB + 4 MB) = 22 GB&lt;/p&gt;
&lt;p&gt;Shared Server&lt;br /&gt;
Memory used = 5000 X 400 KB + 100 X 4 MB = 2.5 GB&lt;br /&gt;
Out of the 2.5 GB, 2 GB is allocated from the SGA.&lt;/p&gt;
&lt;p&gt;Database Resident Connection Pooling&lt;br /&gt;
Memory used = 100 X (400 KB + 4 MB) + (5000 X 35KB)= 615 MB&lt;/p&gt;
&lt;p&gt;Sungguh Sangat jauh bukan?ya itu merupakan sedikit dari salah satu Keuntungan Database Connection Pooling.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CMIIW&lt;/strong&gt; :)&lt;/p&gt;
&lt;p&gt;Bacaan :&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/4041114/what-is-database-pooling&quot; target=&quot;_blank&quot;&gt;http://stackoverflow.com/questions/4041114/what-is-database-pooling&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://docs.oracle.com/cd/E17781_01/appdev.112/e18555/ch_two.htm#BABHHEDD&quot; target=&quot;_blank&quot;&gt;http://docs.oracle.com/cd/E17781_01/appdev.112/e18555/ch_two.htm#BABHHEDD&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://docs.oracle.com/cd/B28359_01/server.111/b28310/manproc002.htm&quot; target=&quot;_blank&quot;&gt;http://docs.oracle.com/cd/B28359_01/server.111/b28310/manproc002.htm&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://pic.dhe.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Fcdat_conpool.html&quot; target=&quot;_blank&quot;&gt;http://pic.dhe.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Fcdat_conpool.html&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Cara mudah install Ruby pada Mac OS X dengan RVM</title>
   <link href="http://jefri-p.com/2013/02/cara-mudah-install-ruby-pada-mac-os-x-dengan-rvm"/>
   <updated>2013-02-06T21:34:37+00:00</updated>
   <id>http://jefri-p.com/2013/02/cara-mudah-install-ruby-pada-mac-os-x-dengan-rvm</id>
   <content type="html">&lt;p&gt;Jika Anda seorang developer Ruby ataupun pengguna cloud hosting (OpenShift, CloudFoundry, AppFog) pasti membutuhkan Ruby untuk dapat menggunakan CLI client. RVM menjadi jawaban saya untuk dapat mengupgrade maupun menginstall Ruby versi yang kita mau, berikut langkah-langkahnya :&lt;/p&gt;
&lt;p&gt;Prequiresites :&lt;/p&gt;
&lt;p&gt;- XCode (biasanya di bundle pada DVD Mac OS X)&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;OSX GCC Installer&quot; href=&quot;https://github.com/kennethreitz/osx-gcc-installer&quot; target=&quot;_blank&quot;&gt;GCC &lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;\curl -L https://get.rvm.io | bash -s stable --ruby&lt;/pre&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Lalu setelah rvm terinstall, kita dapat melihat versi ruby yang tersedia&lt;/p&gt;
&lt;pre&gt;rvm list known&lt;/pre&gt;
&lt;p&gt;Hasilnya&lt;/p&gt;
&lt;pre&gt;# MRI Rubies

[ruby-]1.8.6[-p420]

[ruby-]1.8.7[-p371]

[ruby-]1.9.1[-p431]

[ruby-]1.9.2[-p320]

[ruby-]1.9.3-p125

[ruby-]1.9.3-p194

[ruby-]1.9.3-p286

[ruby-]1.9.3-p327

[ruby-]1.9.3-p362

[ruby-]1.9.3[-p374]

[ruby-]1.9.3-head

[ruby-]2.0.0-rc1

ruby-head



# GoRuby

goruby



# TheCodeShop - MRI experimental patches

tcs



# jamesgolick - All around gangster

jamesgolick



# Minimalistic ruby implementation - ISO 30170:2012

mruby[-head]



# JRuby

jruby-1.2.0

jruby-1.3.1

jruby-1.4.0

jruby-1.6.5.1

jruby-1.6.6

jruby-1.6.7.2

jruby-1.6.8

jruby[-1.7.2]

jruby-head



# Rubinius

rbx-1.0.1

rbx-1.1.1

rbx-1.2.3

rbx-1.2.4

rbx[-head]

rbx-2.0.testing

rbx-2.0.0-rc1



# Ruby Enterprise Edition

ree-1.8.6

ree[-1.8.7][-2012.02]



# Kiji

kiji



# MagLev

maglev[-head]

maglev-1.0.0



# Mac OS X Snow Leopard Or Newer

macruby-0.10

macruby-0.11

macruby[-0.12]

macruby-nightly

macruby-head



# Opal

opal



# IronRuby

ironruby[-1.1.3]

ironruby-head&lt;/pre&gt;
&lt;p&gt;Lalu kita akan install (ruby 1.9.3-p374 adalah versi stabil saat tulisan ini di buat) :&lt;/p&gt;
&lt;pre&gt;rvm install ruby-1.9.3-p374&lt;/pre&gt;
&lt;p&gt;Maka ruby-1.9.3-p374 akan terinstall pada mac Anda.&lt;/p&gt;
&lt;p&gt;Jika Anda mempunyai lebih dari 1 versi maka dapat mengubah default ruby yang akan digunakan&lt;/p&gt;
&lt;pre&gt;rvm use ruby-1.9.3-p374&lt;/pre&gt;
&lt;p&gt;Saya menggunakan Mac Os X (10.6.8) Snow Leopard (Still love this Os X version)&lt;/p&gt;
&lt;p&gt;Beberapa cara lain pun dapat dilihat pada https://rvm.io/rvm/install/&lt;/p&gt;
&lt;p&gt;**Trouble Shooting yang pernah saya alami saat akan upgrade dari Ruby 1.8.7 ke Ruby 1.9.3 terdapat error, coba jalankan :&lt;/p&gt;
&lt;pre&gt;sudo rm /usr/local/lib/libz.*

rvm reinstall ruby-1.9.3-p374&lt;/pre&gt;
&lt;p&gt;*Untuk mengimport gemset manual untuk ruby-1.9.3-p374*&lt;/p&gt;
&lt;pre&gt;rvm system ; rvm gemset export system.gems ; rvm ruby-1.9.3-p374 ; rvm gemset import system&lt;/pre&gt;
&lt;p&gt;Sekian :)&lt;/p&gt;
&lt;p&gt;Thanks to :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/3696564/how-to-update-ruby-to-1-9-x-on-mac&quot;&gt;http://stackoverflow.com/questions/3696564/how-to-update-ruby-to-1-9-x-on-mac&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/5426892/trouble-installing-ruby-1-9-2-with-rvm-mac-os-x&quot;&gt;http://stackoverflow.com/questions/5426892/trouble-installing-ruby-1-9-2-with-rvm-mac-os-x&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://rvm.io/rvm/install/&quot;&gt;https://rvm.io/rvm/install/&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hacking Kohana External Request</title>
   <link href="http://jefri-p.com/2013/01/hacking-kohana-external-request"/>
   <updated>2013-01-10T21:15:24+00:00</updated>
   <id>http://jefri-p.com/2013/01/hacking-kohana-external-request</id>
   <content type="html">&lt;p&gt;Iseng-iseng sedang ada kerjaan untuk membaca webservice lewat kohana 3.2 menggunakan Request::factory($url), saat akan mengakses webservice yang menggunakan protocol HTTPS (semisal https://localhost/json.php), ternyata terdapat error berikut&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed&lt;!--more--&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;karena memang tidak menggunakan valid certificate. Setelah dicari ternyata bisa menambahkan options curl nya pada system kohana (but it's not recommended)&lt;/p&gt;
&lt;p&gt;Untuk dapat mengakses webservice HTTPS yang certificatenya tidak ada/tidak valid pada kohana kita hanya tinggal menambahkan beberapa line pada file system\classes\kohana\request\client\curl.php&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CURLOPT_SSL_VERIFYHOST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;  &lt;/span&gt; &lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FALSE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CURLOPT_SSL_VERIFYPEER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;  &lt;/span&gt; &lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FALSE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Jika Anda ingin menggunakan Request::factory() via proxy dapat menambahkan :&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CURLOPT_PROXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;  &lt;/span&gt; &lt;span class=&quot;err&quot;&gt;   &lt;/span&gt; &lt;span class=&quot;err&quot;&gt;   &lt;/span&gt; &lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ip_proxy_server'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;_options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CURLOPT_PROXYPORT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'port_proxy_server'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Dan akhirnya bisa mengakses webservice yang menggunakan HTTPS.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Install dan Setting Apache 2.2 + PHP 5.3 pada windows</title>
   <link href="http://jefri-p.com/2012/11/install-dan-setting-apache-2-2-php-5-3-pada-windows"/>
   <updated>2012-11-19T03:17:08+00:00</updated>
   <id>http://jefri-p.com/2012/11/install-dan-setting-apache-2-2-php-5-3-pada-windows</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/assets/apache1-300x96.jpg&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;96&quot; class=&quot;aligncenter size-medium wp-image-112&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/plus.jpg&quot; alt=&quot;&quot; width=&quot;97&quot; height=&quot;84&quot; class=&quot;aligncenter size-full wp-image-113&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/php53.jpg&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;197&quot; class=&quot;aligncenter size-full wp-image-109&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Saya adalah penggemar &lt;a title=&quot;Framework Kohana&quot; href=&quot;http://kohanaframework.org&quot;&gt;framework Kohana&lt;/a&gt;, baru-baru ini Kohana mengeluarkan versi terbarunya yaitu &lt;a href=&quot;https://github.com/downloads/kohana/kohana/kohana-3.3.0.zip&quot;&gt;Kohana 3.3&lt;/a&gt; dan membutuhkan PHP 5.3, sedangkan versi PHP yang sedang saya gunakan adalah PHP 5.2. Mau tidak mau saya harus mengganti ke PHP 5.3, dan saya kira akan mudah namun ada beberapa masalah ketika saya akan mengganti ke PHP 5.3 berikut adalah langkah-langkahnya :&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;1. Saya Asumsikan Anda sudah mendownload dan menginstall &lt;a href=&quot;http://archive.apache.org/dist/httpd/binaries/win32/&quot;&gt;Apache 2.2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Tambahkan konfigurasi berikut pada httpd.conf&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;LoadModule php5_module C:/PHP53/php5apache2_2.dll
AddType application/x-httpd-php .php .inc
PHPIniDir C:/PHP53/&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;*perhatian C:/PHP53/ adalah direktori dari PHP 5.3 saya&lt;/p&gt;
&lt;p&gt;2. Download dan ekstrak &lt;a href=&quot;http://windows.php.net/downloads/releases/archives/php-5.3.5-Win32-VC6-x86.zip&quot;&gt;PHP 5.3&lt;/a&gt; (yang saya gunakan adalah 5.3.5-Win32-VC6-x86 thread safe)&lt;/p&gt;
&lt;p&gt;Edit konfigurasi php.ini Anda&lt;/p&gt;
&lt;p&gt;Tambahkan&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;date.timezone = &amp;amp;quot;Asia/Jakarta&quot;
extension_dir = &amp;amp;quot;C:\PHP53\ext&quot;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;dan juga jika Anda akan mengaktifkan extension, hilangkan saja tanda ; (titik koma)&lt;/p&gt;
&lt;p&gt;contoh :&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_http.dll
;php_http.dll dari http://downloads.php.net/pierre/php_http-5.3-svn20091125-vc6-x86.zip
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
;extension=php_mysqli.dll
extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_zip.dll
extension=php_xdebug.dll
;php_xdebug.dll dari http://downloads.php.net/pierre/php_xdebug-2.0.5-5.3-Win32-VC6-x86.zip
extension=php_apc.dll
;php_apc.dll dari http://dev.freshsite.pl/nc/php-accelerators/apc/download/apc-316-for-php-53-vc6.html&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;*untuk extension disarankan menggunakan library VC6&lt;/p&gt;
&lt;p&gt;Karena saya menggunakan php APC, maka saya menambah konfigurasi&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;apc.shm_size=32M&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Ada perubahan pada konfigurasi apc.shm.size ditambahkan M untuk MB atau G untuk GB.&lt;/p&gt;
&lt;p&gt;*jika belum diubah maka akan muncul error &lt;a href=&quot;http://syslint.com/syslint/php-warning-php-startup-apc-shm_size-now-uses-mg-suffixes-please-update-your-ini-files/&quot;&gt;PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Lalu start/restart apache server.&lt;/p&gt;
&lt;p&gt;It's works now i'm using PHP 5.3, can't wait to try Kohana 3.3.&lt;/p&gt;
&lt;p&gt;Sekian, jika ada pertanyaan silahkan ditunggu komentarnya :)&lt;/p&gt;
&lt;p&gt;Website yang berguna untuk pengguna PHP windows http://downloads.php.net/pierre/&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Android : Install default Aplikasi Android kita ke SD Card</title>
   <link href="http://jefri-p.com/2012/11/android-install-default-aplikasi-android-kita-ke-sd-card"/>
   <updated>2012-11-13T01:05:40+00:00</updated>
   <id>http://jefri-p.com/2012/11/android-install-default-aplikasi-android-kita-ke-sd-card</id>
   <content type="html">&lt;p&gt;Saya sedang develop aplikasi Android untuk skripsi sarjana saya, sebelumnya default adalah ke penyimpanan internal namun ada beberapa teman menanyakan untuk bisa install ke penyimpanan external/SD Card. Setelah ditelusuri ternyata fitur ini dapat dilakukan pada Android API Level 8 / Android 2.2 (Froyo) ke atas.&lt;/p&gt;
&lt;p&gt;Hal ini dapat dilakukan dengan cara memodifikasi file manifest / AndroidManifest.xml Anda dengan menambahkan android:installLocation pada elemen atribut .&lt;!--more--&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;manifest&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:installLocation=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;preferExternal&quot;&lt;/span&gt;
 &lt;span class=&quot;err&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Untuk value &lt;strong&gt;&quot;preferExternal&quot;&lt;/strong&gt; maka aplikasi Anda akan diinstal pada penyimpanan external, jika penyimpanan external penuh maka aplikasi akan di instal di penyimpanan internal.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;manifest&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/p&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    android:installLocation=&quot;auto&quot;
 ... &amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Untuk value &lt;strong&gt;&quot;auto&quot;&lt;/strong&gt; maka aplikasi Anda akan dapat diinstal pada penyimpanan external. Sistem yang akan memutuskan lokasi untuk menginstal aplikasi Anda.&lt;/p&gt;
&lt;p&gt;Dengan salah satu value tersebut, pengguna nantinya juga dapat memindahkan aplikasi antara dua lokasi.&lt;/p&gt;
&lt;p&gt;Contoh Aplikasi yang dapat dipindahkan ke SD Card :&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;thumbnail&quot; href=&quot;/assets/SC20121113-123514.png&quot;&gt;&lt;img src=&quot;/assets/SC20121113-123514-180x300.png&quot; alt=&quot;&quot; width=&quot;180&quot; height=&quot;300&quot; class=&quot;alignnone size-medium wp-image-72&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Contoh Aplikasi yang tidak dapat dipindahkan ke SD Card :&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;thumbnail&quot; href=&quot;/assets/SC20121113-123541.png&quot;&gt;&lt;img src=&quot;/assets/SC20121113-123541-180x300.png&quot; alt=&quot;&quot; width=&quot;180&quot; height=&quot;300&quot; class=&quot;alignnone size-medium wp-image-73&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Catatan penting!!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ada beberapa feature dari android sehinggga membuat aplikasi tidak boleh/bisa diinstal ke penyimpanan external :&lt;/p&gt;
&lt;p&gt; - Service&lt;/p&gt;
&lt;p&gt; - Alarm Service&lt;/p&gt;
&lt;p&gt; - Input Method Engine&lt;/p&gt;
&lt;p&gt; - Live Wallpaper&lt;/p&gt;
&lt;p&gt; - App Widgets&lt;/p&gt;
&lt;p&gt; - Account Manager&lt;/p&gt;
&lt;p&gt; - Sync Adapters&lt;/p&gt;
&lt;p&gt; - Device Administrator&lt;/p&gt;
&lt;p&gt; - Broadcast Receiver Listening for &quot;boot completed&quot;&lt;/p&gt;
&lt;p&gt; - Copy Protection&lt;/p&gt;
&lt;p&gt;Jika Aplikasi Anda memakai feature diatas disarankan untuk tidak membuat aplikasi berjalan pada penyimpanan external.&lt;/p&gt;
&lt;p&gt;Untuk Selengkapnya dapat dibaca pada Guide Developer Android &lt;a href=&quot;http://developer.android.com/guide/topics/data/install-location.html&quot; title=&quot;App Install Location&quot;&gt;App Install Location&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Android : Beberapa cara OnClickListener</title>
   <link href="http://jefri-p.com/2012/10/android-beberapa-cara-onclicklistener"/>
   <updated>2012-10-11T21:06:13+00:00</updated>
   <id>http://jefri-p.com/2012/10/android-beberapa-cara-onclicklistener</id>
   <content type="html">&lt;p&gt;Berikut adalah beberapa cara OnClickListener&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;findViewById&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;btnAksi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setOnClickListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;OnClickListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;View&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// Aksi yang akan dilakukan saat button di klik&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;Ada cara lain jika mempunyai banyak button dan untuk mengurangi code&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;View&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;OnClickListener&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;handler&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;View&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;OnClickListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;View&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;btn_aksi1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
	    &lt;span class=&quot;c1&quot;&gt;//Aksi yang akan dilakukan&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;btn_aksi2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
	    &lt;span class=&quot;c1&quot;&gt;//Aksi yang akan dilakukan&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;findViewById&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;btn_aksi1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setOnClickListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;findViewById&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;btn_aksi2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setOnClickListener&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Dan ada 1 lagi OnClickListener dengan menambahkan atribut onClick pada xml button tersebut&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HomeActivity&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Activity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;btnClickHandler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;View&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	  &lt;span class=&quot;c1&quot;&gt;//Aksi yang akan dilakukan&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;Button&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:onClick=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;btnClickHandler&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/Button&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Fungsi btnClickHandler harus mempunyai 1 argument View dan harus di set public.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Android : Menampilkan/menyembunyikan keyboard</title>
   <link href="http://jefri-p.com/2012/10/android-menampilkan-menyembunyikan-keyboard"/>
   <updated>2012-10-09T00:28:20+00:00</updated>
   <id>http://jefri-p.com/2012/10/android-menampilkan-menyembunyikan-keyboard</id>
   <content type="html">&lt;p&gt;Android menampilkan dan menyembunyikan keyboard.&lt;/p&gt;
&lt;p&gt;sebelumnya import terlebih dahulu&lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;android.view.inputmethod.InputMethodManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;InputMethodManager&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InputMethodManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getSystemService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;INPUT_METHOD_SERVICE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;imm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toggleSoftInput&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InputMethodManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SHOW_FORCED&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;atau&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;InputMethodManager&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;imm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InputMethodManager&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getSystemService&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;INPUT_METHOD_SERVICE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;imm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;hideSoftInputFromWindow&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;editText&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getWindowToken&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;atau jika ingin ingin selalu memunculkan keyboard pada suatu window edit AndroidManifest.xml&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;activity&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.HomeActivity&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:label=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Home&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:windowSoftInputMode=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stateAlwaysVisible&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;*Catatan biar ga lupa* :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Jatuh hati pada layanan Cloud Foundry!</title>
   <link href="http://jefri-p.com/2012/10/jatuh-hati-pada-layanan-cloud-foundry"/>
   <updated>2012-10-08T01:07:07+00:00</updated>
   <id>http://jefri-p.com/2012/10/jatuh-hati-pada-layanan-cloud-foundry</id>
   <content type="html">&lt;p&gt;Setelah beberapa bulan saya menggunakan layanan cloud &lt;a title=&quot;Openshift by Red Hat&quot; href=&quot;http://openshift.redhat.com&quot;&gt;Openshift&lt;/a&gt; untuk mencoba-coba layanan cloud PaaS yang 'gratis', gratis disini tidak berbayar tetapi dibatasi namun cukup untuk mencoba-coba layanan cloud (biar ga ketinggalan jaman :D). Layanan tersebut mendukung Java, Ruby, Node.js, Perl serta &lt;strong&gt;PHP&lt;/strong&gt;, kebetulan saya lebih mengerti PHP jadi menarik perhatian saya dan sudah mencoba openshift untuk &lt;a title=&quot;Jefri Blog&quot; href=&quot;http://www.jefri-p.com&quot;&gt;blog saya&lt;/a&gt; (wordpress) menggunakan layanan tersebut.&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Layanan cloud pada openshift tergolong sangat stabil dan cepat (dalam hal akses website dan update plugin blog). Namun baru-baru ini saya mencoba layanan &lt;a title=&quot;Cloud Foundry&quot; href=&quot;http://www.cloudfoundry.com&quot;&gt;Cloud Foundry&lt;/a&gt; yang merupakan layanan cloud PaaS juga, dari segi layanan belum mendukung PHP (atau saya belum tahu) tetapi keterbatasan yang ada di Openshift dalam hal command untuk mengupload menggunakan git lewat ssh yang mana tidak bisa saya lakukan untuk ssh keluar dari sini (kantor), kelebihan menggunakan Cloud Foundry ialah GRATIS (juga) dan dapat mengupload aplikasi yang sudah di compile ke cloud tanpa harus menggunakan git yang ssh keluar, sehingga memudahkan saya untuk mengupload. Commandnya adalah menggunakan cloud foundry command line yaitu vmc yang dapat diinstall dengan menggunakan &lt;strong&gt;gem install vmc&lt;/strong&gt; (yang sebelumnya sudah menginstall ruby dan gem), ya cukup mudah.&lt;/p&gt;
&lt;p&gt;Saya mencoba mengupload sampel aplikasi &lt;a title=&quot;Play! Framework&quot; href=&quot;http://www.playframework.org&quot;&gt;Play! Framework&lt;/a&gt; melalui &lt;a title=&quot;Play! on Cloud Foundry&quot; href=&quot;http://blog.cloudfoundry.com/2012/05/31/cloud-foundry-now-supports-play/&quot;&gt;tutorial&lt;/a&gt;, kenapa Play!?ya karena saya kesengsem dan sedang mempelajari Framework tersebut yang mendukung bahasa Java dan Scala, what a nice ;)&lt;/p&gt;
&lt;p&gt;Pertama masuk ke directory sample play -&amp;gt; cd /Users/jefripakpahan/play/play-2.0.4/samples/java/zentasks&lt;/p&gt;
&lt;p&gt;Dari directory tersebut kita compile aplikasi sampel menjadi aplikasi zip yang akan di upload dengan command : play2 -Dconfig.file=conf.cf dist&lt;/p&gt;
&lt;p&gt;Dan akan menghasilkan zentasks-1.0.zip yang akan di upload, berikut screenshoot&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/play-dist.png&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-44&quot; alt=&quot;&quot; src=&quot;/assets/play-dist-300x107.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Berikutnya adalah menguploadnya ke Cloud Foundry dengan command : vmc push --path=dist/zentask-1.0.zip&lt;/p&gt;
&lt;p&gt;Dengan menggunakan services (db) postgresql&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/vmc-push.png&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-46&quot; alt=&quot;&quot; src=&quot;/assets/vmc-push-300x242.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Dan setelah sukses tinggal buka url Application Deployed URL semisal : &lt;a href=&quot;http://zentasks-jef.cloudfoundry.com&quot;&gt;http://zentasks-jef.cloudfoundry.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/zentasks-login.png&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-47&quot; alt=&quot;&quot; src=&quot;/assets/zentasks-login-300x163.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Halaman login&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/zentasks-home.png&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-48&quot; alt=&quot;&quot; src=&quot;/assets/zentasks-home-300x102.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Halaman Home&lt;/p&gt;
&lt;p&gt;So easy right?&lt;/p&gt;
&lt;p&gt;Jadi ingin memperdalam lagi Play! Framework. :)&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;*Tambahan : Play 2.0.4 untuk bisa jalan di Cloud Foundry butuh tambahan library &lt;strong&gt;&lt;a title=&quot;auto-reconfiguration-0.6.5.jar&quot; href=&quot;https://github.com/cloudfoundry/vcap-staging/blob/master/lib/vcap/staging/plugin/resources/auto-reconfiguration-0.6.5.jar&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;auto reconfiguration&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;, taruh di folder lib*&lt;/span&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Studi Kecil Klasifikasi Bayesian Network, Decision Tree dan SVM untuk Machine Learning pada Weka</title>
   <link href="http://jefri-p.com/2012/09/studi-kecil-klasifikasi-bayesian-network-decision-tree-dan-svm-untuk-machine-learning-pada-weka"/>
   <updated>2012-09-13T23:40:07+00:00</updated>
   <id>http://jefri-p.com/2012/09/studi-kecil-klasifikasi-bayesian-network-decision-tree-dan-svm-untuk-machine-learning-pada-weka</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://www.informatik.uni-hamburg.de/ML/&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;wp-image-20 aligncenter&quot; src=&quot;/assets/ml-wordle-1024x546.jpg&quot; alt=&quot;&quot; width=&quot;524&quot; height=&quot;280&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Iseng-iseng melakukan studi kecil-kecilan melakukan klasifikasi untuk Machine Learning pada Weka, karena saya akan menggunakan salah satu klasifikasi untuk tugas akhir dan akhirnya saya mencobanya pada weka. Sewaktu kuliah saya pernah diajarkan klasifikasi menggunakan weka pada kuliah Data Mining, namun karena saya termasuk mahasiswa yang malas dan kurang memperhatikan (penyakit mahasiswa, ato saya aja kali ya) sehingga mata kuliah tersebut kurang bisa di tangkap oleh saya dengan baik.&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;Klasifikasi yang akan saya coba adalah Bayesian Network, Decision Tree dan Support Vector Machine (SVM). apa hanya itu classifier yang ada?Tentu tidak, banyak sekali klasifikasi yang ada namun ketiga classifier tersebut yang lumayan canggih sedang populer. oke, langsung saja kita akan membahas ketiga classifier tersebut, oh iya ketiga classifier tersebut saya coba pada software Data Mining &lt;a title=&quot;Weka&quot; href=&quot;http://www.cs.waikato.ac.nz/ml/weka/&quot;&gt;Weka 3.6.7&lt;/a&gt; dengan tambahan &lt;a href=&quot;http://weka.sourceforge.net/packageMetaData/LibSVM/index.html&quot;&gt;libSVM&lt;/a&gt; (library terpisah dari weka).&lt;/p&gt;
&lt;p&gt;Pertama-tama tentukan datanya , disini saya menggunakan data yang sudah ada di weka yaitu iris.arff, lalu kita pakai filter Discretize untuk mendiskretisasikan nilai numerik yang ada pada data.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/filter-discretize.jpg&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-33&quot; src=&quot;/assets/filter-discretize-300x217.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Lalu pada tab classifiy kita memilih classifier yang akan kita gunakan, disini Bayesian Network, Decision Tree dan SVM. Test Options yang kita gunakan adalah Cross-Validation dengan nilai, berikut pilihan Test Options :&lt;/p&gt;
&lt;p&gt;• Use training set : data uji dengan data latih sama&lt;/p&gt;
&lt;p&gt;• Supplied test set : data uji dengan data latih benar-benar berbeda&lt;/p&gt;
&lt;p&gt;• Cross-Validation : membagi data menjadi k-subset. Misalnya Folds yang digunakan 10, 9 akan  digunakan sebagai data training dan 1 sebagai data uji sampai seluruh data.&lt;/p&gt;
&lt;p&gt;• Percentage Split : Membagi data sesuai dengan parameter yang akan menjadi data training.&lt;/p&gt;
&lt;p&gt;Berikut hasilnya :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bayesian Network&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/bayesnet-filter-discretize.jpg&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-27&quot; src=&quot;/assets/bayesnet-filter-discretize-300x216.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Decision Tree&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/j48-filter-discretize.jpg&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-29&quot; src=&quot;/assets/j48-filter-discretize-300x216.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SVM&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/svm-filter-discretize.jpg&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-31&quot; src=&quot;/assets/svm-filter-discretize-300x217.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Dilihat dari hasil Akurasi / Correctly Classified Instances SVM mendapatkan akurasi yang lebih tinggi dibanding dengan Bayesian Network dan Decision Tree, namun dalam proses klasifikasi SVM memproses lebih lama. Mungkin dengan data yang berbeda dapat menghasilkan akurasi yang berbeda, tinggal mencoba-coba dan pakai yang terbaik.&lt;/p&gt;
&lt;p&gt;Sumber Bacaan :&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;Weka Manual&quot; href=&quot;http://nchc.dl.sourceforge.net/project/weka/documentation/3.6.x/WekaManual-3-6-7.pdf&quot; target=&quot;_blank&quot;&gt;Weka Manual&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;LibSVM&quot; href=&quot;http://weka.wikispaces.com/LibSVM&quot; target=&quot;_blank&quot;&gt;LibSVM&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hello World!</title>
   <link href="http://jefri-p.com/2012/09/hello-world"/>
   <updated>2012-09-11T07:42:40+00:00</updated>
   <id>http://jefri-p.com/2012/09/hello-world</id>
   <content type="html">&lt;p&gt;Hello World!&lt;/p&gt;
&lt;p&gt;Yup setelah sekian lama bekerja di UI baru hari ini mengisi blog, saya melihat blog teman saya &lt;a title=&quot;Blog JP&quot; href=&quot;https://staff.blog.ui.ac.id/jp&quot; target=&quot;_blank&quot;&gt;Blog JP&lt;/a&gt; jadi turut memotivasi saya untuk mengisi blog disini.&lt;/p&gt;
&lt;p&gt;Mudah-mudahan kalau malasnya tidak keluar bisa rajin untuk mengisi blog ini, karena saya punya blog lain yang jarang diupdate,hehehe..&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;See ya..&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Kohana 3.2 : Membuat Template</title>
   <link href="http://jefri-p.com/2012/07/kohana-3-2-membuat-template"/>
   <updated>2012-07-09T02:52:09+00:00</updated>
   <id>http://jefri-p.com/2012/07/kohana-3-2-membuat-template</id>
   <content type="html">&lt;p&gt;Dalam pembuatan sebuah website/sistem informasi template merupakan elemen penting dalam penyajian tampilan sebuah website, disini akan dijelaskan penggunaan template pada Kohana 3.2, agar pembuatan suatu website lebih efisien dan simpel.&lt;/p&gt;
&lt;p&gt;Melanjutkan Blog &lt;a title=&quot;PHP Framework : Mengenal Framework Kohana 3&quot; href=&quot;http://www.jefri-p.com/2012/04/php-framework-mengenal-framework-kohana-3/&quot;&gt;sebelumnya&lt;/a&gt;, defaultnya template kohana membuat controller turunan dari Controller_Template, namun jika kita membuat 1 template untuk semua kita harus menyertakan title, javascript, css dll yang membuat wasting code. Oleh karena itu dibutuhkan sebuah suatu controller template baru yang akan diturunkan ke controller kita yang mempunyai template yang sama.&lt;/p&gt;
&lt;p&gt;1. kita buat template kita yang berbentuk HTML (dalam hal ini menggunakan &lt;a title=&quot;Twitter Bootstrap&quot; href=&quot;https://github.com/twitter/bootstrap/&quot; target=&quot;_blank&quot;&gt;Twitter Bootstrap&lt;/a&gt;), tinggal menambahkan beberapa tag php.&lt;br /&gt;
&lt;!--more--&gt;&lt;br /&gt;
- title (string) : title dari page&lt;br /&gt;
- scripts (array) : array dari javascripts yang dibutuhkan pada page&lt;br /&gt;
- styles (array) : array dari CSS yang dibutuhkan pada page&lt;br /&gt;
- content (string/array) : isi dari konten website&lt;/p&gt;
&lt;p&gt;ok, just show the code :)&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html-php&quot; data-lang=&quot;html+php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;
&amp;lt;title&amp;gt;Kohana 3.2 Templating with Twitter Bootstrap &amp;lt;?php echo ( ! empty($title)) ? Html::chars(&quot; - &quot;.$title) : ''; ?&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&amp;gt;
&amp;lt;meta name=&quot;description&quot; content=&quot;&quot;&amp;gt;
&amp;lt;meta name=&quot;author&quot; content=&quot;&quot;&amp;gt;

&amp;lt;!-- Le styles --&amp;gt;
&amp;lt;style&amp;gt;
body '{
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}'
&amp;lt;/style&amp;gt;
&amp;lt;?php foreach ($styles as $file =&amp;gt; $type) echo HTML::style($file, array('media' =&amp;gt; $type)), &quot;\n&quot; ?&amp;gt;
&amp;lt;?php foreach ($scripts as $file) echo HTML::script($file), &quot;\n&quot; ?&amp;gt;

&amp;lt;!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --&amp;gt;
&amp;lt;!--[if lt IE 9]&amp;gt;
&amp;lt;script src=&quot;http://html5shim.googlecode.com/svn/trunk/html5.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;

&amp;lt;!-- Le fav and touch icons --&amp;gt;
&amp;lt;link rel=&quot;shortcut icon&quot; href=&quot;assets/ico/favicon.ico&quot;&amp;gt;
&amp;lt;link rel=&quot;apple-touch-icon-precomposed&quot; sizes=&quot;144x144&quot; href=&quot;assets/ico/apple-touch-icon-144-precomposed.png&quot;&amp;gt;
&amp;lt;link rel=&quot;apple-touch-icon-precomposed&quot; sizes=&quot;114x114&quot; href=&quot;assets/ico/apple-touch-icon-114-precomposed.png&quot;&amp;gt;
&amp;lt;link rel=&quot;apple-touch-icon-precomposed&quot; sizes=&quot;72x72&quot; href=&quot;assets/ico/apple-touch-icon-72-precomposed.png&quot;&amp;gt;
&amp;lt;link rel=&quot;apple-touch-icon-precomposed&quot; href=&quot;assets/ico/apple-touch-icon-57-precomposed.png&quot;&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

&amp;lt;div class=&quot;navbar navbar-fixed-top&quot;&amp;gt;
&amp;lt;div class=&quot;navbar-inner&quot;&amp;gt;
&amp;lt;div class=&quot;container&quot;&amp;gt;
&amp;lt;a class=&quot;btn btn-navbar&quot; data-toggle=&quot;collapse&quot; data-target=&quot;.nav-collapse&quot;&amp;gt;
&amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;
&amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;
&amp;lt;span class=&quot;icon-bar&quot;&amp;gt;&amp;lt;/span&amp;gt;
&amp;lt;/a&amp;gt;
&amp;lt;a class=&quot;brand&quot; href=&quot;#&quot;&amp;gt;Jefri&amp;lt;/a&amp;gt;
&amp;lt;div class=&quot;nav-collapse&quot;&amp;gt;
&amp;lt;ul class=&quot;nav&quot;&amp;gt;
&amp;lt;li class=&quot;active&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a href=&quot;#about&quot;&amp;gt;About&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a href=&quot;#contact&quot;&amp;gt;Contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;&amp;lt;!--/.nav-collapse --&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class=&quot;container&quot;&amp;gt;
&amp;lt;?php echo $content ?&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- /container --&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&amp;lt;/p&amp;gt;&lt;/p&gt;
&lt;p&gt;2. Buat Controller_Template baru untuk turunan controller yang akan kita pakai dengan template yang sama. sehingga akan terlihat seperti ini :&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Controller_Template_Layout extends Controller_Template&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Controller_Page extends Controller_Template_Layout&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;Jadi setiap controller akan meng-extends Controller_Template_Layout&lt;/p&gt;
&lt;p&gt;
&lt;br /&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;defined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'SYSPATH'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'No direct access allowed.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Controller_Template_Layout&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Controller_Template&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'template/layout'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;/**
* The before() method is called before your controller action.
* In our template controller we override this method so that we can
* set up default values. These variables are then available to our
* controllers if they need to be modified.
*/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;parent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;session&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;auto_render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// Initialize empty values
&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;templates&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;styles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;scripts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;/**
* The after() method is called after your controller action.
* In our template controller we override this method so that we can
* make any last minute modifications to the template before anything
* is rendered.
*/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;auto_render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$styles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'assets/css/bootstrap.css'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'screen, projection'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'assets/css/bootstrap-responsive.css'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'screen, projection'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

	&lt;span class=&quot;nv&quot;&gt;$scripts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'assets/js/jquery-1.7.2.min.js'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;s1&quot;&gt;'assets/js/bootstrap.js'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;styles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$styles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;styles&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;scripts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;scripts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;parent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;3. Membuat controller yang akan menggunakan template yang sudah kita buat.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;defined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'SYSPATH'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'No direct script access.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Controller_Page&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Controller_Template_Layout&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;action_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Welcome to kohana 3.2 Template'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

	&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;View&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;factory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'page/home'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&amp;lt;/p&amp;gt;&lt;/p&gt;
&lt;p&gt;Template untuk kohana 3.2 siap di pakai.&lt;br /&gt;
&lt;a href=&quot;/assets/templating.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-large wp-image-141&quot; title=&quot;templating&quot; alt=&quot;kohana&quot; src=&quot;/assets/templating-1024x583.jpg&quot; width=&quot;608&quot; height=&quot;346&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Download melalui github &lt;a href=&quot;https://github.com/jefrip/kohana-template&quot;&gt;Kohana Template&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Sumber Bacaan :&lt;br /&gt;
- &lt;a href=&quot;http://kerkness.ca/kowiki/doku.php&quot;&gt;http://kerkness.ca/kowiki/doku.php&lt;/a&gt;&lt;br /&gt;
- &lt;a href=&quot;http://kohanaframework.org/3.2/guide/kohana/mvc/views&quot;&gt;http://kohanaframework.org/3.2/guide/kohana/mvc/views&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Mencicipi Cloud Hosting gratis di OpenShift by Red Hat</title>
   <link href="http://jefri-p.com/2012/06/mencicipi-cloud-hosting-gratis-di-openshift-red-hat"/>
   <updated>2012-06-19T22:44:41+00:00</updated>
   <id>http://jefri-p.com/2012/06/mencicipi-cloud-hosting-gratis-di-openshift-red-hat</id>
   <content type="html">&lt;p&gt;Apa itu cloud computing? dalam blog &lt;a title=&quot;Teknologi Cloud Computing&quot; href=&quot;http://teknoinfo.web.id/teknologi-cloud-computing/&quot; target=&quot;_blank&quot;&gt;teknoinfo.web.id&lt;/a&gt; dijelaskan bahwa Cloud Computing adalah topik yang sedang hangat dibicarakan dan lambat laun para IT professional akan mengadaptasi teknologi ini.&lt;/p&gt;
&lt;p&gt;Di blog tersebut pun dijelaskan beberapa teknologi cloud service, seperti :&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;Infrastructure as a Service&quot; href=&quot;http://en.wikipedia.org/wiki/Infrastructure_as_a_service&quot; target=&quot;_blank&quot;&gt;Infrastucture as a Service (IaaS)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;Platform as a Service&quot; href=&quot;http://en.wikipedia.org/wiki/Platform_as_a_service&quot; target=&quot;_blank&quot;&gt;Platform as a Service (PaaS)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;Software as a Service&quot; href=&quot;http://en.wikipedia.org/wiki/Software_as_a_service&quot; target=&quot;_blank&quot;&gt;Software  as a Service (SaaS)&lt;/a&gt;&lt;br /&gt;
&lt;!--more--&gt;&lt;br /&gt;
Disini kita akan mencoba menggunakan salah satu cloud service (Paas) gratis pada &lt;a title=&quot;OpenShift by Red Hat&quot; href=&quot;https://openshift.redhat.com&quot; target=&quot;_blank&quot;&gt;OpenShift by Red Hat&lt;/a&gt;. Karena masih versi Beta (gratis) dan belum commercial (berbayar) tidak disarankan untuk membuat website yang akan di pakai untuk waktu yang lama di OpenShift.&lt;/p&gt;
&lt;p&gt;Sebelumnya kita perlu &lt;a title=&quot;Register Account&quot; href=&quot;https://openshift.redhat.com/app/account/new&quot; target=&quot;_blank&quot;&gt;register accout OpenShift&lt;/a&gt; dan &lt;a title=&quot;Getting Started OpenShift&quot; href=&quot;https://openshift.redhat.com/app/getting_started&quot; target=&quot;_blank&quot;&gt;menginstall client tools&lt;/a&gt;. butuh menginstall :&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;Ruby&quot; href=&quot;http://rubyforge.org/&quot; target=&quot;_blank&quot;&gt;Ruby&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a title=&quot;RubyGems&quot; href=&quot;http://rubygems.org/&quot; target=&quot;_blank&quot;&gt;RubyGems &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Lalu setelah register dan menginstall client tools, login ke Account OpenShift di &lt;a href=&quot;https://openshift.redhat.com/app/login&quot;&gt;https://openshift.redhat.com/app/login&lt;/a&gt; , setelah masuk ke dashboard Openshift, kita set dahulu namespace agar aplikasi kita unik dan menghindari url yang sama, klik tab &lt;a title=&quot;OpenShift My Account&quot; href=&quot;https://openshift.redhat.com/app/account&quot; target=&quot;_blank&quot;&gt;My Account&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://www.jefri-p.com/wp-content/uploads/2012/06/namespace.jpg&quot;&gt;&lt;img class=&quot;aligncenter wp-image-111&quot; title=&quot;openshift namespace&quot; src=&quot;/assets/namespace.jpg&quot; alt=&quot;openshift namespace&quot; width=&quot;550&quot; height=&quot;240&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Lalu klik tab create application.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;/assets/create-application.jpg&quot;&gt;&lt;img class=&quot;aligncenter  wp-image-114&quot; title=&quot;OpenShift create application&quot; src=&quot;/assets/create-application-1024x700.jpg&quot; alt=&quot;OpenShift create application&quot; width=&quot;547&quot; height=&quot;374&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Pilih aplikasi Framework / CMS yang akan kita install, disini saya memilih WordPress, lalu masukkan nama aplikasi yang akan kita buat dalam namespace ea-rhcloud.com disini saya memakai http://blog.ea-rhcloud.com klik Create Application.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;/assets/wordpress.jpg&quot;&gt;&lt;img class=&quot;aligncenter  wp-image-117&quot; title=&quot;wordpress&quot; src=&quot;/assets/wordpress.jpg&quot; alt=&quot;&quot; width=&quot;557&quot; height=&quot;406&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Tunggu hingga proses Configure new Application selesai.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;/assets/created-successfully.jpg&quot;&gt;&lt;img class=&quot;aligncenter  wp-image-118&quot; title=&quot;created successfully&quot; src=&quot;/assets/created-successfully.jpg&quot; alt=&quot;&quot; width=&quot;563&quot; height=&quot;417&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Ya Anda telah berhasil menginstall WordPress di OpenShift, buka alamat url nya, disini http://blog-ea.rhcloud.com dan jangan lupa mengganti password default adminnya. jika Anda ingin mengclone directory dari WordPress dapat menggunakan git clone (url yang di sebutkan pada akhir instalasi).  contoh : git clone ssh://bc8208f0819a43298775553eee04b86d@blog-ea.rhcloud.com/~/git/blog.git/&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Anda juga dapat mengimport data WordPress menggunakan phpmyadmin, tetapi sebelumnya harus Add Cartridge, lalu pilih phpMyAdmin 3.4, maka Anda dapat mengimport melalui url http://blog-ea.rhcloud.com/phpmyadmin.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;NB : website saya &lt;a href=&quot;http://www.jefri-p.com&quot;&gt;http://www.jefri-p.com&lt;/a&gt; sedang mencoba OpenShift, mudah-mudahan gratisannya lama (hidup gratisan!).&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Sekian dan selamat mencoba (mumpung gratis) :D.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Sumber Bacaan :&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;http://teknoinfo.web.id/teknologi-cloud-computing/&quot;&gt;http://teknoinfo.web.id/teknologi-cloud-computing/&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://openshift.redhat.com/app/getting_started&quot;&gt;https://openshift.redhat.com/app/getting_started&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>PHP Framework : Mengenal Framework Kohana 3</title>
   <link href="http://jefri-p.com/2012/04/php-framework-mengenal-framework-kohana-3"/>
   <updated>2012-04-18T00:56:18+00:00</updated>
   <id>http://jefri-p.com/2012/04/php-framework-mengenal-framework-kohana-3</id>
   <content type="html">&lt;p&gt;&lt;a title=&quot;kohana framework&quot; href=&quot;http://kohanaframework.org/&quot; target=&quot;_blank&quot;&gt;Kohana 3&lt;/a&gt; adalah framework elegan PHP5 yang menggunakan pola arsitektur Hierarchical Model View Controller (HMVC)  yang kaya akan komponen untuk membangun aplikasi web.  Ada beberapa alasan mengapa Anda harus memilih Kohana sebagai PHP framework tetapi yang utama adalah keamanan, ringan dan mudah digunakan.&lt;br /&gt;
&lt;!--more--&gt;&lt;a href=&quot;/assets/logo-new.png&quot;&gt;&lt;img class=&quot;size-full wp-image-80 alignleft&quot; title=&quot;kohana 3&quot; alt=&quot;kohana 3&quot; src=&quot;/assets/logo-new.png&quot; width=&quot;200&quot; height=&quot;70&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dasar HMVC&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Cara mudah untuk berpikir HMVC adalah memikirkan AJAX tanpa tambahan pemanggilan server. Misalnya, jika Anda memiliki tindakan untuk AJAX yang menampilkan daftar pengguna, Anda dapat menggunakan kembali tindakan yang di controller lain, daripada menduplikasi metode ini.&lt;/p&gt;
&lt;p&gt;Salah satu fitur yang paling powerful di Kohana 3 adalah kemampuan untuk memanggil permintaan lain setiap saat selama request flow. Pendekatan MVC berlapis memungkinkan Anda untuk merakit sebuah klien kompleks tier dan benar-benar memanfaatkan keuntungan objek oriented.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cascading Filesystem&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Filesystem Kohana adalah hirarki untuk struktur direktori sama yang cascade. Hirarki di Kohana (digunakan bila file dimuat oleh Kohana ::find_file) adalah dengan urutan sebagai berikut.:&lt;/p&gt;
&lt;p&gt;Arsitektur Berlapis&lt;br /&gt;
- Mengurangi ketergantungan antara bagian yang berbeda dari program&lt;br /&gt;
- Mendorong reusable kode, komponen dan modul&lt;br /&gt;
- Meningkatkan extensibility dan mengurangi maintenance&lt;br /&gt;
- Beberapa digunakan untuk desain HMVC dalam arsitektur client-tier&lt;br /&gt;
- Antarmuka elemen atau widget Modular&lt;br /&gt;
- Aplikasi dan Kontrol Menu&lt;br /&gt;
- Interaksi Server&lt;br /&gt;
- Reusable Application Flows&lt;/p&gt;
&lt;p&gt;File yang berada di direktori yang lebih tinggi urutan lokasi include didahulukan atas file dengan nama yang sama di bawahnya urutan, dimana memungkinkan untuk overload file apa saja dengan menempatkan sebuah file dengan nama yang sama di direktori &quot;lebih tinggi&quot;.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=/assets/cascading_filesystem.png&quot;&gt;&lt;img class=&quot;aligncenter  wp-image-85&quot; title=&quot;cascading filesystem&quot; alt=&quot;cascading filesystem&quot; src=&quot;/assets/cascading_filesystem.png&quot; width=&quot;536&quot; height=&quot;720&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Path modules&lt;br /&gt;
Hal ini ditetapkan sebagai associative array menggunakan Kohana::modules di APPPATH / bootstrap.php. Setiap nilai dari array akan dicaridalam urutan bahwa modules sudah didefinisikan.&lt;/p&gt;
&lt;p&gt;Path system&lt;br /&gt;
Didefinisikan sebagai SYSPATH di index.php. Nilai default adalah system. Semua file &quot;inti&quot; utama atau kelas didefinisikan di sini.&lt;/p&gt;
&lt;p&gt;Path application&lt;br /&gt;
Merupakan tempat pengembangan aplikasi  yang di dalamnya akan terdapat berbagai macam direktori yang berhubungan dengan aplikasi kita termasuk folder cache dan log. Classes adalah tempat di mana kita bisa melakukan overriding terhadap class yang berasal dari core system dan modules, juga sebagai tempat untuk meletakkan Controller serta Model. Views untuk meletakkan view yang akan dipanggil pada Controller.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Instalasi Kohana Framework&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;- Terlebih dahulu download  &lt;a title=&quot;kohana framework&quot; href=&quot;http://kohanaframework.org&quot; target=&quot;_blank&quot;&gt;kohana 3&lt;/a&gt; melalui &lt;a href=&quot;http://kohanaframework.org/download&quot;&gt;http://kohanaframework.org/download&lt;/a&gt; ataupun dapat melalui github &lt;a href=&quot;https://github.com/kohana/kohana&quot;&gt;https://github.com/kohana/kohana&lt;/a&gt; (dalam hal ini adalah kohana 3.2)&lt;/p&gt;
&lt;p&gt;- unzip kohana-3.2.0.zip&lt;/p&gt;
&lt;p&gt;- Ubah nama folder kohana-3.2-master-1 menjadi kohana dan masukkan kedalam docroot dari webserver Anda&lt;/p&gt;
&lt;p&gt;- Buat folder bernama cache dan logs di dalam folder application dan chmod 666&lt;/p&gt;
&lt;p&gt;- Buka browser Anda dan arahkan ke url http://localhost/kohana maka akan memanggil skrip install.php dan memeriksa persyaratan server Anda.&lt;/p&gt;
&lt;p&gt;Kohana dapat berjalan di hampir semua environment, dengan minimum persyaratan :&lt;/p&gt;
&lt;p&gt;- Apache server&lt;/p&gt;
&lt;p&gt;- PHP versi &amp;gt;= 5.2.3&lt;/p&gt;
&lt;p&gt;Anda dapat menginstall &lt;a title=&quot;XAMPP&quot; href=&quot;http://www.apachefriends.org/en/xampp.html&quot; target=&quot;_blank&quot;&gt;XAMPP&lt;/a&gt; ataupun &lt;a title=&quot;WAMP&quot; href=&quot;http://www.wampserver.com/en/&quot; target=&quot;_blank&quot;&gt;WAMP&lt;/a&gt; sebagai web server dan database server (Apache, PHP, MySql Server)&lt;/p&gt;
&lt;p&gt;- Setting pada bootstrap.php jika kohana ada berada dalam subdirectory.&lt;/p&gt;
&lt;p&gt;Pada line 82, ubah menjadi&lt;/p&gt;
&lt;p&gt;Kohana::init(array(&lt;br /&gt;
'base_url' =&amp;gt; '/kohana',&lt;br /&gt;
));&lt;/p&gt;
&lt;p&gt;Jika berhasil maka akan muncul tampilan seperti berikut :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/kohana-install.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-90&quot; title=&quot;kohana install&quot; alt=&quot;kohana install&quot; src=&quot;/assets/kohana-install.jpg&quot; width=&quot;509&quot; height=&quot;754&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jika sudah berhasil dalam pengecekan kebutuhan dari kohana, lalu hapus file install.php, maka akan muncul seperti ini :&lt;/p&gt;
&lt;p&gt;hello, world!&lt;/p&gt;
&lt;p&gt;Yup, Anda berhasil melakukan instalasi kohana 3, it's easy isn't it? sekarang Anda dapat membuat project menggunakan framework kohana.&lt;/p&gt;
&lt;p&gt;Tutorial berikutnya akan mempelajari lebih dalam tentang kohana 3 berikut dengan contohnya.&lt;/p&gt;
&lt;p&gt;Bersambung ....&lt;/p&gt;
&lt;p&gt;Bahan bacaan :&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kohanaframework.org/3.2/guide/&quot;&gt;http://kohanaframework.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kerkness.ca/kowiki/doku.php&quot;&gt;http://kerkness.ca/kowiki/doku.php&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Membuat Search Engine dengan Zend Search Lucene</title>
   <link href="http://jefri-p.com/2012/01/membuat-search-engine-dengan-zend-search-lucene"/>
   <updated>2012-01-12T00:34:19+00:00</updated>
   <id>http://jefri-p.com/2012/01/membuat-search-engine-dengan-zend-search-lucene</id>
   <content type="html">&lt;p&gt;Setelah sekian lama tidak mengisi blog, akhirnya baru ada niat ngisi blog lagi. kali ini saya akan mengangkat topik yang berbeda dengan sebelumnya &lt;a title=&quot;Belajar MyBatis 3&quot; href=&quot;http://www.jefri-p.com/2011/11/belajar-mybatis-3/&quot;&gt;belajar mybatis 3&lt;/a&gt; yaitu Membuat Search Engine dengan Zend Search Lucene. Saya membuat tutorial di karena kan karena ada tugas Temu Kembali Informasi (TKI), ya lagi-lagi tugas kuliah (namanya juga anak kuliahan).&lt;br /&gt;
&lt;!--more--&gt;&lt;br /&gt;
&lt;a href=&quot;/assets/Lucene21.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-70&quot; title=&quot;Zend_Search_Lucene&quot; alt=&quot;&quot; src=&quot;/assets/Lucene21.png&quot; width=&quot;287&quot; height=&quot;127&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene adalah full-text search engine framework porting dari &lt;a title=&quot;Apache Lucene&quot; href=&quot;http://lucene.apache.org&quot;&gt;Apache Lucene&lt;/a&gt; dan bagian dari &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework &lt;/a&gt;, Anda dapat mendownload di web tersebut . Zend_Search_Lucene menjanjikan cara sederhana untuk menambahkan fungsi pencarian ke aplikasi tanpa membutuhkan tambahan ekstensi php atau bahkan database.&lt;/p&gt;
&lt;p&gt;Langsung saja kita praktikan&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Membuat Index&lt;/strong&gt;&lt;br /&gt;
Sebelum kita mencari data terlebih dahulu Anda harus membuat &lt;a href=&quot;http://en.wikipedia.org/wiki/Index_(search_engine)&quot;&gt;Indexing&lt;/a&gt; yang akan mengumpulkan, mem-parsing, dan menyimpan data untuk memudahkan pencarian informasi yang cepat dan akurat&lt;/p&gt;
&lt;p&gt;Disini kita akan mencoba mengindex file xml&lt;/p&gt;
&lt;p&gt;File data.xml&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;documents&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;1&lt;span class=&quot;nt&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;first title on document&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;content&amp;gt;&lt;/span&gt;Ilkomers content &lt;span class=&quot;nt&quot;&gt;&amp;lt;/content&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;published&amp;gt;&lt;/span&gt;1012325463&lt;span class=&quot;nt&quot;&gt;&amp;lt;/published&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;3&lt;span class=&quot;nt&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Search Lucene by Jefri Rahmat Yusuf &lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;content&amp;gt;&lt;/span&gt;tki search lucene from xml data&lt;span class=&quot;nt&quot;&gt;&amp;lt;/content&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;published&amp;gt;&lt;/span&gt;1012356463&lt;span class=&quot;nt&quot;&gt;&amp;lt;/published&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;4&lt;span class=&quot;nt&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Temu Kembali Informasi&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;content&amp;gt;&lt;/span&gt;Temu kembali informasi (tki) with lucene by Jefri Rahmat Yusuf another document&lt;span class=&quot;nt&quot;&gt;&amp;lt;/content&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;published&amp;gt;&lt;/span&gt;1012445463&lt;span class=&quot;nt&quot;&gt;&amp;lt;/published&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;6&lt;span class=&quot;nt&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;another Title in Lucene&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;content&amp;gt;&lt;/span&gt;This is another document for lucene&lt;span class=&quot;nt&quot;&gt;&amp;lt;/content&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;published&amp;gt;&lt;/span&gt;1013325467&lt;span class=&quot;nt&quot;&gt;&amp;lt;/published&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/document&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/documents&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;File indexing.php&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Zend/Search/Lucene.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;htmlentities&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strip_tags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$input&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'data.xml'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//cek file xml
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file_exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)){&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;simplexml_load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Error.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//directory data temporary untuk indexing
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml_index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'index/xml_index'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// index setiap item
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Keyword&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'title'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)));&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)));&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;UnIndexed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'published'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;published&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)));&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Mengindex: &amp;lt;b&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addDocument&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;commit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;br/&amp;gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; Dokumen terindex.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Pertama yang dilakukan adalah cek file xml&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'data.xml'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//cek file xml
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file_exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)){&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;simplexml_load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Error.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Lalu tentukan directori untuk menampung data indexing&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c1&quot;&gt;//directory data temporary untuk indexing
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml_index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'index/xml_index'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Lalu indexing data xml&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// index setiap item
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//buat dan index dokumen
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;commit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;lt;br/&amp;gt;'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; Dokumen terindex.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Untuk membuat dokumen ke index, kita harus membuat document object dan field konten yang spesifik yang akan kita index, dalam hal ini kita akan mengindex title, content dan published.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Keyword&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'title'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)));&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'content'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)));&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene_Field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;UnIndexed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'published'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sanitize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;published&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)));&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Mengindex: &amp;lt;b&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addDocument&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$doc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Item-item yang akan di index terlebih dahulu di sanitasi (sanitize). Berikut adalah keterangan dari masing-masing Zend_Search_Lucene_Field&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene_Field::Keyword // Field is not tokenized, but is indexed and stored within the index.&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene_Field::UnIndexed // Field is not tokenized nor indexed, but is stored in the index.&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene_Field::Binary // Binary String valued Field that is not tokenized nor indexed, but is stored in the index.&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene_Field::Text&lt;br /&gt;
// Field is tokenized and indexed, and is stored in the index.&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene_Field::UnStored&lt;br /&gt;
// Field is tokenized and indexed, but is not stored in the index.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Pencarian Index&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Sebelumnya kita sudah membuat Zend_Search_Lucene index pada data, mari kita implementasikan pencarian.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Zend/Search/Lucene.php'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//buka file index
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Zend_Search_Lucene&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'index/xml_index'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'jefri'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strlen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Kata-kata harus lebih dari 3 huruf'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$hits&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Index Mempunyai &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; dokumen.&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Pencarian untuk query '&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;' menghasilkan &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot; hits&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hits&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;pre&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Score: &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'%.2f'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;br/&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Kita include library , dan buka file index dan cari term lalu looping hasil, kita dapat melakukan pencarian query dengan &lt;a href=&quot;http://framework.zend.com/manual/en/zend.search.lucene.query-language.html&quot;&gt;multiple query terms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Zend_Search_Lucene sangat Powerfull dan simpel, untuk dokumentasi lengkap dapat dilihat di file document yang ada di Zend Framework atau &lt;a href=&quot;http://framework.zend.com/manual/en/zend.search.lucene.html&quot;&gt;http://framework.zend.com/manual/en/zend.search.lucene.html&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Sekian.&lt;/p&gt;
&lt;p&gt;sumber bacaan : &lt;a href=&quot;http://devzone.zend.com/397/roll-your-own-search-engine-with-zend_search_lucene/&quot;&gt;http://devzone.zend.com/397/roll-your-own-search-engine-with-zend_search_lucene/&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Belajar MyBatis 3</title>
   <link href="http://jefri-p.com/2011/11/belajar-mybatis-3"/>
   <updated>2011-11-21T02:31:11+00:00</updated>
   <id>http://jefri-p.com/2011/11/belajar-mybatis-3</id>
   <content type="html">&lt;p&gt;Setelah sekian lama akhirnya saya bisa menuliskan blog lagi, yups di web saya sendiri &lt;a href=&quot;http://www.jefri-p.com&quot;&gt;jefri-p.com&lt;/a&gt;, semester ini saya mendapat banyak matakuliah yang mempunyai banyak tugas akhir, salah satunya adalah PSBO (Pemrograman Sistem Berorientasi Objek) dan tugas akhirnya apalagi kalau bukan membuat sistem yang berorientasi objek, saya memilih &lt;a title=&quot;Java&quot; href=&quot;http://id.wikipedia.org/wiki/Java&quot; target=&quot;_blank&quot;&gt;Java&lt;/a&gt; sebagai bahasa pemrogramannya walaupun saya belum terlalu mahir &lt;a title=&quot;topik java&quot; href=&quot;http://www.jefri-p.com/topik/java&quot; target=&quot;_blank&quot;&gt;java&lt;/a&gt;. Demi memudahkan project tersebut saya memilih &lt;a title=&quot;MyBatis website&quot; href=&quot;http://www.mybatis.org/&quot; target=&quot;_blank&quot;&gt;MyBatis Framework&lt;/a&gt; (yang dulunya &lt;a title=&quot;iBatis website&quot; href=&quot;http://ibatis.apache.org/&quot; target=&quot;_blank&quot;&gt;iBatis&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/assets/ibatis_mybatis.png&quot;&gt;&lt;img class=&quot;size-full wp-image-16&quot; title=&quot;ibatis_mybatis&quot; alt=&quot;ibatis mybatis framework&quot; src=&quot;/assets/ibatis_mybatis.png&quot; width=&quot;274&quot; height=&quot;149&quot; /&gt;&lt;/a&gt; ibatis mybatis&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Apakah MyBatis itu?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;MyBatis Framework adalah Data Mapper framework yang membuat kita lebih mudah menggunakan database relational dengan aplikasi berorientasi objek.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The MyBatis data mapper framework makes it easier to use a relational database with object-oriented applications. MyBatis couples objects with stored procedures or SQL statements using a XML descriptor. Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping tools.&lt;/p&gt;
&lt;p&gt;To use the MyBatis data mapper, you rely on your own objects, XML, and SQL. There is little to learn that you don’t already know. With the MyBatis Data Mapper, you have the full power of both SQL and stored procedures at your fingertips.&lt;/p&gt;
&lt;p&gt;(&lt;a href=&quot;http://www.mybatis.org&quot;&gt;www.mybatis.org&lt;/a&gt;)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-15&quot; title=&quot;flow-mybatis&quot; alt=&quot;flow mybatis&quot; src=&quot;/assets/flow-mybatis.png&quot; width=&quot;504&quot; height=&quot;432&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Tanpa banyak basa-basi mari kita pelajari contoh pertama menggunakan &lt;a href=&quot;http://www.jefri-p.com/topik/mybatis&quot;&gt;MyBatis&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pre-Requisites&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Saya menggunakan:&lt;/p&gt;
&lt;p&gt;IDE: &lt;a href=&quot;http://eclipse.org/&quot;&gt;Eclipse&lt;/a&gt; (atau bisa yang lain)&lt;/p&gt;
&lt;p&gt;DataBase: &lt;a href=&quot;http://dev.mysql.com/downloads/&quot;&gt;MySQL&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Libs/jars: &lt;a href=&quot;http://www.mybatis.org/&quot;&gt;Mybatis&lt;/a&gt;, &lt;a href=&quot;http://dev.mysql.com/downloads/connector/j/&quot;&gt;MySQL conector&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;pertama kita buat database java, dan tabel contact (dalam hal ini menggunakan MySQL)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sample Database&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;DROP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;EXISTS&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`contact`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`contact`&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`id`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`namalengkap`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`phone`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;`email`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`id`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Jefri Pakpahan'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'1245123'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'email@jefri-p.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Jefri Pakpahan'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'1245123'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'email@jefri-p.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Jefri Pakpahan'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'1245123'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'email@jefri-p.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Jefri Pakpahan'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'1245123'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'email@jefri-p.com'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;1. Contact Beans / POJO&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mycontact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;beans&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Contact&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;Integer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Integer&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Integer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;namalengkap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namalengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;phone&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;email&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;2. ContactMapper.xml&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Berikut adalah ContactMapper.xml&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE mapper
  PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
    &quot;http://mybatis.org/dtd/mybatis-3-mapper.dtd&quot;&amp;gt;&lt;/span&gt;
 
&lt;span class=&quot;nt&quot;&gt;&amp;lt;mapper&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;namespace=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Contact&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;resultMap&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;result&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Contact&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;result&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;property=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;id&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;column=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;result&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;property=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;namalengkap&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;column=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;namalengkap&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;result&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;property=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;phone&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;column=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;phone&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;result&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;property=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;column=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/resultMap&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;insert&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;insert&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parameterType=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Contact&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		INSERT INTO contact 
	  	    (namalengkap, phone, email) 
		VALUES 
		    (#{namalengkap}, #{phone}, #{email})
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/insert&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;update&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;update&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parameterType=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Contact&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		UPDATE contact 
		SET
		   namalengkap = #{namalengkap},
		   phone = #{phone},
		   email = #{email}
		WHERE 
		   id = #{id}
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/update&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;delete&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;deleteById&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parameterType=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;int&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		DELETE from contact WHERE id = #{value}
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/delete&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;select&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getAll&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;resultMap=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;result&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
		SELECT * FROM contact
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/select&amp;gt;&lt;/span&gt;

	&lt;span class=&quot;nt&quot;&gt;&amp;lt;select&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getById&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;parameterType=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;int&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;resultMap=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;result&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt; 
		SELECT
		    id, namalengkap, phone, email
		FROM
		    contact
		WHERE 
		    id = #{value}
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/select&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/mapper&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;3. Register ContactMapper.xml ke configuration.xml&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mycontact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.FileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.IOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.Reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.io.Resources&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.session.SqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.session.SqlSessionFactoryBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyBatisConnectionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactory&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;org/mycontact/example/xml/configuration.xml&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Reader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resources&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getResourceAsReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactoryBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileNotFoundException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;iOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactory&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getSqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;4. MyBatisConnectionFactory&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mycontact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.FileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.IOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.Reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.io.Resources&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.session.SqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.session.SqlSessionFactoryBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyBatisConnectionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactory&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 
    &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 
            &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;org/mycontact/example/xml/configuration.xml&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Reader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resources&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getResourceAsReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactoryBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileNotFoundException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;iOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactory&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getSqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;5. ContactDAO&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mycontact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.FileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.IOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.io.Reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.io.Resources&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.session.SqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.apache.ibatis.session.SqlSessionFactoryBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MyBatisConnectionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactory&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
 
    &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 
            &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;org/mycontact/example/xml/configuration.xml&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Reader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resources&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getResourceAsReader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactoryBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileNotFoundException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fileNotFoundException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;iOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
 
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SqlSessionFactory&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getSqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
 
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlSessionFactory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;6. Example Main program&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;lalu mencoba program kita&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mycontact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;java.util.List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.mycontact.example.beans.Contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.mycontact.example.dao.ContactDAO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MainExample&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;

		&lt;span class=&quot;n&quot;&gt;ContactDAO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ContactDAO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;

		&lt;span class=&quot;c1&quot;&gt;//insert&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contactIns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactIns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Jee Hernandez&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactIns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;jee@email.com&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactIns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1235&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;insert&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contactIns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		
		&lt;span class=&quot;c1&quot;&gt;//select last Id&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;selectByLastId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contact0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt;
				&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
		
		&lt;span class=&quot;c1&quot;&gt;//select by id = 2&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;selectById&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contact1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt;
				&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
			
		&lt;span class=&quot;c1&quot;&gt;//delete id 4&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
			
		&lt;span class=&quot;c1&quot;&gt;//update 5&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contactEdit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactEdit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Jefri Edit&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactEdit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Jefri@email.com&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactEdit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;123456&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactEdit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contactEdit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		
		&lt;span class=&quot;c1&quot;&gt;//select all&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contactdao&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;selectAll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Contact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt;
					&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getNamaLengkap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;contact&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getPhone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Jika Anda kurang paham ataupun kurang jelas, ada baiknya membaca User Guide MyBatis.&lt;br /&gt;
Selamat Berimajinasi :)&lt;/p&gt;
&lt;p&gt;NB : Maaf syntaxhighlighternya agak error ketika memasukan email.&lt;br /&gt;
&lt;a href=&quot;http://loianegroner.com/2011/02/getting-started-with-ibatis-mybatis-xml-configuration/&quot;&gt;Sumber&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 
</feed>
