Tuesday, August 19, 2008

Google App Engine application is temporarily over its serving quota

After developing a google app engine application for two months and investing a lot of time in it, and now serving more than 500,000 page views per month I got the following error appear on my website:

"Over Quota

This Google App Engine application is temporarily over its serving quota. Please try again later."

It seems that i had a small mistake which caused runtime exceptions in some of the requests, This small mistake cause my web site to shutdown for several hours!!!!

I really don't understand Google making this error apeear, I understand that they want to secure their servers but why to shutdown an application for several hours, once the error was fixed the server should be activate again.

Now that the server is done, and many users see the error they won't use the application again!

For this reason I really don't recomment you use Google App Engine.

Sunday, June 29, 2008

Google App Engine

One month after I started writing my first Google App Application I had reached more then 1000 Page View per one day!!!

One of the great advanatges of GAE over creating my own Web Server is that robutness of Google servers, My application is up 100% of the time, And after writing the application in correct way without consuming too much CPU per request and handling exceptions the application can be used anytime by the users.

The question is what would happen when GAE would support also Java, I realy don't know how I would be able to convert my application from Python to Java

Friday, June 13, 2008

Google App Engine Tips

  1. Often your application would work just fine locally but after deploying it the application won't work, a reason for that is that when running locally there is no CPU limit but on Google servers there is a CPU limit, My advice is to deploy your application at night this would enable you to test your application live without interfering the users
  2. Check your Logs frequently to see if your application throws exceptions to the user, You should strive to a point that no error logs would be displayed at all.
  3. To delete old entities you can access from "Application Overview" then choose "Data Viewer" and then select the entity click on the top check-box and then click the delete button, once there are no rows the entity would be removed.
  4. Don't upload an application if you havn't fully tested it before locally.

More tips would be posted in the next posts

Tuesday, June 3, 2008

My First Google App Engine Application

Ok, I finally succeed writing the Beta version of my Google App Engine application, This application translate from Hebrew Language to 15 other Langauges - Engish, Russian, Japanesse, Chinesse, Korean. The application use the datastore to hold the dictionary and also it auto-correct words which are misspelled, You can check the application at this url -


Deploying such application myself which would be both robutness and scalable can cost a lost of money, If buying servers and paying for high bandwith internet connection and maintaining the DB and using Load Balancer and so on, I think that it's worth it.

Wednesday, May 14, 2008

Google App Engine in Java Language

As A Java Developer it is very hard to use Google App Engine.
As for now Google App Engine supports only Python Programming language, Trying learning and writing Python languages can be very frustrating when you are used to the good pleasing Eclipse IDE.

Then I found this nice project:


You can write you Google App Engine Application in Java Language and then just convert it to Python and upload it to Google Servers!!!


Sunday, May 11, 2008

Google App Engine Limits

Google App Engine has many unknown limits and resterictions, here are few of them:

  • Data store is limit to 500mb
  • 5,000,000 monthly page views
  • 3 applications per user
  • Application response time to user must be short something like 3 seconds
  • Bulk upload failed to load long strings, I didn't succed upload strings which are more then 40 letters long
  • Unicode charcters can't store in datastore
  • Bulk upload cookie expiration is 15 minutes long, If your upload takes more time then you would need to run bulk upload several times again and again
  • Number of users which can user Goolge App Engine is limit for now
  • It is not possible to rewrite datastore date only to add more rows using bulk upload
  • Google App Engine is limit for now only to Python programming language

Nevertheless Google App Engine works and it has many advantages which are not exists elsewhere, It is ideal for developers which don't have the resource to maintain a complex website for their applications.

Wednesday, April 30, 2008

Google App Engine Work !!!

After hard work and many workarounds I managed to run my first Google App Engine application !!!

And it works great, The performances are amazing, I have more than 10,000 rows in my tables and selecting the rows takes few milliseconds.

I manage to find workaround for the unicode problem by not writing unicodes in the Goole App Engine datastore, I also managed to find workaround for the bulk upload problem by loading the entities one by one and not 10 entities at a time.

So regarding my last post which suggest not to use Google App Engine, I change my mind, You can use it but you would need to work very hard to make it work.

Monday, April 28, 2008

Google App Engine and GWT

