Thursday, March 20, 2008

Build Mashup Application

In this post I would explain how easily is to build mashup web applications, and I would list providers which provide services to build Mashup applications.

Mashup is a Web Application that combines data from several external sources into the application and thereby the development of such application is wasy and fast.

Example of such external sources are


There a lot of other external sources, like RSS feeds and others.

There are also tools which allow to build Mashup applications On-Line, This tools allows to create workflow which get sources from external resources such as in RSS format and merge this dats into one web site, The major software vendors provide such tools -

The disadvantage of mashup applications are

  • They depend on many sources, so if one of this resources is unavailable then all the mashup application becomes unavailable.
  • The performance of such applications is not good since they depend on several outer resources from different locations.
  • If one of the resources change it's API or start to charge for the service your Mashup application would stop working.

Sunday, March 16, 2008

Cache Manager

Actually I took the following Cartoon idea from a real project which I was involved in it. To improve the performance of our application the Architect wanted us to build local cache (We couldn't use Open Source in our project).





















They gave us several months to develop it... :)

Monday, March 10, 2008

Terracotta - Simplfy Cluster Development

Cluster development is often very complicated, Many applicatoins needs to develop special infrastructure to support clustering such as Cluster cache, replication of data between the different servers in the cluster and each develop need to take into account the design and the implementation of his module to run well in cluster environement.

Terracotta comes to solve this problem, Terracota is Open Source and it is called "Network Attached Memory" or simply NAM. Terracotta take care for all the cluster issues, eliminate the developer the need to deal with all this complicated stuff.

For example java synchronized(), wait() & notify() can work exactly the same across several VMs as across threads!!!

Terracotta also provides In Memory DB which is durable to Server Crashes.

In summary if you are looking for an open source which can scale your application in little effort I recommend using Terracotta.

Sunday, March 9, 2008

Execute Async Method

Sometimes you need to execute methods in async way.

There are several ways which you can do it

  1. Send JMS message in J2EE Application with a Callback object, Write MDB which would listen to the Queue which you send the message to, When the MDB would finish it would call the method 'done' on the Callback if the execution succeed, and it the execution failed it would call the method 'failed' on the Callback.
  2. If you write with Java 1.5 simple small Java Program and you don't need to distribute your async command in cluster environment you can use the 'Executors' class to create pool of executions in this way:

ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10);

and then just write:

executorService.submit(callable);

This would execute the callbale call method in async way, You can pass callback to the

callable object which would later be called to send the response back.

Saturday, March 8, 2008

Captcha Hack - Part 1

Captcha is a type of challenge-response test used in computing to determine whether the user is human.





For example:









Does Captcha word can be read by a non-human eyes?

The answer is yes, In this Post I would explain the idea of how this can be done, the algorithm behind it and at last a sample code which implement the algorithm.

Trying to read the letters using image processing is pretty difficult, we would use different technique.

Not all Captcha words can be hack, However the hacking of Captcha code take advantage of the disadvanatges of poor Captcha words.

Many Captcha words are combine of four letters or digits,
Lets assume that it combine both from letters and digits, since abc containts 26 letters and there are 10 digits there are 36 combinations for each letter/digit.

This gives us a total of 36*36*36*36 = 36^4 = 1,679,616 combinations.

If the Captch word is combine only from letter it is even better, this would give us a total of only 26*26*26*26 = 26^4 = 456,976 combinations.

We can then build a DB with all the possible comibnations and give a unique key for each of one of the combinations.

When a Captcha image is displayed we then generate a unique key from this image, and find the matching one in the DB, this would give us an understandable word which can be used to enter the Captcha word.

Some assumptions were done to implement this algorithm:

  • The Captcha word generate must be at the same format, meaning captcha background must have the same pattern, Captch words must be the same font each time.
  • The number of letters/digit can't be over 4 digits, this algorithm wouldn't be able to solve the Captcha word since 36^5=60,466,176 which is too much to store at a simple DB.

The algorithm would be able to solve this special scenarios:

  • If the number of digits is changing between 3 or 4 digits
  • If the backgorund color or the font colors are changing
  • If there are simple lines on the Captch word which intend to interrupt reading the word

In the next posts I would give a more detail algorithm with a solution for the above speical scenarios.

Webmasters - Improve your Captcha words!!!

Monday, March 3, 2008

Debug Web Applications

Debuggubg Web Applications is not an easy task,
However this area is involving, and there several ways now to debug Web Applications.

  1. The simplest way is to use remove tags inside your html/jsp/jsf files and check the result, or adding border="1" to tags and see the layout of your html.
  2. in FireFox you can use tool which is called FireBug, This is a great plugin in FireFix which allows you to debug JavaScript code, It can also show you the border of each component in the HTML, you can also see the HTTP Get and Post requrest between the Client and the Server.
  3. If you develop your Web Application using Google GWT you can debug your Web Application in Develop Mode as it is a pure java application.

Links

 
RSS Feeds Submission Directory