Archive for the ‘Blog’ Category

Kalau Jadi Orangtua itu….

Senjata utamanya kalo diomongin bae2.."Yang namanya anak ga usah nasehatin orang tua!"

Enak banget yah!

Dari dulu udah begitu, dikasih tau bae2 malah marah2. Ya orang sekarang jadi diem aja donk.

Jadinya kelakuan grasak grusuk ga keruan gitu kan.

Kalo makan permen bungkusnya harus dibuang keluar jendela, mobilnya terlalu bersih kayanya.
Kalo nelepon kaki harus diangkat ke meja, aneh2 aja. Duduk napa?
Oooh kursi ga boleh ada di toko, bikin orang males katanya. Lha terus yang molor ngalor ngidul pas jam toko siapa?

Yg satu ini juga.. ucapan ga bisa dijaga. Udah dibilang.. beda antara "contoh baik" lu (yup, gw sama ortu pake "gw" en "lu") sama ga pernah cukup itu bedanya tipiiiis banget. Gw aja eneg denger "contoh2 baik" dari lu.
"Si itu tuh.. begini......"
"Ya udah ga usah disamain lah.."
"Kalo contoh baik kan perlu dicontoh.."

Entah kenapa makin ke sini makin mantap. Dua minggu pulang bisa dua minggu jaga toko. Seminggu pertama yang punya pergi maen, seminggu kedua yang punya pulang maen terus sakit. Satunya lagi sibuk cari pelarian, masak keq, belajar apa keq, ngomel2 keq...

Persis orang gila...

Nah yang di tengah yang pontang panting. Sibuk ngatur strategi supaya ngga perang dunia lagi. Masalahnya bukan cuma internal, tapi seringkali perang dunianya meluas ke luar2. Jatuh deh korban2 tidak bersalah. Ini loh yang paling nggak enak. Kalo untuk kita2 sih, rasanya udah kebal semua. Plus kita udah punya keluarga baru lagi (yang ngga enak lah jadi korban). Duh pusingnya.

Punya keluarga baru juga bukannya tambah adem gitu, ini ya ampun, kalo di belakang omongannya ...halah lah...bagi gw sih jahat. Kalo udah biasa ngomong di belakang, kadang2 keceplosan ngomong di depan. Gw aja yang ngedenger ga enak... untung keluarga barunya sabar.

Kalo cerita wuih anak saya sekolah ini itu di sini di situ... yang ada hati ini malah miriiiiis banget. Kenapa sih, kalau ngga ditanya, perlu disebut "Ini anak saya yang sekolah di ...." ?? Tujuannya apa?
Orang juga punya otak donk, masa anaknya sekolah begini begitu, orang tuanya grasak grusuk begitu. Anaknya bego apa? Ya udah paling banter cuma bisa senyum aja.
Mending orang2 tau aja kalau anaknya bego... mending....

Doa gw ngga terkabul. Dari dulu gw paling takut ortu gw berubah jadi ortu2 yang bawa foto anaknya yang menang Olimpiade fisika-lah, kimia-lah, lalu keliling2 dan pamer. Semua yang dikenal harus dipamerin. Ya ampuuun Pak, Bu...tujuannya apa? Anak pinter karena ortu pinter? Lah ortunya ngitung turunan aja ngga bisa? Bangga.. atau sombong?

Ngga bisa dibilangin ya mau bilang apa?? Paling pura2 buta, bisu, dan tuli.

Selamat Galungan dan Kuningan

Galungan dan Kuningan sudah datang lagi …


Filed under: Personal Tagged: Galungan, Kuningan

Kembali ke Emas Sebagai Alat Pembayaran

Di era milenium falcon begini masih aja ada orang model gini, aduh capeee deh!

Kalo emas sebagai alat investasi is OK ga masalah!

Alat pembayaran? Weit tunggu dulu, GA PRAKTIS juragan....

Coba kita hitung2 sedikit yuks!

Harga 1 gram emas (10 Mei 2010, 12:20 NY Time, sumber di sini): 351,755 (351 ribu sekian sekian rupiah).

Yang berarti 1000 rupiah itu 1/351.755 = 0.0028 gram. Bisalah beli kangkung seiket.
Tapi.....bisa ga yang jual kangkung nyediain timbangan seakurat 1/10000 gram? Harga timbangannya lebih mahal dari omset jualan kangkungnya sebulan (belum lagi perlu ditera BMG).

Tang ting tung... tapi kan bisa di-koin-kan, seperti uang logam begitu loh.

OK, asumsi kita koinkan 1000 rupiah dalam koin emas (secara ga boleh itu pake logam2 lain...takut inflasi katanya). Berarti 1 koin 0.0028 gram kan.

Karena saya Cin* dan turunan iblis, saya nakal. Saya kikir sedikit koinnya (kandidat terbaik adalah di bagian gerigi di dimensi tebal koin). Satu koin jadi 0.0025 gram.
Saya korupsi 0.0003 gram per koin.

Ketahuan? Bagaimana mungkin? Sempet transaksi menimbang2 sampai se-detil itu? Keburu layu kangkungnya dan sekali lagi sulit cari timbangan sedetil ini.
Dan lagi emas itu logam lunak. Sebagai alat transaksi massal, wajar donk ada baret2 (seperti uang kertas yang lecek2).

1000 koin saya kikir (modal 1 juta rupiah), saya dapat 0.3 gram EMAS, yang harganya 105 ribu sekian sekian. 10% untung sekejap mata! Dan mudah lagi menjual kembali secara ini langsung EMAS.
Beda dengan koin biasa, dikikir nilai logamnya tidak sebanding nilai intrinsik koinnya.

Saya suka sekali kalau ini terjadi... yuuk mari....mungkin saya akan investasi di pabrik kikir.

Proud to be Indonesian

Last Sunday, when queuing for some cakes at the KKIS birthday party, a women was waving to her friend. Not long after that she asked her friend to get closer. But this man seemed not agree with her. He decided to stay behind the last person of the queue. That's the right thing to do, indeed! But this women who stood in front of me keep asking him to get closer. The man said to her that the queue was a long one and he cannot go to her place just like that.

Then *I don't know why* she suddenly looked at me. Perhaps she was trying to ask permission from me. But I cannot do that, I was not the only one queuin in the line. So I said to her: "Maaf Bu, antriannya memang dari ujung sana". She then replied to me with a smile: "Iya, maaf, maklum orang Indonesia". It was then I felt something exploded inside me and without thinking any further I said to her with a little bit angry tone: "Wah, jangan bawa-bawa nama bangsa dong, Bu!". Fortunately, she did not hear a thing about what I have said to her. It was too crowded that afternoon. My bad!

I mean, what was she thinking? It has nothing to do with the country! Do Indonesian teachers never teach you to queue? I AM INDONESIAN. I hate when people say: "They must be Indonesian, they don't know how to queue!" I even hate more those who admitting themselves as Indonesian who cannot queue!

*Siram air dingin ke kepala*

Oh well, we, as the young generation, must not allowed this kind of attitude spreading any further. Please, be proud to be Indonesian, not just by saying "I am proud to be one", but more than that, be a better individual with a better attitude.

"Knowledge is power, but character is more!"

Beta Excuses

Beta Excuses

There will never be a final version, only beta version

Bu Guru Thane

Allow, Thane!

Knapa julukan "Bu Guru" muncul saat aku berusaha mendeskripsikan seorang Thane ya?
Ntahlah, profesi itu begitu saja terlintas di pikiranku. Thane, menurutku, adalah orang yang paling bijaksana diantara kami semua. Dengan segala ide dan perkataan yang ia keluarkan, kami bisa menjadi sebuah "kelompok bermain" yang kompak selama ini. "Reliable" adalah satu kata lain yang bisa kugambarkan.

Pertemuanku dengan Bu Guru ini bermula saat makan malam di Makan Sutra. Sehari sebelum "petualangan" kami ke Pulau Ubin. Belum genap dua bulan sejak hari itu dan sekarang aku dan teman-teman sudah harus melepas Sang Ibu Guru, Thane, untuk menelusuri jejak hidupnya sendiri. Meninggalkan kami di persimpangan jalan yang berbeda. Tali-tali yang saat itu beririsan dan membentuk sebuah "simpul" kini telah menemukan jalan lain, seperti yang diungkapkan oleh Sang Pujangga. Kapan ya kita akan bertemu lagi? Aku tidak tahu.

Waktu punya dua hadiah buatku. Awal dan akhir. Awal adalah kesempatan yang tanpanya, hidup adalah bukan sebuah kehidupan. Dan akhir adalah guru yang selalu mengajarkan makna dari sebuah kehidupan. Akhir selalu berusaha memberitahukan bahwa setiap detik yang kita jalani adalah berharga. Tiap pertemuan yang ada adalah satu momen yang unik dan tidak akan pernah bisa diulang. Karena itu dalam setiap pertemuan, aku berusaha untuk tidak sekedar "ada", "hadir", tapi lebih dari itu, memberi sebuah "kesan". Saat akhir datang menjemput, perpisahan, pasti ada rasa sedih. Tapi semua itu sudah terbayar di setiap detik pertemuan yang terlewat. Karena ada "kesan" di setiap momen itu. Ada awal, pasti ada akhir. Dan itulah yang membuat manusia lebih bisa menghargai arti sebuah kehidupan. Semoga pertemuan kita selama ini berkesan ya ;)

Buat Thane, hehe, aku ngga pinter ngomong langsung, lewat tulisan aja deh. Aku juga ga bisa nyanyi apa2 tadi, soalnya emang ga kepikiran mo nyanyi apa ya enaknya :-p Maaf klo aku punya salah2 dan apapun yg mungkin kurang berkenan :) Sekali lagi, semoga sukses dalam menjalani hidup n mengejar mimpi. Salam kompak dari anak2 TK SukaSenang2! Bye2 Bu Guru, we'll meet again someday!

Mengejar Impian

Post ini narsis!

Masalah terbesar dari Kardy adalah: dia selalu punya target yang berbeda (baca: terlalu banyak maunya). Disuruh apa aja (sekolah keq.. kerja keq..) pasti banyak mainnya.

Kemarin gw dan anak2 sekolah berlibur ke Pulau Ubin, yup seperti Bobby dan teman2-nya. Bukan pertama kali memang gw ke Pulau Ubin, secara dulu pernah ketika gw masih muda.
Tapi ini pertama kalinya gw menjelajah pulau secuil itu dengan sungguh2 (secara dulu pergi dengan kakek2 dan nenek2 gitu looh).

Kita nyewa sepeda dan bersepeda "santai" keliling pulau. Perlu sekitar 30 menit untuk kenalan dengan sepeda sewaan, dan setelah itu we were a great partner! Ga jelek.. 3 x 7 speed hard tail mountain bike. Suspensi depan memang agak lousy tapi still manageable. Sepeda murahan memang (paling murah sewanya SGD 3, paling mahal SGD 10, sepeda ini SGD 5), tapi entah kenapa cocok betul... ada koneksi batin (halah).


