Windows 7 RC Expiration

February 17th, 2010 James No comments

I received a mail from Microsoft today morning about Windows 7 expiration. Here is the essence of the mail:

It’s time to upgrade from the Windows 7 Release Candidate

While most people who tested Windows 7 have now moved to the final version, some are still running the Release Candidate. If you haven’t moved yet, it’s time to replace the RC.

Starting on March 1, 2010 your PC will begin shutting down every two hours. Your work will not be saved during the shutdown.

The Windows 7 RC will fully expire on June 1, 2010. Your PC running the Windows 7 RC will continue shutting down every two hours and your files won’t be saved during shutdown. In addition, your wallpaper will change to a solid black background with a persistent message on your desktop. You’ll also get periodic notifications that Windows isn’t genuine. That means your PC may no longer be able to obtain optional updates or downloads requiring genuine Windows validation.

To avoid interruption, please reinstall a prior version of Windows or move to Windows 7. In either case, you’ll need to do a custom (clean) install to replace the RC. As with any clean installation, you’ll need to back up your data then reinstall your applications and restore the data. For more details about replacing the RC, see the Knowledge Base article KB 971767. For more information, visit the Window 7 Forum.

Thanks again for helping us test Windows 7.

The Windows 7 Team

This sounds very unprofessional and disappointing. Why shutdown the operating system every 2 hours? Why change the wall paper to “a solid black background with a persistent message on your desktop”?. Why display “periodic notifications that Windows isn’t genuine”?. Did we cheat Microsoft by running Windows 7 RC? Why not just expire gracefully with some friendly reminders.

What do you think about this?

You can get more information about Windows 7 RC expiration from Microsoft Knowledge Base.

 
Categories: General Tags: ,

What Java Look and Feel do you use?

November 9th, 2009 James 3 comments

Quite some time back, I read an article titled “20+ Free Look and Feel Libraries For Java Swing“. I have evaluated most of the libraries mentioned in that article. Personally, I  prefer the System look and feel that is bundled in the JRE. However, I like Substance, PGS and JGoodies as well. Which one do you use? Curious to know.

What Java Look and Feel do you use?

View Results

Loading ... Loading ...
 
Categories: Java, Polls Tags: , , ,

Developing A Simple Java Application With Spring

November 4th, 2009 James 14 comments

Introduction
Spring is a powerful application framework that can be used across any layer in your application. For example, you can use Spring to manage only your data access layer or you can use Spring to provide remote services for your swing client. In this article, I will explain how to get started with Spring by developing a simple java application.

Requirements
1. Your favorite IDE
2. Latest Spring framework.

(Note: This article makes use of Spring framework 2.5.6 which is the current production release)

The Application
We are going to develop a simple application that fetches and display the list of registered users. The application consists of just two interfaces, their implementation.

The DAO layer
Let us now develop the DAO layer of the application. This layer consists of just one interface “UserDao” and it’s implementation “UserDaoImpl”. The interface consists of just one method named “getUsers()”. Let us quickly develop them.

Listing 1. UserDao

package com.springapp.dao;
import java.util.Iterator;

/**
 *
 * @author James
 */
public interface UserDao
{
    Iterator<String> getUsers();
}

Listing 2. UserDaoImpl


package com.springapp.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author James
 */
public class UserDaoImpl implements UserDao
{
    public Iterator<String> getUsers()
    {
        List<String> users = new ArrayList<String>();
        users.add("Gavin King");
        users.add("Geertjan");
        users.add("Mike Keith");
        users.add("James");
        return users.iterator();
    }
}

Nothing fancy here. The implementation is pretty straight forward, though in a real environment you might fetch those details from the database using ORM frameworks like JPA.

The Service Layer

We will encapsulate the service layer from the dao implementaion by writing code against the interface UserDao. We will follow the same pattern we used in developing the dao layer and write the interface UserService and it’s implementation UserServiceImpl.

Listing 3. UserService


package com.springapp.service;

