Archive for Java/J2EE

Asynchronous I/O

I/O is a costlier operation as it will slow down the processing because it involves communicating and making another hardware device work.  I/O also means that the process that triggers it is put under wait until it completes it.  Say you have a requirement to read some information from a huge file on the server and you have to display it as part of a web application screen.  Logically this means you have to read the entire file and then embed it as part of your HTML and send it back to the browser client. The disadvantage here is bigger the file is, more time the client is going to wait.  This also means that the client cannot do anything else as the page will load only when the server application completes reading the entire file, frames the HTML and sends it back to the browser.

Basically the thread that was initiated in the request in the above scenario gets locked until the file I/O is complete. What if you actually wanted to bring back the rest of the screen and bring up the information from the file through an AJAX request and update it as and when you have chunks of information? On the server side you need to have the capability to get the information from the file in chunks and keep sending it to the browser client.  Non-blocking I/O (NBIO) or Asynchronous I/O mechanism help in achieving this.  Basically in block I/O data is processed in chunks rather than byte by byte. Java introduced New IO (NIO) as part of JDK starting from version 1.4.  Part of it is asynchronous I/O which can help in enabling producer/consumer kind of requirement without blocking the request during I/O. This IBM developerWorks tutorial “Getting started with new I/O” (needs signing up with IBM developerWorks) explains NIO with a section on Asynchronous I/O.

Blink this Asynchronous I/O at blinklist.com    Bookmark Asynchronous I/O at blogmarks    Bookmark Asynchronous I/O at del.icio.us    Digg Asynchronous I/O at Digg.com    Fark Asynchronous I/O at Fark.com    Bookmark Asynchronous I/O at Furl.net    Bookmark Asynchronous I/O at NewsVine    Bookmark Asynchronous I/O at reddit.com    Bookmark Asynchronous I/O at Simpy.com    Bookmark Asynchronous I/O at Spurl.net    Bookmark Asynchronous I/O with wists    Bookmark Asynchronous I/O at YahooMyWeb

Comments      Cosmos

AJAX frameworks

As I posted the basics of AJAX yesterday, immediately I wanted to checkout the list of available frameworks for AJAX. Whoa, the below links will show you different frameworks available.

And of course Rails already comes built with Ajax capabilities and you can do wonders out of the box without looking for any frameworks.

Blink this AJAX frameworks at blinklist.com    Bookmark AJAX frameworks at blogmarks    Bookmark AJAX frameworks at del.icio.us    Digg AJAX frameworks at Digg.com    Fark AJAX frameworks at Fark.com    Bookmark AJAX frameworks at Furl.net    Bookmark AJAX frameworks at NewsVine    Bookmark AJAX frameworks at reddit.com    Bookmark AJAX frameworks at Simpy.com    Bookmark AJAX frameworks at Spurl.net    Bookmark AJAX frameworks with wists    Bookmark AJAX frameworks at YahooMyWeb

Comments      Cosmos

AJAX basics

I have friends who keep asking me to give some sample code to start with AJAX.  For better reasons there are many frameworks that hide a lot of how AJAX is being done these days and can really ease your way into creating an Ajax application.  But it is worth understanding some basics first and then everything is the same irrespective of what technology or framework is helping you behind.  I was looking for something on AJAX and I hit this article “Implementing simple AJAX..” in JavaReference.com.  This will be a kick start if you are new to AJAX and if you know a little bit of Servlets and JSPs.

Blink this AJAX basics at blinklist.com    Bookmark AJAX basics at blogmarks    Bookmark AJAX basics at del.icio.us    Digg AJAX basics at Digg.com    Fark AJAX basics at Fark.com    Bookmark AJAX basics at Furl.net    Bookmark AJAX basics at NewsVine    Bookmark AJAX basics at reddit.com    Bookmark AJAX basics at Simpy.com    Bookmark AJAX basics at Spurl.net    Bookmark AJAX basics with wists    Bookmark AJAX basics at YahooMyWeb

Comments      Cosmos

AppFuse - Kick start your application development

