Thursday, June 4, 2009

GWT Tetris - Great Puzzle Game from the 80s



I am sure there are some of you out there that have never heard of the puzzle game Tetris. Seems like the 1980s was just a few years ago, ah how time flys. I first played the game Tetris on my Tandy Color Computer 3, and played and played. I absolutly loved the game! Funny, I still love the Color Computer too. Here is a screen shot of Tetris on the Color Computer:

Some time ago I tought it would be a fun little project to take the game Tetris and write a GWT version of it. Well now someone has already done it. A few days ago on the Google Web Toolkit Group I noticed a post about Tetris. I had to give it a try, and I was quite impressed with the result:

I had a chance to talk to the author Janusz Prokulewicz and asked him a few questions about the development of this game.

Some time ago Janusz created a Java version of his Tetris game. Having created the same game as a linux shell application over 4 years ago he was able to get his Java version working in three days. So the real question, how hard was it to convert to GWT and how long did it take? To quote Janusz: "It took me 2 and a half days (or rather nights) to do it".

So we have an existing Java application that Janusz was able to convert it to GWT in two nights. The game can now be played in any modern browser with no special plug-ins and no goofy browser quirks to worry about. Write it once in GWT and compile and you are ready to go.

Unfortunately at this time he does not have a web site that contains his other work, maybe in the future he can set something up.

He used GWT version 1.6.4 with no additional libraries.
The game is deployed with a PHP backend using JSON to get/send data to the server.

Janusz's web site is here.

Update June-8-2009: Janusz now has a blog setup. You can see his site here.


Wednesday, April 8, 2009

GWT support in Google Apps Engine AND GWT 1.6

Big news today for GWT!

First GWT 1.6 is available for download. Please see the official blog entry from Google here.

Second big annoucement for GWT is that the Google Apps Engine now supports Java. One thing to be aware of is that google has said that they are only allowing the first 10,000 developers. Better sign up fast. Here is the link to signup.

The also ask that you provide feedback, here is that link.

To find out more please see the official blog post from Google here on Google App Engine supporting Java.

For those of you using Eclipse for Java development (and I highly recommend you use it) there is now a GWT/App engine plugin for Eclipse.
For more information on the plugin see this Blog post.

The quick start guide to install the GWT/Google App Engine Eclipse plugin is here.

If you are already an eclipse user and know how to install plugins here are the shortcuts you need:

Eclipse 3.3 (Europa)
http://dl.google.com/eclipse/plugin/3.3

Eclipse 3.4 (Ganymede)
http://dl.google.com/eclipse/plugin/3.4

Friday, February 13, 2009

GWT 1.6 Milestone 1 available for download

This is the latest GWT release, it is a milestone release so be sure to only use it for testing.
If you are like me and use Eclipse to develope your GWT application there is a nice change that is part of this release. You no longer need to run these commands to create a new GWT Eclipse project:

C:\Program Files\gwt-windows-1.5.3>applicationCreator.cmd -eclipse MyGWTProject -out c:\MyGWTProject com.mynumnum.client.MyClass
Created directory c:\MyGWTProject\src
Created directory c:\MyGWTProject\src\com\mynumnum
Created directory c:\MyGWTProject\src\com\mynumnum\client
Created directory c:\MyGWTProject\src\com\mynumnum\public
Created file c:\MyGWTProject\src\com\mynumnum\MyClass.gwt.xml
Created file c:\MyGWTProject\src\com\mynumnum\public\MyClass.html
Created file c:\MyGWTProject\src\com\mynumnum\public\MyClass.css
Created file c:\MyGWTProject\src\com\mynumnum\client\MyClass.java
Created file c:\MyGWTProject\MyClass.launchCreated file c:\MyGWTProject\MyClass-shell.cmd
Created file c:\MyGWTProject\MyClass-compile.cmd

C:\Program Files\gwt-windows-1.5.3>projectCreator.cmd -eclipse MyGWTProject -out c:\MyGWTProject

Created directory c:\MyGWTProject\test
Created file c:\MyGWTProject\.project
Created file c:\MyGWTProject\.classpath


Now all you need to do is run the command webAppCreator:

C:\Program Files\gwt-windows-1.6.0>webAppCreator.cmd -out c:\MyGWT16Project com.
mynumnum.MyClass
Created directory c:\MyGWT16Project\src
Created directory c:\MyGWT16Project\war
Created directory c:\MyGWT16Project\war\WEB-INFCreated directory c:\MyGWT16Project\src\com\mynumnum
Created directory c:\MyGWT16Project\src\com\mynumnum\client
Created directory c:\MyGWT16Project\src\com\mynumnum\server
Created file c:\MyGWT16Project\src\com\mynumnum\MyClass.gwt.xml
Created file c:\MyGWT16Project\war\MyClass.html
Created file c:\MyGWT16Project\war\MyClass.cssCreated file c:\MyGWT16Project\war\WEB-INF\web.xml
Created file c:\MyGWT16Project\src\com\mynumnum\client\MyClass.java
Created file c:\MyGWT16Project\src\com\mynumnum\client\EchoService.java
Created file c:\MyGWT16Project\src\com\mynumnum\client\EchoServiceAsync.java
Created file c:\MyGWT16Project\src\com\mynumnum\server\EchoServiceImpl.java
Created file c:\MyGWT16Project\build.xml
Created file c:\MyGWT16Project\.projectCreated file c:\MyGWT16Project\.classpath
Created file c:\MyGWT16Project\MyClass.launch

