Friday, 27 February 2009

Model View Controller for Dummies




MVC stands for Model View Controller is a Modeling Architecture that allows easy further modification and development by isolating user interface and logic engine. MVC consists of 3 main elements, first Model, acts as data element mapping. Usually, Model represents some data type or object that connected to database or data source. View is a user-interface element. Mostly, View has events like "on click", "on change", "on this", or "on that". The last, Controller, acts as a procedure or method for any processes or actions triggered by View’s events.

Each element comunicates using concept called Context. To simplify, usually Context is formed as a reference or pointer to native data type or object, that refers to some data variables inside every element --Model element, View, or Controller element--.

For complete ref, please go to: http://en.wikipedia.org/wiki/Model–view–controller

Sometimes people get wrong with MVC and 3-tiers architecture. If we talk about comparing between those two, they are not comparable, because they stand in 2 different concepts. 3-tiers architecture has 3 levels of tiers, presentation, logic, and data source /database tier; on the other hand, MVC has no database element. In some practical perception, MVC can be used to encapsulate presentation and logic tiers while leaving the database tier behind.

My daily use of MVC is when I do SAP Webdynpro programming. SAP Webdynpro is a part of SAP’s stuff that use web based application under SAP-enhanced Java-Eclipse. It has more SAP related libraries and objects so we can use it to connect to SAP server over RFC protocol.

I don’t know if this concept is being taught in my ex-collage Unpar. Because I and Ignat have told Lucky Adhie --my late lecturer-- that this subject should be taught in Advance Information System subject instead of just bringing any conventional architecture.

Correct me if I’m wrong with what I wrote above, I’m just trying to do some very simple “MVC for dummies” based on my experience and don’t want to share my stupidity to anyone :D…..

Sunday, 22 February 2009

My Nose bleeds

Udah 4 hari berturut2 nih gua mimisan malem2... Gak tau kenapa, tiap malem, tiap bis sikat gigi ma cuci muka... langsung mimisan. Gua emang sering mimisan dari dulu. Dulu sih kalo kecapean, ato kurang tidur suka mimisan. Pa lagi kalo lagi bikin program yang rada njelimet... Nah suka tiba2 mimisan depan komputer, kadang di Lab Komputer lagi, pas banyak anak2... Dulu pernah sih, pas lagi sibuk2nya... seminggu penuh mimisan mulu... dah mo pingsan rasanya... Dulu pernah ke dokter sih... ma dokter dibilang normal semua, mpe cek darah segala, normal... Akhirnya ma dia cuman dikasih multivitamin beberapa jenis.

Tapi dah 4 hari ni... mimisan mulu... What is this, somekind of illness? Biasanya sih kalo lagi mimisan gini, gua banyak2 makan vitamin ma banyak minum... mungkin tekanan masalah tekanan darah yang gak seimbang kali... gak tau juga sih... moga2 aja bukan pertanda2 kena penyakit aneh2....

Thursday, 19 February 2009

Noah's Arc story in Greek Mythology

People heard about Noah's story in bible; on the other hand, Greek also have similar myth with Noah.

Deucalion, the son of Prometheus was the Greek equivalent to Noah.When Zeus sent a flood to destroy the evil
mankind (of the copper age), Prometheus told the righteous Deucalion and his wife Pyrrha, daughter of Prometheus's brother Epimetheus and Pandora, to save themselves by building an ark.
After sailing for nine days and nights, they landed on Mount Parnassus near Delphi. Deucalion made an offering to Zeus the Saviour, and the god's response was to send Hermes with a promise to make any wish come true.
Deucalion then asked for the earth to be re-populated, and he was told to throw his mother's bones behind him. The couple then took stones and threw them over their shoulders, and the stones became the new human race: Deucalion's stones the men, and Pyrrha's the women. The new race was dark and short where the previous had been tall and blond.
The couple had a son, Hellen, who in turn became the father of Aeolus, Dorus and Xythos, and grandfather of Ion and Achaios. These names all refer to the different Greek tribes, with Hellen - "Greek" - as the ancestor.

