Sunday, 24 April 2011

Cloud Outage

I'm a big fan of a cloud-based note-taking application called Springpad to help me remember things, and it's always been an excellent, reliable tool, and I've recommended this app to everyone that I know. Last Thursday before Easter, I was on my way home and had a look at it on my mobile. For some reason it was asking me to logout and re-login since it could not sync to the cloud, so I did what it asked me to do, but alas, it was a big mistake! At that exact moment, Springpad and other cloud-based applications such as Foursquare, Quora, Hootsuite, Shareaholic were down, as you can see from this article. Even Crust Pizza online ordering system was also down (see their twitter status link). I was not able to login, or access my check list, shopping list, car insurance comparison, bookmarks, trip plans, and other useful stuff that I normally use this tool to take a note of for 2 days. Users were angry, as you can see from this link. I seriously considered going back to using Evernote.

All those cloud-based services are using Amazon EC2 (Amazon Elastic Compute Cloud), a cloud service provided by Amazon designed to be flexible in terms of resizing cloud capacity and other technical functionalities, hence making it easier for developers. When this cloud went down, all the services did go down with it since all the data was stored in this Amazon cloud. Some of the services actually moved their hosting elsewhere until the Amazon cloud was back up so that users could still use them.

Imagine that you don't have access to all your important data for 2 days! It may not seem long but nowadays that is a very long time. Here we can see the downside of using cloud based services. You're at the mercy of your provider if the cloud goes down, but in my opinion, people should not be discouraged by this event. Hosting data on your own has its downsides too, and some downtimes are also expected. What I would suggest they do is:

  • Don't put all of your resources in one cloud. Amazon EC2 has various availability zones, so it is wise to spread your resources into different zones, or better still if possible, into different providers
  • Just because you've outsourced your data to the cloud, does not mean that you should not think of a backup plan just in case it goes down
  • Have offline access, where applicable, so if the cloud goes down, the application can display a meaningful message and users would still be able to continue using it

Sunday, 21 March 2010

NetComm Wireless Modem Router

A couple of days ago my F5D7230-4 Belkin wireless router stopped working. I was hoping that it was an adaptor problem, so I went to the electronics shop and tested it with a new adaptor, but unfortunately it still did not work. I've had this router for more than 3 years and I actually like this wireless router as it had been providing me with excellent signal strength.


Now, the way I set up my home networking was by using a modem router given by my ISP, NetComm NB9W. The "W" is supposed to give me wireless support as well but I was not satisfied with the range. It was so hopeless that when I moved to another room, which is not so far away, the signal was extremely weak. That is the reason why I used my Belkin wireless router on top of this modem. I just switched off the modem's wireless option.

I was a man on a mission to get a new wireless N router/modem. I searched online, ebay, and went to a few computer shops. Initially, I was a bit sceptical about "x" in one devices since essentially a wireless router modem is a 3-in-1 device (a modem, a wireless router, and a switch), hence the reason why I used two separate devices. When one goes wrong, I could just replace the faulty one instead of the whole thing. I then went on to see different reviews of different products on the net, including NetGear, NetComm, Linksys, Belkin, and D-Link. I wanted to get another Belkin since it had been proven as a good performer in terms of its wireless signal. I was also told that the NetComm modem that I have is actually one of the lowest ranges, hence the bad quality. In the end, I purchased the new shiny NetComm NB6Plus4Wn, installed it, and surprised on how easy it was to set it up and also it had good signal strength. I have to admit that it is pretty good so far. Here's a picture of my new 11n wireless modem router in action:


Wednesday, 10 March 2010

Maven Plugin Dependency Duplication

Maven is a great build tool, and it has saved me from taking care of all the libraries and dependency hell, but it is not perfect, at least not in the version that I used (2.0.6). I wanted to use a newer version of one of the hibernate libraries, so I specified the new version in my project pom xml. The problem was that in the final war file, I had both the new version and the old version of the library. One of the plugin dependency actually depends on an older hibernate library, hence Maven automatically included both libraries. It is actually a known bug in 2.0.6 (see MNG-2972) and it's fixed in 2.0.9, so upgrading my Maven to 2.0.9 did the trick.

Monday, 8 March 2010

Transaction Pitfalls

Just thought that I need to post this very useful article about common transaction mistakes in Java platform. It's just so easy to assume that transaction works and then in the end (or worse, in production), you find out that it does not work as intended. The classic "Transaction Rollback" mistake is surprisingly common. I've seen this again and again as people assume that this would work automatically.

Thursday, 23 July 2009

Dummy SMTP Server

Papercut is, in my opinion, one of the best tools for a dummy SMTP server. The interface is nice, clean, and best of all, simple and easy to use. Installation took me a few minutes, and all you need to do next is point your application's smtp server to localhost and you can start testing.

Thursday, 14 May 2009

Null Check for Java Bean Properties

I was trying to find out an easy way to check nulls in my Java Bean. There is this filter screen where I need to throw an Exception if all the properties are blank. This is required so that the database don't get hit with "Search All" query. I used BeanUtils from Apache Commons to get all the properties and StringUtils to check if the property is blank. Here is a snippet of the code that I used:


.
.
.
Map<String, String> map = BeanUtils.describe(searchCriteria);
boolean allBlank = true;
if (map != null) {
for (String key : map.keySet()) {
if ("class".equalsIgnoreCase(key) || "metaClass".equalsIgnoreCase(key))
continue;
if (StringUtils.isNotBlank(map.get(key))) {
LOG.info("key " + key + " is not null");
allBlank = false;
break;
}
}
}
if (allBlank) {
throw new IllegalArgumentException("searchCriteria cannot be blank"));
}
.
.
.

Wednesday, 26 November 2008

java.lang.ClassCastException: oracle.sql.BLOB

This is by far the most annoying problem I've ever had. What ClassCastException??? This is my code:

oracle.sql.BLOB blob = (oracle.sql.BLOB) resultSet.getObject("fileBlob");

It turned out that there are 2 Oracle JDBC jars in my Tomcat directory (common/lib and WEB-INF/lib), so I removed the one from WEB-INF, restarted the application, and it all worked fine.
Share |