Drive from Atlanta to Birmingham

It been long time that i had got an opportunity to demonstrate my driving skills on road, and was memorizing when did I had a good test for my good driving skills, the first thing that comes to my mind is a drive from Atlanta to Birmingham.

Let me give my driving background first, I’m always fascinated by Cars and a great fan of Formula 1 and in particular to Michael Schumacher and Ferrari. I’m used for driving manual gear cars with a drive on right side, mostly driven in Asia and United kingdom where traffic is considerable good, when moved to states, needed to drive a automated gear cars, not much of traffic on streets, cars hasa left drive (rigth traffic), to make life even difficult very polite drivers , low seep limits on a good roads and photo enforcement in most of the places :-)

Sometime back I was working in Atlanta, GA, the one place where I love to drive. Here most of the traffic drives is very very aggressively. I’m a frequent visitor to Phoenix, AZ; so any guess how does Birmingham come into picture? Yes its because of Southwest airlines. Couple of times I had to pickup my flight from Birmingham, according to maps, the drive time between the two places should be approximately to 2 hours 20Min’s (around 150 miles). After driving for a while a in Atlanta, thought its an 1 hr and 40Min’s drive and having obtained a boarding card, ideally a door to door of 2 hours and 30 - 40 min’s is an ideal time for drive (need to be a bit careful in time calculations, Alabama is in CST and Georgia in EST).

Already, I missed couple of factors,

The drive from Atlanta to Birmingham is on I20 from east to west; for most part of the freeway official speed-limit is 75miles/ hour. Every time I had driven from Atlanta to Birmingham, it was definitely never without action, excitement!

My Trip to Birmingham started on a bad note, Got stuck in traffic in Atlanta Just before I could enter I 20 freeway, It was a delay of 6Min’s, was getting nervous as I knew I’m on road which I have no knowledge about, and that’s the last southwest flight from Birmingham to Phoenix; so pretty much knew what should I do if I miss my flight :) . Once Entered into I 20, well its all mine, Friday traffic was there, but as long as I was in Georgia, the whole traffic moves at a higher speed so no real problems till 50miles, all of sudden a “Work Zone” sign for next 6miles; hmm getting interesting :) drove about a mile at reduced speed, then another surprise, slow traffic and eventually no movement in the car (may be 10feet) for 25 minutes, totally frustrated, saw a small gap in front of me, so moved around 3feet, here you goo….bang!!! its from the back, someone hit me from back! hmm stopped the car to check the damage, a small dent and its was a old lady driver who expressed her apology, considering time constraints immediately back to car; after 40 Min’s of near stand still situation, suddenly found my car running at 40miles/hour then slowly to hitting the speed limit on the road, car speed limit slow traffic, a quick mathematics says I need an “average speed” of 80miles + 10-15minutes for car parking and security + boarding (Assumption was Birmingham is a small airport). May times, was revisiting my decision, would it be good to return back ? but same time wanna to give a try.

The opportunity to test driving skill was presented to me in a most beautiful way, drove to the potential of my car for next 50miles, the expected average speed was so high that my speed is not making any significant impact on the overall time, so complete 100miles; here comes another surprise, “work zone next 6miles”, hmm I don’t remember if I had followed the speed limits, but mostly it was a empty work zone roads! after that its all driving on I20 in a deep forests no sharp turns and not many narrow roads, but once reached the outskirts of Birmingham, traffic was there, not so crowded, comparatively, the average speed seems to be low in Birmingham, reached airport 13Min’s before my flight schedule, car parking in Birmingham was the best (just 1min walk), I parked in C12 slot (which later realized is the nearest place to reach airport security), a 30sec run, I’m in airport, a minute to find the security location and if my flight was still there, around 10 Min’s left at in front of security, Luckily, I’m the lone one at security counter (small airports are handy ah :-) ) 6minutes left,1 minute run to boarding area, “well, you are too close sir” was the greeting I got! Sounded like honey to ears, ” I made it”.

Now thinking back, the only thing, I was missing the other day was “Rain”, I love driving in rainy conditions, it would have been awesome had it rained, although I wasn’t sure If I could have make it to my flight :-)

Written by Ravi Nallakukkala on April 13th, 2007 with no comments.
Read more articles on Uncategorized.

Things I hate in IntelliJ compared to Eclipse

I come from a strong Eclipse background and in my new assignment, my project team uses IntelliJ IDE; So thought let me check this IntelliJ editor. As expected (after being loyal to Eclipse for many years) first I noticed all the bad things about IntelliJ, Here’s my list of bad things (Let me know if there is a better way of using IntelliJ to get around my problems)

Written by Ravi Nallakukkala on April 11th, 2007 with 2 comments.
Read more articles on Editors.

Spring Framework Declarative Transaction with Annotations

<tx:annotation-driven transaction-manager=”txManager”/> where txManager points the underlying transaction manager and the tx namespace refers to http://www.springframework.org/schema/tx

(more…)

