Saturday, January 28, 2012

Creating custom build wine deb package

In one of my projects, I need to install custom build of wine to several computers running ubuntu.
Hence, I had to get the sources, apply the patch files and then compile the source.  Doing this for 1 computer is okay, however repeating this to several computers is a huge waste of time.

The solution is compiling once and then build a debian package (*.deb), so for the other computers we just install the debian package file. Fortunately, making a debian package is very-very easy. Here is what I did:


Saturday, January 14, 2012

Merge several pdfs in ubuntu

Some times we need to merge several pdf files into 1 pdf file. Fortunately, it is very easy to do it in ubuntu. For instance, I have 2 pdf files: proposal_rpi.pdf and program_qc.pdf.

Here is how I merge these 2 files into 1 pdf file: proposal_jan_15_2012.pdf:


bambang@bambang-notebook:~$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=proposal_jan_15_2012.pdf -dBATCH proposal_rpi.pdf program_qc.pdf

Wednesday, January 11, 2012

Tip: Recompiling PHP under linux

There is a problem if we install PHP from source, i.e: when we need to recompile due to a new version we should reapply the old configure parameter. Forgetting to enable some features often means break our web application which depends to the feature, however it is also hard memorizing what parameters we passed to the configure command as we do not often compiling the PHP. Fortunately, there is an easy way. Here it goes:

Wednesday, December 7, 2011

HTML <textarea> maxlength problem

We can limit the maximum characters in <input> with <maxlength> attribute. However it is not possible to do the same thing with <textarea>. This will be a problem if value of the <textarea> will be stored into database table and the length of the user input exceeds the field's length, either the value will be truncated or your database will throw an error to you.

Tuesday, December 6, 2011

Debugging php application with xdebug, netbeans and Google Chrome

Debugging PHP application is a pain. When we get problems, we often to use var_dump() or die() in various location to inspect the variables and then clean them again once the problem is solved. Fortunately, there is a piece of software called xdebug which can tremendously help us debugging php code. This article is about using xdebug in linux environment.


Web app: move to next field with enter ala dos application

This is a little experiment on how to use enter as a mean to move to the next input field in web application ala dos application. We need jquery here. Here we simply trap the enter key with keypress event.


Sunday, December 4, 2011

HTML <input> tips - 01

Beberapa tips yang berguna untuk penggunaan <input> pada html.
  1. Membatasi jumlah character maksimal yang boleh diinput.
    Gunakan attribute maxlength. Contoh:
    <html>
    <head>
    </head>
    
    <body>
    Input ini hanya dibatasi 5 character saja <input type="text" maxlength="5">
    </body>
    
    </html>