Getting your J2EE application quickly up and running is a challenge particularly when you are using a variety of open source frameworks, configuring it and structuring your application and integrating them all together and making it work might take a while till your developers are comfortable to start really working on the problem. AppFuse is an open source tool that can kick start your J2EE development. Similar to how you create a rails application with a command, creating a J2EE application that Struts+Hibernate+Spring with AppFuse involves executing few ant scripts.

AppFuseAppFuse is an application for “kickstarting” webapp development. Download, extract and execute ant new to instantly be up and running with a Struts+Spring+Hibernate app running on Tomcat/MySQL app. Uses Ant, XDoclet, Spring, Hibernate (or iBATIS), JUnit, jMock, StrutsTestCase, Canoo’s WebTest, Struts Menu, Display Tag Library, OSCache, JSTL and Struts (Spring MVC, WebWork, Tapestry and JSF are also options). To learn more about AppFuse, its history, goals and future, checkout AppFuse: Start Your J2EE Web Apps on java.net. You can also watch this video, which shows you how to create a project with AppFuse - as well as gives you a tour of its out-of-the-box features.

Blink this AppFuse - Kick start your application development at blinklist.com    Bookmark AppFuse - Kick start your application development at blogmarks    Bookmark AppFuse - Kick start your application development at del.icio.us    Digg AppFuse - Kick start your application development at Digg.com    Fark AppFuse - Kick start your application development at Fark.com    Bookmark AppFuse - Kick start your application development at Furl.net    Bookmark AppFuse - Kick start your application development at NewsVine    Bookmark AppFuse - Kick start your application development at reddit.com    Bookmark AppFuse - Kick start your application development at Simpy.com    Bookmark AppFuse - Kick start your application development at Spurl.net    Bookmark AppFuse - Kick start your application development with wists    Bookmark AppFuse - Kick start your application development at YahooMyWeb

Comments      Cosmos

Code Coverage

Code Coverage is a process which determines the level of testing that has been performed on a program. While you can get more information on code coverage from wikipedia, manually doing code coverage is going to be a tedious process and you need someone specifically for it to really look at all the programs the developers have done. At the same time code coverage is important to identify how much of testing is done on a code and how much can actually be covered during unit testing.

We know that unit testing is very important as it uncovers lot of issues prior to the application going to QA. A vigorously tested application at the development end means a lot of challenge to the QA team to really break the system. If the QA team is challenged they are forced to think beyond what it takes to really bring up a bug. This means you are covering all sorts of possibilities that will break the system and solve it. Ultimately the point is each and every project should have code coverage done.

Of course not 100% of the code can be unit tested. Come on how can you unit test this line in your code “}” :) . So there should be an acceptable percentage set that the unit tests should cover. Given that, code coverage will make more sense in terms of time if there is a tool that could it. There are tools that will help in doing code coverage. Each and every technology has a flavor of code coverage tools which you can google search and get. The highlight would be if you can automate this code coverage so that you can view the report every day and make sure the developers cover unit tests properly. Cobertura is one tool that can analyze the JUnit tests written and if your application build/release is automated through Maven, the maven cobertura plugin can help generate the code coverage results as and when a build happens (or you could schedule report generation at a separate time say every midnight since it takes some take than the normal build).

Blink this Code Coverage at blinklist.com    Bookmark Code Coverage at blogmarks    Bookmark Code Coverage at del.icio.us    Digg Code Coverage at Digg.com    Fark Code Coverage at Fark.com    Bookmark Code Coverage at Furl.net    Bookmark Code Coverage at NewsVine    Bookmark Code Coverage at reddit.com    Bookmark Code Coverage at Simpy.com    Bookmark Code Coverage at Spurl.net    Bookmark Code Coverage with wists    Bookmark Code Coverage at YahooMyWeb

Comments (1)      Cosmos

Job Scheduler

Suppose your web application needs to run something on a periodical basis. Say for example every day at midnight you want to send a quote to all your subscribers. So you need a scheduler that can trigger off a process which will call appropriate action in your application that will get a quote from the database, get the list of subscriber’s mail id and send out a mail to each subscriber. This scheduler is the key to make sure that a specific action gets triggered in your application at a scheduled time. The following are the job scheduling frameworks available for different technologies.

“Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components or EJBs. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering.

