Pages

Sunday, December 20, 2009

Tapestry 5 and Javascript

Ok, I'm not a web designer. The only web framework that I've ever learn was tapestry. So when i try to make something and that something is related to web scripting, javascript or css, I'm lost. But i can't let that happened all the time, that is a necessary skill for me to complete my side project. Because of that reasone I'm spending this long weekend to know javascript in Tapestry 5 a little better.

Since my side project is building something with google maps, i find that there are 3 kind of javascript that i need to handel in my page. First external javascript, my google maps library that reside in another webserver. Second my javascript library, javascript code that will be used in many pages. And the third is the javascript for my current page.

Isn't the first and second type can be consider as one ? Unfortunately no, from the perspective of the page they both are external javascript. But currently there are no way to treat the external javascript from google like javascript library in Tapestry 5.

My Story


Okay, since I'm a bit slow picking up new things. So I created my page the old way. I put everything in the template (.tml) file. Luckily it worked, the map from google shows and I've managed to create some polygon above it. Doing this required me to have :

a link to google maps javascript library
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=xxxxx" type="text/javascript"></script>

my own link
<script type="text/javascript" src="${asset:context:js/mapeditor.js}" charset="utf-8"></script>

and my own javascript for current page
<script type="text/javascript">
// tapestry aware vars
var latLng = ${getArea()};
<!-- //
// used for only initialization and invoke method in js lib,
// while other js lib will be added using addScript command in the java file
// lets keep the template clean
var map = null;
var gmarkers = [];
var other_polygon = [];

function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(-2.1088986592431254, 117.158203125), 5);
showPolygon(latLng);
}
}

// -->
</script>

This worked !

The Other way
Now I'm trying to do it the right way, in this case the Tapestry 5 way. As i understand you can add external library so it will render in the top of your page by using renderSupport addScriptLink method. But unfortunately this method cannot add the external Javascript from google, so i leave the google javascript library in the template file.

While i've managed to move my library to the java file, so the template would look clean. I understand moving the current page to the render support is also possible, but composing the javascript into a string using StringBuffer is a pain :(. And i don't see the real benefit anyway. Because as long as you keep the page javascript clean, only for initialization, its okay to leave it on the template page.

Anyway one of tapestry strong point is to separate coding and UI design. And sometimes the UI designer uncomfortable when they doesn't know the behaviour of the page. If you move all of the script to the java class. And that would break their design tool WYSWYG and also force them to understand the java class.

PS : I understand one more things writing this blog. Writing code in blogger is pain, because you need to < , > sign to the appropriate mark-up your self.

Monday, December 14, 2009

Din

I hate the word "Religious People" !

As if, people, normal common people, is not someone that truly believe their religion. But people that see used their religion when ever they see fit with their causes. Here the law of togetherness apply. Together we are strong, not actually right, but strong enough to create a common wisdom, which eventually passed to generation to come. And the people who truly believe with their religion, will somehow get labeled, pushed away, and become not ordinary.

For me, my religion is very special, very private, i keep it as a treasure and a guide for my self. It is a journey, to understand your self, to understand this world, and to understand your soul, and what it really want. So, you think I'm religious ?

Like i said, i hate that word. But i do believe in my religion, I've done many wrong thing according to my religion, but i still believe it, it managed to guide my live and stopped me from committing a great sin. Like I said, its a journey. And its human to make mistakes, but you need to learn from it.

So what the urges that push me to write this ? Its because in this era, when ever i look. I see how religion is being pushed away from our daily life. As if its a different entity between what we do in day light, at work. And what we do at night in our home.

When you make a business decision, you only based in on your economic or management knowledge. Push away what your soul know and only used your brain, its the logical thing to do right ? And many other thing in our daily life where we made decisions only based on logic. No matter how hard your heart cry or torn to pieces. No wonder so many people felt so lost, depressed, unhappy. Its only our own doing, our own ignorance that we didn't take care of our soul, pushed it away. And now we're just an empty shell of meat, bone and logic.

This is not natural, because human needs happiness, love and peace. And those things isn't reside in your brain. It is entities that attached to your soul. So please, from now on, listen to your soul. And bit by bit nurture it with doing what is right whenever you can. You don't need to change the world, your workplace, or your even your friend. All you have to do is stay strong, don't torture your self with changing everything immediately. Stay in this path, because only you yourself understand what your true happiness is, and one day .... it will come to you.

Friday, December 11, 2009

Some things ....

karena terbangun tengah malam, seperti biasa, browsing-browsing dan nemu beberapa hal. Ada blog teman kantor, yang walaupun isinya tidak terlalu banyak tetapi lumayan detail dan mungkin suatu saat berguna :) Nanti kalau ada waktu mungkin bisa dibaca lebih detail, kehausan akan ilmu pengetahuan memang susah mencari penawarnya :)

