jeudi 30 juillet 2009

Google App Engine vs App Engine Patch?

I'm beginning to understand what's Python, what's Django, what's webapp and I already have a great decision to take.
Which framework to choose in order to manage the presentation layer ( The story of the computer science is endless.)? I thought it was simple but it's not:)

The Django version provided with the google appengine is the 0.96 and many features (Internationalization, Forms) I need seem to be present only in the full 1.0 Django Version.

On the other side, the App Engine Patch site says that Django could be slow at starting if where are no enought requests to maintain it alive.

After reading the following discussion http://www.mail-archive.com/google-appengine@googlegroups.com/msg06044.html. I will try the patch and see what happens

jeudi 23 juillet 2009

Python - AppEngine - Let's Go

Today, I would like try to use Python/Django to make some tests with Google App Angine. Unlike Java and grails, I don't know anything about Python.
If I succeed to do something, it would means that product is great, otherwise It should be because of me:)

First good news, we can use Eclipse instead of Netbeans with the plugin pydev. I configure it by following this tutorial.

First bad news, the menu item run google app engine doesn't appear in the menu:(. I try with the simple eclipse sdk and with a previous version but this run menu remains not present)

I solve my first mistake!!! The menu appears only if you right-click on the src folder. It's not present at the project level. A great example about loosing stupid time because of ergonomy details.

Again a time consuming action, setting the proxy configuration because a connection timeout occurs. I don't know why but it never works as expected:)

In my case, setting the proxy allows the command to go to the step where it asks for the mail and password. The connection error occurs afterward.
If I set a wrong proxy value, this step is not reached.

I said that because I think it means my proxy configuration is OK and I have a problem elsewhere.
After many tests, I didn't succeed in downloading my application. I don't want to spend more time on that subject. I will do the uploading from my personal computer.

I already had the same problem with the stax platform and never succeed in downloading an application.

Nevertheless, I succeed in starting some examples without any problem. The framework makes me a strong impression. The server starts fast, runs fast. The management of Python by eclipse is also really pleasant. Maybe I will be convinced?

Of course this is a first impression. When I started with Grails, my problem come later in term of complexity.

Now I have to learn how the triptich Python/Django/GAE manages all things needed by a project in the real life like testing, managing internationalization, how presentation framework works ....

But it will be another story....

Grails - App engine - the search is not over

In fact I'm very disappointed by the way grails managing app-engine.
For now I begin thinking that the cost to be hosted by the appengine is two hight and we are far from an industrial technology.

I gladly admit that I don't have many time to try solving all problems I met. But this is the real life and I have to make choice:)

Anyway i will do some test with Python and django in order to see if the solution is stronger.

For now I didn't succeed in using JPA so all items described hereafter are linked to JDO.
  • The whole model of persitency have changed, say goodbye to the save() method, say goodbye to all generated findBy.... methods.
  • The code you're writing looks like using Spring with Java by having a persistency manager. The problem is that you're writing in Groovy and of course the completion done by the IDE isn't as fine as if you were in Java. Without the implicit job done by Grails, writing this code is painfully.
  • Most of your code is linked to google, the "import com.google.appengine.api.datastore.*" is everywhere. Don't expect a fast come back to a more traditionnal hosting by changing a config file.
  • I don't succeed to create integration test (I guess it's possible by making some spring call during the setup()). So don't expect that your exiting tests will run.
  • Forget the validation() method and thus forget the smart contraint management provided by Grails
To end, these problems come only after trying to create two objects without any relationship or complex pocessus.
For now, my personal feeling is that this is not a stable solution for a real application. Nevertheless, I of course continue to follow the developement.
Another problem is that nowhere on the official sites, these limitations are detailled. All tutorials are very simple and work only if you do exactly that's written (for exemaple don't try to create a domain class without any package).

mercredi 22 juillet 2009

Grails - App Engine - No validation available