Your new GWT 1.6 Project will be ready for import into Eclipse. Also you will notice that a simple client and server class is created in the example that demonstrates how to send and receive RPC requests.

Errors when launching your Eclipse GWT project in the GWT shell

You must create a lib folder in your 'project folder'/war/WEB-INF folder and copy gwt-servlet.jar into that folder.
After this is done you should be able to launch your new Project without this nasty error message:


2009-02-13 12:22:51.760::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2009-02-13 12:22:51.901::INFO: jetty-6.1.x
2009-02-13 12:22:52.229::WARN: failed echoServlet
java.lang.NoClassDefFoundError: com/google/gwt/user/client/rpc/RemoteService
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)



Monday, December 22, 2008

Another GWT Powered Web Site sendMeHome.com

It seems that these question always comes up on Google-Web-Toolkit group :
  • Who is using GWT?
  • Is GWT ready for prime time?
  • Why would anyone use GWT when they can use language X and toolkit Y?
  • Does Google even use GWT for their web pages?

I have been using GWT in a 24x7x365 day production environment for over two years now and I can tell you that GWT is ready to deliver on the promise of easy and reliable Ajax web development.

As for the question of 'who is using GWT?' I would like to share some information from the guys over at SendMeHome.com

Their site uses GWT and the GWT incubator project. I spoke with one of their developers and he was nice enough to share some details of their experience with GWT, what GWT widgets they are using, and their overall opinion on the Google Web Toolkit. Please see the details below:

SendMeHome was developed over the course of four months. We chose GWT to create SendMeHome as it allowed us to code in a familiar language (Java), provided a wide array of widgets, and could deliver the type of end user experience we wanted to provide.

Although the GWT compiler is quite intelligent and removes any unused functions and libraries at compile-time we wanted to keep SendMeHome as small as possible as some of our users may be accessing the site on a dial-up connection. To do this we consciously tried to only use widgets in the gwt jar file, these include:

  • Text Box / Password Text Box / Text Area / Rich Text Area
  • Radio Buttons and CheckBoxes
  • File Upload
  • Tree
  • iFrame
  • Toggle and Push Buttons
  • Grids and FlexTables
  • Just about every panel available, including the Tab, Decorator, Disclosure and Popup Panels

We initially broke our own rule when we discovered the Glass Panel from the incubator. We used it to create a “Lightbox Effect” for our login and error messages. However, we really began using Google’s other API’s when we developed our Stories feature. Stories allows you to track where a physical item travels to and lets you collect stories from the people it meets. To enhance Stories we integrated with Google Maps and YouTube and the process was stunningly simple. We now host all of our videos on YouTube and our users never have to visit YouTube.com or even have a YouTube account.

The only complaint we’ve had with GWT is that browsers cannot remember a user’s email and password easily. Otherwise it was been an absolute joy to work with and we are surprised that there aren’t more GWT apps out there!



Sunday, December 21, 2008

Eight Queens Puzzle Solution GWT style

I have deployed a very 'rough' GWT application, you can check it out here.  This is an Eight Queens Puzzle solution using GWT.  Hosting is with Mochahost using Tomcat.  Technically there is no reason to host this application with a Tomcat instance, but I thought it would be fun to take the same Java code and let Tomcat run the Eight Queens solution on the server and then let GWT compile the Java code to Javascript and run it on your client browser.

With a fast processor and Google Chrome I don't see why someone out there cannot beat the calculation time for the puzzle on their browser!  The bulk of the time on the browser is spent building the chess boards and populating the queens onto the board.  The Eight Queens Puzzle solution just takes a few seconds, or in the case of Crome miliseconds.

Lots more to come including:
  • Source code
  • Make the web page look better

Some other ideas I had:
  • Capture user agent information and store calculation times based on browser type and OS
  • Add a selection box so the user can select their processor speed and save this data with the solution time.
  • Build a report showing data based on cpu speed, browser type, bowser version, and OS
For more information on how to setup GWT with Tomcat hosting using Mochahost please see my previous post on GWT hosting.

Please leave me any feedback here.  Thanks!

Tuesday, December 2, 2008

Calling all GWT web sites!

I would love to hear from anyone currently using GWT for a web site or anyone that is in the process or using GWT for a new web site. Please post comments here with your site address and description. If you really feel nice you can also add in all the other libraries or technologies that you incorporated in building your GWT powered site. BTW - my favorite GWT combination is GWT 1.5 + GWT Incubator + Eclipse + Apache Tomcat 5.5

Thanks!

Sunday, October 19, 2008