Skip to main content

Posts

Changing Eclipse Workspace

Easy way to do this, go to “ File->Switch Workspace ”. This option will show you previously used workspaces. You can select workspace you want to use, if the one you want to use is listed in it. If not then select “Other” option. This will open “Workspace Launcher” dialog. This dialog will allow you to choose the directory which you want to use as workspace. Simple isn’t it! Well the hard way of doing this – Open the “ ECLIPSE_HOME/configuration/.settings ” directory, in this directory you’ll find a file “ org.eclipse.ui.ide.prefs ”. Open this file using any text editor like Notepad/Wordpad. This file contains workspace related configuration. “ SHOW_WORKSPACE_SELECTION_DIALOG ” and “ RECENT_WORKSPACES ” are the ones concerned to changing workspace. SHOW_WORKSPACE_SELECTION_DIALOG – This property will have either “true/false” value. If this property is set to true, then next time when you open eclipse, it’ll open “Workspace Launcher” dialog through which you can select the...

Oracle SQL Developer & Named MSSQL Instance

Its a small tip to connect to a ‘ Named MSSQL Instance ’ using Oracle SQL Developer. Oracle SQL Developer allows you to connect to any database which has supported JDBC drivers. You can add these drivers either using “Help –> Check for Updates” and by selecting “Third Party SQL Developer Extensions” option. This will list available updates, from which you can select the needed drivers. Second option is adding these drivers from your local drive using “Tools –> Preferences” and by selecting the “Database –> Third Party JDBC Drivers” option from the tree given in the left column. If you installed needed driver for MSSQL database you’ll get the tab “SQL Server” on the New Database Connection window. If you observe this window, you’ll see that there is no text field/option to provide “Database Instance Name”. This window is simple to create a Database Connection to Unnamed MSSQL Database Instance. The big question is how do we create a connection to a Named MSSQL Database Insta...

Auto Scrolling Java Script Component

Well after a long break, here I am, back with a component which might be useful for web developers/designers. In this post I’ll try to explain Auto Scrolling Java script component. You might think Auto Scrolling is very old topic and you’ll find many examples of this kind. Even I was thinking the same couple of months ago. I was supposed to work on something similar to this, I thought I can use some existing components with out putting effort to write my own. But ended up writing my own Auto Scrolling component. Reason – Those examples I found did not fit my requirement and are really complicated for a common developer to understand and plugin to existing code. This component is small, simple and can be plugged in to any piece of code [at least my perception] with out any effort. All the source code is free for every body to use [this is also one of the constraint I wrote my own], download it using the links provided a the end of this article. Why wait, lets get on with it. This ...

Connection Pool Configuration Using DBCP

Connection pool configuration, for most of the web applications with data base interaction, is a common process. Either small or big, its always suggested to have connection pool configured for better performance. If your JDBC or DAO code is creating data base connection for each call, it results a lot of overhead and reduces your application performance. Using connection pool will improve application performance a lot. If you are deploying your web application in Application Servers like Weblogic, Webspere, etc. they will allow you to configure connection pool and maintain them for you. But if you are opting for Web Server like Tomcat , which is the most common case when you go for shared hosting services, then you have to depend on resources like DBCP [Data Base Connection Pool] for connection pooling. Its one of the best options available for connection pooling. By configuring connection pool in Tomcat will relieve lot of responsibilities from your application. We let Tomcat cr...

Simple DAO API Using JDBC

Update: Source code now available @ http://code.google.com/p/simple-dao-api/ This article is about the "Simple DAO API" which I wrote using JDBC API to assist database programming. This TINY LITTLE API containing 7 classes [Not exactly an API, you can not call a set of 7 classes as API I guess]; is INSPIRED by the SPRING DAO classes and is intended for those beginners who just started learning JDBC and trying their small examples, class assignments and for those who are trying to develop small desktop applications, small Servlet based web applications. For this kind of development it'll be difficult to use the those very nice features of APIs like Spring to ease database programming, as it requires bit of time to understand the Spring API, and most of the times you end up not using all the features of the API. You can find the links to download the source code at the end of this article. As I mentioned above these classes were written after getting inspired by...

Hosting Multiple Domains In Tomcat

Tomcat allows us to host multiple domains in one instance, using multiple ' Host ' tags. In this article I will explain how to do it on Tomcat. This is very simple configuration using ' Host ' tags in your server.xml . A novice can also understand this configuration very easily. Before going into the details of the configuration first lets have a look at the ' Host ' tag, ' Context ' tag and ' Alias ' tags first. <Host name="domain1" appBase="[application base]" autoDeploy="[true/false]" unpackWARs="[true/false]"> <Alias>...</Alias> <Context path="" docBase="" reloadable="[true/false]"/> </Host> First lets have a look at ' Alias ' tag. This tag is used to provide aliases for your actual domain. For example you have a domain called 'domain1.com', and you want to run the same application for 'www.do...

String manipulation in Java

One topic most of the developers in early days of their career overlook while programming is STRING MANIPULATION . This article will throw some light on this topic, so that one can make habit of some efficient coding. I am going to give some insight into Java string manipulation and some better ways to do string manipulation. In Java String objects are immutable, what it means is once you create a String object in Java, it can not be changed/modified. For example look at the following code. String a = "A String Object"; a = "Second String Object"; In the above code, we created a String object 'a' at line#1 with the value "A String Object", and in line#2 we tried to change the value of the object 'a' to "Second String Object". As I mentioned little earlier, when you create a String object in Java, it can not be changed. In line#2 when you try to change the value of object 'a', JVM [Java Virtual Machine] will c...