Quartz is freely usable, licensed under the Apache 2.0 license.”

“Schedule and run server-side tasks from your ASP.NET applications. PortSight Task Scheduler is a component for ASP.NET applications that can be used for scheduling an immediate or recurring execution of server-side tasks. Since the tasks are executed on the server, they can run asynchronously and under a privileged account. It allows you to execute long-running and resource intensive tasks. You can also serialize your tasks to avoid concurrent access to shared resources and possible locks, which makes your applications more robust and available”

PortSight is commercial but is available for trial.

“RailsCron is a way to execute background tasks using your Ruby on Rails environment. The RailsCron object is an ActiveRecord, so you can manipulate it in familiar ways”

Also a ruby program can be written to run as cron job. The book “Enterprise integration with Ruby” has some insights on creating services and daemons.

Blink this Job Scheduler at blinklist.com    Bookmark Job Scheduler at blogmarks    Bookmark Job Scheduler at del.icio.us    Digg Job Scheduler at Digg.com    Fark Job Scheduler at Fark.com    Bookmark Job Scheduler at Furl.net    Bookmark Job Scheduler at NewsVine    Bookmark Job Scheduler at reddit.com    Bookmark Job Scheduler at Simpy.com    Bookmark Job Scheduler at Spurl.net    Bookmark Job Scheduler with wists    Bookmark Job Scheduler at YahooMyWeb

Comments      Cosmos

Java code tips

I bumped into this site titled “Tips for maintainable Java code” with a list of tips or a java developer. I had covered some of the disciplines mentioned in this site in my previous posts. But on the whole it is a good collection of tips worth reading it, taking a print out and keeping it by your side if you are a Java developer.

Blink this Java code tips at blinklist.com    Bookmark Java code tips at blogmarks    Bookmark Java code tips at del.icio.us    Digg Java code tips at Digg.com    Fark Java code tips at Fark.com    Bookmark Java code tips at Furl.net    Bookmark Java code tips at NewsVine    Bookmark Java code tips at reddit.com    Bookmark Java code tips at Simpy.com    Bookmark Java code tips at Spurl.net    Bookmark Java code tips with wists    Bookmark Java code tips at YahooMyWeb

Comments      Cosmos

Using Rails to increase J2EE development productivity

At Compassites we have project developments on Ruby on Rails and J2EE. Now that we have realized the power of rails and its power to create rapid application development we are using it to boost our development productivity on the J2EE applications as well. As we are executing our projects using eXtreme programming techniques, development happens as and when requirements are clear. But this also means that we assume certain dependencies of incomplete requirements. There might be a data dependency from a requirement that is not complete. In such situations with the available information we create temporary table structures. When the business analysts and the testers test the application at the end of an iteration they need to have some valid content in these temporary tables.

We create the CRUD (create, read, update, delete) screens rapidly using ruby on rails that connects to the same database as the application does. Then the BA’s and testers use the rails application to add the data they want through these CRUD screens . Even in the development environment it saves a lot of time to manipulate these temporary tables and none of us have to run SQL against the database or need to understand to use a database tool. Since the rails application is throw away, we don’t need to add any validations, error or exception handling checks. So within minutes the CRUD screens are ready for use. This is like data mocking equivalent to the object mocking.

Blink this Using Rails to increase J2EE development productivity at blinklist.com    Bookmark Using Rails to increase J2EE development productivity at blogmarks    Bookmark Using Rails to increase J2EE development productivity at del.icio.us    Digg Using Rails to increase J2EE development productivity at Digg.com    Fark Using Rails to increase J2EE development productivity at Fark.com    Bookmark Using Rails to increase J2EE development productivity at Furl.net    Bookmark Using Rails to increase J2EE development productivity at NewsVine    Bookmark Using Rails to increase J2EE development productivity at reddit.com    Bookmark Using Rails to increase J2EE development productivity at Simpy.com    Bookmark Using Rails to increase J2EE development productivity at Spurl.net    Bookmark Using Rails to increase J2EE development productivity with wists    Bookmark Using Rails to increase J2EE development productivity at YahooMyWeb

Comments      Cosmos

Next entries » · « Previous entries

Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.