seri terbaru dari wakeup project, phase 3, ternyata sudah lumayan banyak. Lagi, kalau ada waktu pengen nonton, soalnya gak bagus juga terkurung di dunia IT yang sempit ini. Got to know what happened to the world, and it has a different point of view than the mainstream media. The world that we live is important to us right ?

Here's the intro to the series.

Dapat kolaborator untuk ngoprek Web dan Android, fiuh... kayak masih banyak waktu aja di luar kantoran :P Yah kita lihat saja, mungkin kalau dipaksa seperti ini bisa break salah satu tembok penghalang diri gw :)

All in all I've just made up this meaningless phrase, 2009 is coming to an end. Its been painful, crazy, mind opening, and surprisingly good year. You'll be missed two thousand nine :)

PS : lupa bilang, akhirnya gw beli HTC Hero, android phone pertama gw di akhir oktober lalu. And I'm loving it :D

Thursday, December 10, 2009

Malem Jum'at

Yup ini malam jum'at, setidaknya waktu gw mulai menulis post ini :)

Minggu ini gw ada 2 project yang sedang gw pegang dan lumayan besar. Masih fase2 awal dan belum mulai, tetapi mengumpulkan info di awal, baca docs sana-sini, menjawab pertanyaan2 yang muncul, sangat melelahkan. Karena ada kebetulan project ini ada di dua domain yang berbeda, satu database dan satunya lagi middleware.

Sudah 3 hari pulang malam dan minum pharmaton formula terus untuk doping :P. Akhirnya hari ini gw memutuskan untuk untuk pulang lebih cepat dari kantor, gak baik terus-terusan dipaksa, selagi ada waktu untuk istirahat, manfaatkan sebaik-baiknya. Tapi tentu saja gw pulang kerumah dengan pikiran melanjutkan pekerjaan dari kantor sesuai dengan jam kerja yang masih tersisa.

Selama diperjalanan masih terpikir tentang langkah-langkah, dan task-task yang harus dilaksanakan secara berurut untuk kedua project ini. Sampai di rumah, setelah selesai mandi, teringat bahwa ini hari kamis. Masih berusaha untuk menyeimbangkan diri dengan cara yang sebelumnya gw pikirkan :) Akhirnya gw putuskan untuk berhenti sejenak, masih punya banyak waktu belum ada deadline, 1 jam sudah lebih dari cukup. So i start reading ....

Ternyata tidak beberapa lama setelah mulai membaca, gw ketiduran. Yah mungkin memang tubuh gw sudah saatnya mendapatkan istirahat, yang kemarin-kemarin tertutup-tutupi karena nge-doping :P Gw pikir ini hal yang bagus, karena akhirnya ada bisa yang me-rem pikiran-pikiran yang ada di kepala gw mengenai proyek ini. Ketika gw bersemangat, dan nexus-nexus di otak gw sudah saling terhubung untuk memikirkan proyek-proyek ini, somehow i can't make it stop.

Ketika terbangun gw merasa segar. I think i've beginning to found my balance :)


PS : ternyata rencana untuk melakukannya setiap hari terlalu berat untuk jadwal gw saat ini. Jadinya gw mencoba setidaknya satu kali dalam seminggu untuk menyeimbangkan jiwa gw.

Tuesday, December 1, 2009

Weird poping noise in ubuntu

Okay ever since i've upgraded to Karmic Koala, i've got this weird poping noise from my laptop. At first i thought because there's somethings wrong with my laptop (I've reinstall to karmik because my disk has crashed). The hardisk has a bad sector, but for now the assumption for my laptop accident is not the hardisk, but the connector from the Mobo to the disk (that causing the weird poping noise). But mind though, that this only an assumption without actually opening up my laptop. If its gonna die, then its gonna die. Its got 6 more month to live anyway.

The annoying thing was, di poping noise is spreading to my audio, it comes and go. So i was thinking maybe its not because the hardware fault, maybe there are 2 problem that causing this weird poping sound when my audio is off.

So i googled and got this solution, you need to edit

/etc/modprobe.d/alsa-base.conf

look for

options snd-hda-intel power_save=10 power_save_controller=N

and change it to

options snd-hda-intel power_save=0 power_save_controller=N

I'm hoping that it would fix both of my problem, kinda wishful thinking though, i settle for one anyway :D

the detail can be seen here :
http://ubuntuforums.org/showthread.php?p=8223592#post8223592

Sunday, November 22, 2009

Unbalanced