[picked from http://www.in2greece.com/english/historymyth/mythology/names/deucalion.htm]

Nelayan dan Pengusaha

Mungkin semua orang tau cerita ini :
Suatu kali seorang pengusaha sedang berlibur ke sebuah kampung nelayan, ia merasa terganggu saat melihat seorang nelayan sedang bersantai dibawah pohon.

"Pak, mengapa bapak tidak melaut ?", tanya pengusaha itu seraya menghampiri.
"Saya sudah melaut semalam dan saya perlu istirahat", sambut sang nelayan dengan senyuman.
"Kalau bapak malaut lagi, bapak akan memperoleh lebih banyak ikan", saran sang pengusaha sambil menunjuk ke arah laut.
"Lalu ?", balas sang nelayan dengan tenang.
"Bapak bisa mengumpulkan uang lebih banyak untuk membeli sebuah perahu", sahut sang pengusaha.
"Lalu ?", balas sang nelayan kembali.
"Dengan perahu itu, bapak tidak perlu lagi menyetorkan sebagian keuntungan bapak kepada pemilik perahu", tukas sang pengusaha.
"Lalu ?", balas sang nelayan sembari membetulkan topi jeraminya.
"Bapak bisa mengumpulkan lebih banyak lagi uang untuk membeli perahu kedua", ucap sang pengusaha dengan bersemangat.
"Lalu ?", balas sang nelayan dengan senyuman.
"Dengan dua perahu, bapak bisa menghasilkan lebih banyak uang dan membeli perahu ketiga, perahu keempat, kelima dan seterusnya", dengan bersemangat sang pengusaha menjelaskan.
"Lalu ?", balas sang nelayan dengan senyum yang bertambah lebar.
"Jika perahu bapak sudah banyak, bapak bisa menyewakannya pada nelayan lain sehingga bapak tidak perlu lagi melaut", sang pengusaha membalas dengan sedikit tertawa.
"Lalu ?", sang nelayan kembali menyahut sembari membenahi posisi santainya.
"Bapak bisa hidup tenang dan bersantai", ujar sang pengusaha dengan keyakina bahwa idenya akan diterima oleh sang nelayan.

Dengan santai, nelayan tersebut tersenyum dan berkata, "Menurut bapak, apa yang sedang saya lakukan sekarang?"

Gua menganggap orang terlalu membesar2 kan cerita ini. Soalnya, ini sebenarnya cerita untuk orang yang malas. Ok, they have the same
goal, bersantai, tapi kualitas santai mereka jauh berbeda, "To know the pleasure we must know the pain". Nelayan, tidak akan menghargai
waktu santainya seperti sang pengusaha hargai.
Just like I do, I know how good Lembang is after I live in Jakarta. Before that, I felt Lembang was so boring. I just realized, Lembang and Bandung are so great, no wonder
Jakartanians(people live in Jakarta) go to Bandung every weekend and make traffic everywhere.

Another thing, sang pengusaha dapat berbagi kesantaian-nya dengan keluarganya. Sedang kan sang nelayan, meskipun dia santai, bagaimana keluarganya,
mereka juga dapat menikmati kemalasan seperti si nelayan itu, mereka juga memiliki kebutuhan lain. Mereka pasti punya pikiran, "Our family can do more than others".

Sebenarnya yang kedua ini tidak terlalu penting selama seluruh keluarga bisa saling menerima gaya hidup sang ayah (sang pengusaha atau si nelayan).
Apa mereka bisa? Sometimes they need cellphone (supir angkot aja punya HP), baju baru waktu lebaran, sekolah di tempat bagus (no doubt this one costs a lot), wisata bersama keluarga,
help families and relations, hobbies, buy medicines, and self actualization. "Money is not everything, but everything needs money". If you don't want this, than have no family,
don't merry anyone, and live just like the fisherman does. Jangan menyebarkan bibit kemiskinan.

Tuesday, 17 February 2009

Automate things with AutoHotKey

AutoHotKey helps us automate things so we can increase our productivity. We can download AutoHotKey
at http://www.autohotkey.com/download/ and install. After installation, create a file with .ahk extension.
Edit the file using text editor and we can start our new AutoHotKey script. We can run the script by doulble
click the files on explorer.

With AutoHotKey we can remap any keys, write down this line:

a:: z

Save and execute the file. After you execute this, everytime you type 'a' it will be recognized as 'z'.
So if you attempt to type 'zaaap' it will become 'zzzzp'.

Another simple example, we can remap keys become shortcut.

^n:: Run Notepad

With this script, we can automatically run notepad by pressing Ctrl+n. '^' symbol represent Ctrl key. This is
the complete list:
^ = Ctrl
+ = Shift
# = Win
! = Alt
* = [wildcards, any above key]

The statement 'Run Notepad' simulates 'Run menu', type 'Notepad', then click 'Ok'.

Another usefull feature of AutoHotKey is as typing tool.

::wtf::What the f**k

This will replace any typing 'wtf' into 'What the f**k' just like autocorrect.

There are still plenty of usefull features that AutoHotKey can do, like moving your mouse cursor using your keyboard,
block some keyboard key, create hotkeys, and others.

These examples can automate your work :

; ----start of code-----
; line in semicolon will be considered as comments
; Shortcut : Win+hotkeys
#g:: Run http://www.google.com
#i:: Run "C:\Program Files\Internet Explorer\iexplore.exe"
#n:: Run "C:\Program Files\Notepad++\notepad++.exe"
#o:: Run "C:\Program Files\Opera\opera.exe"
#v:: Run "C:\Program Files\VideoLAN\VLC\vlc.exe"
#w:: Run "C:\Program Files\Winamp\winamp.exe"
#y:: Run http://www.yahoo.com

; disable some key
; modify CapsLock so you must press Shift+CapsLock to trigger the key it
+CapsLock:: CapsLock
*CapsLock::
; do nothing
Return

; modify ScrollLock so you must press Shift+ScrollLock to trigger the key
+ScrollLock:: ScrollLock
*ScrollLock::
; do nothing
Return

; for autocomplete
::btw::by the way
::wtf::what the f**k
::omg::oh my God!!!!

; ----end of code-----

Wednesday, 11 February 2009

My name has been taken away....

Nickname gua biasanya monoceros. In any game, or any internet account. Tapi pas buat blog ini lho... kok dah dipake yah... akhirnya ganti deh jadi monoceros85. Because I was born in 1985... T_T so sad....

Why monoceros? monoceros means unicorn in constellation. When I was child, I seek for a nickname. Some names came out like 'Viper', 'Spica', 'Gemini', 'Serpent', or 'Pegasus'. Most of the names taken from name of stars or constellations, because I was so obsessed by Greek ancient legend about gods and any kind of that.

Sometimes people get wrong with 'rhinoceros', because both have similar pronunciation. But 'monoceros' sounds cooler than 'rhinoceros', so please don't take them as the same object, get used to it.