Pages

Thursday, November 10, 2011

D day

this is IT !
the day !
so bring your A game
the innocent yet charming looks
the witty but not hurtful response
the smart and also caring way to talk

this is MY DAY.

Monday, August 22, 2011

Great Indonesia

I think there are 4 things that needs to be achieved before "This" country could become great.

1. Find a good leader. Someone that doesn't have a debt on a political party, or even a pawn. Someone that doesn't consider how much he's being payed or how much he'll retired with. Someone who doesn't concern about putting his relatives on the government to make sure he stays in power. Simply someone who's interested in making changes in the 5 years he's running.

2. Spread your culture if you want to dominate the world.

3. Educate your people ! Not by superstitious things. But by leveraging their interest in science and knowledge

4. Find a way to make people of religion, science and politics live in harmony.

Monday, July 11, 2011

Cleaning up my GMail Account

Once i thought my Gmail account is impossible to fill, but after a few years, couple of mailing list, couple of crazy mailing list, now i often need to clean up my email to make sure no email is lost because my inbox is full. This is what i usually do

Find email that has an attachment
This is usually the quickest way to free same space. You can use
has:attachment to query the mail that contains attachment in the search box. Or if you want, you can even specify the type of file by using filename: .doc adding "label:" to the query can give more refined search. Too bad we can't sort it by the attachment size

Using date
We can also use date to delete our old email. This can be done by using the "before:" and "after:" query. For example :

label:notification before:2011/01/01 after:2010/01/01


Again, using label like the above example, can help to refine your search. And to lessen the impact if you search and then delete the wrong query :)

Starred mail
While using the query above is very useful but often the queries return hundred or even thousand of emails. GMail will page the result, dependent on your settings it can give 25, 50 or even 100 in each page. But still a tedious task to do. GMail can help you even more, by selecting all of the email in that page, another option will come out in the top, that will let you select all of the email in this query. And then delete it.

But this approach is a "scorched earth" approach. You will delete all of the email, but sometimes there are important email included in this search, the one that we usually mark with a star. Logically, we want another parameter in our query. Looking for a starred email can be done by adding is:starred parameter to our query. But what we need is a "not starred" parameter. This can be achieved by negating the previous parameter to :
-is:starred . But the problem is, even there's only one email in the thread that isn't starred. The thread would still be selected.

Thus why i create my own method to handle this. first i create a temporary label named "my_starred" then i go to each label and query

label:notification before:2011/01/01 after:2010/01/01 is:starred


selecting all, and add my_starred label. And then remove the notification label. After that you an select the notification label again with the date range, and then delete all the email. The last step is to go to the my_starred label, and change it back to the notification label. Repeat this for every other label that you want to clean up.

Heaven

Sometimes people have to go through a series of unfortunate event. To understand, that their values didn't belong in this world. To Let go will give you a better understanding and the opportunity to rise again from the ashes, just like a phoenix soaring up to the sky.

Heaven is Dead

Wild beast

The thing that we bear for others
The things that we must do.
what we mustn't do
in the name of society, norm and values.

But sometimes, it is necessary to be savages.
To give in, to let your anger explode
Becoming the wild beast that is full of lust and hatred
Becoming the purest kind of human
that will survive
above everything

Because after all of that has passed,
you will find true calm and peace

Wednesday, May 4, 2011

Debugging HTC Hero in Ubuntu

So, when I'm not on my PC. I'm using ubuntu in my laptop. Turn out, developing on the device is not as a simple as in windows. You need to follow the link below to make it work.

http://forum.xda-developers.com/showthread.php?t=823956

Saturday, April 2, 2011

Its time to have some bug tracking tools - Installing Trac

We're in the stage where simple notes.txt isn't enough to track our project. I think we need a better bug/feature tracking tools. So, I'm going hunting for a few of the common bug tracking tools that's available on the market.

I narrow down my choice into two, Jira and Trac. I've used Bugzilla before, but it never clicked with me. And also Bugzilla and Mantis have their own horror story. Jira actually caught my attention with the $10 starter pack. But the next packet, 25 user for $1,200 is way out of my league.

So finally my decision goes to Trac. It was simple enough. People won't be distracted or hinder by the many fields they need to fill to submit a bug. Both Jira and Trac support mercurial. Just perfect. And although simple and minimalistic Trac have two very cool feature :
  • Timeline – shows current and past project events in order
  • Roadmap – shows the upcoming milestones to be achieved in the project

The only drawback in Trac is the interface, it has its way to annoy you when you look at it too long :P

Installation

I wont be installing this from scratch. I will be installing this at the last state of  my infastructure post.

You can install Trac with mercurial support using this three simple steps :
sudo apt-get install python-setuptools
sudo apt-get install python-genshi
sudo apt-get install trac-mercurial