First there was GWT - Google Web Toolkit a very nice framework to develop Ajax applications in Java language which then translate to JavaScript, It worked with Tomcat Web Server. Then Google decide to release Google App Engine a service which provide the ability to develop applications in Python language and deploy them on their servers for free and provide datastore which is like DB to store data.

It seems like their is no syncrhonization at all with the two groups GWT and Google App Engine, once Google goes for Java and then for Python, Is there any direction to which Google wants to go to?

In their website they claim that they choosed Pyhton because it is secure language, There is no more secure lagnuage than Java, How would GWT developers would deploy their applications on Google App Engine, would they need now to convert their code to Python? I really confused

Friday, April 25, 2008

Why not using Google App Engine

After worked several days with Google App Engine, I was realy dissapointed, It seems that since it has just released and it is in "Preview Release" it contains some bugs and since Google choose Python as the programming language it make it hard to develop for programmers which don't know well Python, Here are the problems that I come with

  • Python is VERY hard language to develop applications which required Unicode, Maybe for english applications its not so bad language but when you try writing something which is not english you need to find yourself using decode, encode, unicode and other awful methos.
  • It seems that urlfetch method which retrieve data from other urls doesn't support unicode
  • I tried to upload my datastore to the application server, when I do it locally it works, however when I try to upload the datastore remotly on Google Servers it fails.
  • Datastore also doesn't support unicode characters, everything has to be in english
  • Sometimes after uploading the application to the Google Servers it says error 500, However the application works just find locally
  • Python language is the only programming language I know which requires not using Tabs inside the source code and it doesn't use { and } characters to define block but rather it looks on where the line begins. There are much more advance programming languages like Java which could fit more to be used with Google App Engine

In summary I think that I would wait some time before Google App Engine would have more stable versions.

Monday, April 21, 2008

Working with Google App Engine

I just got today invitation to try Google App Engine,
It seems that I'm one of the lucky 10,000 people that got invitation to try it.

Well first I had to admit that I don't know shit about Phyton, Google App Engine is based about Phyton language, However it seems that it is not hard to learn this langauge once you know Php, Java or other programming language.

The big advantage of Google App Engine, is that you don't have to take care about all installing and deploying applications, taking care for performance or load balancing, you get all this things for Free!!!

It seems that it is pretty easy to develop applications using Google App Engine, you just need to install phyton, and Google App Engine SDK, and thats all.

Then you are your phyton application file, and you can test it localy by running GAE (Goolge App Engine) locally.

Once you finished writing you application you just upload it to the Google Server.

The biggest advanatge of GAE in my opinion it is ability to store data and retrive data from the database using GQL Google Query Language which is just like SQL but a bit different, This allow the application writing highly scalabe SQL selects.

Once I would finish writing my application I would publish it here.
Please comment if you have any questions.

Tuesday, April 8, 2008

Google App Engine

Google announced yesterday about their ambitious project "Google App Engine",

The idea for Google is why we should spend so much effort developing applications? Lets make developers outside Google develop applicatons for us. This is the same idea like "YouTube" the users upload the videos for Google.

Each user gets free 500MB of persistent storage and bandwidth for about 5 million page views a month.

Don't hurry to register since the project is limited to the first 10,000 developers, And there are more than 10,000 developers which already registered.

When I tried to check the App Gallery all the applications returned the following error after trying to login: "The requested page is expiered".

Google App Engine

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:


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.

Wednesday, February 20, 2008

Typical Software Development Project Cartoon

Thursday, February 7, 2008

80% of commercial apps to use open source by 2012

I had found this intresting article which claim that 80% of commercial apps to use open source by 2012, This are not good news to application software giants such as Oracle, Microsoft, Sun, IBM etc', While for every aspect of software developing you have Open Source alternative the Open Source alternative becomes more appealing for it's robutness, and for it being free.

In IDE enviroment when coming to choose between Eclipse, IntelliJ, Netbeans most choose Eclipse, In Application Server when coming to choose between WebLogic, WebSphere, JBoss and some companies use JBoss.
Tomcat, Apache, GWT all of then are open source.

So how open source projects make their profit? The answer is from support, and not only Open Source projects, many of the software applications giants make their profit from support which can reach up to 80% net incomes.

Only in companies in which the security is critical such as Banks or Goverment institutes Open Source is not being use beacuse it might containg backdoors.

Design Patterns Quick Reference in two pages

I had found this amazing Design Patterns quick reference which containg All the basic design patterns in only two pages!!!