import java.util.Iterator;

/**
 *
 * @author James
 */
public interface UserService
{
    Iterator<String> getUsers();
}

Listing 4. UserServiceImpl


package com.springapp.service;

import com.springapp.dao.UserDao;
import java.util.Iterator;

/**
 *
 * @author James
 */
public class UserServiceImpl implements UserService
{
    private UserDao userDao;

    public Iterator<String> getUsers()
    {
        return userDao.getUsers();
    }

    public void setUserDao(UserDao userDao)
    {
        this.userDao = userDao;
    }
}

Kindly notice that both the service layer classes and dao layer classes are Spring agnostic. That’s the beauty of Spring. Spring is less invasive. Most of the application code can be developed without knowing anything about Spring.

The Client

Now we need someone to make use of our service layer and we will waste no time in developing the client for our service. We can just write a junit test class to invoke our service but I prefer to write a simple java class to be the client. Though our client will be a simple POJO class, you can easily replace it with a Swing or Web front end. Enough talking, let us dive into action! We will first develop our client as a normal java class without using Spring.

Standard Client

Listing 5. StandardUserServiceClient


package com.springapp;

import com.springapp.dao.UserDao;
import com.springapp.dao.UserDaoImpl;
import com.springapp.service.UserServiceImpl;
import java.util.Iterator;

/**
 *
 * @author James
 */
public class StandardUserServiceClient
{

    private UserServiceImpl userService;

    public StandardUserServiceClient()
    {
        userService = new UserServiceImpl();
        UserDao userDao = new UserDaoImpl();
        userService.setUserDao(userDao);
    }

    private void fetchUsers()
    {
        Iterator<String> users = userService.getUsers();
        while (users.hasNext())
        {
            System.out.println(users.next());
        }
    }

    public static void main(String[] args)
    {
        StandardUserServiceClient client = new StandardUserServiceClient();
        client.fetchUsers();
    }
}

Hmm, there you can see our client code is “coupled” tightly with the service and dao implementations. That’s where Spring comes to our rescue. Spring will dynamically “inject” the implemenations so our application will remain “loosely” coupled.

Spring Client

But how will Spring know about our implementations? We need to inform Spring a little about our application and define the “hotspots” where it can dynamically “inject” the dependencies or implementations. Spring expects these details in a configuration file and let us quickly write that. Create a package called “resources” and create a xml file called “applicationContext.xm” inside it.

Listing 6. applicationContext.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

 <bean id="userDao" class="com.springapp.dao.UserDaoImpl">
 </bean>

 <bean id="userService" class="com.springapp.service.UserServiceImpl">
     <property name="userDao" ref="userDao"/>
 </bean>
</beans>

In the “applicationContext.xml” file we defiend two beans named “userDao” and “userService”. We also specified their implementations using the “class” attribute. Also notice that we are setting the property “userDao”  in the “UserServiceImpl” class with “UserDaoImpl” by referencing it’s name “userDao”. Pretty straighforward!

Now it’s time to churn out our Spring client.

Listing 7. SpringUserServiceClient


package com.springapp;

import com.springapp.service.UserService;
import java.util.Iterator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author James
 */
public class SpringUserServiceClient
{
    private UserService userService;

    public SpringUserServiceClient()
    {
        //initialize the spring container
        ApplicationContext context = new ClassPathXmlApplicationContext("resources/applicationContext.xml");
        userService = (UserService) context.getBean("userService");
    }

    private void fetchUsers()
    {
        Iterator<String> users = userService.getUsers();
        while(users.hasNext())
        {
            System.out.println(users.next());
        }
    }

    public static void main(String[] args)
    {
        SpringUserServiceClient client = new SpringUserServiceClient();
        client.fetchUsers();
    }
}

A couple of details about this class:

  • The ApplicationContext interface helps us to plug into the Spring container and lookup the classes we need by using the name we defined in the xml file.
  • There are many implementataions of ApplicationContext available in Spring. One of the most widely used implementation is “ClassPathXmlApplicationContext”. It is used to load Spring configuration files found in classpath.

