Thursday, October 7, 2010

You're a Bad Manager. Embrace It.

You're a Bad Manager. Embrace It.: "You manager developers and you'd like to think you're a good manager... but look at the evidence. Most, if not all, of your projects are late. Your team often delivers products riddled with bugs. Quite a few never ship at all. How can you be a good manager if you constantly fail? Isn't getting the job done a big part of being a good manager? Let's look at this situation.Let's look at a few of..."

Thursday, August 26, 2010

Java 7 : The New try-with-resources Statement

Java 7 : The New try-with-resources Statement: "From build 105, the compiler and runtime of the Java 7 Releases have
support for the new form of try : try-with-resources, also called ARM
(Automatic Resource Management) blocks.This new statement makes
working with streams and all kind of closeable resources easier. For
example, in Java, you can have this kind of code :


James Sugrue"

Thursday, July 8, 2010

Effective Teamworking With Eclipse: Change Sets

Effective Teamworking With Eclipse: Change Sets: "The last two days I have been looking at various ways that Eclipse assists developers when working with version control systems. First, we talked about highlighting local changes, then we discussed how to automatically synchronize with the version control system. Todays tip deals with Change Sets, which is the most useful feature in Eclipse for seeing real context behind changes in version..."

Wednesday, July 7, 2010

Experience: JasperServer Enterprise Edition

Experience: JasperServer Enterprise Edition: "I have been given a one-year commercial license by the Jaspersoft to test their JasperServer Enterprise Edition version 3.7.0.1. This software is very valuable for use in a company that might need to handle large amounts of data. From the data one can create customized reports, which prove to be valuable for supervisors and, of course, the boss."

Effective Teamworking With Eclipse: Autosync With Version Control

Effective Teamworking With Eclipse: Autosync With Version Control: "Over the course of your workday, you should find yourself synchronizing with your version control system frequently. After all, you need to see when somebody's made a change, and the sooner you know, the sooner you can integrate that change locally before committing. Once again, Eclipse has a really easy way to schedule your syncs. Everything you need is on the Synchronize view (Window/Show..."

Effective Teamworking With Eclipse: Highlighting Local Changes

Effective Teamworking With Eclipse: Highlighting Local Changes: "Eclipse can make your life really easy when it comes to working with version control systems. Over the next few articles, I'll be sharing some of the tips that I've picked up while using Eclipse (with CVS). When you make changes in your local workspace, the default decoration is a '>' before the change, up to project level. This is fine, but isn't particularly obvious when scanning..."

Four Things to Know when Writing Comments

Four Things to Know when Writing Comments: "Every developer has been learned from his teachers how important is
to comment his source code. You should comment the classes, the methods,
the logic, etc. However nobody explained how exactly to code with
comments between the lines. Have you ever seen that
i++; // we increment i with one
That’s a shame! This doesn’t tell you anything, and what will happen
if sometime later somebody sits..."

Effective Teamworking With Eclipse: Highlighting Local Changes

Effective Teamworking With Eclipse: Highlighting Local Changes: "Eclipse can make your life really easy when it comes to working with version control systems. Over the next few articles, I'll be sharing some of the tips that I've picked up while using Eclipse (with CVS). When you make changes in your local workspace, the default decoration is a '>' before the change, up to project level. This is fine, but isn't particularly obvious when scanning..."

Four Things to Know when Writing Comments

Four Things to Know when Writing Comments: "Every developer has been learned from his teachers how important is
to comment his source code. You should comment the classes, the methods,
the logic, etc. However nobody explained how exactly to code with
comments between the lines. Have you ever seen that
i++; // we increment i with one
That’s a shame! This doesn’t tell you anything, and what will happen
if sometime later somebody sits..."

Spring Framework Architecture

Spring Framework Architecture: "The Spring framework is a layered architecture which consists of several
modules. All modules are built on the top of its core container.
These modules provide everything that a developer may need for use in the
enterprise application development. He is always free to choose what features he needs and eliminate the modules which are of no use.
It's modular architecture enables integration with..."

Tuesday, June 29, 2010

Google Wave Now Open to Everyone [Google]

Google Wave Now Open to Everyone [Google]: "
Google Wave now lets anyone with a Google account jump in and see what the early adopters have been squawking (and snarking) about. Head to wave.google.com now to get Waving, but read on for some beginner tips and use cases. More »

"

Thursday, May 6, 2010

Add Comments and Javadocs in Eclipse With a Single Keystroke

Add Comments and Javadocs in Eclipse With a Single Keystroke: "When you want to work with comments in Eclipse, you could use the
slow way of moving to the start of the line, pressing // and then
repeating this for all the lines you have.
Or you could use the quick way of adding a comment with a single
keystroke no matter where the cursor’s positioned in the statement.
The same goes for Javadocs – there are just too many things to type
before you can..."

Tuesday, April 27, 2010

Database Connection pooling

For building any application which has a database, we need to every time query database. So almost every function requires to create connection with database. Creating connection with database takes lot of time which can be an overhead to database. Also we need to limit the no of simultaneous connection to the database to protect from failure. Hence, if we use already created connection we can improve the performance of the application to great extent. The mechanism of using already created connection is called as Database Pooling. I have implemented a simple database pooling which I am sharing with you. you can download the jar file from here.
To use just import the jar file in eclipse or put in your class path. After that you need to initialize the connection parameters. for this purpose if you are making web-application, use ServletContextListener to initialize by importing the context-params as show below:


<context-param>
 <param-name>url</param-name>
 <param-value>jdbc:mysql://192.168.0.11:3306/test</param-value>
</context-param>
<context-param> 
 <param-name>driver</param-name>
 <param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
<context-param>
 <param-name>login</param-name>
 <param-value>login</param-value>
</context-param>
<context-param>
 <param-name>password</param-name>
 <param-value>password</param-value>
</context-param>
<listener>
 <listener-class>database.MyServletContextListener</listener-class>
</listener>

In above configuration replace the driver, url, login and password according to your database.

Now we need to write the ServletContextListener. it is as shown below:

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import database.DbConnect;
import database.MyConnection;
public class MyServletContextListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent arg0) {
/* creating ten connections, MyConnection is a static class which has the
* connection properties and DbConnect is a class which gives us the
* static functions getConnection() and release();
*/
ServletContext context = getServletContext();
String url = context.getInitParameter("url");
String driver = context.getInitParameter("driver");
String login = context.getInitParameter("login");
String password = context.getInitParameter("password");
try {
  MyConnection.initialize(url,login,password,driver);
  DbConnect.connect();
 } catch (Exception e) {
  e.printStackTrace();
 }
} 

public void contextDestroyed(ServletContextEvent arg0) { // closing all active connections DbConnect.close(); }

Now our connections are ready to be used, below is the example of getting the connections and releasing.
MyConnection conn = null;

try {
conn = DbConnect.getConnection();
Statement s = conn.connection.createStatement();

} catch (Exception e) {
e.printStackTrace();
} finally {
if (conn != null)
DbConnect.release(conn);
}

hope so it might be useful to you. Kindly share your comments and doubts here. thank you.

Friday, March 26, 2010

Importing Contacts from a CSV file into Gmail Account

To import contacts to gmail account save contacts from another mail account into CSV (comma delimited) format and follow these steps:

  1. First go to Contacts 
  2. Then click on import
  3. you ll get the screen shown below. choose the CSV file downloaded also check the check box to add contacts to existing group or new group and click import.
  4. you ll be prompted for new group name.
  5. Enter the group name and the contact will be imported. Same applies to other mail accounts also.

Monday, March 15, 2010

Recover Lost Hard Disk Partitions

If your habits match to me and you also like to try every new OS which you hear of, then you might have lost hard disk partitions like me. Last week, my friend advised me to try CentOS and while installing this I lost my all partitions. I also never take backup of my data so there was no option but to recover my partitions. I started to surf the web and found many softwares which can help me to recover my data. If you also fall into same situations then follow these steps to recover your data completely:

  1. Do not format your hard disk. If you format all your data will be lost. 
  2. First create only primary partition of the same size as previous and install your windows operating system.
  3. Do not create any other extended or logical partitions, if you create you'll wipe your previous  data.
  4. After windows installation is finished, install the recovery tool Find & Mount. It can be found here. This software is available for free with the limitation of 512kb/sec data transfer. You can remove this limitation by purchasing pro version.
  5. There are three modes to find partitions use third mode: through scan.
  6. After some time you'll start seeing the partitions.
  7.  Under found partitions your partitions will be visible. Mount those partitions and then copy all your data to any other hard disk.
  8. Now you are free to create your new partitions and your data is recovered. 

    Sunday, March 14, 2010

    JInt Demo: Implementing MVC Architecture using Struts

    Introduction

    Struts is an open source framework from Apache Jakarta for building applications using Model View Controller (MVC) design pattern. Struts provide the basic infrastructure for implementing MVC allowing developers to concentrate on the business logic. The framework is also flexible and can be extended to meet the requirements specific to a project.
    The objective of this article is to help users quickly get started with using Struts in their applications. It also shows how JInt Demo uses Struts to implement (MVC) architecture in its Web applications.

    MVC Architecture

    The aim of MVC architecture is to separate the business logic and data of the application from the presentation of data to the user. Following is the small description of each of the components in MVC architecture:
    Model : The model represents the data of an application. Anything that an application will persist becomes a part of model. The model also defines the way of accessing this data ( the business logic of application) for manipulation. It knows nothing about the way the data will be displayed by the application. It just provides service to access the data and modify it.
    View : The view represents the presentation of the application. The view queries the model for its content and renders it. The way the model will be rendered is defined by the view. The view is not dependent on data or application logic changes and remains same even if the business logic undergoes modification.

    Controller : All the user requests to the application go through the controller. The controller intercepts the requests from view and passes it to the model for appropriate action. Based on the result of the action on data, the controller directs the user to the subsequent view.

    Click here to get started with Struts>>>>

    original article: http://www.oracle.com/technology/sample_code/tech/java/j2ee/jintdemo/tutorials/Struts.html

     

    Saturday, February 6, 2010

    Essel World....ghar nahi jaauga main..

    6 mths of planning to visit Essel World became true. Some of my CDAC friends have ...had never visited Essel World, so we were planning to take a break from studies and enjoy. But due to assignments and projects, every time our plans failed. Last ADWE project was very tiring and we finally decided that what ever may be the situations, we are going...

    I enjoyed all the rides but the most enjoying was the Hoola Loop.... i had this ride for 5 times with 4 times in a row. Other rides which I liked are Zyclone, Thunder, Enterprise, Rainbow. I also enjoyed clicking photos there. I recommend everyone to visit Essel World for the new ride Hoola loop....