I had printed it in my office and it is very helpful when designing new components,
This great quick reference can be found at mcdonaldland blog.


Saturday, February 2, 2008

2008 Acquisitions

After Microsoft bid on Yahoo for 44.6-billion-U.S.-dollar and after Oracle bought BEA and Sun bought MySql 2008 seems to be the acquistion year, the question is what would be the next big acquisitions in 2008?

Here is my bet on the next big 2008 acquisitions:

  • Salesforce.com would be bought by either Oracle or SAP. Both of this software companies want to extend their On-Deman CRM services, Salesforce would put them on the front line, After Oracle bought People Soft and and Siebel it would want to extend it's CRM products even more.
  • RedHat would be bought by Oracle. RedHat which posses JBoss would likely be bought by Oracle which would very interest in the Linux and to extend it's middleware products.
  • Microsoft would buy Logitech to extend it's computer control devices
  • IBM would continue with it's straretgy to buy only small Start-up companies

Tuesday, January 29, 2008

Google Interview Questions - Part 9

Q1: How you would tweak bits in C to find out if a machine’s stack grows up or down in memory?

Q2: There are 8 stones which are similar except one which is heavier than the others. To find it, you are given a pan balance. What is the minimal number of weighing needed to find out the heaviest stone ?

Q3: N threads .. n resources .. what protocol do you use to ensure no deadlocks occur?

Here are the answers:

A1: Instantiate a local variable. Call another function with a local. Look at the address of that function and then compare. If the function's local is higher, the stack grows away from address location 0; if the function's local is lower, the stack grows towards address location 0.

A2: Divide the stones into sets like (3,3,2). Use pan to weigh (3,3). If the pan is remains balanced, the heavier is in the remaining (2). use pan again to find which is heavy from (2). (Total pan use 2) If the pan does not remain balanced when weighing (3,3), pick the set of stones that outweigh other. Divide it into (1,1,1). use pan to weigh first two. It it remains balanced, the remaining stone is the heavier, otherwise the one outweighing other is heavier(total pan use 2)


  • Avoiding Deadlocks with Lock Leveling, each thread would have different level, thread with high level would be able to lock thread with lower level but not contrary.
  • Avoid acquiring more then one lock at a time.
  • Acquire the lock always in the same order.
  • Shrink synchronized blocks.

Thursday, January 24, 2008

Most Popular Developers Interview Question

This is one of the most popular developers interview question I know,

I had been asked about this question so many times.

The question is about the singleton design pattern, how to ensure a single instance of singleton object.

This answer is wrong:

public MySingleton getInstance() {

if (instance==null) {

instance = new MySingleton();


return instance;


This is because if two thread would call getInstance the same time then they may both enter the if statement before instance was initialized.

Another answer for this question is to initialize instance in the creation of the class.

private static final MySingleton instance = new MySingleton();

but if the classloader is not lazy then this class would be initialized even if no one use it.

A good solution is to initalize it in a static section of the class

static {

instance = new MySingleton();


this code would only be called when someone create an instance of the class and two threads can't enter the same time the static section.

Another bad solution is to write

public synchronize MySingleton getInstance() {
if (instance==null) {
instance = new MySingleton();
return instance;

This is not good solution since each time someone would get instance it would synchronize the call this would decrease the performance.

So a more sophisticated good solution is:

public synchronize MySingleton getInstance() {

if (instance==null) {

synchronize {

if (instnace == null) {

instance = new MySingleton();



return instance;


in this case two threads can enter the first if statement in the first call but then only one of them would get into the second if since the synchronize keyword, this would create only one instance, and also this would create in lazy when the singleton is first access.

Be prepared to be asked about this question in your next interview.

Spring vs. EJB 3

This article would overview the differences between Spring Framework and EJB 3

EJB 3.0

  • EJB 3.0 is a specification.
  • EJB is an architecture
  • The EJB 3.0 framework is a standard framework defined by the Java Community Process (JCP) and supported by all major J2EE vendors. Open source and commercial implementations of pre-release EJB 3.0 specifications are already available .

Spring Framework
  • Spring is an implementation.
  • Spring is application framework
  • The Spring framework is a popular but non-standard open source framework. It is primarily developed by and controlled by Interface21 Inc. Spring can work standalone or with existing application servers.

EJB 3.0 Advantages
  • EJB 3.0 specification horroble old entity beans have been replaced with the JPA
  • Deal with transactions and both succeed modularizing this functionality in a way that it doesn't clutter business logic
  • Tune the transaction propagation levels via annotations
  • Support state management via stateful session beans,
  • Support injection of primitive types, allows injecting EJB's
  • Supports AOP using interceptors
  • Brings a basic implementation of component management
Spring Framework Advantages
  • Integrates with many popular persistence frameworks including JDBC, Hibernate, JDO, iBatis and JPA.
  • Transaction demarcation, propagation, and isolation are all declared through its AOP.
  • Support state management via prototype beans and also request, session, and global session scoping
  • Support injection of any type, allows injection of any domain objects using the features of AspectJ
  • Suppotrs AOP by tightly integrating with AspectJ with all of it's features
  • Spring 2.0 offers a lot more power and customization, but the use of AspectJ actually makes the hard to learn

Spring Framework Disadvantages

  • The idea of annotations was to stop work with XML - Deploymenet Descriptor files which were in EJB 2.1, but Spring encourage a lot the use of XML for dependency injection
  • Refresh the Spring load data is impossible, if you change something in the configuration you need to restart the Application Server.

You can integrate Spring and EJB 3 technologies to take advantage of their relative strengths and weaknesses, In Spring and EJB 3 there are a lot of duplication in the compoments you can choose the best of this technologies to use in you application.

Friday, January 18, 2008

Writing Cluster Application

Here is a checklist of things that need to be done to write good application which would work in Cluster enviroemnt

  • When accessing the cluster from outside using HTTP or RMI verify that access to the cluster is done throught load balancer, this can be either software or hardware load balancer.
  • Consider using 'Optimistic Locking' or 'Pemisitic Locking' if two or more clients may update the same row in the databse at the same time
  • If you want to cache data all over the cluster and not on a single server then don't use Singleton, you would need to user Cache framework such as GigaSpaces or OSCacheor JCache etc', this solution is good mainly for read only data or data which is mostly read.
  • In many application servers you can configure your MDB if it would run on a single server or on several servers.
  • Avoid reading files/writing to files in the code, Since you may run on different hosts in the cluster and the files may not exists on the current host which you are running
  • Use Synchronize where two threads may access the same data at the same time, This problem can also occure on non cluster system.

Please comment if you have other issues which are missing.

Top Buzzwords which make you Expert

Here is a top five buzzwords which developer needs to know in order to make himself an expert

  1. Scalability - Means that the application can handle a growing amount of work in a graceful manner, Usage Example: "I don't think that this system is scalable, A raise in my salary might encourage me to make it scalable"
  2. Robustness - Means that the application can withstand stress and can continue to operate despite ourside or inside errors, Usgae Example "This application is robustness, One time I explode it with Dynamic and it continued to run"
  3. High Availability - Means that the application ensures a certain amount of operational continuty during a given period, Usage Example: "This application high availability stinks, we need to build a cluster of servers to make it high avilable"
  4. Interoperability - Means that the applications can exchange data in commonn set of exchange format. Example: "We should expose the application service with Web Services this would make our application interoperabale"
  5. Portability - Means that the application can run on a different operating system, Example: "In a team meating I told my boss that we should write a portable application beacuse the application needs to run also in Unix, He promote me to team leader"

Thursday, January 17, 2008

Sun agrees to pay $1b for MySQL

Sun Microsystems Inc., the third-largest maker of server computers, agreed to buy software company MySQL AB for about $1 billion.

MySQL is the world's most popular open source database, over 100 million copies of its software downloaded or distributed throughout its history, It is mainly used by web sites and it is used also by Google Inc.

What is the interest of Sun to buy MySQL, well Sun unlike IBM/Oracle/Microsoft doesn't have it's own Database, Sun has its own Application Server and this would create a more complete product solution which would be supply by Sun.
The profits for Sun will come from the support for MySQL installations.

The question now when Sun would be bought and by who?

Wednesday, January 16, 2008

Oracle to Pay $8.5 Billion for BEA

Another acquestion by Oracle, this company just swallow all the other competitions.

The big question what is now what would be now with BEA WebLogic application server? Since Oracle has it's own application server 10g, would they stop to develop it? My guess is that they will continue to support old 10g customers and would offer new customer BEA WebLogic application server.

Oracle profits are just continue to grow and this cause Oralce competitiors to afraid, Now that there are now only two major J2EE Application - IBM and Oracle it would be intrest to see what would be the next acqusiton

Google Interview Questions Part 8

This questions are a bit tricky, lets see if you can solve it.

First question:

       1 1
       2 1
    1 2 1 1
  1 1 1 2 2 1

What is the next number?

Second question:

What number comes next in the sequence: 10, 9, 60, 90, 70, 66, ?

A) 96
B) 1000000000000000000000000000000000\
C) Either of the above
D) None of the above

And here are the answers:

First question answer is:

one one (Since the previous line has one time one number)
two ones (Since the previous line has two time one number)
one two one one
one one one two two ones

So the next line answer is 3 1 2 2 1 1

Second question answer is:

ten, nine, sixty, ninety, seventy, sixty-six,

Each number has one letter more than the previous number, ten has 3 letters, nine has 4 letters etc'

Since "sixty-six" has 8 letters the next number need to have 9 letters which is

You can find more questions here:

Google Interview Questions Part 1
Google Interview Questions Part 2
Google Interview Questions Part 3
Google Interview Questions Part 4
Google Interview Questions Part 5
Google Interview Questions Part 6
Google Interview Questions Part 7

GWT vs. Flex

This article would compare Google GWT (Google Web Toolkit) and Adobe Flex 2 and would describe the advantages and disadvantages of each of these technologies.
This two technologies are both Rich Internet Application (RIA) frameworks.

GWT Advantages:

  • Doesn't require plug in installation on the client side
  • GWT doesn't require the user to know JavaScript since the code is written in Java
  • GWT doesn't cost money since it is Open Source.
  • Changes in the Client side are immediately shown on the browser by using refresh, no need to restart the server.
  • GWT can be easily debugged in hosted mode.
  • There is compatible between different web browsers.

GWT Disadvantages:

  • The html and JavaScript code which GWT generates is pretty heavy and not necessary fully optimized.
  • GWT doesn't come out of the box with all the possible widgets, there is a need to use extra components

Flex Advantages:

  • The UI looks nicer then plain HTML/JavaScript code, It contains huge amount of animations, widgets etc'
  • Compatible between different web browsers
  • Flex 2 SDK and Flex Builder 2 for Education are both free
  • Google can index SWF files

Flex Disadvantages:

  • It requires plug in installation on the client side , however this may not be disadvantage since Adobe claims that Flash is installed on more then 99% percent of users.
  • Flex Builder 2 costs some money

Friday, January 11, 2008

Improve SOA Performance

SOA Applications Performance are disaster.

Lets assume you want to buy a book using SOA, this means you need to access several times a remote server using web service to complete the transaction, If you work with java then for each web service request you need to parse you java objects to XML objects send the request to the remote server on the other side the XML is parsed back to java objects it do it's stuff and then return a response parse it back to XML you get the XML and parse it back to java objects.

Lets assume that each of this horrible way takes 2 seconds, if you need to send 4 requests to complete the transaction it would take 8 seconds for one small transaction!!!

To improve the performance you would first need to set a well done granularity for your web services if it is possible, For example if to buy a book you first send a request to get the book name by book if and then you send a request with the book name to check if the book exists and then you send another request to buy the book, a better way would be to send one web service request which would do all of the above this would reduce the round trips between the client and the remote server, Instead of parsing XML files 2*3=6 times you would parse only 2 times.

A second way to improve the performance is to cache locally all the read only data which exists in the remote server, so instead of accessing the server using web service you would just read the data from the cache, You can also cache not read only data if you don't necessary need the last-to-update date.

Technical ways to improve the performance is to choose a good performance web service package, some packages take a lot of CPU/Memory to parse the XML to objects and vice-verse.

I recommend this SOA book to learn more:

Tuesday, January 8, 2008

Flex vs. JSF

This article would compare Flex and JSF technologies and would describe the advantages and disadvantages of each technology.

JSF Advantages:

  • Doesn't require plug in installation on the client side
  • JSF has a standard specification and it has several implementation
  • JSF has Open Source implementations which doesn't cost money.
  • Changes in the JSP files are immediately shown on the browser, no need to restart the server.

JSF Disadvantages:

  • Very complicate to develop because the basic implementation is pretty basic and for complicated UI screens need to have additional component libraries
  • Doesn't compatible between different web browsers

Flex Advantages:

  • The UI looks much nicer then JSF UI
  • Flex looks like more simple to develop rather then JSF
  • Compatible between different web browsers
  • Flex 2 SDK and Flex Builder 2 for Education are both free

Flex Disadvantages:

  • It doesn't has standard specification
  • Adobe is the only provider of Flex
  • It requires plug in installation on the client side , however this may not be disadvantage since Adobe claims that Flash is installed on more then 99% percent of users.
  • If you build a web site which users would need to search in some search engine the search engine would not be able to understand the content of the flash files (search engines can only understand standard html files/pdf files etc')
  • Flex based pages takes a lot of time to get loading compare to JSF pages
  • Flex Builder 2 costs some money

Both JSF and Flex integrate very well with java.

In summary, if you build an simple enterprise application which requires nice UI I would recommend using Flex, if you build an complicated application which requires good performance or application which is open to all the Internet users I would recommend using JSF.

Sunday, January 6, 2008

GWT Proxy

Here is a nice way to write GWT Proxy to call the server services using the proxy design pattern:

The advantages of this proxy are:

  • The client call the service as it's a local call
  • The proxy hides the difference between calling the services in hosted and development modes.
  • It improves performance since the end point is set only once

First write this Client util class:

public class ClientUtil {
private static final String PRODUCTION_URL = "http://www.koko.com";

* Check if the code run in production or development mode
* @return true if we run in production mode (i.e. Ruler.html is called)
public static boolean isProduction() {
return GWT.isScript();

* Set endpoint for service which want to access the server
* @param service the service class
* @param name the name of the service
public static void setEndpointForService(Object service, String name) {
ServiceDefTarget endpoint = (ServiceDefTarget) service;
String moduleRelativeURL = getRelativeURL() + name;

public static String getRelativeURL() {
String moduleRelativeURL = null;

if (!isProduction) {
moduleRelativeURL = GWT.getModuleBaseURL();
} else {
moduleRelativeURL = PRODUCTION_URL;

return moduleRelativeURL;

Then write your proxy class, for example:

package com.mycompany.client.util;

import com.google.gwt.core.client.GWT;

public class MyProxy {

private static MyServiceAsync myService = (MyServiceAsync) GWT.create(MyService.class);

static {
// serviceName is the name which define in app.gwt.xml file
ClientUtil.setEndpointForService(myService, "serviceName");

public static void foo() {
MyCallback myCallback = new MyCallback();

finally to call the server use:


You can read more at:

GWT Development or Production Mode

Here is a nice trick to know if your GWT application runs on hosted mode (development mode) or does it runs in production mode on a real web site.

Why do you need this? Because your access to the server side is different between development and production modes, and because you might your application behave differently between this two modes.

So to do this you would need to have two main html files one for development mode and another one for production mode, the two html are the same expect in the production mode you would put this following line:

‹iframe id="production" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 0px; BORDER-BOTTOM: 0px; HEIGHT: 0px"›‹/iframe›

and you can also put your advertisements like Google AdSense and Google analytics and other production stuff.

after you put this write this code in your main module class:

public void onModuleLoad() {
Object isProduction = RootPanel.get("production");

if (isProduction!=null) {

Also create this ClientUtil class:

public class ClientUtil {
private static boolean isProduction = false;

public static boolean isProduction() { return isProduction; }

public static void setProduction(boolean isProduction) {
ClientUtil.isProduction = isProduction;

Now in every place in the code user ClientUtil.isProduction() to know if you are in production or not.

Tuesday, January 1, 2008

Java becoming old?

Some "experts" claiming that Java becoming old and that it would reach it's end in a few years,
Some of these "experts" claim that java would end as Cobol, and new technologies would be adopted such as "Ruby On Rails", PHP and Ajax.

I completely disagree with this statements, First of Cobol is still one of the most common software programming languages. Beside that other new technologies such as Ruby still doesn't mature - we've tried several projects with it and have reverted to Java.
PHP is cool, but doesn't scale as well as Java for large user base applications.
AJAX -is like Javascript and CSS; It intended to be used with JSP/ASP/HTML etc.
Java still is the best choice - by far - for development. It runs on virtually any platform and doesn't lock you in to one OS vendor or flavor. It works, and it's fast. It's a great tool for back-end and web development. Yes, it's not the newest kid on the block, and frankly that doesn't matter much - It has solid performance and results pretty well in production


RSS Feeds Submission Directory