Yang gw sendiri heran adalah.. ngga cape cuy (thanks to my bike..muach)! Rekan seperjalanan ngos2-an, protes kenapa gw terlalu cepat (yang ada gw malah muter2 dulu nunggu mereka..ya kali2 sok sosial dikit lah), dan kenapa gw nda pernah turun dari sepeda dan ngedorong pas tanjakan.
Medan bagi gw sih yaaaa... lumayan lah (kita ke timur, utara, en barat pulau) cuma diperberat dengan kita nge-goes di kitaran jam 1 siang ke atas...so lagi panas2-nya.

Hihihi...gw bisa ngomong dengan gayanya...duh yang namanya student itu.. harus sporty dunks =P.

Sejujurnya gw agak kaget juga... gw berharap antara gw kecelakaan (gw master-nya dalam hal kecelakaan kendaraan), pusing (panas gombreng gitu), atau muntah (my best buddy dalam olahraga).

Cuma waktu itu ada saat dimana gw senyum2 sendiri: "Koq kayanya gambarnya mulai tersusun yah".

Ketika muda dulu gw pernah bilang "Tek, gw pingin ikut triathlon" (see my 2009 post). Gila kali yah..Kardy yang muntah lari 3.2 km, beratnya 89 kg di SMU, pas SMP gendut, selalu duduk di pinggir lapangan pas jam olahraga.

Bagi gw sih ga masalah cita2 gila... mengutip kata Chicken Soup: "Gantunglah cita2-mu setinggi langit, kalaupun kamu tidak berhasil menggapainya, kamu masih akan berada di antara bintang2." So yup cita2 gw memang aneh2...jadi bintang bokep, gigolo, biologist, sex consultant, virologist, dll.

Sadar tidak sadar ketika kuliah gw memperbaiki renang. Pertama kali nyemplung ke kolam ITB, gaya bebas gw ancur, bisa sih bisa..tapi 50 m langsung muntah (gitu2 masih dapet A =P). Maklum dari kecil selalu spesialisasi di gaya dada.
Sampai tingkat 2, pas ketemu bule keren yang berenang gaya bebas jam 12 siang. Non-stop bo (makanya keren)! Sekali nyemplung bolak balik sampai naek lagi (entah berapa kali cuma yang pasti banyak). Dari "mencontoh" (plagiat ini) si bule itulah gw belajar long distance swimming untuk gaya bebas. Ooh.. kakinya ga usah semangat '45 banget... dikit2 juga OK.
Di tingkat akhir pun.. gw males lulus cepet2, mengulur waktu untuk belajar side swimming. Alih2 sibuk ngerjain TA, setiap sore ke kolam renang buat ngelatih side swimming gaya bebas (malemnya nge-DoTA). Pokoknya ogah lulus sampai bisa.

Ketika kerja gw memperbaiki skill sepeda. Untung dapet pos di Lampung yang satu kota jalanannya mirip jalanan kompleks perumahan. Asri bo! Lengkap dengan tanjakan dan turunan yang gila (serius gilanya). Well masih inget pertama kali goes ke kantor..langsung muntah! Dan pernah malemnya lembur ngerjain tender, paginya latihan tanjakan, siangnya mantap mimisan! Jatoh? wuih menggelinding masuk bahu jalan. Celana jeans sampe bolong (yg ini sakit..keseret aspal en gravel).

Ketika kuliah lagi sekarang...hihihi.. agenda tersembunyi gw adalah memperbaiki lari. Secara negara ini kondusif buat lari. Dulu 3.2 km muntah, sekarang 5km bisa 2x seminggu (biasa aja tuh), 10 km masih tenang2 aja. Sebenernya cape sih nda begitu... lebih ke bosen!
Makanya mau coba ikutan event marathon someday. Tahun lalu pingin ikut Stand Chard marathon, cuma kepentok presentasi Data Mining :(. Taon ini kali yaa... kalo masih di SG.

Dan yoga pun luar biasa membantu. Well secara gurunya sering ngomong: "Mind over body, and breath over mind. Thus breath is everything." Entah kenapa eh beneran loh setelah ikutan jadi bisa lebih tenang. Pegel kaki ketika goes di tanjakan.. mirip koq dengan posisi warrior one, warrior two, etc. Masalah panas pun teratasi dengan pernafasan yang lebih tenang.
Mo dibilang haram keq.. pokoknya senam yang ini mantap!

Kalau sekarang ngeliat ke belakang...rasanya ok juga ya. Someday entah kapan I'm going to nail that triathlon! Ga ngincer juara memang, cuma ngincer finish. Habis itu bisa deh mati dengan tenang (yup2 gw masih pingin mati muda en beautiful).
Daripada married, gw lebih memilih mengejar impian yg ini!

Btw gw sekarang bisa push-up loh (baru sadar 2 minggu belakangan ini)... ga semati-matian dulu :). Good job to myself!

Hot Stuff Coming Through

hot-stuff
Referensi:
Homer@fb-page


Filed under: Komputer, Selingan, w380i Tagged: Float's Mobile Agent, FMA

8-Puzzle Problem (Bagian 3)

Bismillaah…

Melanjutkan pembahasan sebelumnya mengenai 8-Puzzle Problem, kali ini mungkin saya hanya akan berbagi alternatif implementasi terkait algoritma Hill Climbing. Pada uraian sebelumnya, dicontohkan implementasi Hill Climbing dalam bahasa Java, namun sekarang saya coba contohkan penerapannya menggunakan C++ sederhana. Perlu diketahui bahwa contoh implementasi berikut ini belum menggunakan konsep berorientasi objek, jadi masih murni prosedural. So… let see the idea…

/*
 * @author: Andik Taufiq
 * Bandung - May 07, 2010
 * Program implementation with Hill Climbing strategy for 8-Puzzle Problem
 */

#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#include <iostream>

using namespace std;

int initialState[] = { 1, 0, 2, 8, 4, 3, 7, 6, 5 }; // initial state
int goalState[] = { 1, 2, 3, 8, 0, 4, 7, 6, 5 }; // goal state
int resetValue = 0;
int tempHeuristic[] = { resetValue, resetValue, resetValue, resetValue }; // penyimpan sementara evaluation value
int totalSolution = 0; // total solusi yang dihasilkan

// prosedur untuk mencetak isi sebuah state ke layar
void printState(int state[]) {
    for (int i=0; i < 9; i++) {
		if (i % 3 == 0) {
			cout << "\n";
		}
        cout << state[i];
		cout << " ";
    }
	cout << "\n";
}

// prosedur untuk menggerakkan kotak kosong ke arah kiri
void moveLeft(int state[]) {
	int index0;
	for (int i = 0; i < 9; i++) {
        if (state[i] == 0) {
            index0 = i;
        }
    }
	if (index0 % 3 > 0) {
		int temp = state[index0];
		state[index0] = state[index0-1];
		state[index0-1] = temp;
	}
}

// prosedur untuk menggerakkan kotak kosong ke arah kanan
void moveRight(int state[]) {
	int index0;
	for (int i = 0; i < 9; i++) {
        if (state[i] == 0) {
            index0 = i;
        }
    }
	if (index0 % 3 < 2) {
		int temp = state[index0];
		state[index0] = state[index0+1];
		state[index0+1] = temp;
	}
}

// prosedur untuk menggerakkan kotak kosong ke arah atas
void moveUp(int state[]) {
	int index0;
	for (int i = 0; i < 9; i++) {
        if (state[i] == 0) {
            index0 = i;
        }
    }
	if (index0 > 2) {
		int temp = state[index0];
		state[index0] = state[index0-3];
		state[index0-3] = temp;
	}
}

// prosedur untuk menggerakkan kotak kosong ke arah bawah
void moveDown(int state[]) {
	int index0;
	for (int i = 0; i < 9; i++) {
        if (state[i] == 0) {
            index0 = i;
        }
    }
	if (index0 < 6) {
		int temp = state[index0];
		state[index0] = state[index0+3];
		state[index0+3] = temp;
	}
}

// fungsi yang menghasilkan nilai 1 jika array1 identik dengan array2, menghaslkan 0 jika tidak
int hasSameElement(int array1[], int array2[]) {
	int temp = 1;
	int i = 0;
	for (int i = 0; i < 9; i++) {
		if (array1[i] != array2[i]) {
			temp = 0;
		}
	}
	return temp;
}

// fungsi yang menghasilkan nilai heuristic untuk masing-masing sisi 8 puzzle
//	benar 1 dinilai 1, benar 2 dinilai 5, benar 3 dinilai 40 --> Pak Sabar's Heuristic :p
int sideHeuristic(int side, int currentState[], int goalState[]) {
	// side :
	//	upside = 1
	//	rightside = 2
	//	downside = 3
	//	leftside = 4
	//	center vertical = 5
	//	center horizontal = 6
	int temp = 0;
	int match = 0;
	switch (side) {
		case 1:
			match = 0;
			for (int i = 0; i < 2; i++) {
				if (currentState[i] == goalState[i] && currentState[i] != 0) {
					match++;
				}
			}
			if (match == 1) {
				temp = temp + 1;
			} else if (match == 2) {
				temp = temp + 5;
			} else if (match == 3) {
				temp = temp + 40;
			}
		break;
		case 2:
			match = 0;
			for (int i = 2; i < 9; i=i+3) {
				if (currentState[i] == goalState[i] && currentState[i] != 0) {
					match++;
				}
			}
			if (match == 1) {
				temp = temp + 1;
			} else if (match == 2) {
				temp = temp + 5;
			} else if (match == 3) {
				temp = temp + 40;
			}
		break;
		case 3:
			match = 0;
			for (int i = 6; i < 9; i++) {
				if (currentState[i] == goalState[i] && currentState[i] != 0) {
					match++;
				}
			}
			if (match == 1) {
				temp = temp + 1;
			} else if (match == 2) {
				temp = temp + 5;
			} else if (match == 3) {
				temp = temp + 40;
			}
		break;
		case 4:
			match = 0;
			for (int i = 0; i < 7; i=i+3) {
				if (currentState[i] == goalState[i] && currentState[i] != 0) {
					match++;
				}
			}
			if (match == 1) {
				temp = temp + 1;
			} else if (match == 2) {
				temp = temp + 5;
			} else if (match == 3) {
				temp = temp + 40;
			}
		break;
		case 5:
			match = 0;
			for (int i = 1; i < 8; i=i+3) {
				if (currentState[i] == goalState[i]) {
					match++;
				}
			}
			if (match == 1) {
				temp = temp + 1;
			} else if (match == 2) {
				temp = temp + 5;
			} else if (match == 3) {
				temp = temp + 5;
			}
		break;
		case 6:
			match = 0;
			for (int i = 3; i < 6; i++) {
				if (currentState[i] == goalState[i]) {
					match++;
				}
			}
			if (match == 1) {
				temp = temp + 1;
			} else if (match == 2) {
				temp = temp + 5;
			} else if (match == 3) {
				temp = temp + 5;
			}
		break;
	}
	return temp;
}

// fungsi yang menghasilkan kolom ke- dari sebuah index value pada state
int getCol(int val) {
	return ((val/3)+1);
}

