Ooh … Begitu! I see, I see …


Setelah kelayapan di internet, cari-cari info dari sana-sini dan bongkar pasang tips (terutama programming), akhirnya baru sadar … ternyata begitu caranya … [all about tricks and tips I have found during my work as programmer.]

SMS Gateway, oh SMS Gateway …

* still cursing herself after posting a bubbling in her other blog with the same title. *

Guys … do you know where is the place to get a lot of AT Commands manuals or references? Especially for the modems, not just for mobile phones. Please help. Many thanks for your attention and help. ^^

…….. ah yes, I am a “she”. ­čśŤ

Filed under: Delphi programming, Java programming, , ,

cast Double to String in java

Double to String casting …
if you want to display its String in number format (like this ###,###,##0.00) do not use these lines …

    Double sk = 12300000000.35;

they would result like these ones:


use this one instead.

    Double sk = 12300000000.35;
    NumberFormat nm = NumberFormat.getNumberInstance();


the latter result would be this:

Filed under: Java programming, , , , , , ,

deprecated File toURL() method in Java 6

after upgrading to Java 6, I just found out that toURL() method is deprecated in Java 6.
after doing some googling, I reached to this page: http://www.jguru.com/faq/view.jsp?EID=1280051

The author (in the link above) said:

The toURL() method of File does not properly escape characters that aren’t valid in a URL. You can write better code today without waiting for Java 6 by calling the toURL() method after calling toURI() on a File object.

and provided these code samples for us:

    URL url1 = file.toURL();         // bad
    URL url2 = file.toURI().toURL(); //good

hmmm … okay, I got it.

Filed under: Java programming, , , , , , , , ,

how to check if two filename paths refer to the same file?

I just found out the information that a filename path may include redundant names such as ‘.’ or ‘..’ or symbolic links (on UNIX platforms).
so how to know exactly if two filename paths are referring to the same file?

use File.getCanonicalFile() to convert a filename path to a unique canonical form suitable for comparisons. and then, compare the results of both getCanonicalFile() with equals(…)

just take a look at this example below to get some idea.

    public boolean isSameFile() {
        File file1 = new File("./filename");
        File file2 = new File("filename");
        // Filename paths are not equal
        // false, don't use this way to compare.
        boolean b = file1.equals(file2);                
        // Normalize the paths first.
        try {
            // D:\\sth\\filename
            file1 = file1.getCanonicalFile(); 

            // also D:\\sth\\filename
            file2 = file2.getCanonicalFile(); 
        } catch (IOException e) {
            // your exception lines...
        // Filename paths are now equal.
        return file1.equals(file2);              // true

I got this information from www.exampledepot.com there are more interesting tips about file handling in Java programming. just make sure you won’t miss those tips too. ­čÖé

have a nice day of coding.

Filed under: Java programming, , ,