Snippet IT IT News, Programming, Internet and Blogging

30May/100

Database: CHAR and VARCHAR – What are the differences?

Most programmers may already know the main different between CHAR and VARCHAR - The first one supports fixed-length data and the second one supports variable-lengths of data.

Some people may think, since VARCHAR can do what CHAR does, then why we still need CHAR in our database design. I even have heard one of the very experienced Oracle database administrator say "Nowadays nobody is using CHAR anymore, you can forget about putting CHAR column in your database design".

12Jan/100

Java: Use ByteBuffer As InputStream

Sometime, your program may need to read data from a ByteBuffer buffer into a InputStream object. There is no class in Java library that provide the facility to do the conversion.

Anyway, to use a ByteBuffer object as an InputStream is pretty simple. What you need to do is to write a class wrapper that inherit InputStream and override the read() function in InputStream.

5Jan/102

Java: Format Integer Into Fixed Width String

Sometime, you may want to format an integer or a long value into a fixed width String. You need to display the value in fixed width especially in reports where you want to keep the numbers in aligned (e.g. 3456 as 0003456 and 1234 as 0001234).

Other than that, you may also want to format the integer value for a better visibility. For example, to display integer value as a document number (e.g. 12345678 as 00-01234-5678), for example an account number.

The Java.format() is not flexible enough to solve my problem. At least it cannot be used to format a fixed length document number in the format I want: XX-XXXX-XXXX. Therefore I decide write my own format function.

20Dec/0912

Google Wave Invitation Giveaway

I got my free Google Wave invitation from LiewCf, thanks for the invitation! Ok, now is my turn to give you guys, my blog readers, the free invitations.

Google Wave Invitation

18Dec/090

Adobe Acrobat Reader: Possible Security Vulnerability When Acrobat JavaScript Is Enabled

It is possible to have security vulnerability in Adobe's Acrobat Reader if the Acrobat Javascript option is enable.

When the option is enabled and you open a crafted PDF file with Adobe Reader that allows JavaScript execution, your computer will be exposed to security risk - hacker may able to access your valuable data from your hard disk.

17Dec/090

Java: Continuously Read Data From FileChannel Without MappedByteBuffer

When programmer writes a program to read data from a file continuously and sequentially with a fixed data type reading sequence (e.g. to read three integers then 2 doubles repeatedly), he or she may find the MappedByteBuffer from Java library is useful.

10Dec/090

Short URL: Top 5 Websites That Provide Free Short URL Service

What is a "short URL"? Short URL or tiny URL is an URL used to represent a long URL For example, http://tinyurl.com/45lk7x can be used to represent and will be used to redirect to http://www.snippetit.com/2008/10/implement-your-own-short-url.

Why people use short URL? First, because it is easy to remember. Imagine when you read an article on a magazine or newspaper that shows you a site with 100 characters and complicated URL. How can you remember the long URL, put down the magazine or newspaper, sit in front of your computer and type out the URL at web browser correctly? When the URL is short, for example tinyurl.com/45lk7x, you can do it easily.

Second, short URL is more portable. For instance, when you want to send your friend a SMS that contains some message and an URL, with short URL you can save a lot of space and give you more space to type your message.

26Nov/090

Wordpress: How To Add Table Into A Post

Wordpress' WYSIWYG post editor does not come with the functionality that allows user to create table when editing a post (like what you can do in Microsoft word).

23Nov/090

Google Chromium OS

Google Chromium OS or Chrome OS is an open source project created by Google that aims to build an operating system that provide fast, simple and more secure computing experience. The new OS is target for people who spend most of their time on the web.

The following videos explain in detailed what Chrome OS is:

What is Google Chrome OS?

19Nov/092

JavaScript: Overcome Slow Loading JavaScript On A Web Page

Sometime a web page may load slowly due to loading a third party JavaScript source file from other domain. Most of the time, a web site comes with advertisement scripts or scripts for keep tracking visitors and these scripts are normally provided by third parties like Google Adsense, Statcounter, Amazon and etc. When these scripts' loading speed is extremely slow, it blocks the whole page from loading.