But when i write this blog post the trac version in ubuntu repository is 0.11.7. Since i want to use trac 0.12, I'll be doing some of the things manually.

First I installed the setup tools using apt-get.
sudo apt-get install python-setuptools

Then I'm using setuptools easy_install to install Genshi and Trac
sudo easy_install Genshi
sudo easy_install Trac

And for the trac-mercurial plugin, you need to check out and build it manually. But first you need to install subversion.

sudo apt-get install subversion

check out the code, build the egg, and install it
mkdir trac-plugin
cd trac-plugin
svn co http://svn.edgewall.com/repos/trac/plugins/0.12/mercurial-plugin
cd mercurial-plugin
python setup.py bdist_egg
sudo easy_install dist/TracMercurial-0.12.0.28dev_r10657-py2.6.egg

After finished installing Trac, lets do some test. But first you need to create a database for Trac in mysql. Using mysql root user :
-- It is better to set the innodb as the default storage engine
mysql> create database trac;
mysql> grant all privileges on trac.* to 'trac'@localhost identified by 'mypassword';
mysql> flush privileges

Trying logging out and then loggin in using the new account.

Next, you need to install python library for connecting to mysql from python.
sudo apt-get install python-mysqldb

And the basic setup is complete.

Create A Trac Project

Now we need to create a trac project. Since i want it to be integrated with my mercurial server. I've created the project in my hguser account.
sudo su - hguser

create the directory for your project
mkdir -p ~/trac/myproject

init the project
trac-admin ~/trac/myproject initenv

If you're having a problem with trac-admin not in your path, try logging out and then relogin to your system.

The initenv command will ask some question. On the database connection string input this :
mysql://username:password@hostname:port/databasename

After finish with the environment, we need to modify the configuration file to support mercurial.
vi /home/hguser/trac/myproject/conf/trac.ini

modify the file with the line below :

[components]
tracext.hg.* = enabled[repositories]

[trac]
repository_dir = path_to_default_repository
repository_type = hg


You can start trac server and see the result by accessing http://yourserver:8000/myproject

tracd --port 8000 ~/trac/myproject

Integrating with apache

Mod_python is dead, so I'm choosing mod_wsgi to integrate trac with my apache server. First you need to install mod wsgi and restart the apache2 server
sudo apt-get install libapache2-mod-wsgi
sudo service apache2 restart

sudo to the hguser and create egg-cache directory under ~/trac/myproject

to create the wsgi file you can create it manually, or use the trac-admin deploy method like below :
trac-admin trac/myproject deploy /tmp/deploy

it will create the .cgi .fcgi .wsgi file under the cgi-bin directory. Then you can copy the file to the real cgi-bin directory
sudo mkdir /usr/lib/cgi-bin/trac
sudo cp /tmp/deploy/cgi-bin/trac.wsgi /usr/lib/cgi-bin/trac/myproject.wsgi
sudo chmod +x /usr/lib/cgi-bin/trac/myproject.wsgi

now you need to add the new location to your apache configuration file. Usually it's under site-enabled/000-default-file . I'm using port 8008 for this purpose but later will create a subdomain for trac :


ServerAdmin webmaster@localhost
DocumentRoot /var/www

#WSGI scrip for trac
WSGIScriptAlias /trac/myproject /usr/lib/cgi-bin/trac/myproject.wsgi

        <Directory /home/hguser/trac/myproject>
            WSGIApplicationGroup %{GLOBAL}
            Order deny,allow
            Allow from all
        </Directory>

After restarting apache, you should be able to access your trac installation in http://yourlocalhost:8008/trac/myproject

While trying to integrate trac with apache, I keep stumbling to an error that said :

TimeoutError: Unable to get database connection within 0 seconds. (TracError: Database "/usr/www/trac/db/trac.db" not found.)

I'm using mysql so trac shouldn't need to create the embedded db. It seems that trac couldn't read the content of my trac.ini files. It turn out that I've stumble to this bug. As a work around I added group read-write permission ,
sudo chmod g+rw ~/trac/myproject/conf/trac.ini
but i wonder, will this create a security problem. Since the trac.ini contains the db access URL ?

Configuring Authentication

To add authentication method, I just added my mercurial hgusers file

        <location /trac/myproject/login>
                AuthType Basic
                AuthName "Trac"
                AuthUserFile /home/hguser/hgusers
                AuthGroupFile /home/hguser/hggroups
                Require group myproject
        </Location>

To be able to use the admin web page you need to add admin privileges to your user
trac-admin ~/trac/myproject permission add frodo TRAC_ADMIN

it is recomended to install the AccountManager plugin. To install it run

sudo easy_install https://trac-hacks.org/svn/accountmanagerplugin/trunk