Written by Ravi Nallakukkala on April 10th, 2007 with no comments.
Read more articles on Spring.

Unit Testing - Junit Approach

Unit Testing involves testing unit components or modules of Code and validating that they work properly. It’s a proactive procedure, which means that code written by developers needs to be unit tested at the unit level. All test cases are independent of each other and are to be written and executed by development team.

Prior fixing a bug, write a unit test to reproduce it. When the bug is fixed, verify the fix using the unit test. All methods need to be covered by the tests. The tests need to covers all paths through the unit. Unit Tests will ensure errors are picked up at the earlier stage and will facilitate easy integration.

Unit Testing Process

The figure below illustrates the Unit Testing Procedure and it encourages developers to write test cases before they start developing their use cases.

Unit test life cycle

Guidelines for Unit Test Cases

Unit Testing Tools
Consider a combination of JUnit and EasyMock to write Unit Test Cases. These tools are integrated with Eclipse (hopefully with Intellij) to merge unit tests with the development process.

Unit Testing Framework - JUnit
JUnit provides a Java based framework for unit testing. In order to setup JUnit one has to download the junit.jar file which is freely downloadable and append it to your classpath. JUnit will be integrated with the Eclipse development environment.

EasyMock
EasyMock, an open source library provides an easy medium to generate mock objects for a given interface. This facilitates running Junit tests for individual classes with the collaborators being simulated with Easy Mock Objects.

To get a Mock Object, we need to perform the following steps:

import junit.framework.TestCase;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reset;
import static org.easymock.EasyMock.verify;

public class UserServiceImplTest extends TestCase {
private UserDao userDaoMock;
private UserService us;
public void setUp() throws Exception {

// 1. create the mock for our DAO
userDaoMock = createMock(UserDao.class);

// 2. create an instance of the class under test
us = new UserServiceImpl();

// 3. wire test object and mock
us.setUserDao(userDaoMock);

}

/**
* after each test method call the mock has to be reset
*/
public void tearDown() throws Exception {
reset(userDaoMock);
}
}

Written by Ravi Nallakukkala on April 8th, 2007 with no comments.
Read more articles on Design.

Eclipse IntelliJ Shortcut keys a comparison

In my new project, my team was using IntelliJ as their IDE and I come from a strong Eclipse background, Initially it was hard time to find out all the Shortcut Keys for IntelliJ so thought I could document the shortcut keys that I commonly use, I will update this list as my learning experience continues with IntelliJ

Description Eclipse shortcut IntelliJ Shortcut
Navigate a Java Type CTRL + ALT + T CTRL + N
Navigate a Resource CTRL + ALT + R CTRL + SHIFT +N
Last Modified Source ALT + Left arrow CTRL + ALT + left arrow
Debug F11 Shift + F9
Open Declaration F3 CTRL + SHIFT + B
Open Hierarchy F4 CTRL + H
Organize Imports CRTL + SHIFT + O CTRL + ALT + O
Find CTRL + F CTRL + F
Find Again/ previous F3 / SHIFT + F3 F3 / SHIFT + F3
Step Into F5 F7
Step Over F6 F8
Step Out F7 Shift + F8
Resume F8 F9
To find impl of an abstract Method ? Ctrl + Alt + B

Written by Ravi Nallakukkala on April 6th, 2007 with no comments.
Read more articles on Editors.

Java Serialization impact of unused variables

Java serialization is a process of saving an object’s state to a byte stream and rebuilding the bytes into a Java object (may be at some future time).

As serialization is a concept based on maintaining the state of the object, so every attribute inside the object will have an impact on the amount of data serialized.

To explain the impact of unused variables on Java serialization lets take an example.

(more…)

Written by Ravi Nallakukkala on April 4th, 2007 with no comments.
Read more articles on Java/ J2EE.

SOA based Search Design - Handling of bulk data on server side

Its me again, For past few days my life is all about searching, search criteria and analyzing its result. The product I work has to scale up-to returning search results of the magnitude of few hundred records. Unfortunately we don’t have the luxury of having the pagination for these search results, hence there is a high amount of tuning required on the server side.

In this article I will be describing a SOA based search design for handling bulk data in a multi layered architecture; The project I was working was architect to have 3 layers: Facade Layer, Services Layer and a DAO Layer.

Facade layer was implemented though EJB 3 and as expected was the main communication interface for the client, our clients talk to the server side Facade though the Data Transfer Objects (Dto); One of the main responsibility of the facade is to convert Dto objects passed by the clients to the Business Object (Bo) for request processing and during response scenario, facade also converts the Business objects to the Dto and send the response to the client.

Service Layer is the place where the main business logic will placed,the communication to/ from the services layers always happens through the Business Objects. Main responsibilities of this layer include invoking the Data Access Object Layer (Dao) and invoking other Services.

Data Access Object Layer is mainly responsible for invoking the persistence api (most of the cases, it will be ORM like hibernate, JPA).

To achieve the flexibility in the design approach, Dto are used to communicate between the client and server, but it has to be noted that all the processing on the server side happens on Business Objects.