As seen from Listing 7, Spring helps us to program to interfaces and develop loosely coupled applications. As a result, applications become more testable as there are no external dependencies like application server. It is also very easy to switch the implementations effortlessly. For example, in our sample application you can easily write a UserDaoMockImpl and use it in your test cases effortlessly.

Project Structure

Here is the complete application looks like:

screenshot1

 
Categories: Java Tags: ,

Developing A Simple Pluggable Java Application

September 20th, 2009 James 13 comments

Most of the applications we use on daily basis are pluggable. Popular applications like Firefox, Eclipse, NetBeans, JEdit, Wordpress, Hudson are all pluggable. In fact, pluggability has played a major part in the success of most of these applications. Why not make the Java applications we develop pluggable as well? Yes, we get pluggability out of the box, if our applications are based on a rich client platform like NetBeans or Eclipse. But for some reasons if you decide not to use those platforms, it doesn’t mean that they should not be pluggable. In this article, we will learn how to write a simple pluggable application that will load it’s plugins dynamically.

The API
First, let us define a plugin interface that should be implemented by all the plugins of our application. We are going to keep it very simple. Create a project called “plugin-api” in your favorite IDE and create the interface “ApplicationPlugin”.


package com.pluggableapp.plugins.api;

public interface ApplicationPlugin
{
    String getName();
    void init();
}

Read more…

 

NautilusSVN – The TortoiseSVN for Linux users

September 19th, 2009 James 5 comments

TortoiseSVN is the dominant Subversion client for Windows. While there so many Subversion clients available, what makes TortoiseSVN special is it’s smooth integration with the Windows Explorer. As a result, working with your Subversion repository becomes super easy. When I switched completely from Windows to Ubuntu Linux, TortoiseSVN is one of the few applications I missed. Not anymore!

As I mentioned earlier, NautilusSVN attempts to be the TortoiseSVN for Linux. It looks like NautilusSVN is not yet available in the Ubuntu repositories but fortunately they had a “deb” package which I downloaded.

Though their documentation specifies that you don’t need anything extra, I had to install a few packages before proceeding to NautilusSVN. I installed the dependencies using the following command,

sudo apt-get install python-nautilus python-svn python-configobj

Then I installed the “deb” package using the command,

sudo dpkg -i nautilussvn*.deb

I had to just close and open Nautilus to see NautilusSVN in action.

All other SVN tasks can be performed by simply doing a “right click” at appropriate places in your working copy.

NautilusSVN has a commit window quite similar to TortoiseSVN.

NautilusSVN provides decent support to create branch/tag, move, change properties, view revisions etc. But there is no “Repository Browser” yet and the “Revert” option needs more polish. Also I noticed that as my working copy grew, NautilusSVN seems to slow down Nautilus. This can be a major downside which might prevent the adoption of this otherwise great tool. But NautilusSVN is still in beta and I hope these issues will be resolved shortly.

 

What UML Tools do you use?

August 26th, 2009 James 22 comments

Recently I read the article “Free UML tools” which explains about the various free UML tools available. That article made me think “What UML tool do people actually use?”. Over the years, I have used tools like Microsoft Visio, ArgoUML, NetBeans UML, StarUML and finally settled with JUDE. How about you? What UML tools do you use? Some of you might use more than one tool (at work, at home etc), so feel free to choose all the options applicable.

What UML tools do you use?

View Results

Loading ... Loading ...
 

Readers choice: Most popular Subversion clients

August 25th, 2009 James No comments

Subversion is a very popular version control system. As a result, subversion has a wide array of client tools which makes life difficult for us, the users. So we wanted to know what our readers actually use and here is the summary of their opinions.

Not surprisingly, close to 50% of them use the popular TortoiseSVN as their client.

The only limiting factor of this wildly popular tool is that it is available only for Windows.

