5th Cross

my writings about java, eclipse and musings about technology

Author Archive

Finding bugs in your code using FindBugs

leave a comment »

Static code analysis is the analysis of the software that is performed without actually executing the program. The process provides an understanding of the code structure and can help to ensure that the code adheres to industry standards. Static analysis code reviews compare the source code of an application with a set of standards to ensure the source code compiles with those standards, to find unwanted dependencies, and to ensure that the intended structural design of the code is maintained. The main advantage of static analysis is the fact that it can reveal errors that do not manifest themselves until a disaster occurs. Static analysis is only a first step in a comprehensive software quality regime.

Read the rest of this entry »

Written by Phani Kumar

July 22, 2010 at 11:07 pm

Posted in eclipse, plug-in, software

Tagged with ,

Test Post: posting source code

leave a comment »

Sample source code

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Sample source code initially collapsed

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Sample source code with line highlighting

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Link to my article on how to do this.

Written by Phani Kumar

May 29, 2010 at 10:59 pm

Posted in code, syntax

Installing Jadclipse in Eclipse

with 7 comments

Today I am going to show you how to install and use Jadclipse. Jadclipse is eclipse plug-in that integrates Jad (Java decompiler) with Eclipse.

  • First you require Jad for decompiling java files. You can find a list of mirrors on this site where you can get JAD for various platforms. Download it and unzip into any folder on your hard drive.
  • Next download the Jadclipse plug-in jar file from here and place the jar file in your eclipse plugins folder
  • Restart your eclipse. If eclipse didn’t recognize the plug-in then launch eclipse with -clean flag.

eclipse -clean

  • Configure the path to the Jad executable in eclipse under Window > Preferences… > Java > JadClipse > Path to Decompiler.
  • Set the full path of the jad executable, e.g. C:\Program Files\Jad\jad.exe
  • Go to Window > Preferences… > General > Editors > File Associations and make sure that the JadClipse Class File Viewer has the default file association for *.class  files.
file association

file association

Now everything is done. If you want to view the source for any class then simply ctrl+click on that class then the source for that class will be showed in your eclipse editor.

Written by Phani Kumar

May 20, 2009 at 11:58 am

Posted in eclipse, ide, java, plug-in

Tagged with , , ,

Reading from CLOB in java through JDBC

leave a comment »

Here is a code snippet that I have used to read from a CLOB, Oracle 10g instance.

PreparedStatment ps = connection.prepareStatement
("SELECT clobcolumn from clobtable");
ResultSet rs = ps.executeQuery();
while(rs.next())
{
oracle.sql.CLOB clobValue = (oracle.sql.CLOB)rs.getCLOB(1);
BufferedReader reader = new BufferedReader(new
InputStreamReader(clobValue.getAsciiStream()));
String read = null;
StringBuffer buffer = new StringBuffer();
while((read = reader.readLine()) != null )
{
buffer.append(read);
}
}

Digg This

Written by Phani Kumar

February 21, 2009 at 10:30 am

Posted in CLOB, code, Code Snippet, database, java, JDBC, sql

Tagged with , ,

Installing Eclipse SQL Explorer Plug-in in Eclipse Ganymede (Eclipse 3.4)

with 13 comments

This is an updated post for my earlier post Installing Eclipse SQL Explorer Plug-in for installing Eclipse SQL Explorer plug-in in Eclipse 3.4

Eclipse version 3.4
Eclipse SQL Explorer version 3.5.0

Installing using the Eclipse update manager.

  • From the Eclipse menu select Help->Software Updates…
Photobucket

  • Software Updates and Add-ons dialogue box will be displayed. Select the Available Software tab on the top of the dialogue box. Now Click on the Add Site button on the right hand side of the dialogue box.
Photobucket

  • You will be presented with the Add Site dialogue box. Now in the location add “http://eclipsesql.sourceforge.net/” (without quotes) and click ok to close the dialogue box.
Photobucket

  • It will search and present you with available software
Photobucket

  • Select the features you want to install . In this case select the branch, it will also install the patch and click on the Install button on the top right hand side.
  • It will check for dependencies if any and will present to you what all you need to install.
Photobucket

  • Confirm the plug-ins you want to install and click next
Photobucket

  • Accept the license agreement and click on Finish.
Photobucket

After the installation is done it will ask to restart the workbench, restart the workbench. To open the Eclipse SQL Explorer perspective from the menu select Window->Open Perspective->Other. From the list of perspectives select Sql Explorer and click on ok, you will be switched to SQl Explorer Perspective.
Photobucket

Technorati Tags: , ,

Written by Phani Kumar

December 2, 2008 at 10:37 am

Posted in database, eclipse, ide, java, plug-in, sql

XBMC Media Center on Ubuntu Hardy

with one comment