// fungsi yang menghasilkan baris ke- dari sebuah index value pada state
int getRow(int val) {
    return ((val%3)+1);
}

// fungsi yang menghasilkan jarak langkah suatu kotak terhadap kondisi goalnya
int stepCounter(int condition1, int condition2) {
	int temp1 = getCol(condition1)-getCol(condition2);
	if (temp1 < 0) {
		temp1 = (temp1 * -1) * 2;
	}
	int temp2 = getRow(condition1)-getRow(condition2);
	if (temp2 < 0) {
		temp2 = (temp2 * -1) * 2;
	}
    return (((temp1 + temp2) * -1) + 4);
	//return (temp1 + temp2);
}

// menghasilkan nilai Manhattan Heuristic untuk current state terhadap goal state
int manhattanHeuristic(int currentState[], int goalState[]) {
    int temp = 0;
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            if (currentState[i] != 0) {
                if (currentState[i] == goalState[j]) {
                    temp = temp + stepCounter(i, j);
                }
            }
        }
    }
    return temp;
}

// menghasilkan nilai heuristic total (Manhattan + Pak Sabar's) untuk setiap current state terhadap goal state
int heuristicValue(int currentState[], int goalState[]) {
	return sideHeuristic(1, currentState, goalState) +
		sideHeuristic(2, currentState, goalState) +
		sideHeuristic(3, currentState, goalState) +
		sideHeuristic(4, currentState, goalState) +
		sideHeuristic(5, currentState, goalState) +
		sideHeuristic(6, currentState, goalState) +
		manhattanHeuristic(currentState, goalState);
}

// prosedur yang melakukan penyalinan nilai setiap elemen pada array2 ke setiap elemen pada array2
//	array1 dan array2 sama-sama telah terdefinisi sebelumnya
void copyArray(int array1[], int array2[]) {
	for (int i = 0; i < 9; i++) {
		array2[i] = array1[i];
	}
}

int getTheBestIndex(int arrayHeuristic[]) {
	int temp = 0;
	int tempValue = arrayHeuristic[0];
	for (int i = 0; i < 4; i++) {
		if (arrayHeuristic[i] > tempValue) {
			tempValue = arrayHeuristic[i];
			temp = i;
		}
	}
	return temp;
}