Surprisingly, the second most popular choice for users is their IDE (like Eclipse, NetBeans etc). 30% users are satisfied with the support provided by their IDE. I hope this user base will only increase in future as the IDEs offer more sophisticated support not just for Subversion but also for other popular version control systems.

NetBeans

But there are some limiting factor in using the IDE as the Subversion client. The support, in most cases (atleast in NetBeans), is limited to only the projects you are working from the IDE. That’s where the third popular Subversion client comes into picture.

The third choice of the users is the Subversion command line client which comes bundled with Subversion.

To be frank, the command line client is what all you need with the only limiting factor being it’s “command line” nature :-) . Whenever the tool you use falls short in certain scenarios, the command line client can be your life saver. 14% of users vow by the Subversion command line client and I believe most of them are Linux users.

RapidSVN comes at the distant fourth garnering only 5% of votes.

Going by the comments, SmartSVN is preferred by a couple of users and so is nautilus scripts, nautilussvn, git-svn, kdesvn.

I have used SmartSVN for a while and I would say it’s almost on par with TortoiseSVN. The biggest advantage of SmartSVN is it’s cross platform nature while the biggest drawback is that it’s not opensource. NautilusSVN has big potential as it attempts to become the TortoiseSVN for linux.

Thanks for everyone who participated in the poll “What is your favourite Subversion client?

If you use any other Subversion client, please let us know.

Read more about Subversion at the dedicated SolitaryGeek Subversion category.

 

Five different uses of Java Applets

August 22nd, 2009 James 2 comments

In a world where everyone is using technologies like Flash, Silverlight etc to present rich content, are Java Applets still used? Are they still relevant? The answer is – “Yes”. Apart from being used primarily for playing online games, Java Applets are still used in many different ways. Here I would like to highlight a few applications that put Applets to good use.

1. Online Office Suite
ThinkFree is a very popular and professional online office suite based on Java Applet and Ajax.

2. Virtualization
JPC or Java PC Emulator is a pure java based virtualization software that can be used to boot your virtual computers right inside the browser. Yes they run as “Java Applets” inside the browser.

3. Remote Desktop Viewer
Products like TightVNC and UltraVNC provide a java applet based client to view remote desktops.

4. (Web) Operating System
iCloud, is an web operating sytem that makes use of XML and Java Applet Technology (atleast for Firefox).

5. File Upload

Facebook uses a beautifully designed Java Applet to upload photos to facebook photo albums.
net2ftp is a web based ftp client that makes use of tiny Java Applet to “drag and drop” files from local computer to the browser and upload them to the remote ftp server.

If you have come across any website that make use of Java Applets, please share your thoughts in the comments.

 

Poll: What is your favourite Subversion client?

August 15th, 2009 James 8 comments

Do you use Subversion as your version control system? Then, please share with us what is your favourite Subversion client.

What is your favourite Subversion client?

  • TortoiseSVN (47%, 103 Votes)
  • The one that comes with my IDE (NetBeans, Eclipse, etc) (30%, 65 Votes)
  • Subversion Command Line Client (13%, 29 Votes)
  • Other (Please mention your choice in the comments) (5%, 11 Votes)
  • RapidSVN (5%, 10 Votes)

Total Voters: 218

Loading ... Loading ...
 

Subversion and RapidSVN

August 15th, 2009 James 5 comments

Subversion is a very popular version control system. Though Subversion provides a very robust command line client, most of us prefer using a nice GUI front end. Windows users are really fortunate to have a powerful tool like TortoiseSVN which without any argument is simply the best front end for Subversion. Unfortunately, TortoiseSVN is available for just the Windows platform. Here I would like to highlight about RapidSVN, a cross-platform GUI front end for Subversion.

This tutorial is directed towards new users of Linux or people who migrated from Windows to Linux recently. If you are a Windows user, TortoiseSVN might be the best bet for you. Learn more about TortoiseSVN from the post “Extending Subversion by using TortoiseSVN“.

Read more…