XBMC is an award winning media center for Linux, Mac, Windows and XBox. First thanks to this post which I stumbled and discovered about XBMC. Now I am going to tell you about my experience about XBMC.

First add these lines to your third party software sources list:

  • deb http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main
  • deb-src http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main

Then save and reload your repositories, you can also do this from terminal by typing

  • sudo apt-get update

Now after the update is finished, you can install xbmc by typing this line in the terminal

  • sudo apt-get install xbmc

You can start XBMC by navigating to Applications -> Sound & Video ->XBMC Media Center

I instantly liked this application, the screens, the navigation and everything is good looking. I used another media center application by name Entertainer but I liked XBMC more. Entertainer didn’t work well while compiz is running you need to use matacity for it to display properly. It also created tiny image thumbnails of the contents of the pictures folder in each folder. On the other hand XBMC has no problem loading while compiz is running and views are really good. Though I find one proble with XBMC is playing DVD’s. It loaded the DVD properly but started playing it very fastly as if you press fast forward. It even loaded iso file but same problem with it, it’s playing the movie as if your’re fast forwarding it might be that it is a beta version. It had no problems playing avi files, flv or any other video files it played perfectly well.

Check out some of my screen shots of XBMC.

Powered by ScribeFire.

Written by Phani Kumar

October 10, 2008 at 5:35 pm

Posted in media center, ubuntu

Tagged with

Ubuntu 6.10 with XGL & Kiba-Dock

leave a comment »

Written by Phani Kumar

June 5, 2007 at 1:50 pm

Posted in kiba-dock, ubuntu, videos, xgl

Windows Vista Aero Vs Linux Ubuntu Beryl

leave a comment »

Written by Phani Kumar

June 5, 2007 at 1:02 pm

Posted in Uncategorized

Configuring SQL Explorer Plugin

with 19 comments

We will configure the SQL Explorer Plug-in & connect to the database. I will be using MySql server. It will be almost the same for all the databases. If you have not yet installed the plug-in please see my post on Installing Eclipse SQL Explorer Plug-in.

  • From the eclipse menu, select window->preferences
  • In the preference dialog box, select the SQL Explorer node.
  • Select the JDBC Drivers node.
  • Select the Driver you want to configure. We will configure MySQL Driver. So select the MySQL Driver & click edit on the right hand side.
  • Select the “extra class path” tab in the change dialog box.
  • Add the MySQL Connector jar file by clicking on add button. You can download the connectors from MySQL site. You can download it directly from here.
  • Once you added the jar file click on List Drivers on the right hand side. You can see all the loaded drivers. Select the one appropriate to you.
  • Enter the URL of your MySQL Server in the Example URL text box. Something like this “jdbc:mysql://localhost:3306/test”. Here “test” is the database name & enter the url without quotes.
  • Click ok to finish the installation of the driver. You should be able to see a green tick mark for the driver we just installed.

Now we will connect to the database.

  • From the eclipse menu, select window->Open Perspective->other.
  • In the Open Perspective dialog box select SQL Explorer & click ok.
  • Eclipse will be switched to SQL Explorer perspective.

Written by Phani Kumar

May 8, 2007 at 8:19 am

Installing Eclipse SQL Explorer Plug-in

with 12 comments

For installing SQL Explorer plug-in in eclipse 3.4 go to this updated post Installing Eclipse Explorer Plug-in in Eclipse Ganymede (Eclipse 3.4).

Today I am going to show you how to install SQL Explorer plug-in in eclipse.

There are two ways to install.

  1. Download the distribution
    file and unzip it into your Eclipse installation.
  2. Use the Eclipse Update
    Manager.

Installing using the Eclipse Update Manager

  • From the Eclipse menu,
    select Help->Software Update->Find and Install. You will be
    displayed with a Install/Update dialog box.
  • Select Search for new
    features to install radio button & click next.
  • Click on the New Remote
    Site on the right hand side of the Install dialog box
  • Enter the name as “SQL
    Explorer” & “http://eclipsesql.sourceforge.net/” (without quotes) for
    the url in the New Update Site dialog box and click ok.
  • Select the SQL Explorer
    site in the Install dialog box and click finish.
  • Once the search is
    finished, it will present with the features to install.
  • Select the features you
    want to install. In this case select SQL Explorer branch & click next.
  • Accept the license
    agreement & click next.
  • Select the install location
    where you want to install this plug-in. By default it will be installed
    into the eclipse plug-in directory. If you want to add another location
    click on the change location button on the lower right hand corner and
    specify the directory where you want to install. Once you are finished
    with the selections click on finish button.

Written by Phani Kumar

May 8, 2007 at 5:32 am

Posted in database, eclipse, ide, java, Plugins, sql

Follow

Get every new post delivered to your Inbox.