Considering this architecture, Even for a search case too, search criteria will be passed to the server in the form of a Dto, and in the facade layer this search criteria dto will be converted to a Bo and then the criteria in the form of a Business object will be passed to the Dao and based on the persistence technology an appropriate query will be executed and the results in the form of the Bo will be returned to the facade, where again the Bo will be converted to the Dto objects.

Now, this approach works very well for low to medium volume search result sites; in order to optimize this search we have been looking around for some options and finally arrived at saying “For searches, why not allow the criteria (Dto equivalent) to be passed to the Dao layer and get the results from Dao in the form of Dto”. Essentially, all we are doing is eliminating the conversions from Bo to Dto and vice-versa. For large volume Search results, the conversation to/ from Dto/Bo makes a big differences (time consuming process). This approach also gives us a flexibility of selecting any specific attribute in an entity (unlike the case-of the Query though Business Objects, the entire Business Object will be loaded even though you need a single attribute of that entity)

There is already some support by JPA to support this kind of architecture for searches, for example look at the following query

select new com.alpha.beta.SearchResult(emp.id, emp.name, emp.salary) from Employee emp

Now the ‘SearchResult’ class should have a constructor matching to the above construct

i.e,

public class SearchResult{

private Long id;
private String name;
private BigDecimal salary;

public SearchResult(Long id, String name,BigDecimal sal){
this.id = id;
this.name = name;
this.salary = sal
}
}

If the query retuns a ‘List’, In this example the list will contain a list of ‘SearchResult’ Objects.

To Summarize the advantage of this approach (of bi-passing the layers for search)

Written by Ravi Nallakukkala on April 1st, 2007 with no comments.
Read more articles on Design.

Search Pagination Design (Server side pagination using Hibernate)

One of the biggest problem which is commonly faced in searches is pagination; On the first day of my new job, I was asked to looked the performance issues related in the search functionality of the application. When I looked at the application, application is slow when the users gets a search results of magnitude of 6000 records( each record had 10 fields to be displayed) and all the results were displayed in a single HTML page (Even if you had designed one search implementation, you would have guessed what the problem is).

There is no pagination concept implemented for this search/ problem, its a logical thing to say this search program is using whole lots of memory and slow. Assuming the search queries are already fine-tuned, Slowness can be mainly attributed to the HTML rendering by the browser. IE browser render the complete HTML and then displays it to the user so the slowness can be easily be found compared to Firefox 2, where the browser starts displaying the data as it receives (rather completely render it and displays it).

Given this background, Now we started seriously looking at pagination as the only option. In pagination, could think three approaches as a potential solutions

Lets go in details of each one of them.

Real time pagination on the server side :

This is an approach where from the UI, always pass the search criteria plus the page start record and the end record (or size of the page). So your server implementation will have these two extra arguments along with your query and returns you only the required result set which needs to be passed to front end.

On the implementation front, you could handle this scenario at two levels

Query q = s.createQuery( “your query….” );
q.setMaxResults(PAGE_SIZE);
q.setFirstResult(PAGE_SIZE * pageNumber);
List page = q.list();

Lets looks at the pros and cons of this approach

Criteria Caching based pagination on Server side

This is an approach where all records matching to the search criteria will be fetched from the database to the the server and cached. Caching is based the search criteria and a timeout period.

From the UI point of view, request will contain the search criteria plus the start record and the size( r the end record) to be fetched.

Lets looks at the pros and cons of this approach

Pagination on the UI front

This is an approach where all the records corresponding the search criteria will be retrieved from the database and held in the controller of the UI Framework and using custom tag libraries the records could be displayed in the Jsp/ Servlet.

Here are some of the recommendations for writing your own custom pagination tab lib

Lets looks at the pros and cons of this approach

Written by Ravi Nallakukkala on March 30th, 2007 with 2 comments.
Read more articles on Design and Hibernate.

does weblogic 8.1 supports java 5/ jdk1.5 version ?

Nope.

Weblogic 8 (including all service packs) supports only jdk 1.4.x

For more information…

http://e-docs.bea.com/platform/suppconfigs/configs81/81_over/overview.html

Written by Ravi Nallakukkala on March 26th, 2007 with no comments.
Read more articles on Servers.

Dozer - DTO to Business object (Bo) data transfer

Dozer is a powerful, but simple Java Bean to Java Bean mapper that recursively copies data from one object to another.
Dozer supports simple property mapping, complex type mapping, bi-directional mapping, implicit-explicit mapping, as well as recursive mapping. This includes mapping collection attributes that also need mapping at the element level.

This is different from Bean utils, which copies the data recursively for the object which has the same property names. Bean-Utils has a restriction for working with complex data types.

Dozer tool can be found here

here’s some of the key advantages found on Dozer

Recommanded Usage Scenario:

Disadvantages for Dozer

Written by Ravi Nallakukkala on March 25th, 2007 with no comments.
Read more articles on Spring and Tools.

« Older articles

Newer articles »