Wednesday, May 26, 2010

Remote Debugging Java packages in WSO2 Carbon using IntelliJ IDEA

Here I'm going to tell you an easy way of debugging java packages deployed under any WSO2 product. So, you don't need to go wondering and go through thousands of lines looking what the bug was in your package.
What you need:
  • IntelliJ IDEA
Thats it. Now, open your Java package/bundle from IDEA.
Then, go to Run -> Edit Configurations
Add a remote debug configuration by clicking on '+' sign (at top left corner) and then remote.
It comes with a default set of settings. Keep them intact. get to know the port number(generally it's 5005)

Now, start the WSO2 Product you are using with the parameter of debug followed by the port number.
sh debug 5005

It waits and listens on port 5005 until remote debugging client is started. Start the client by, (in IDEA)
Run -> Debug
All done. Now you can do normal debugging by putting break-points in your .java files.

That's how I got it done. Does this help you to succeed in remote debugging?

Tuesday, May 18, 2010

Remote Desktop for Linux Using VNC

Here, I'm telling you a easy way to do remote desktop from Linux. You can access Linux machine through another machine with Linux Distribution or from Microsoft Windows as well.
The method used for this is VNC (Virtual Network Computing).
Before, trying anything, you need to know this. The machine that you use to access a Remote machine is called the client. And the Remote Desktop is the server. In VNC what happens is, we install a VNC server software in server side (Remote machine) and access it though a client software.
Let's get in to business. It's pretty easy. Here I'm telling doing remote desktop for a Linux machine from any environment. I did this Ubuntu 10.04 Lucid Lynx but applicable to other distros as well.
  • In Server (Remote machine), first install vnc4server package from Synaptic Package Manager. (Go to System -> Administration -> Synaptic Package Manager) Search for vnc.

  • Install the package named vnc4server. Or, in terminal,
sudo apt-get install vnc4server
  •  Then, go to client machine and install xvnc4viewer. By terminal or from Synaptic. This is accesses the server and displays the virtual desktop.
apt-get install xvnc4viewer
Now the installation is over. How to run?
  • First, create a server instance in the Remote machine you want to connect to by, entering command 'vnc4server' in terminal. Your output would look similar to below if everything went smooth.
kasun@uom:~$ vnc4server
New 'uom:1 (kasun)' desktop is uom:1
Starting applications specified in /home/kasun/.vnc/xstartup
Log file is /home/kasun/.vnc/uom:1.log
NOTE: In the first run it will ask to set a password. Give a strong password to it as anyone with it can access your server if it's turned on.
You can create any number instances as you like. They will be numbered as <host>:<id> which will be distinguised by a port number. You can know the port number by looking at the log file from ~/.vnc/<host>:<id>.log. ex. cat ~/.vnc/uom\:1.log . You need port to access the server instance. Port number is generally 5901 or nearby. And server IP address (do ifconfig)

Now go to Client.
  • Run xvnc4viewer .  It will ask for the server to connect to: give it in the format <ip>:<port> ex.
  • OR, there are Microsoft Windows alternatives available such as RealVNC. Download it from here. (Filling the form is not compulsory!)
    If nothing went wrong, now a window will be opened with the remote machine desktop. Here I'm running a Red Hat Linux Instance from my Ubuntu Lucid Lynx machine. :-)

    A comment about your experience or anything is appreciated. Good luck!

    Saturday, May 15, 2010

    Fix for 'Ubuntu Lucid Touchpad not working'

    Ubuntu 10.04 is intended as a Long Term Support (LTS) release, but surely it's not less of bugs. Touchpad stopped working when disable button is pressed, is surely one major bug of Lucid by usability wise. My friend Subash and I both faced this problem when we install Lucid. We both have HP Pavillion Series Laptops. In theory, this should work on any laptop/touchpad. Based on user comments, this fix was successful in both Acer and Lenovo, (and of course HP). Does this applies to later versions of Ubuntu as well? Just let me know. I'm using Gentoo Linux now for a change!

    There's a fix for Ubuntu 11.04, 11.10 (Unity) as well. Read to the end. 

    The Synaptic Touchpad driver of touch-pad is installed, and it's Recognized. The problem is sometimes it gets disabled for no reason. Subash's Touchpad didn't work just after the fresh install, forcing him to reinstall again, as the reason was unclear at the moment. Later we found the problem and the fix.

    What we have to do is enable the touchpad by setting the touchpad_enabled property to true. Here's the command to do it in one step.
    gconftool --type Boolean --set /desktop/gnome/peripherals/touchpad/touchpad_enabled true
    This changes the touchpad_enabled property to true in ~/.gconf/desktop/gnome/peripherals/touchpad/%gconf.xml file. This will fix the issue.

    Alternative to above, you may edit the file manually and restart gnome. Change the touchpad_enabled property to true (see screenshot), and enter following command in terminal:
    killall gnome-session

    As I've said, this has fixed the issue in my laptop, HP DV-5, Synaptic Touchpad, Ubuntu 10.04. Share the model of your laptop as well if this fix worked for you too.

    The above solution is for GNOME, and probably won't work on Unity Desktop Environment (ie. Ubuntu 11.04, 11.10). For that, try the following.

    • unity --replace
    Wait for few minutes until it loads all back in to place. If this didn't work, try the following command. My issue was solved by the following command on Ubuntu 11.10. But I tried the above one first.

    • sudo modprobe -r psmouse && sudo modprobe psmouse

    Does this fix work for you? I haven't extensively checked this. So, value your feedback.

    UPDATE 1: After the touchpad issue, it's quite difficult to navigate. So, I created a simple script for it. Save it to your home(~/)  folder. Then, you can run it by following command from terminal.
    sh ~/

    (You can get the terminal by pressing ALT+F2. Type "gnome-terminal" without quotes and press Enter. Or just press Ctrl + Alt + T)

    UPDATE 2: Sometimes, when touchpad disable button is pressed, Keyboard starts to not work. But, still (fortunately) some key combinations works. The reason for keyboard not functioning is unknown for me, but there's a workaround for this problem. The work around which fixed this keyboard issue is the following.

    That is, go to console tty1 and come back! Strange, but it does work.
    • Press CTRL+ALT+F1  (This will bring you out of X Window for a moment)
    • Then, CTRL+ALT+F7  (This brings back the X )

    Wednesday, May 12, 2010

    Fixing the error in installing Maven plugin in Netbeans 6.8

    I yesterday installed Ubuntu family newest OS release Ubuntu Lucid Lynx (Ubuntu 10.04) and then gone through the step of installing softwares. (Tried upgrade option of Ubuntu from Karmic Koala, but got screwed up! anyway it's another story.)
    Ubuntu Lucid comes with Netbeans version 6.8. But there's a bug in it which prevents users from installing Maven plugin in it. It gives an error saying,
     Some plugins require plugin Utilities API to be installed. The plugin Utilities API is requested in version >= 8.0 but only was found.

     This is a bug Netbeans and it is reported in Launchpad. Luckily, a workaround is available. It's listed under #2. What you have to do is,
    1. Click on "Settings" tab in "Plugins"
    2. Activate "NetBeans" (if not activated) and deactivate "Ubuntu Specific" (or "NetBeans for Ubuntu" in case of 6.8-0ubuntu4)
    3. Go back to "Available Plugins" and Reload the catalog.
    4. Then install Maven.