Didn't I put it in the title?! Well, this is my blow-by-blow account of my experience with Java, Linux and other Copyleft stuff. Blogging to take the FUD away!

Wednesday, November 30, 2005

LemonSMS mavenized!

Source codes of LemonSMS are already available in CVS. I also managed to mavenize the project. I used Maven 2.0.

After checking out the source code, you need to download the library dependencies. Then, extract it to $MAVEN_HOME/repository.

To build the application you just need to issue the ff. comand:

mvn package

Be sure to have the mvn executable in your path. After building, you can now use the library in your application. If you have any problem, feel free to drop me mail.


LemonSMS - Open Source SMS Java Library

Finally LemonSMS is in Java.net!

2 years ago I created an open-source SMS Java library. It's now hosted in the Java.net project
website at http://lemonsms.dev.java.net/

I am still developing the main project website. Here's the link http://lemonsms.lemongreen.biz

I just found time to transfer the sources from Sourceforge. For those
interested, you can download the source of the library and use it in
your projects. I want to get feedback and see how I can improve it. I
invite everybody to join the mailing lists and discussions.

In Java.net, you can request an observer role so you get updated with
what's new in the project. If you also want to help with the
documentation, it would be great. Just send me a private email.

A brief description of the library

LemonSMS is a Java library that enables developers to integrate their web or standalone applications to send and receive SMS messages. It works with a GSM modem, compatible phone or an SMS appliance. The LemonSMS API is easy to use. It leverages Sun's Java Communications API for Windows applications and RXTX for Linux implementations.

It is stable enough and has commercial implementations developed by Lemongreen Inc. for its out-of-the-box SMS appliance solution

Enjoy! Happy hacking ;-)

Sunday, November 27, 2005

Pesky Date data type in Oracle

I was wondering why I was getting the wrong time when I queried a column in an Oracle database with a Date data type. With the help of my friends who are Oracle and Java experts, I have managed to solve the problem.

When saving a Date in an Oracle table with a Date type, you need to save it as a Timestamp. This ensures that the time isn't truncated.

Calendar cal = Calendar.getInstance();

//Set Prepared Statement parameter.
ps.setTimestamp(1,new Timestamp(cal.getTimeInMillis()));

To read the date correctly, I used SimpleDateFormat to format the data I got from the table.

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");


According to the JDBC specifications, the Date data type really doesn't include the time so this is some sort of a workaround.

Whew! :-)

Tuesday, November 15, 2005

Head First Design Patterns

Last week I borrowed a copy of Head First Design Patterns from a friend. I haven't been able to find time to read through it yet. I read the introduction and it the way stuff are explained. It was pretty interesting. Patterns were explained in a very creative way and even idiots can probably learn it fast. That's why I am confident that I will be able to grasp the concepts. hahaha :))

Installing Linux in a Dell Inspiron 6000 Finale

Finally I had Fedora installed in my laptop and the built-in WIFI works! I shouldv'e installed Slackware but I saw some bugs for the ipw2200 driver mentioned in some of the forums so I hesitated to do that. It would've been great. Last time I installed slack was when it was still in the 8.1 version I think. Way back when Patrick V. wasn't ill yet. He's fine now anyway. Well, the itch has been scratched and I feel safe now. I don't know why I feel some security when workin' in Linux than Windows. Maybe it's really more secure?! It is more secure!!! I'll bet my ass on it. Now I can download anything I want without having to think about viruses...

Thursday, November 10, 2005

Installing Linux in a Dell Inspiron 6000

Windows is crap but I have to use it at work. I really don't have a choice. To scratch my itch, I decided to install Linux in my company-provided laptop. It's a Dell Inspiron 6000. I never really thought it was that challenging.

My first try was with Ubuntu Breezy Badger. It was just released at the time of my install. If I'm not mistaken it's just a few days since it was available for download. Hmmm...I thought it was kind of interesting. It's a relatively new distro as I just have heard of it a few months back. Known for its ease of use, Ubuntu was the right choice since I will just be using at home. I downloaded a CD from the net and managed to burn myself a copy. Damn Internet is fast here! I was able to get a copy for just an hour.

My laptop was already for the install since I already had it partitioned. Partitioning is actually good practice even you are solely using the OS from the Dark Side. Your files will eventually get corrupted and you need to reinstall XP again. I don't know if this by design. Anyway, I got my CD and started my first ever experience with Ubuntu. To my surprise, what I saw was a crappy menu. Last time I saw this was when I was installing Debian. I think Ubuntu is based in Debian anyway. Well, I really wasn't disapppointed. Just surprised. I even like it because it is fast to load. Going through the menu is pretty straightforward.

After a few minutes I got Ubuntu up and running in my Dell. Since most connections here are WIFI-enabled I had to try if I can browse the net. Wow! It was working! Ubuntu would ask while installing if you have a WIFI connection and configures it for you. I had to sleep so I turned off my machine and rest. I had sweet dreams since I it was a success.

When I was at work the next day, my damned WIFI connection won't work. I probably missed out something in the configuration. So I was really pissed off. I know I missed something so I was kind of disappointed with myself. I searched the Internet using our LAN and looked for some people who encountered the same problem. Unfortunately, I found no solution. I was really puzzled because I can browse access points using iwlist. For some reason, I can't authenticate using WEP or WPA. I never got an IP address from the DHCP server. I never gave up and tried reinstallng the drivers. I got this tutorial from a list.


It was a nice read but it didn't work for me :-(

So since I heard someone made this Dell model worked with Fedora Core 3, I tried that option. I was able to install it. I followed this tutorial and it worked! My WIFI rocks!


So you think I'm done eh?!

After successfully installing FC3, I ran Gnome. Some applications hang like shit! I got this when running GAIM. It's like those things you get in Windows. All you get is blank windows. I thought it was a GTK problem so I upgraded some libraries using Redhat's online update. I can't remember what's it exactly called. I left it overnight. When I started it up at work, damn it won't boot! I knew I messed it up.

Well, I'll try install again now and see how it goes. Installing in my Dell is a pain! I never got this with an HP.

To be continued.

for(;;) and while(true). Is there any difference?

Gideon, a member of our 4 yr old PinoyJUG mailing list used javap to see if there was a difference in the bytecodes.

Quoting his test:

It seems that javac generates the same byte code for both these
implementation of endless loops.

--begin While.java--
public class While {

public static void main() {
while (true) {

--end While.java--

output of "
javap -c While.java"
public class While extends java.lang.Object{
public While();
0: aload_0
1: invokespecial #1; //Method java/lang/Object."
4: return

public static void main();
0: goto 0


--begin ForLoop.java--
public class ForLoop {

public static void main() {

--end ForLoop.java--

output of "javap -c ForLoop.java"
public class ForLoop extends java.lang.Object{
public ForLoop();
0: aload_0
1: invokespecial #1; //Method java/lang/Object."":()V
4: return

public static void main();
0: goto 0


According to his test there isn't any difference in the bytecode generated. Well there's this guy who is debating that there is a difference in terms of faster processing of the controversial contructs. Is there really a difference? Maybe someone from Sun can enlighten us regarding this matter.

So whatchathink? Which is faster?

I need a post to preview?!!!

According to Blogger's message, I need an initial post to preview my template. So here it goes... This has nothing to do with Java or any OSS stuff.