Gw yakin pengetahuan yang gw miliki saat ini jauh lebih banyak jika dibandingkan dengan satu tahun lalu. Kalau ditarik lebih jauh lagi, dibandingkan dengan 5 tahun lalu saat baru lulus, pastinya perbedaannya amat jauh sekali.

Kalau melihat ke bawah, gw merasa teramat beruntung karena bisa berhasil sejauh ini. Walaupun kalau melihat ke atas, rasanya masih jauh sekali yang ingin gw capai. Seiring begitu banyak pengetahuan baru yang masuk, sedikit demi sedikit gw mulai merasakan keanehan di diri gw. Kehilangan arah , mudah stress, dan tidak gampang untuk bangkit kembali. Semua orang pasti pernah merasakan jatuh dan gagal. Tetapi kemampuan masing-masing orang untuk bangkit kembali berbeda-beda. Disaat ini gw merasa kemampuan gw berada di bagian paling bawah lembah kegagalan.

Ketidakseimbangan waktu untuk pekerjaan dan hal lain dalam hidup, gw rasa menjadi kontributor utama perasaan ini. Sekedar memperkaya diri dengan pengetahuan duniawi gw rasa tidak cukup. Belum lagi ditambah uang yang lebih dari cukup, some sense of power. Terkadang bisa membuat orang lupa akan hakikat alaminya dan mengalami deteorisasi mental.

Alhamdulillah setelah menyadari hal ini, secercah cahaya menyinari pikiran gw. Ide untuk mengatasi pertanyaan, "kalau begitu banyak waktu yang gw luangkan untuk pekerjaan, dan sisanya tercurah untuk waktu sosial dan keluarga". "Bagaimana cara agar gw bisa memberikan waktu bagi jiwa yang sudah lama tidak berkembang ini" ? Ternyata caranya mudah, tetapi penerapannya sepertinya butuh kekuatan hati yang lebih :)

Ketidakadaan waktu sebenarnya hanya ilusi. Kalau kita memanfaatkan waktu dari waktu magrib hingga isya untuk melepaskan diri dari kegiatan duniawi, pekerjaan, internet. Dan menggunakan waktu yang singkat itu untuk membasuhi jiwa yang kekeringan ini dengan sesuatu yang bermakna. Seperti mengaji, membaca buku yang menyentuh ruh kita, atau sekedar berzikir, itu sudah lebih dari cukup untuk menyelamatkan kita dari kegoyahan. Cara ini sebetulnya amat tepat bagi gw, karena selain bisa menyeimbangkan kembali diri gw. Sholat isya yang biasanya kelewatan karena ketiduran, bisa dikerjakan di awal :)

Mudah-mudahan cara ini bisa sukses. Its to shift the unbalance scale to its place.

*saat ini buku yang sering gw baca diantara magrib dan isya adalah sejarah hidup muhammad oleh Dr. Muhammad Husain Haekal, Ph. D*

The karmic koala...

I've been postponing my upgrade from hardy heron to karmic koala for a long time. But because my laptop disk crash, somehow i've been forced to do it anyway :) So here is my experience...

Installation

The installation was easy and fast. Since I'm installing to another hardisk (used windows disk), i just used the default option and wipe the whole content of the disk.

After successfully installing karmic koala, now comes the detail part. I need to restore my data, since my previous hardisk luckily can be mount using ubuntu live cd, i just copy my home folder to a backup directory in the new one.

There's one problem though. Because in my previous installation I've installed Wine emulator, somehow some of my file was copied more than once. From the real path and from the wine path. Since i don't use Wine any longer, i think its better to remove .wine folder before start copying your old file.

Another thing you should notice when copying your old file is, you better do it with sudo. Because some of my file was created by root id, it failed to copy to the backup folder.

Program List - part 1

Before starting to install the programs there's one thing i like to mention. I use to manually modify the apt source list using vi to point to my favorite repository. But now i can do that through the synaptic manager repository settings. Since my favorite repository is available, one click would do the trick instead of copying several lines in the /etc/apt/sources.list :)
(a bit OOT, my favorite repository is dl2.foss-id.web.id, its blazing fast)

Here's the minimum list of program that i need to install after i finished my karmic installation :

