public static Image resizeImage(Image src, int screenWidth, int screenHeight)
{
    int srcWidth = src.getWidth();
    int srcHeight = src.getHeight();
    Image tmp = Image.createImage(screenWidth, srcHeight);
    Graphics g = tmp.getGraphics();
    int ratio = (srcWidth << 16) / screenWidth;
    int pos = ratio / 2;

    // Horizontal Resize
    for (int x = 0; x < screenWidth; x++)
    {
        g.setClip(x, 0, 1, srcHeight);
        g.drawImage(src, x - (pos >> 16), 0, Graphics.LEFT | Graphics.TOP);
        pos += ratio;
    }

    Image resizedImage = Image.createImage(screenWidth, screenHeight);
    g = resizedImage.getGraphics();
    ratio = (srcHeight << 16) / screenHeight;
    pos = ratio / 2;

    //Vertical resize
    for (int y = 0; y < screenHeight; y++) {
        g.setClip(0, y, screenWidth, 1);
        g.drawImage(tmp, 0, y - (pos >> 16), Graphics.LEFT | Graphics.TOP);
        pos += ratio;
    }

    return resizedImage;
}
Advertisements
  • Add a user ‘cvs‘ and a group ‘cvs
    #useradd -M -s /sbin/nologin cvs
    #useradd -M -s /sbin/nologin anonymous
  • Edit /etc/group to add another user to cvs group
    #vi /etc/group
    cvs:x:502:user1,user2,anonymous
  • Check whether the following 2 lines has been added on file /etc/services
    cvspserver 2401/tcp
    cvspserver 2401/udp
    If can’t find, you have to add the lines.
  • (more…)

The Google Chart API lets you dynamically generate charts. To see the Chart API in action, open up a browser window and copy the following URL into it:

http://chart.apis.google.com/chart?cht=p3&chd=s:hW&amp;
chs=250x100&chl=Hello|World

Press the Enter or Return key and – presto! – you should see the following image:

(more…)

What is a Crontab?
A cron is a utility that allows tasks to automatically run in the background of the system at regular intervals by use of the cron daemon. Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at what times they are to be run. This can be quite useful. For example, you may have a personal temporary directory that you wish to be cleaned out once a day to keep your quota from being exceeded. This is where cron scheduling comes in to play. Not all systems allow for a cron schedule to be setup. You need to see your system administrator to see if it is available on your system.

How does it work?
A cron schedule is a simple ASCII text file. Each user has their own cron schedule. This is normally located in /var/spool/cron/crontabs for linux machines. The crontab files are not edited (or created) directly and you do not have access to the file without invoking it from the crontab command. You may not use any text editor you wish. You must use the text editor that has been specified in you system variables (see your system administrator for these). The text editor vi is usually the default text editor. The editor must be invoked using the -e switch. To create a cron schedule type:

crontab -e

(more…)

Saat pertama kali berjumpa dengannya di tahun 1948, pada waktu itu ia Menteri Penerangan RI, saya menjumpai sosok orang yang berpakaian paling camping (mended) di antara semua pejabat di Yogyakarta; itulah satu-satunya pakaian yang dimilikinya, dan beberapa minggu kemudian staf yang bekerja di kantornya berpatungan membelikannya sehelai baju yang lebih pantas, mereka katakan pada saya, bahwa pemimpin mereka itu akan kelihatan seperti ‘menteri betulan’

[George McT Kahin, Guru Besar Cornell University]

Mohammad Natsir adalah seorang tokoh kunci dan pejuang yang gigih mempertahankan negara kesatuan RI, yang sekarang menjadi pembicaraan hangat karena melemahnya rasa kesatuan bangsa sebagai akibat reformasi yang kebablasan. Berkali-kali dia menyelamatkan Republik dari ancaman perpecahan. Ia lah yang pada tahun 1949 berhasil membujuk Syafruddin Prawiranegara, yang bersama Sudirman merasa tersinggung dengan perundingan Rum-Royen, untuk kembali ke Jogya dan menyerahkan pemerintahan kembali kepada Sukarno Hatta. Dia jugalah kemudian yang berhasil melunakkan tokoh Aceh, Daud Beureuh yang menolak bergabung dengan Sumatera Utara pada tahun 1950, terutama karena keyakinan Daud Beureuh akan kesalehan Natsir, sikap pribadi yang tetap dipegang teguh sampai akhir hayatnya.

(more…)

WordPress.com supports \LaTeX, a typesetting system that’s really good at formatting mathematical formulas.

To include \LaTeX code in your post, use the following:

$latex your-latex-code-here$

So, for example,

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$

produces

i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>

These few standards show a bit more about what’s now possible on WordPress.com.

(more…)