Friday, September 28, 2012

Returning to Java

In my early years of coding, I learn several programming language for my career. I'm doing VB, Borland Delphi, before finally settled with Java. So in my final years in uni, I done a lot of work in Java, including my final year project. In the same time, a new framework emerge and advertised as Java killer: .NET Framework with C# Language - which I also learn. Then I joined my first company (after graduated), which is a Microsoft partner and is one of .NET early adopter. That's how I ends up in .NET (or Microsoft) world for 10 years, although I keep doing several side projects or just learning view tricks in Java/Linux.
Finally, view months ago, a friend convinced me to join his startup, and I have freedom or at least a say in choosing which technology that will be used in this new enterprise. I pulled the trigger to use this chance to re-join Java world. Here's some of points on the journey on redefined myself as Java programmer:

  • I choose Netbeans as IDE, instead of Eclipse and Intellij IDEA. My problem with Eclipse is to use Maven and Tomcat, I need to install and enable several plugins - manually, which for Netbeans the plugins available automatically. For Intellij IDEA, the reason of not using it is because if I can get things "free" with Netbeans, why I need to pay for Intellij IDEA. Yes, that's really a lame excuse, the community/free version already give enough. But at the end, I must say that Netbeans team really done a good job to bring Netbeans this far. I'm a happy user of this fantastic IDE.
  • In choosing of programming stack, Spring framework is the (likely) sole candidate, and for web stack, we evaluate several available options like JSF, ZK, and Vaadin (even GWT). At the end the framework of choice is JSF, since this is the official web framework for Java EE (although we not going to Java EE direction - EJB thingy), and Primefaces is really bring JSF to the new level.
  • We choose Ubuntu as our primary Linux distro. I already work with this distro for quite some times, and it's maybe the "easiest" Linux distro out there, which is means "easy" for system admins (which is our end users sysadmin) to maintain their own systems.
Let see how far we can go from here!

Tuesday, September 4, 2012

Set A Static IP On Ubuntu

To change my IP address on Ubuntu from DHCP to static IP, I do following step. First, open file /etc/network/interfaces. I'm not a fan of vi/vim, I'm using nano (or editor in MC)
sudo nano /etc/network/interfaces

You will find something like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

To make it static, I change to (based on my network):
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.191
netmask 255.255.255.0
gateway 192.168.1.1

Restart the interface:
sudo ifdown eth0
sudo ifup eth0

And with ifconfig, voilĂ :


But, I still have problem later:


The system cannot resolve DNS. To resolve this, I re-edit /etc/network/interfaces, and add entry of dns-nameservers. So the complete /etc/network/interfaces will looks like:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.191
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1

Done, restart the interface again (ifdown and ifup), now I can browse internet.

Tuesday, August 7, 2012

How to zip an Entire Folder in Linux?

Linux uses a program named tar to archive data, which can then be compressed with a compression program like gzip, bzip2, 7zip, etc.

So, in order to "zip" an entire folder, the command is:
tar -zcvf archive.tar.gz folder-name/ 
This will tell tar to c (create) an archive from the files in the folder (tar is recursive by default), compress it using the z (gzip) algorithm, store the output as a f (file) named archive.tar.gz, and v (verbosely) list all the files it adds to the archive.

On another way around, to decompress and unpack the archive into the current directory:
tar -zxvf archive.tar.gz 

Saturday, July 14, 2012

Upgrade NetBeans to Version 7.1.2

I'm still using Netbeans version 6.9.1. Yes, no typo, you read it correctly, it's two years ago version. You must be asking, why? Are you hiding under a rock? Now is Netbeans 7.1.x era. I have my reason, and here my reason: I'm still using Tomcat version 6. Why I'm using version 6? Because I'm utilizing the tomcat pre-configured in Ubuntu 10.04 LTS (lucid): Tomcat 6.0.24.

So this is my development (learning) environment:
  • Netbeans 6.9.1
  • Tomcat 6.0.24
  • Mysql Server (maintained with PHPMyAdmin)
Since the Ubuntu comes with newer LTS version, I'm ready to make a move:
  • Ubuntu 12.04 LTS (precise) comes with Tomcat 6.0.35 but also Tomcat 7.0.26. This time I determined to make an upgrade, so I installed version 7.0.26 in Ubuntu, and in my desktop (use zip/tar.gz version, not the exe version)
  • Time to upgrade to Netbeans 7.1.2
  • MySQL Server version also increase (get the latest installation, although I think the impact should be minor)

The result; NetBeans 7.1.2 is a smooth upgrade from NetBeans 6.9.1. In the new IDE, I can open my project without problem at all. That's good, since I already uninstalled Netbeans 6.9.1 prior to the upgrade. So, no turning back...

PS: Anyway, I'm still using Java 1.6. Doesn't mean I have no trust in the new Java SE 7 (1.7), but giving it sometimes before mature becomes mainstream