- openssh
- pidgin
- rar plugin
- thunderbird mail client
- exaile (yes we can't live without mp3 anyomore :P)
- sun java 6


few of my own notes. Karmic comes with empathy as the default IM client. But it still lack many things, especially proxy option. Thats why i still need to install pidgin. Thunderbird is my default my client (and probably most people), Evolution is simply not my thing.

And for Exaile, i was using Amarok. But since it load many KDE library, i was looking for another alternative. Exaile seems nice enough. But the most important thing i missed from Amarok is the key binding to start and stop music using windows- z through b. If only another player incorpoorate this :(

The plugins

Yes, its not enough to simply install the programs, now everything come as a plugin :) For me it quite straigh forward, all i need is :

- Flash plugins, Flash Blocker Plugins, Ad Block Plus Plugin and Firebug plugins for my Firefox
- gstreamer for playing mp3 and mpeg files


Restoring

Well one thing i like about Firefox and Thunder bird, to restore all of your mail folder, rss, bookmark, etc. All you need to do is copy the old file and overwrite the old configuration. For thunderbird is a simple as this. copy the content of .mozilla-thunderbird from the old to the new one, open thunderbird and see all of your mail back to where it belongs. You can delete the new profile if you like.

For firefox you need to copy .mozilla/firefox/profiles.ini and .mozilla/firefox/[old profile folder] from the old one to the new one. I was using 3.0 and now 3.5 and the transition is very smoth, i even got my previous opened tab and history just like in my old hard disk :D


The UI

The default Karmic UI still feels somewhat clunky for my taste, so its time to tune it a little bit. I like putting all of bar on one place, preferably bottom. You used to able to do this by dragging the bar. But now you need to right click on the bar, choose properties, and choose the orientation to bottom.

The default ubuntu font is an eyesore to my taste, you can download your own font. There are 2 font that i like to mention, first is the sun font, the sans and serif is quite good. But for my karmic i like to try a new font, the droid font.

The droid font was designed for small system, so even in small display it doesn't break or become clunky. It fit perfeclty for my 14" laptop screen. To install it you just need too look for ttf-droid in the synaptic package manager.

After installing the droid font, you need to configure the appearance through System > Preference > Appearance > Fonts. My configuration is :
- Application fonts Droid Sans Japanese 8
- Document fonts Droid Sans Japanese 8
- Desktop fonts Droid Sans Japanese 8
- Window title fonts Droid Sans Bold 8
- Fixed width font Monospace 10

you need to change a little thing on Firefox to give it the finishing touch. Just go through firefox Edit > Preference > Content > Font. My Configuration is :
- Proportional Serif 15
- Serif Serif
- Sans-Serif Sans-Serif
- Monospace monospace 12


and Voila ... My Karmic Desktop is Prettier than my windows desktop :D

with this settings I've managed to continue my work, the other could be updated piece by piece, and here's some of the advanced part i've managed to set on the weekend.

Notification

Karmic comes with a new centralized notification, sometimes it can be very annoying, especially when you're using pidgin. It keeps popping every time my buddy sign on, combined with bad network, its a living hell for working. To solve this you need to configure your pidgin like this. Go to Tool ->Plugins -> 'Libnotify popups' -> Configure Plugin . And then remove 'Buddy signs on' checkbox.


LILO

My laptop is lenovo 3000 N200. Since Hardy Heron I've always get this problem. My DVD isn't detected on my Ubuntu, the funny thing I'm able to use the DVD for installation or using live cd.

It turn out i'm not the only one, lots of people having this kind of problem with this lenovo series. One of the solution is to set ACPI off in boot time, but has the risk of damaging the laptop in the long run. So i choose the other solution replacing grub with lilo as the boot loader.

Installing lilo is quite easy :
- Make sure you have live cd ready just incase anything happens
- Just go through synaptic and download the lilo package.
- Backup your /etc/fstab to lets say ~/backup/fstab.backup.
- Modify the fstab files so lilo would work, since lilo hasn't been updated to recognize UUID for the boot partition, you need to restore it to the old fasion way. For example like this

# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/sda1 / ext4 defaults,errors=remount-ro 0 1 <--- the changes
#UUID=ca06fd83-becb-4012-8579-9e65662c9ef0 / ext4 errors=remount-ro 0 1

# /dev/sda2
UUID=948b4626-2f62-40c0-bc92-6ee8b69af42e /media/hda2 reiserfs defaults 0 2


- after that run sudo liloconf, since i didn't use grub anymore i just rewrite the MBR
- and then restart

And finaly my DVD worked and I've managed to backup my work :D

One thing, the default lilo is very slow comparing to grub. It took about 2-3 minute to start while grub could do under 1 minute. There's a way to speed up Lilo boot up time, by using the compact mode. You just need to type this as root,

lilo -c -v

see /etc/lilo.conf and make sure there's line saying compact and its not commented. Then lilo would boot up pretty fast. Comparable with grub, the side note is, this solution is intended for FD, could have some problem with old hardware. But since my laptop is not that old, so far i haven't had a problem with it.

Network Management Applet

Well this is another pain in the ass , but this has been a very long post. So lets leave it as it is and save it for another time :D

- Adeu -