int _tmain(int argc, _TCHAR* argv[])
{
	int currentState[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	copyArray(initialState, currentState);
	int childState[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	while (hasSameElement(currentState, goalState) == 0) {
		printState(currentState);
		copyArray(currentState, childState);
		moveUp(childState);
		if (hasSameElement(childState, currentState) == 1) {
			tempHeuristic[0] = 0;
		} else {
			tempHeuristic[0] = heuristicValue(childState, goalState);
			moveDown(childState);
		}
		moveLeft(childState);
		if (hasSameElement(childState, currentState) == 1) {
			tempHeuristic[1] = 0;
		} else {
			tempHeuristic[1] = heuristicValue(childState, goalState);
			moveRight(childState);
		}
		moveRight(childState);
		if (hasSameElement(childState, currentState) == 1) {
			tempHeuristic[2] = 0;
		} else {
			tempHeuristic[2] = heuristicValue(childState, goalState);
			moveLeft(childState);
		}
		moveDown(childState);
		if (hasSameElement(childState, currentState) == 1) {
			tempHeuristic[3] = 0;
		} else {
			tempHeuristic[3] = heuristicValue(childState, goalState);
			moveUp(childState);
		}
		int tempIndex = getTheBestIndex(tempHeuristic);
		switch (tempIndex) {
			case 0:
				moveUp(currentState);
			break;
			case 1:
				moveLeft(currentState);
			break;
			case 2:
				moveRight(currentState);
			break;
			case 3:
				moveDown(currentState);
			break;
		}
		totalSolution++;
	}
	printState(currentState);
	cout << "\nTotal Solution = ";
	cout << totalSolution;

	getchar();
	return 0;
}

Kasus initial state dan goal state masih berupa hardcode, sehingga untuk mengubah-ubah nilainya perlu dilakukan secara langsung di kode program. Untuk fungsi evaluasinya, digunakan gabungan dari dua (2) nilai heuristic: Manhattan Distance dan Pak Sabar’s Heuristic :D . Manhattan Distance telah saya jelaskan sebelumnya, sedangkan untuk Pak Sabar’s Heuristic penilaiannya dilakukan untuk setiap sisi pada 8-Puzzle (upside, rightside, downside, dan leftside). Thanks to Pak Sabar atas idenya. Satu lagi… program di atas belum dilakukan strategi big jump, jadi ketika ada kasus local maxima, maka akan terjadi forever loop. Semoga bermanfaat!!!

Bersambung…


Pahlawan atau Pengkhianat?

Kalo pergi keluar negeri untuk jadi housekeeper merangkap nanny, dianggap sebagai pahlawan devisa.

Kalo pergi keluar negeri untuk kerja di perusahaan, dianggap pengkhianat bangsa.

Tapi kalo udah terkenal ato udah jadi bos di luar negeri, dianggap megharumkan nama bangsa.

Pusing, terlalu banyak label.

Kalo mau mudah, tiap manusia punya keinginan tersendiri. Selama keinginannya itu 'sekadar' ingin bahagia bekerja di tempat yang dipilihnya (plus tidak merugikan orang lain), rasanya tidak ada masalah.

The Watch Fishes

The Watch Fishes

Who will watch the watch fishes?

Make Prediction #QoD

if you make a great number of predictions, the ones that were wrong will soon be forgotten, and the ones that turn out to be true will make you famous.


Filed under: Quotation of the Day, Sitiran Tagged: Michael Newton, THE ENCYCLOPEDIA OF SERIAL KILLERS

Mohon Dibaca Untuk Mahasiswa Alpro Kelas Bu Rosa

Ini sebuah tips dari dosen UNS, jadi kalian bisa pada tahu kalau saya tidak berbohong mengenai bagaimana menguasai Algoritma dan Pemrograman.
Tips Sukses Belajar Pemrograman


The Power Of Positive Thinking

The Power Of Positive Thinking

It works! The deadline is passed and I am still working on this.
-Emma

8-Puzzle Problem (Bagian 2)

Bismillaah…

Menyambung postingan sebelumnya tentang 8-Puzzle Problem, kali ini akan saya lanjutkan dengan pembahasan detail mengenai metodologi yang digunakan dalam menyelesaikan permasalahan 8-Puzzle.

Di postingan sebelumnya telah disebutkan bahwa terdapat dua (2) metodologi dasar yang digunakan yaitu Blind Search dan Heuristic Search. Keduanya termasuk ke dalam jenis Pencarian atau Searching yang melibatkan pohon pencarian. Untuk yang Blind Search tidak akan saya bahas lebih lanjut karena secara prinsip cukup sederhana penalarannya. Sebagai contoh, sebut saja Depth First Search, yang termasuk ke dalam golongan Blind Search, hanya melakukan penelusuran terhadap pohon pencarian secara mendalam pada salah satu jalur pencarian hingga menemui solusi. Atau Breadth First Search yang hanya melakukan pencarian dengan menelusuri setiap level dari pohon pencarian. Untuk itu, sebelum kita melangkah ke pembahasan mengenai Heuristic Search, terlebih dahulu kita perlu tahu apa yang disebut sebagai heuristic itu sendiri.

Heuristic dalam konteks yang luas dapat didefinisikan sebagai suatu nilai informasi yang “dianggap” mendekati nilai solusi dari suatu permasalahan. Sebagai contoh, jika kita misalkan ada seseorang yang berada di Bandung hendak menuju Surabaya, lalu orang tersebut ingin mencari rute jalan darat terpendek yang dapat dilalui dari Bandung menuju Surabaya. Maka nilai heuristicnya bisa kita tentukan dari, misal jarak estimasi dari setiap titik keberangkatan menuju Surabaya berdasarkan jarak yang tertulis pada peta. Atau bisa saja nilai heuristicnya didasarkan pada jarak setiap titik keberangkatan terhadap stasiun kereta api terdekat. Yang jelas, nilai heuristic ini dapat sangat relatif berdasar penilaian masing-masing pembuat keputusan. Tapi perlu diingat, nilai heuristic ini digunakan dalam proses evaluasi setiap periode tertentu atau setiap titik evaluasi tertentu. Jadi sebisa mungkin nilai heuristic yang kita tentukan bersifat admissible atau dapat diterima secara semantik, baik karena kedekatannya dengan solusi maupun “masuk akal” dari sisi logika. Jika tidak demikian, maka bisa jadi bahwa proses pencarian yang kita lakukan malah akan menjauhkan kita dari solusi.

Pada 8-Puzzle Problem, kita juga dapat menentukan nilai heuristicnya. Namun agak berbeda dengan permasalahan bertipikal pencarian jarak terpendek, nilai heuristic pada 8-Puzzle langsung ditentukan berdasar kondisi kedekatannya dengan goal, karena kita tidak pernah tahu jarak atau langkah yang kira-kira dapat ditempuh dari state sekarang ke goalnya.

Pada berbagai referensi, ada beberapa nilai heuristic yang dapat dijadikan acuan untuk permasalahan 8-Puzzle. Salah satu yang cukup terkenal adalah Manhattan Distance. Manhattan Distance didefinisikan sebagai penjumlahan jarak masing-masing kotak 8-Puzzle terhadap posisinya yang benar pada kondisi goal. Sehingga, pada kondisi goal, heuristic pasti akan bernilai 0, karena semua kotak sudah pada posisinya masing-masing (jarak dengan posisinya yang benar = 0). Cara pendekatan seperti ini telah cukup dianggap admissible atau masuk akal. “Bagi yang mengatakan tidak masuk akal berarti akalnya belum masuk” by Jaya Setiabudi. :D

Berikut adalah contoh perhitungan Manhattan Distance untuk suatu state terhadap kondisi goalnya.

Seperti telah dikatakan sebelumnya, bahwa penilaian heuristic ini sangat relatif berdasar cara penalaran si pembuat keputusan. Jadi, sebenarnya penilaian ini juga dapat disebut sebagai penerapan strategi untuk permasalahn 8-Puzzle. Semakin bagus strateginya, maka akan semakin mangkus jalur pencarian yang dihasilkan. Monggo… bagi yang mempunyai strategi lebih bagus daripada Manhattan Distance dapat dishare dengan saya. :)

Berikutnya, yang kita lakukan adalah menentukan metodologi atau algortima pencariannya. Dengan menentukan metodologi pencarian, berarti kita menentukan bagaimana proses evaluasi yang dilakukan, tentunya menggunakan penilaian heuristic yang telah kita tentukan. Ada banyak metodologi yang dapat diterapkan untuk permasalahan 8-Puzzle. Berikut ini akan saya bahas beberapa algoritma populer yang dapat diterapkan untuk mencari jalur langkah penyelesaian 8-Puzzle.

Hill Climbing
Algoritma Hill Climbing merupakan salah satu teknik optimasi matematis yang termasuk ke dalam kategori local search. Disebut local search karena hanya melakukan evaluasi terhadap kemungkinan-kemungkinan state yang saat ini sedang dihadapi. Ketika telah memilih salah satu state yang dianggap terbaik, maka Hill Climbing akan melanjutkan pencarian hanya berdasar state yang telah dipilih tersebut, hingga mencapai kondisi goalnya. Jadi, ketika telah dipilih satu jalur, maka jalur yang lain akan diabaikan. Itulah mengapa Hill Climbing sering dianggap sebagai cara pencarian heuristic yang tercepat, karena hanya melakukan simple evaluation terhadap beberapa kemungkinan state yang dianggap terbaik, lalu memilihnya, dan melupakan kemungkinan lain yang berada di luar kondisi evaluatifnya. Dengan bahasa awamnya, Hill Climbing ini adalah tipikal yang setia dalam melakukan pemilihan. :D

Pada 8-puzzle, satu kali proses evaluasi menggunakan Hill Climbing hanya akan melibatkan maksimal 4 state untuk kondisi initial state, dan maksimal 3 state untuk kondisi state selain initial state. Sehingga state space untuk algoritma ini dapat dikatakan relatif sangat kecil. Berikut adalah contoh bagaimana algortima Hill Climbing dijalankan untuk suatu kasus state tertentu. Perlu diingat bahwa proses evaluasi yang dilakukan akan selalu mengambil nilai heuristic yang paling kecil.

Tetapi, Hill Climbing mempunyai dua (2) kelemahan:

  • Plateau, kondisi ketika ada dua (2) atau lebih evaluation state yang mempunyai nilai heuristic sama besar dan juga merupakan nilai terbaik.
  • Local Maxima, yaitu solusi lokal yang ditemukan dengan fungsi evaluasi. Tetapi solusi ini bukan kondisi goal yang diharapkan, dan jika dilakukan evaluasi secara terus menerus, maka akan kembali lagi ke kondisi solusi lokal itu sendiri. Karena memang fungsi evaluasi yang dilakukan menemui batasan pencarian lokal.

Untuk mengatasi kelemahan tersebut, ada strategi yang dapat diterapkan pada Hill Climbing agar solusi dapat ditemukan dengan baik. Strategi tersebut adalah:

  • Untuk plateau cukup dapat diatasi dengan menerapkan aturan prioritas pergerakan kotak kosong. Misal, pergerakan kotak kosong ke atas adalah lebih diprioritaskan daripada pergerakan ke kiri, pergerakan kotak ke kiri lebih diprioritaskan daripada pergerakan ke kanan, dst.
  • Sedangkan untuk local maxima, diperlukan lompatan besar (big jump) dengan memilih evaluation state yang lain ketika dalam kondisi local maxima. Big jump dapat diartikan dengan memilih state lain yang memiliki kedekatan heuristic dengan state terbaik, atau dengan cara melakukan pemilihan acak (random) terhadap state lainnya yang bukan terbaik.

Berikut adalah contoh implementasi algoritma Hill Climbing menggunakan bahasa pemrograman Java.

import java.util.Vector;
/**
 *
 * @author Andik Taufiq
 * Hill Climbing solver for 8 puzzle problem
 * March 18, 2010 - Bandung, Indonesia
 */
public class HillClimbing {
    public Vector trackNodes;
    private Node node;
    public int[] initialState;
    public int[] finalState;
    public String message = "";
    public HillClimbing(int[] initialState, int[] finalState) {
        this.initialState = initialState;
        this.finalState = finalState;
        trackNodes = new Vector();
        node = new Node(initialState, "");
        node.heuristicValue = heuristic(node.nodeState, finalState);
        trackNodes.addElement(node);
    }

    public String strArray(int[] array) {
        String temp = "[ ";
        for (int i = 0; i &lt; array.length; i++) {
            temp = temp + Integer.toString(array[i]) + &quot; &quot;;
        }
        temp = temp + &quot;]&quot;;
        return temp;
    }

    public String strSpecialArray(int[] array) {
        String temp = &quot;+===+===+===+\n&quot;;
        String value = &quot;&quot;;
        for (int i = 0; i &lt; array.length; i++) {
            if (array[i] == 0)
                value = &quot; &quot;;
            else
                value = Integer.toString(array[i]);
            temp = temp + &quot;| &quot; + value + &quot; &quot;;
            if (i%3 == 2) {
                if (i &lt; array.length - 1) {
                    temp = temp + &quot;|\n+---+---+---+\n&quot;;
                } else {
                    temp = temp + &quot;|\n&quot;;
                }
            }
        }
        temp = temp + &quot;+===+===+===+\n&quot;;
        return temp;
    }

    private boolean hasSameElement(int[] state1, int[] state2) {
        boolean temp = true;
        int tempInt = 0;
        for (int i = 0; i &lt; state1.length; i++) {
            if (state1[i] == state2[i])
                tempInt++;
        }
        if (tempInt == state1.length)
            temp = true;
        else
            temp = false;
        return temp;
    }

    private boolean hasSameElements(int[] state, Vector arrayOfNodes) {
        boolean temp = true;
        int i = 0;
        int counter = 0;
        Node tempNode;
        tempNode = new Node(state, &quot;&quot;);
        for (i = 0; i &lt; arrayOfNodes.size(); i++) {
            tempNode = (Node) arrayOfNodes.elementAt(i);
            if (!hasSameElement(state, tempNode.nodeState)) {
                counter++;
            }
        }
        if (counter == arrayOfNodes.size()) {
            temp = false;
        } else {
            temp = true;
        }
        return temp;
    }

    private int getMinVal(int[] array) {
        int tempIndex = 0;
        int tempValue = array[0];   // pre-assumed that array will never contains null value
        for (int i = 0; i  array[i]) {
                tempIndex = i;
                tempValue = array[i];
            }
        }
        return tempIndex;
    }

    private Node getTheBestNode(Vector childs) {
        int[] tempHeuristic = new int[childs.size()];
        for (int i = 0; i &lt; childs.size(); i++) {
            tempHeuristic[i] = heuristic(((Node) childs.elementAt(i)).nodeState, finalState);
        }
        int tempIndex = getMinVal(tempHeuristic);
        return (Node) childs.elementAt(tempIndex);
    }

    public int[] moveLeft(int index, int[] state) {
        int[] tempState = new int[state.length];
        for (int i = 0; i &lt; tempState.length; i++) {
            tempState[i] = state[i];
        }
        int temp = tempState[index-1];
        tempState[index-1] = 0;
        tempState[index] = temp;
        return tempState;
    }

    public int[] moveRight(int index, int[] state) {
        int[] tempState = new int[state.length];
        for (int i = 0; i &lt; tempState.length; i++) {
            tempState[i] = state[i];
        }
        int temp = tempState[index+1];
        tempState[index+1] = 0;
        tempState[index] = temp;
        return tempState;
    }

    public int[] moveUp(int index, int[] state) {
        int[] tempState = new int[state.length];
        for (int i = 0; i &lt; tempState.length; i++) {
            tempState[i] = state[i];
        }
        int temp = tempState[index-3];
        tempState[index-3] = 0;
        tempState[index] = temp;
        return tempState;
    }

    public int[] moveDown(int index, int[] state) {
        int[] tempState = new int[state.length];
        for (int i = 0; i &lt; tempState.length; i++) {
            tempState[i] = state[i];
        }
        int temp = tempState[index+3];
        tempState[index+3] = 0;
        tempState[index] = temp;
        return tempState;
    }

    private Vector getPossibleChilds(Node parent, Node ancestor) {
        Node tempNode = new Node(parent.nodeState, &quot;&quot;);
        Vector tempStates = new Vector();
        int[] tempState = new int[parent.nodeState.length];
        for (int i = 0; i &lt; tempState.length; i++) {
            tempState[i] = parent.nodeState[i];
        }
        int index = 0;
        // locate the index of empty tile
        for (int i = 0; i &lt; 9; i++) {
            if (tempState[i] == 0) {
                index = i;
            }
        }
        switch (index) {
            case 0:
                tempState = moveRight(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveLeft(index+1, tempState);
                tempState = moveDown(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 1:
                tempState = moveLeft(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveRight(index-1, tempState);
                tempState = moveRight(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveLeft(index+1, tempState);
                tempState = moveDown(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 2:
                tempState = moveLeft(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveRight(index-1, tempState);
                tempState = moveDown(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 3:
                tempState = moveUp(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveDown(index-3, tempState);
                tempState = moveRight(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveLeft(index+1, tempState);
                tempState = moveDown(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 4:
                tempState = moveUp(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveDown(index-3, tempState);
                tempState = moveLeft(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveRight(index-1, tempState);
                tempState = moveRight(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveLeft(index+1, tempState);
                tempState = moveDown(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 5:
                tempState = moveUp(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveDown(index-3, tempState);
                tempState = moveLeft(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveRight(index-1, tempState);
                tempState = moveDown(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 6:
                tempState = moveUp(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveDown(index-3, tempState);
                tempState = moveRight(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 7:
                tempState = moveUp(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveDown(index-3, tempState);
                tempState = moveLeft(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveRight(index-1, tempState);
                tempState = moveRight(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
            case 8:
                tempState = moveUp(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
                tempState = moveDown(index-3, tempState);
                tempState = moveLeft(index, tempState);
                if (!hasSameElement(tempState, ancestor.nodeState)) {
                    tempNode = new Node(tempState, &quot;&quot;);
                    tempStates.addElement(tempNode);
                }
            break;
        }
        return tempStates;
    }

    public Node getLastNode(Vector trackNodes) {
        return (Node) trackNodes.elementAt(trackNodes.size()-1);
    }

    public void solveHillClimbing() {
        Node tempNode = new Node(initialState, &quot;&quot;);
        Vector tempChilds = new Vector();
        tempChilds = getPossibleChilds((Node) trackNodes.elementAt(0),
                (Node) trackNodes.elementAt(0));
        tempNode = getTheBestNode(tempChilds);
        int i = 0;
        while (!hasSameElement(((Node) trackNodes.elementAt(i)).nodeState, finalState)) {
            if (hasSameElements(tempNode.nodeState, trackNodes) == false) {
                trackNodes.addElement(tempNode);
                if (!hasSameElement(tempNode.nodeState, finalState)) {
                    tempNode = new Node(tempNode.nodeState, &quot;&quot;);
                    tempNode = getTheBestNode(getPossibleChilds((Node) trackNodes.elementAt(i+1),
                        (Node) trackNodes.elementAt(i)));
                }
                i++;
            } else {
                trackNodes.addElement(tempNode);
                message = &quot;Local max at &quot; + strArray(((Node) trackNodes.elementAt(i)).nodeState);
                i++;
                break;
            }
        }
    }

    private int getCol(int val) {
        return ((val/3)+1);
    }

    private int getRow(int val) {
        return ((val%3)+1);
    }

    private int stepCounter(int condition1, int condition2) {
        return (Math.abs(getCol(condition1)-getCol(condition2)) +
                Math.abs(getRow(condition1)-getRow(condition2)));
    }

    public int heuristic(int[] currentState, int[] finalState) {
        int temp = 0;
        for (int i = 0; i &lt; currentState.length; i++) {
            for (int j = 0; j &lt; finalState.length; j++) {
                if (currentState[i] != 0) {
                    if (currentState[i] == finalState[j]) {
                        temp = temp + stepCounter(i, j);
                    }
                }
            }
        }
        return temp;
    }
}

Keterangan Kode Program:

  • Kode program di atas membutuhkan kelas Node seperti yang telah saya tuliskan pada postingan sebelumnya.
  • Komponen masukan untuk penyelesaian dalam algoritma adalah berupa atribut initalState dan finalState.
  • Penghitungan nilai heuristic diterapkan pada method heuristic().
  • Langkah penyelesaian diimplementaskan pada method solveHillClimbing().
  • Sehingga diperoleh hasil solusi yang ditampung pada trackNodes. Isi dari trackNodes ini dapat digunakan, baik untuk ditampilkan dengan GUI maupun dengan text mode.

Untuk program drivernya, saya berikan kebebasan bagi Anda untuk berkreasi. :D

bersambung…


Only If..

When there’s a shadow near, reach for the sun
When there is loving here, look for the one
And for the promises, there is the sky
And for the heavens are those who can fly

Chorus:
If you really want to, you can hear me say
Only if you want to will you find a way?
If you really want to you can seize the day
Only if you want to will you fly away?

Interlude:
Na na na…

When there’s a journey to follow the star
When there’s an ocean to sail to far
And for the broken hearts there is the sky
And for tomorrow are those who can Fly

Chorus….

Bridge:
Je voudrais voler, comme un oiseau d’ailleurs
(bis) d’ailleurs

Chorus…


Filed under: Daily Life, Lirik, Song of the Day Tagged: Enya, May it Be

Maaf ya… Nikon

Bismillaah…

Rasanya sudah lama tidak corat-coret di buku gambar. Kebetulan hari jumat malam sengaja membeli pensil 2B dan sebuah buku gambar di Ganesha Stationary. Dan… inilah hasil iseng-iseng saya hari ini. :D

Nikon… sori ya, dirimu tergantikan sementara oleh Kiky dan Staedler Mars Lumograph 2B


Double Dump

Double Dump

and she deleted me from facebook :D

Ahead

Mau nya menggambar dengan tema "Ahead" malah jadinya orang lomba maraton. Pelari maraton dengan tipe penyanyi dangdut.
Ilustrasi dibuat untuk Illustration Friday.

Wrong Question To Ask

Wrong Question To Ask

Apa yang Harus Dilakukan Jika Merasa Sendiri Menyelesaikan Banyak Hal?

image source: http://hardiaputra.files.wordpress.com/2009/03/sendiri.jpg

Apa ya yang harus dilakukan jika kita merasa sendiri dalam melakukan banyak hal? Merasa sendiri di keramaian, merasa sendiri walau ada orang di sekitar.


No hard feeling, but it’s all about the metric dear…

"I don't want to have kid(s)." once I said to my parents. And they said "Just see, your mindset will change as you grow older." But at this stage of life, 20+x going to 20+x+1 whereas x> 5, I really really really don't want to have a kid.

Perhaps I should share it to you: my future never-will-be child, why i don't want to be your parent. It's not because i don't love you nor because i'm selfish nor because i'm not afraid to die alone. But it's because: i consider every day, every single day in my life up until now, as NOT-interesting. And I truly hope that you will not suffer the same fate as me.

Our society and civilization has evolved so much. And at current date, at its glorious so called modern state, do you see what i see?
Twenty years back you could sell sweet soya sauce by claiming: "My sweet soya sauce is the best!"
However at current age, people will throw back your claim at your face and say "Uh-huh..what is the support of your claim?" Which is in simple term: you have to translate the term: BEST into something that can be understood by common people: NUMBERS!
For soya sauce the translation can be varies:
  • The average change of number where the husband is eating home-cook food in one week from 1000 families.
  • The average change of family members' body weight after a month using the given soya sauce.
  • Or whatever as long as it displays good numerical properties.
So you can see my dear child, nowadays all the advertisements are not stating qualitative terms but rather displaying quantitative terms such as surveys, analytical results, etc.

This lead to another discussion: how do we value our own life?
My dear child, the greatest sin in our current society is not about blasphemy, denying so called holy ghost, etc.
But more into: sitting in false positions in too many properties (dimensions) of our society bell curves.
In other words: for a given property, you can't afford to be a standard more-over sub-standard. You have to be over the standard.

So if your intelligence = standard, face = standard, body = standard, communication ability = standard, etc1 = standard, etc2 = standard, ... etcn = standard, you know that you're in deep shit.
Yup my dear child, it is can be seen in our current society professional lives. Professor is someone whose intellectuality is over the standard, porn star is someone whose body and face are over the standard, etc.
If you are within standard, then welcome to join millions of other robotic-like, clone-like "ordinary" employees. If you are a sub-standard, then you're a trash.

My dear child,
since the very early stage of your life, you will be calculated, converted into numerical values so called marks. Yup, your quality is nothing more than numbers in your report sheet. Will i care about your desires, dreams, about how you treat others, or about how you view this world? Suddenly it will look like the soya sauce advertisement. No, i will not be able to understand you. I will choose the easiest path: by numerical values.

And since it is in numerical values, it will become easy to compare you and the others. Suddenly you will be placed inside the famous bell curve. The problem is the bell curve will shift according to the sample values. In other word, if you are a top in one property, you will be grouped with other tops and suddenly you become standard again. So what is the limit? What is the goal?

I also don't know. But say: if you were a top student in Stanfart, Hardfart, Institut Tai Burung, Not-Up-to-Standard, i would say that I am proud you! Because at that state, you stand as the over-standard outliers from thousands, millions perhaps, of people.

This will break my heart into pieces.

I really don't want to convert you into such values. I really want to consider you as an uniqueness. For whatever bell curves, you are always over the standard for me.
But yeah, i have to admit, the society doesn't permit me to. Even if i can protect you, but i can't protect you from society. When you go out, to find a job for example, you will be converted again, and the mighty bell curves will be put on you.
It is a slavery, we are the slaves, and our society is the master.

I always like the story where the hero is fighting monsters with strong righteous heart, or undead with faith. But currently we are fighting each other with yeah...metric. The numerical properties of our "self". There is no place for non-understandable terms like righteous heart, faith, etc.

I don't like this world. I do wish to be able to see other worlds, where metric will fail, where something else prevails. Perhaps in the other world there exists a method to view this world other than metric and numbers. Perhaps...and perhaps...

At the end, as silly as it seems, I do hope we can fight monsters and undead together, in the other world.

Nabi Saja Oedipus Complex (Suka Wanita Lebih Tua), So Why Not?

image source: http://permataakmi.files.wordpress.com/2009/10/jilbab-kartun.jpg

Kemarin ada topik menarik yang sedang diolok-olokkan beberapa mahasiswa terhadap temannya. Olok-olok itu terjadi mengenai apabila seorang lelaki menyukai wanita dengan usia lebih tua. Saya orang yang sangat terbuka dengan pilihan hidup siapapun karena bagi saya hidup adalah pilihan, semua pilihan memiliki resiko, dan semua pilihan ditanggung oleh manusia yang membuat pilihan, jadi pilihan terserah orang yang menjalaninya. Semua pilihan selalu memiliki nilai plus dan minus.
Saya kurang setuju dengan kurang open mind-nya masyarakat kita mengenai pilihan hidup seseorang. Sekarang coba kita lihat, Nabi Muhammad saja diberikan jodoh wanita yang jauh lebih tua dari usia Nabi (oedipus complex (menyukai wanita yang lebih tua)). Saat menikah setahu saya Nabi Muhammad berusia 25 tahun dan Khadijah berusia 40 tahun, selisih 15 tahun. Dan setahu saya, saat bersama Khadijah Nabi survive dari permasalahan-permasalahan sulit dengan Khadijah yang memang lebih wise di usianya. Bahkan saat bersama Khadijah Nabi tidak poligami. So dimana letak negatifnya? Atau hanya karena anggapan kultur belaka?
Lalu satu hal yang saya juga kurang setuju dengan kultur di masyarakat dimana seorang wanita tabu mengatakan “suka” duluan. Setahu saya Khadijah yang menyatakan dulu kepada Nabi Muhammad akan maksudnya. So dimana negatifnya? Atau hanya takut mengambil resiko ditolak saja? Apa kata dunia? Begitukah? Saya rasa sebaiknya kita lebih open mind dengan setiap pilihan manusia, jangan hanya termakan kultur belaka.


Doa Nabi Ibrahim Memohon Keturunan yang Baik

Ya Tuhanku, jadikanlah aku dan anak-cucuku orang-orang yang tetap mendirikan shalat. Ya Tuhan kami, perkenankan doaku.

Lord, make me and my offspring steadfast in prayer. Our Lord, grant our wishes. (Q.S. 14: 40)


Filed under: Al Quran, Quotation, Quotation of the Day Tagged: Ibrahim, Quran

UPI Wisuda VS Gasibu Minggu

Ternyata saat di UPI ada acara wisuda, suasananya tidak kalah dengan pasar minggu di Gasibu. Mulai penjual daleman sampai luaran semuanya ada :D .

Depan Parkir Gedung FPMIPA-C Ilmu Komputer

Depan Gedung FPMIPA-C Ilmu Komputer

Rame kan?

Suasana depan Lapangan Olahraga


Seru Bersama Mahasiswa

Inilah beberapa foto serunya saat-saat mahasiswa di Ilmu Komputer UPI bersama Bu Rosa he he he he he……

Yang Mana Dosennya?



Lesehan di Lobby Ilmu Komputer


Tetap Belajar Walau Lesehan di Lab. RPL dan Dekat Rak Sepatu


Lesehan di Lab. RPL


Romantisme Mahasiswa


No More FV

Undangan FarmVille

Ampuun, saya sudah pensiun ‘berkebun’ (koinnya dipake naik haji & jalan-jalan ke Maroko).


Filed under: Sampah, Selingan Tagged: FarmVille, Zinga

Love And Spellcheck Are Perfect Match

Love And Spellcheck Are Perfect Match

Roses are red, Violet are bule.
–Charlie

Cikal Bakal Kultur Plagiat dan Korupsi yang Sudah Biasa di Indonesia

image source: http://i.ytimg.com/vi/35bVHdAzgI0/0.jpg

Jaman dulu dah sering lagu India tiba-tiba jadi lagu dangdut di Indonesia cuman diubah lirik. Lalu alasan pemakai nadanya terinspirasi dari sebuah lagu India (Gak langsung diakui kalo njiplak). Anda tentu tahu kan beda menjiplak dan “terinspirasi”.

Saya pernah mereset nilai mahasiswa saya (dianggap tidak ada nilai sama sekali di 2 kelas) karena sebagian besar dari mereka menyontek.

Saya pernah menge-nol-kan nilai beberapa mahasiswa saya karena ketahuan menyontek.

Mungkin terkesan saya kejam atau dijuluki “wanita berhati lurus”, tapi di hukum agama saya saja jika orang yang sudah baligh mencuri, maka harusnya dipotong tangannya, apakah Tuhan kejam jika begitu?

Dari semua peristiwa itu sepertinya memang “menyontek” sudah kultur.

Belum lagi plagiat di Universitas Parahiyangan Bandung oleh Seorang Profesor, atau plagiat Disertasi S3 yang ada di ITB baru-baru ini (baca disini). Parahnya mereka sudah melakukan lebih dari sekali. Lalu sering alasan yang dipakai orang Indonesia, “Saya Khilaf”. Saya pernah mendengarkan sebuah perkataan dari seorang dosen, kurang lebih seperti ini, “Manusia melakukan kesalahan pertama itu wajar dan manusiawi, lalu melakukan kesalahan kedua yang sama, itu juga masih manusiawi, tapi jika melakukan yang ketiga kalinya kesalahan yang sama itu sama dengan keledai“. Memalukan, apa karena sudah tidak punya malu?

Kenapa saya membahas menyonteknya. Karena menyontek biasanya dilakukan karena seseorang malas berusaha keras sehingga demi mendapatkan nilai bagus dia menyontek. Nah itu bisa berkembang menjadi karena ingin mendapatkan uang banyak dan malas berusaha keras maka dia korupsi (cikal bakal Gayus gayus yang lain). Intinya pada moral “malas” dan “menghalalkan segala cara”.

Hal ini sudah seperti lingkaran “setan” saja, karena misal awalnya moral dibentuk dari kecil seperti sekolah Dasar (SD), tapi semua orang juga tahu secara mayoritas siapa yang akan menjadi guru SD (saya saja tidak bersedia sebagai PNS guru SD :D , bagi saya jadi guru SD susah). Sering agar sekolah mendapat penilaian bagus saat UN malah yang pintar disuruh gurunya menyonteki yang tidak bisa. Memang benar-benar sudah susah secara sistem untuk dibenahi. Atau ketika para guru itu diharuskan sekolah lagi ke S1 malah pas ujian saling menyontek, atau skripsinya benar-benar nyontek, yang penting lulus. Lha terus……kalau gurunya begitu, bagaimana siswanya?


Gangsir.com Bangkit dari Kubur… (Part 2)

Logo Gangsir.com

Akhirnya Gangsir.com mampu bangkit kembali dari kuburnya. Ini kedua kalinya situs ini bangkit dari kuburnya. Gangsir.com pertama kali hidup sekitar tahun 2006. Kami hosting pada sebuah perusahaan hosting lokal. Tapi ternyata tidak sampai satu tahun, perusahaan tersebut bangkrut dan pemiliknya kabur :( . Dan sialnya, domain Gangsir.com terdaftar atas nama pemilik hosting tersebut, bukan atas nama kami. Kami harus menunggu cukup lama agar domain tersebut expired dan kemudin kami daftarkan lagi. Memang sih kami memilih hosting di tempat tersebut karena harganya yang murah.

Setelah menunggu beberapa bulan, akhirnya Gangsir.com kembali. Terima kasih buat teman kami Ditto Rahmat yang telah membantu agar Gangsir.com bisa bangkit dari kuburnya pada sekitar bulan November 2007. Setelah berjalan hampir 2 tahun kami kembali terkena musibah. Gangsir.com kembali mati pada pertengahan tahun 2009 gara-gara masalah hosting juga…

Dan alhamdulillah setelah sekian lama, pada hari Senin, 19 April 2010 kami berhasil menghidupkan kembali Gangsir.com. Semoga ini adalah kebangkitan yang terakhir dari situs ini, karena akan kami usahakan agar situs ini tidak pernah mati lagi. Amin. Kami sekarang hosting ditempat yang berbeda lagi. Sekali lagi terima kasih kepada Ditto Rahmat yang telah banyak membantu pada kebangkitan Gangsir.com untuk yang kedua kalinya.

Dikebangkitan Gangsir.com yang kedua ini, kami juga memberikan fitur yang benar-benar baru. Kami membuat sebuah proyek open source aplikasi untuk para dokter. Aplikasi tersebut kami beri nama GangDoctor. Aplikasi tersebut dapat digunakan untuk mencatat data pasien dan data obat. Semoga aplikasi tersebut dapat bermanfaat bagi semuanya. Amin.


Hungry-hungry Hobo

Siaga satu, segera menyelamatkan data.


Filed under: Sampah Tagged: FreeAgent, Seagate FreeAgent

Ask The Introverts: Blackberry

Ask The Introverts: Blackberry

It’s all about peer pressure with Blackberry.
- Charlie

Invincible

Diambil dari www.chantalkreviazuk.com

I thought I had the right day, but I was in the wrong place.
I tried to open a door, but got it slammed in my face.
I’m at the back of the line, feels like eternity.

Well, they tell me I’m gettin’ close, but I know I’m still far.
You can dress me up, but you can’t cover my scars.
I’ve become a professional at hide and seek.

I’m a danger to myself.

I can take a wrong turn, you’re right behind me.
Crash and burn, I know you’ll find me.
As long as you’re here, I’m invincible.

I can call your name and you’ll come running.
It’s pouring rain, you’ll make it sunny.
As long as you’re here, I’m invincible.

Want to be part of the cure, but I’m part of the disease.
I can chase butterflies, but I get stung by the bees.
Sometimes I think too much, forget my clarity.

I bought every self-help book that I could fit on the shelf.
Too many Downward Dogs, they can be bad for your health.
I don’t know who I am, so much for therapy.

I’m a danger to myself.

I can take a wrong turn, you’re right behind me.
Crash and burn, I know you’ll find me.
As long as you’re here, I’m invincible.

I can call your name and you’ll come running.
It’s pouring rain, you’ll make it sunny.
As long as you’re here, I’m invincible.

I’m not the same old girl, no.
I want a brand new world.

I can take a wrong turn, you’re right behind me.
Crash and burn, I know you’ll find me.
As long as you’re here, I’m invincible.

I can call your name and you’ll come running.
It’s pouring rain, you’ll make it sunny.
As long as you’re here, I’m invincible.

I thought I had the right day, but I was in the wrong place.
I tried to open a door, but got it slammed in my face.
I’m at the back of the line, feels like eternity.


Filed under: Daily Life, Lirik, Song of the Day Tagged: Chantal Kreviazuk, Plain Jane

Detective


Akhirnya mengikuti saran dari Cely buat ikutan illustrationfriday. Kali ini topic nya adalah "detective". Ini gambar detective lagi senyum-senyum sambil melacak sesuatu. Camera dari bawah.

Altering Execution Flow

Dengan menggunakan mekanisme try catch sebuah exception, kita bisa bikin eksekusi code kita melompat – lompat sesuai keinginan kita. Ini biasanya kita gunakan untuk sanity check dari variable yang kita punya.

Contohnya adalah code berikut ini (penjelasannya ada di comment dari method berikut ini):

protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object object, BindException bindException) throws Exception {
    // user must be authenticated (avoids auth errors)
    if (Context.isAuthenticated()) {
        HttpSession httpSession = request.getSession();
        httpSession.setMaxInactiveInterval(-1); // don't let the session expire

        String password = ServletRequestUtils.getStringParameter(request, "password");
        String passphrase = ServletRequestUtils.getStringParameter(request, "passphrase");

        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

        byte[] iv = new byte[IV_SIZE];
        try {
            MultipartFile secretFile = multipartRequest.getFile("secretFile");
            // sanity check
            if (secretFile == null || secretFile.isEmpty())
                throw new IOException("Unable to read secret file.");
            InputStream secretFileInputStream = secretFile.getInputStream();
            int ivSize = secretFileInputStream.read(iv);
            // make sure the iv is 16 byte
            if (ivSize != IV_SIZE)
                throw new IOException("Secret file is corrupted or invalid secret file are being used.");
            secretFileInputStream.close();

            MultipartFile returnedData = multipartRequest.getFile("summaries");
            // sanity check
            if (returnedData == null || returnedData.isEmpty())
                throw new IOException("Unable to read collection of summaries file.");
            InputStream summariesInputStream = returnedData.getInputStream();

            FileUtils.inflateSummaries(summariesInputStream, SummaryConstants.OUTPUT_LOCATION, password, passphrase, iv);
            FileUtils.loadIndexFile("summaryindex.sql");

            summariesInputStream.close();

            String message = "Inflating collection of summary files completed successfully. Please check if files are decrypted succesfully.";
            httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, message);
        }
        catch (Exception e) {
            log.error("Inflating collection of summary files failed", e);
            httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, e.getMessage());
        }
        return new ModelAndView(new RedirectView(getSuccessView()));
    }
    return showForm(request, response, bindException);
}

Inti dari tips kali ini adalah throwing exception didalam try catch block. Dengan mekanisme ini, flow dari program kita akan berubah sesuai dengan exception yang terjadi. Contohnya saat ivSize yang dibaca tidak sesuai dengan minimum yang kita inginkan, kita bisa men-throw exception disana dan exception ini akan di-catch kemudian sebuah error message akan ditampilkan di halaman web yang sedang dibuka oleh user.

            if (ivSize != IV_SIZE)
                throw new IOException("Secret file is corrupted or invalid secret file are being used.");

Dengan mekanisme ini, kita bisa mengatur flow eksekusi program kita tanpa if-then-else dan tanpa explicit goto.


Filed under: Personal Tagged: Java, programming

Knowing When to Stop

It's just like when we see people who love to gamble, this sentence is often said to stop them doing things that they, themself, know that it's not going to work at all, at least not in the way it is. Stop doing something repeatedly when you already know that the outcome is not going to be any better.

But what about love? Knowing that your path of loving someone is going to be very painful...do you still want to move forward and take all the risks? Don't you think by doing something like that you will only hurt more people and undoubtedly your love one?

Well, actually I don't have the intention to keep this serious talking right now. I just remember what my friend said when we were having dinner today. One of my friend ask us a question about the criteria of our ideal girlfriend/boyfriend. And this friend of mine, she said two things that made us laughed. She said, the first one must be "gebetable" and followed by "kissable", well more or less something like that.

"Gebetable" is, hmm, an Indonesian slang word joined with "able". "Gebetan" (n) is something like a person that you have an eye for. By saying this, does that mean that you have to know when to stop liking a person when he/she, for some reasons, is not "gebetable"? You have an eye for him/her but you know that if you have a relationship with him/her things will not go as a prince-and-princess-lived-happily-ever-after story, or at least that's what you think...

"Gebetable" --LOL-- Oh come on, Girl! You must be joking right! Where did you find that word? --LOL-- Hilarious! Indeed!

--
And what is this "kissable" about --LOL--
Just thinking about these two words makes me laugh all night long...

8-Puzzle Problem (Bagian 1)

Bismillaah…

Di tengah merebaknya “gosip” seputar paniknya pengumpulan tugas kuliah yang kian hari kian “riweuh” dan menumpuk, sepertinya baru mulai terasa bahwa kehidupan perkuliahan rupanya mengandung beban yang makin syarat serta semakin menguras waktu dan pikiran (lebay mode: ON). Untuk itu, saya berniat sedikit berbagi dengan teman-teman yang mungkin sedang sibuk-sibuknya “kejar tayang” dengan pekerjaan kantornya atau barangkali sedang “nyungsang jempalik” mengurusi masalah keluarga yang juga tidak kalah pentingnya. Sebagai “jomblowan” dan kaum “pengangguran”, saya memaklumi hal itu. Berikut adalah ulasannya. Monggo disemak!!

Ok… postingan kali ini adalah tentang tugas perkuliahan Intelejensi Buatan Tingkat Lanjut (EL5133) yang membahas mengenai permasalahan 8-puzzle (8-Puzzle Problem). Dalam dunia artificial intelligence, permasalahan-permasalahan yang sederhana seperti 8-Puzzle ini sering digunakan sebagai miniatur simulasi pencarian solusi terhadap suatu masalah. Tentang seperti apa, mengapa, dan bagaimana penerapan 8-Puzzle Problem ini, ada baiknya kita uraikan satu per satu poin-poinnya.

Definisi Singkat
8-Puzzle adalah representasi permainan teka-teki yang dapat diselesaikan dengan mengurutkan atau menyusun komponen-komponen pembentuknya sesuai dengan kondisi yang diinginkan. Komponen pada 8-Puzzle adalah berupa kotak-kotak bernomor atau bergambar (sesuai kebutuhan) yang dapat diacak sedemikian hingga menjadi suatu pola random yang dapat dicari jalan penyelesaiannya. Sesuai namanya, 8-Puzzle terdiri atas 8 kotak dan 1 tempat kosong yang dapat digerakkan dengan aturan tertentu. Aturan pergerakannya hanya berupa empat (4) arah pergerakan, yaitu: atas, bawah, kanan, dan kiri. Serta terlimitasi oleh ukuran dimensi papan yang ditempatinya. Pada 8-Puzzle, batasannya adalah ukuran 3×3. Sehingga, 8 kotak yang dimiliki hanya dapat bergerak dalam lingkup ukuran tersebut.

Tipikal Permasalahan
Tipikal permasalahan yang disajikan oleh 8-Puzzle adalah berupa pencarian langkah-langkah konkret sesuai aturan sehingga menuju kondisi akhir yang diinginkan. Oleh karena itu, pada bidang artificial intelligence, penyelesaian permasalahan 8-Puzzle ini dapat dikategorikan ke dalam metode Pencarian atau Searching. Penjelasan lebih lanjut mengenai Searching akan dibahas pada poin Metodologi.

Struktur Representasi
Karena berupa pencarian langkah-langkah menuju goal, maka permasalahan 8-Puzzle ini mungkin lebih sesuai jika direpresentasikan dalam bentuk Pohon Penyelesaian. Sehingga implementasinya akan lebih “mengena” jika menggunakan struktur pohon atau tree node dengan jumlah child sebanyak N, atau yang lebih familiar kita sebut sebagai N-ary Tree. Berikut adalah contoh implementasi N-ary Tree yang saya buat menggunakan bahasa favorit saya, JavaTM (dibacanya bukan Jawa Timuran ya… :p).

import java.util.Vector;
/**
 *
 * @author Andik Taufiq
 * Node represents element of N-ary tree
 * March 18, 2010 - Bandung, Indonesia
 */
public class Node {
    public Node parentNode = null;
    public Vector children;
    public int index = 0;
    public int[] nodeState;
    public String nodeId;
    public int level = 0;
    public int heuristicValue;
    public boolean closed;

    public Node(int[] state, String id) {
        this.children = new Vector();
        nodeState = new int[9];
        for (int i = 0; i < 9; i++) {
            nodeState[i] = state[i];
        }
        if (parentNode == null) {
            nodeId = id + "0";
            level = 0;
        } else {
            nodeId = parentNode.nodeId + Integer.toString(parentNode.getChildrenNum() + 1);
            level = parentNode.level + 1;
        }
        closed = false;
    }

    public void appendChild(Node node, int[] state) {
        node.parentNode = this;
        node.index = this.children.size();
        node.nodeState = new int[9];
        for (int i = 0; i < 9; i++) {
            node.nodeState[i] = state[i];
        }
        node.nodeId = node.parentNode.nodeId + Integer.toString(node.parentNode.getChildrenNum() + 1);
        node.level = this.level + 1;
        node.closed = false;
        this.children.addElement(node);
    }

    public int getChildrenNum() {
        return this.children.size();
    }

    public boolean hasChildren() {
        return this.getChildrenNum() > 0;
    }
}

Representasi di atas saya bungkus ke dalam satu kelas bernama Node yang mewakili satu node pada struktur pohon N-ary. Untuk atribut, saya sesuaikan dengan kebutuhan terkait struktur data state pada 8-Puzzle yang sepertinya lebih cocok jika direpresentasikan dalam bentuk array of integer nodeState yang beranggotakan bilangan integer dari 0 sampai 8. Bilangan 0 mewakili kotak kosong atau blank, sedangkan bilangan lainnya mewakili kotak-kotak bernomor yang bersesuaian dengan bilangan tersebut. Serta nilai informasi menuju goal yang saya simpan pada atribut heuristicValue. Pembahasan mengenai nilai informasi ini akan diuraikan lebih dalam pada poin Informed Search.

Metodologi
Cara penyelesaian masalah dalam Searching, secara garis besar dibagi menjadi dua (2) metode, yaitu:
1. Pencarian dengan tanpa nilai informasi menuju kondisi akhir, biasa disebut sebagai Uninformed Search.
2. Pencarian yang memperhitungkan nilai informasi menuju kondisi yang diinginkan dan biasa disebut sebagai Informed Search.

…bersambung…


The Self Help Book That Really Helps

The Self Help Book That Really Helps

It helps more than ten thousand readers with or without the book.
-Charlie

SandClow 2010-04-13 08:31:00

Tadi malam bermimpi ketemu nenek yang sudah meninggal.

Pertanyaan:apakah aku akan didatangi nenek atau aku yang bakal mendatangi dia?

“Dikaryakan”…..Mekanisme Awal Dosen CPNS

Ternyata aturan CPNS itu aneh, beberapa institusi ternyata “mengkaryakan” orang-orang yang masuk CPNS dengan bekerja tanpa “dihargai”. Seperti kata Mario Teguh, “jika ada orang mengatakan menghargai pekerjaan Anda tanpa membayar, itu berarti Anda tidak dihargai”, kata Mario Teguh lagi, “menghargai” berasal dari kata “harga” yang berarti pembayaran, dimana alat pembayaran adalah uang.

Pada CPNS, gaji akan mulai diberikan jika SK CPNS turun, sebelum itu, jika institusi menghendaki orang-orang yang ketrima CPNS ini bekerja maka konsekuensinya sering tidak ada pembayaran. Lalu banyak yang menyebut dengan istilah “pengabdian” dimana sering diartikan bahwa pengabdian adalah mau disuruh menghadiri kegiatan macem-macem dan bekerja tanpa ada “penghargaan”. Kadang sering digambarkan bahwa selama status masih CPNS harus terlihat baik, agar nantinya goal jadi PNS beneran. Nah lalu begitu jadi PNS, statusnya hampir tidak tergoyahkan karena justru dipecat dari PNS itu hampir tidak ada.

Logikanya adalah apakah dengan pengabdian orang bisa hidup? Apakah orang bisa makan dengan pengabdian? Tidak tanggung-tanggung, “pengabdian” ini ternyata bisa sampai berbulan-bulan (bisa nyampe 6 bulan ke atas). Mungkin institusi merasa orang-orang CPNS lah yang butuh mereka, jadi bisa diapa-apakan walau kurang manusiawi. Well, memang benar-benar bangsa yang sulit menghargai orang lain kecuali dirinya sendiri. Makanya gak maju-maju he he he he.


Email Is So 2000

Email Is So 2000

What’s my email address? Umm, let me see first.
–Emma

Cheesy Cutesy Laptop Potato Couple Pillow Cases



Several months ago, my BFF and I discussed about couple pillows advertised on the net. Too bad it demanded a quite lot of fortune to have a pair. But then we were talking about how to make it ourselves. After a long delay, I finally made one! (Yay!)

The materials were simple. A pair of pillow cases (white, preferably), some permanent markers, and a wee bit of creativity.



Before drawing on the cases, I designed some cartoony drawings. They sure look cheesy.. Haha.. Well, at least Rz said they were cute.



Firstly, the chosen drawing was drawn by pencil on the cases. Secondly, cartons were placed under the fabrics. In this case, insert the carton inside the cases. Then, using the permanent markers, I drew on the cases following the pencil lines. Here were how they looked after these steps.













It was supposed to be male and female potatoes in front of their laptops, connected to each other through hmm.. maybe wi fi or bluetooth, whatever.

Oh, I didn't realize that I copied my BFF signature icon, an octopus shaped head. Sorry, Nyo.. Didn't mean it..

Next, after letting the ink dried, I ironed the cases (after placing a cotton cloth on top of them) on the hottest setting for about a couple of minutes to fix the ink on them.



Now, they're ready!



Just a bit clue of how to use these C2L(PC)2:











P.S. In narcissistic way, I like the title of this post. Plus, it can be abbreviated as C2L(PC)2, sounds like a name for a sophisticated robot in old time sci-fi movies.

Black White Colors

Kembali menggambar menggunakan kuas. Kali ini ditambah sedikit warna dari photoshop. Sedang malas memberi warna. Saking males nya tepi buku gambar pun tidak dipotong. Ditampilkan seadanya.
Mengingatkan sama Lady Oscar?

Grace and (Gospel of) Luke

Christianity in one word: grace. Famously introduced by Paul and even adopted into one of the five solus (sola fide, sola scriptura, sola gratia, solus Christus, and soli Deo gloria): the slogan of Protestant. In Paul's letter to the Ephesians, he wrote:

"For it is by grace you have been saved, through faith--and this not from yourselves, it is the gift of God--" (Ephesians 2:8, NIV)

The interesting question: is it true that Paul is the first to introduce the concept of grace?

It is noteworthy to take into account that some studies indicates Luke, the writer of the gospel, actually was a constant companion to Paul.

The story of Paul is originated in the book Act of Apostles (Acts) which is strongly indicated to be written by Luke as he addressed the book to the same person as his previous book (Gospel of Luke):

"... it seemed good also to me to write an orderly account for you, most excellent Theophilus" (Luke 1:3, NIV)

"In my former book, Theophilus, I wrote about all that Jesus began to do and to teach..." (Acts 1:1, NIV).

And Paul also mention Luke in his letter to the Colossians:

"Our dear friend Luke, the doctor, sends greetings. So does Demas. " (Col 4:14, NIV)

So is it possible that Paul's understanding about Jesus was under influence from Luke? It is highly possible.

Though Luke is suggested to be the one who wrote last (from all synoptic gospels) and took some material from Gospel of Mark and Matthew, it is how he wrote his Gospel that make his Gospel unique compared to the previous two.

Luke tells the story that emphasizing heavily about Jesus as companion to the sinners. As someone who defend them, forgave their sins, and ultimately gave them their salvation. Something that the two previous Gospels (Matthew and Mark) even do not mention!

Let's take a look at a few examples:

Jesus anointed by a sinful woman
(Luke 7:36-50)
(compare to Mat 26:6-13, Mark 14:1-11, John 12:1-11)
The others three Gospels mention about a woman that was going to anoint Jesus with perfume stored in an alabaster jar. But a disciple protested that the perfume should be sold instead and the money should be given to the poor.

But only Luke mentions that the woman was a sinner. She stood behind Jesus, at his feet weeping, and wet his feet with her tears. And later on she wiped them with her hair.

The Pharisee saw this and said "If this man were a prophet, he would know who is touching him: a sinner".

And at the end of the story Jesus said to her "Your sins are forgiven."

The Parable of the Lost Son (Luke 15:11-31)
This parable, found exclusively in Luke, tells story about a young son that asked for his share from his father. After he got his share, he set off for distant country and squandered all his wealth for wild living.

Eventually all his wealth was gone, and with nothing to eat, he wanted to fill his stomach with pods that the pigs were eating, but no one gave him anything. Then he intended to go home to his father, but because he had sinned against his father, he only intended to become one of his father hired man.

But as his father saw him, he ran to his son, threw his arms around him and kissed him. As the son spoke his thought to be his father hired man, the father said to his servants to bring the best robe and put it on him. And also to kill the fattened calf and prepare a feast to celebrate.

The Parable of the Pharisee and the Tax Collector (Luke 18:9-14)
This parable also appears exclusively in Luke. It should be noted that at Jesus' time, the Jews were under the occupancy of Roman. Jews as strong monotheistic followers were obliged to pay tribute to Roman, a polytheistic nation. This brought bad notion to the tax collector occupation (as a sinful occupation), moreover because they were said to always collect more than what they supposed to.

Two man went up to the temple and pray, one a Pharisee and the other a tax collector.

The Pharisee prayed "God, I thank you that I am not like the other men -- robbers, evildoers, adulterers or even like this tax collector."

The tax collector stood far away, beat his breast and said "God have mercy on me, a sinner."

And Jesus told that the tax collector went home justified before God.

Zacchaeus the Tax Collector (Luke 19:1-9)
The third story found exclusively in Luke.

As Jesus entered Jericho, a tax collector named Zacchaeus wanted to see Jesus and since he was a short man, he climbed a tree to see him.

Jesus reached the tree, looked up, and said to Zacchaeus that he must stay at his house today. As the people saw this, they began to mutter "He has gone to be the guest of a sinner."

But Zacchaeus stood up and said "Look here and now I give half my possessions to the poor. And if i have cheated anybody, I will pay back four times the amount."

Jesus said to him "Today salvation has come to this house, because this man too is a son of Abraham."

The Two Other Crucified Men at the Crucifixion(Luke 23:39-43)
(compare to Mat 27:38, Mark 15:32, John 19:32)
This is by far the boldest step in Gospel of Luke.

Matthew and John agree that there were two other men crucified together with Jesus. Mark however added that those crucified with him also heaped insults on him.

But Luke tells different story:
One of the criminals who hung there hurled insults at him: "Aren't you the Christ? Save yourself and us!"
But the other criminal rebuked him. "Don't you fear God," he said, "since you are under the same sentence? We are punished justly, for we are getting what our deeds deserve. But this man has done nothing wrong."
Then he said, "Jesus, remember me when you come into your kingdom."
Jesus answered him, "I tell you the truth, today you will be with me in paradise."


Whether Luke conducted more research, or merely crafted those stories is the unknown fact. However through his writings the foundation of grace in Christianity is put. That the path to salvation is not by weighing sins and good deeds but merely because God's love for mankind including sinners.

It is worthy also to look at the last Gospel: John, which is still debatable, the last of the four gospels.

(Gospel of) John mentions literaly:

"For the law was given through Moses; grace and truth came through Jesus Christ." (John 1:17, NIV).

And John also tells the famous story because of its portrayal in Mel Gibson's movie: The Passion. This story however is debatable since nearly all the biblical scholars agreeed that this story is a later addition to the Gospel. New International Version (NIV) stated "The earliest and most reliable manuscripts and other ancient witnesses do not have John 7:53-8:11.

A story, however inaccurate, is always worthy to take a look (John 8:1-11):

The Pharisees brought a woman caught in adultery and said to Jesus: "Teacher, the law of Moses commanded us to stone such women, now what do you say?"

Jesus bent down and started to scribble the ground with his finger. When they kept asking he said "If any one of you is without sin, let him be the first to throw a stone at her."

After hearing this, one by one go away until only Jesus was left. Jesus asked the woman "Woman, where are they? Has no one condemned you?"
"No one, sir" she said.
"Then neither do I condemn you." Jesus declared. "Go now and leave your life of sin."

Menggambar menghilangkan stress

Saking lamanya tidak menulis blog, begitu update cuman isinya gambar. Mencoba menggambar menggunakan fude/kuas.

Natasha

You walk alone in the valley of life
In the shadow of love
Under the trees of happiness
You walk along like a baby unborn
Like a father unknown
Like a pocket penniless

I’m happy that you really care
But do you really know how scary
This is for you and is for me
Oh do you really know
Do you really know


Filed under: Daily Life, Lirik, Song of the Day Tagged: Rufus Wainwright, Want One

Tomcat Streaming

Ah mari kita pindah topik sedikit ke masalah coding. Waktu ini saya diminta membuat halaman untuk mengelola file clinical summary dari 180 ribu patient. Wah bingung juga gimana coding-nya untuk nge-download 1.5GB data itu. Yang jelas data itu harus di-stream, karena kalo di-buffer semuanya terus dimuntahin sekaligus ke user, dijamin si server bakalan tewas dengan sukses. Damn, masak mesti baca – baca wikipedia lagi seh … Dan akhirnya nyangkut kesini deh Content Disposition. Oh ternyata itu toh yang dipakai biar user dikasi window save as itu ya.

        // -- Java codenya
        // --- response: adalah HttpServletResponse object
        // --- filename: nama file
        // --- zippedFile: pointer ke file yang akan di stream

        response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".zip");
        response.setContentType("application/zip");
        response.setContentLength((int) zippedFile.length());
        response.flushBuffer();

Lalu streaming e gimana? Bleh tambah pusing dah. Ternyata pake NIO lebih enak kalo streaming itu hehehe … Ga tau seh apakah pake yang IO biasa bakalan jalan ato ga. Harusnya sih jalan – jalan aja lah ya si basic IO. Intinya seh baca sedikit demi sedikit terus tulisin di buffer e si response hehehe …

        BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(zippedFile));
        ReadableByteChannel input = Channels.newChannel(inputStream);
        WritableByteChannel output = Channels.newChannel(response.getOutputStream());
        ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);</code>

        while (input.read(buffer) != -1) {
            buffer.flip();
            output.write(buffer);
            buffer.clear();
        }

        input.close();
        output.close();

Dan setelah di test, data 1.5GB pun ter-stream dengan sukses tanpa membunuh server tercinta. Berikutnya pusing – pusing bersama Java Cryptography Extension. Yah, mereka pengennya kan data yang bakalan dipindahin ini terenkripsi dengan sukses supaya kalo ada yang nyegat yang bawa data, dia ga bisa dapat isi datanya dengan mudah hehehe …


Filed under: Personal Tagged: Content Disposition, Ga Penting, Java, programming, Streaming

Nice Communication Skill

Nice Communication Skill

Well, i have 108 contacts. That’s networking, right?

Pause or Procrastinate?

At first, when I was reading my friend's writings (Pause and Sehari Lebih Tua), I just said to myself that I couldn't agree more than that. That's it. Period. But not long after that, for some reason, I just couldn't stop thinking about this topic. I looked back to my past and tried to convince myself that what I've been done until this very time is not just another "pause" moment.

Apparently, I found another missing piece of puzzle. Now, where shall I put this one? I'm not pausing anything but I am procrastinating something. Being a perfectionist is one of the reason behind it. But more importantly, aren't I just afraid to make decisions? Blabbering about things that are impossible to do or even have no point to do...

Guess it's time to "wake up", no, I mean, "get up" and face myself properly. I've been hiding behind my own shadow for quite some time now. One can live his life not without a purpose! Now, where shall I put my star?

*Himura_Kens, pinjem topinya buat dipajang ya! :-p

Oh Fortuna

Hari-hari ini saya ‘keracunan’ lagu (choir) ini, potongan dari Carmina Burana. Mulanya saya menyimak suatu forum yang membahas tentang GO yang semakin resisten terhadap obat, merembet ke cara penularan, sampai akhirnya sampai di plesetan lagu O Fortuna. Kenapa? Karena di lagu plesetan ini ada kata Salsa cookies, windmill cookies, they’ll give you gonorrhea!.

Latin Plesetan English
O Fortuna
velut luna
statu variabilis,
semper crescis
aut decrescis;
vita detestabilis
nunc obdurat
et tunc curat
ludo mentis aciem,
egestatem,
potestatem
dissolvit ut glaciem.
Oh, four tuna
bring more tuna,
statuary on his knees
Some men like cheese
hot temperate cheese
vimto can taste of kidneys
lukewarm two rats
bet too cool rats
you don’t get cheese or chicken
bend chips all day
hot and salty
dip sore feet good hot chili
O Fortune,
just as the moon
Stands constantly changing,
always increasing
or decreasing;
Detestable life
now difficult
and then easy
Deceptive sharp mind;
poverty
power
it melts them like ice.
 
Sors immanis
et inanis,
rota tu volubilis,
status malus,
vana salus
semper dissolubilis,
obumbrata
et velata
michi quoque niteris;
nunc per ludum
dorsum nudum
fero tui sceleris.
saucy codpiece
get me cod, please
brought up too full food in me
suck juice from moose
fun with some goose
second these so rude big knees
open bra top
get them loved up
leaking foot when near cherries
look there look good
dogs sure look cute
farewell to kness and berries
Fate—monstrous
and empty,
you whirling wheel,
stand malevolent,
well-being is vain
and always fades to nothing,
shadowed
and veiled
you plague me too;
now through the game,
my bare back
I bring to your villainy.
 
Sors salutis
et virtutis
michi nunc contraria,
est affectus
et defectus
semper in angaria.
Hac in hora
sine mora
corde pulsum tangite;
quod per sortem
sternit fortem,
mecum omnes plangite!
salsa cookies
windmill cookies
the’ll give you gonorrhea
this octopus
let give him boots
send him a car or pizza
lovely torah
send me more of
potato soup & chicken
hot mess all day
sing it ugly
be good for peace monkey’s sake
Fate, in health
and in virtue,
is now against me
driven on
and weighted down,
always enslaved.
So at this hour
without delay
pluck the vibrating string;
since through Fate
strikes down the strong,
everyone weep with me!

 


Filed under: Lirik, Selingan, Song of the Day Tagged: Carmina Burana, O Fortuna, Orff

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 1630 items have been purified.