Well, With the couple Grails/GAE, I move from one problem to another:(

The today issue came in two steps:

First I add some constraints to my object and notice that they are not managed. All objects violating these constraints are created.

I look at the generated controller code and note that the validate() method is not called before saving the object. I of course add it and everything works fine.

def save = {
def instance= new Item(params)
instance.validate()
if(!instance.hasErrors() ) {
try{
persistenceManager.makePersistent(instance)
} finally{
flash.message = "instance ${instance.id} created"
redirect(action:show,id:instance.id)
}
}

render(view:'create',model:[instance:instance])

}

Now I upgrade my inline application and note that it doesn't work anymore. There is the following server error if a constraint is broken (the case where there is no error works fine):

Error: Server Error

The server encountered an error and could not complete your request.

If the problem persists, please report your problem and mention this error message and the query that caused it.

If you want to check that behavior simply go to http://petclinic-grails.appspot.com/owner/add and try to create a owner with all fields empty.

It seems that the validate() is done by the hibernate plugin which is replaced by the appengine plugin.

Moreover I saw that flash messages don't have the expected behavior. They stay more than one page reload. I don' t have time to see why.

Grails - App Engine - How to test my App?

That's a good question no?

I don't like make by hand that a computer did for me at better cost so I'm using to deeply test my code. With the app-engine plugin, the command grails test-app doesn't work any more because of JDO class not found problem

java.lang.NoClassDefFoundError: javax/jdo/JDOException
I hope adding the jar jdo2-api-2.3-ea.jar coming from the google sdk (see T:\appengine\1.2.2\lib\tools\orm) is sufficient. Let's try again. There is another error about Spring.

Because it was an integration test coming from an existing project, I try to create an integration Test from the command grails create-integration-test, just to see if the plugin modify the template for them. The answer is no.

Because I'm starting to understand that I have to forget many things which made the simplicity of Grails like object.save() Object.findByXXX() ... I try to write my test by following the template of the contoller by using the persistenceManager.

The result is the same.
gant.TargetExecutionException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'persistenceManagerFactory' while setting bean property 'persistenceManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceManagerFactory': Invocation of init method failed; nested exception is javax.jdo.JDOFatalUserException: A property named javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, or a property named javax.jdo.option.PersistenceUnitName must be specified.

Well,well, the javax.jdo.PersistenceManagerFactoryClass is defined inside the jdoconfig.xml file. I have to find how to load it before the test starting:)


Badly, where are no advice about how testing an application running on GAE. Even the pet-clinic sample app doesn't have integration test.
Greame tests only the controller. (and during the time I'm testing the application, I get 2 server Error)

Hum maybe I should better see how Python works.....

mardi 21 juillet 2009

Grails and Google App Engine

Because I'm a fan of Grails, I'm of course interested in what's Google's doing with its Google App Engine.

Like all new technologies, where is a period during which making development for professional issues could be a little complex 'Ooooo no, again an unexpected exception and a whole day lost'.
What's why before starting a real application, i would like to test several configurations and options to make my own opinion.

Before started where are one Big Question: Java or Python?
I know Java and more specifically Grails. Spring source claim that Grails 1.1.1 is ready for Google so OK let's start with Grails.

First test: does it work?

I follow the tutorial of Guillame Laforge but, because I like to play, I create a class named Item instead of demo.Book. First fail, the plugin can't manage a class without any package ... grrrrr, my first whole day lost.

I try to upload the application, it's not clear if we have to use the plugin command or the shell one. If I well understand, we have to start first the command and again the plugin works.

I my environment, the plugin doesn't work (even after using the shell command), I also use the shell command to deploy my war.

Of course this is a little tricky to set the proxy, we have to add the following line to the command appcfg.cmd:
java -Dhttp.proxySet=true -Dhttp.proxyHost=proxy -Dhttp.proxyPort=1111 -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*


Then you can upload your application by using appcfg update target/war from the root of your grails project (the script asks for your mail but your account login is sufficient) .

Once of the most stupid things which makes me waste time if that the grails command (grails app-engine upload) asks for the google account login and password. And guess what?, you have to tape return when the script asks for your mail before entering it.
It seems this is a bug in the ant script (see JIRA)


Little stress - The 1000 files limit

I read that app-engine doesn't accept more than 1000 files. The problem is, that as soon as you use a javascript plugin (like richui) with your application, you get 1000 files without doing anything more. I've to test that point.

Next time, Two other questions: JPA or JDO and Grails 1.1.1 or 1.2mx

vendredi 17 juillet 2009

Getting Things Done

La première action issue de l'application de la méthode était de créer ce blog et essayer d'y écrire régulièrement, la deuxième était d'écrire un petit mot sur la version française de Getting Things Done, à savoir "S'organiser pour réussir".

Et bien devinez quoi, j'ai été assez déçu, j'avais déjà lu quelques résumés sur la méthode et j'avoue que le livre entier n'apporte pas grand chose de plus.
Une fois que vous avez compris qu'il faut mieux agir que ressasser les choses et que vos projets courants sont mieux gérés lorsqu'ils sont décrits dans un système externe et bien le livre est fini.
Après David Allen vous donne un pseudo mode de classement (mais qui a envie de classer sa vie sur les 5 ans à venir?) et répète les mêmes concepts avec 3 nuances pour remplir les quelques 300 pages du livre. De plus la partie très présente 'je suis un consultant, appelez moi!' est assez horripilante. En fait, ce coté bateleur renvoie de David Allen l'image du Père dans le film Little Miss Sunshine. Je vous l'accorde il mérite mieux.

Bref si la méthode vous intéresse (et elle est intéressante), allez lire les quelques pages de wikipédia sur le sujet, ensuite vous pouvez éviter le livre et accéder directement au niveau 'je gagne du temps en évitant les efforts inutiles'.