and then go to the admin tab > plugin , and enable the features

Removing anonymous user access

You can disallow anonymous user access by


trac-admin ~trac/myproject permission remove anonymous '*'

Thursday, March 17, 2011

Mercurial : Separating two groups

In my mercurial setup a new requirement has come up. I need to separate two groups of user, lets call the first group research and the second one project. A user can belong to one of the groups or both. My mercurial server is setup like this, and then I modified it a little to enable the virtual server name right here. To implement this requirement I'm following the public and private repositories and modified it a little.

Configuration

First, what i do is i log-in as the hgusers (user I've setup specially for mercurial, see the first blog post). At the hgusers home directory I've created a new folder called project. And then I move hgusers and hgweb.config from the hg folder to the hgusers main folder.

We need to create a different set of file for our repositories. So copy each of the config files :
$> cp hgweb.config hgweb_project.config

and then modify hgweb_project.config content so it will point to the new project folder. The file content should look like this :

[collections]
/home/hguser/project/ = /home/hguser/project/

now go to our hgweb.cgi directory and copy the file
$> cd /usr/lib/cgi-bin/hg/
$> cp hgweb.cgi hgweb_project.cgi

modify the config variable to point to the project repo folder

config = "/home/hguser/hgweb_project.config"

and finally modify the apache settings
vi /etc/apache2/sites-enabled/000-default

copy the previous ScriptAlias and Location div, and modify it to point to the project location. Another that you need to do is to add the AuthGroupFile, and change The Require line. I will go into detail about this in the next section. The file should look like this :

ScriptAlias /project /usr/lib/cgi-bin/hg/hgweb_project.cgi


AuthType Basic
AuthName "Mercurial repositories"
AuthUserFile /home/hguser/hgusers
AuthGroupFile /home/hguser/hggroups
Require group project


ScriptAlias /repo /usr/lib/cgi-bin/hg/hgweb.cgi


AuthType Basic
AuthName "Mercurial repositories"
AuthUserFile /home/hguser/hgusers
AuthGroupFile /home/hguser/hggroups
Require group research

Creating Group
I already have user sam and frodo from my previous settings. Now i'm adding two more user using htpasswd command. The users are golum and sauron.

Now we need to create the group for these users. To do this go to the hguser home directory and create a new file called hggroups. You can use VI or your favorite text editor to create it. The file content should look like this :

research: frodo sam golumn
project: golumn sauron

the word before the colon is the group name, like the one you specify on the Require group line. And the words after that is the users that belong to the group. In my setup sauron would only able to see the project repository (limiting his access). And so does frodo and sam, they can only see the research repository. While golumn would be able see both repo. Just what i wanted to.

If you wanted to have a lot of user that can access both group, you could create a new group and than add that group to the Require line

Sunday, March 13, 2011

I

I love non self centered people. And my number 1 list, is to witness a miracle, from me.

Thursday, February 24, 2011

Saving youtube video from google chrome

If you remember my post about youtube flv cache files, I've been saving my youtube video's manually. I like this approach because it allowed me to watch the video first, if I found it interesting then I will save the video. While some firefox plugin allow you to save youtube videos, it often force you to re-download the video from the beginning. And if you just download the video without watching it first, some time after one hour of waiting you just end up with a complete garbage !

These days I'm using Google Chrome as my main browser. So I'm faced with the same problem in a different environment. Unlike firefox, Chrome uses the windows temp to store its temporary files. Including the FLV files. But it's very defensive. You can't copy the cache while chrome uses it, and if you close the tab that shows the video, Chrome will immediately delete the file. Giving you no time to copy it. Damn you google guys :P

After some goggling i finally found a solution. Hobocopy to the rescue ! Hobocopy is an open source utility that can copy copy-protected file in windows. You can download hobo copy from here. Using this approach I can copy the protected files. The flv cache files can be identified easily by their name and size.  Usually it will start with fla and end up with .tmp extension. So using Hobocopy i can copy the file i want as simple as :

C:\HoboCopy.exe C:\temp F:\MyVideos\ fla18E.tmp

But you must be aware, since Hobocopy is not actually a file copy utility, the Syntax is a bit different.

Another thing that I've found out is about the firefox case. Remember when firefox only cache a part of my video but I can still play the full video in my browser. It turn out you can get the full FLV video's from Windows temp directory using this same exact method.

Now i can view my Youtube video's without worry about rebuffer and wasted a lot of bandwidth :D

Thursday, February 10, 2011

Screen Scrapping Guide for Java

I created and app about one year a go. The application need to screen scrap a website because it didn't give an API to access the data. When i started, I was confused by so many choice that available for screen scrapping in java. And at that time I've decided to go with NekoHTML, its very powerful but also complicated and a bit of nightmare to maintain. So today i decided to look for better alternative. It turn out, after one year I easily confused by the so many java library out there that i can use. So i decided to create this guide.

Regex
The simplest and probably the fastest way to do screen scrapping in Java. The regex class is already included in the standard java library. So you don't need to add another library and learn how they work.

The problem is, regex is very prone to error. There are many reason for the error. It could be because the html doesn't comply to standards, bad implementation, or even non matching tags. And also a simple change on the website could break the whole regex rule and you need to start from zero. 

To use regex, you need to be very diligent about white space character, or it's only a matter of time before it bites you.

NekoHTML
This is one of the best parser that i know. It often used on other framework such as HTMLUnit as the default html parser. It creates the DOM representation of the page, and then you can traverse through the DOM tree getting each node content. Since it such a low level access, its a bit of pain to maintain. And also you still need to traverse throug the node that isn't important for you. Such as empty text, series of newline, break tag, etc. 
To overcome this you can add a custom filter to remove the unnecessary tag, and uses XPath to query the tag that you are interested in. 

HTMLUnit
Beside as a framework for testing, you can use html Unit for screen scrapping. It can be used for screen scrapping. You just create a webclient and then you can access the tag that you are interested in using the getHtmlElementById or you can also uses XPath. Then you can access the data as an XML or Text. 

It gives a higher abstraction, you don't need to traverse the DOM tree manually. And it also gives build in cookie management, proxy access, JavaScript, CSS and Ajax Support. Everything that you ever need from a headless browsers.

The funny thing is, after looking for something new, i decided to stick with NekoHTML. Its fast, and implementing custom filter helps me a lot. And it also doesn't come with the unnecessary bagage such as Javascript, CSS and Ajax Support. I don't need it for the moment. And of course using XPath has become very valuable. It cuts my previous code to 1/3 even 1/4 in some case. No more manually navigating through the dome, and it's more intuitive. I think i finally found the right tool :)



Hope that helps , I'll re-write the rant some other time to give better explanation. :)



Saturday, January 29, 2011

Crazy

I'm going crazy. There's only so much that one people can handle. Got to do something, or i will break down and crumble.

Wednesday, January 12, 2011

Unanswered prayer

If only someone know what I'm going through.

Tuesday, January 11, 2011

Be brave !

You know, there's many way that people choose how to live their lives.
There are the ignorants, the bastard, and there is the wanderer, the one that always wonder what to do and what would their live would have been.
But for most people, their live is govern by fears.

Fear of dying, fear of breaking the law, fear of god, fear of the uncertain future.
Fear of their position, fear of their place in the society, and the end fear for live it self.
Must've been sucks to live like that.
What ever the action, whatever the luckyness that some how happened to them,
they can never enjoy the things to the fullest.
Always worry what would happened next.

It's a choice, and maybe the one that is closest to the right answer is the ignorants. They don't seem to care about the future, the society, and maybe live it self. The only problem is, they don't care about anything. Because it takes a whole lot of courage to really care about something.

So...
Make a choice, don't be afraid.
Just live your life to the fullest.
Day by day, minute after minute.
Don't be afraid,
maybe society will treat you bad when you broke their rule,
and maybe , you're wrong. It just the way live is, everybody make mistake
so don't let anything stop you.
Just remember one rule, don't ever, ever ! Let your action based on the intention of hurting someone else.

In other word, be brave ! And don't give a fuck about what the world thinks !
And in the end, life will find you a path !

Sunday, January 9, 2011

POM 2

- I treat my Friends like Family, and I treat my Family like my Enemy

- Politician, people that came when ever an opportunity arises, and leave in the wake of destruction. (AFF 2010)

- If we should lose, we should lose gracefully (AFF 2010)

Wednesday, January 5, 2011

Who we are

We work to satisfy our souls.
Money is important, but it should never be our first priority. 
It should be the means to keep us going.
Doing what we do, Doing what we loved.

Because what matter to us,
Is not how to get rich fast.
But to see the the joy, and appreciation.
When what we make, have a direct positive impact to the people that use it.

Its like sailing against the wind,
with barely enough, and torn out sail.
And for that, we need a lot of help,
and Friends.

But we are sure,
one day we'll make it. 
To be able to sail against the wind.
And when that time comes, 
please joins us with your spirit and courage.
Because after that, we can only go faster !

You

I just realize why she couldn't ever say yes.

It's because somehow it would make an end isn't it ? Your world would stop turning. Everything that is you, somehow would change. The problem is, whether you would like the change or not. I guess your action is the answer that you've found. Probably you're scared, very-very scared, that why you weren't able to believe. And I think you're probably right :)

It's such a shame that we weren't meant for each other :)