ActionsScript 3: Calling nonexisting methods

I have been wondering all along how it is possible to call a method that is not defined anywhere in that class and get something reasonable done, e.g. the method on the Cairngorm delegate that conducts the call to the server.

After playing around with Grails I became aware of the fact that this mechanism is used extensively not only in Grails but in other frameworks that are based on dynamic languages such as Ruby on Rails.

This great blog entry on flexonrails.net lifts the veil and explains the magic.

Grails App-Engine deployment

When deploying a new version of my application (actually I started an entire project from scratch) I continuously bounced my head against this  “You don’t have the permission…” exception.

I finally added the following lines to my Configuration/config.groovy file:

google.appengine.application=”myproject”
google.appengine.email=”myname@gmail.com”
google.appengine.password=”XXX”

where myproject is the part that appears in the url, like myproject.appspot.com.

Google App-Engine, Grails and Security

Here are the directions for a patch in a great Screencast by Tomás Lin that makes authentication work  in a Grails Application on Google’s App-Engine:

google.appengine.sessionEnabled = true // default true
google.appengine.enableSsl = true // default true
google.appengine.security.useHttps = ["/secure", "/shoppingcart/*", "/admin"]
google.appengine.security.requireAdmin = ["/admin", "/notsecuredadmin"]
google.appengine.security.requireLogin = ["/admin", "/", "/yabbadabbadoo"]

Don’t forget to apply the securePatch.diff patch to the plugin directory of your project – that is in <home>.grails/1.1.1/projects/myproject/plugins/app-engine-0.8.1 in order for these properties effectively written to the web.xml file.

Google App-Engine and Grails Dynamic Methods

A blog entry about running grails on Google’s App Engine. Among other things the methods that are provided by the App-Engine plugin are listed.

The added domain class MetaClass methods are:

  • save
  • get
  • delete
  • findAll
  • withTransaction
  • withPersistenceManager (to execute code with access to the PersistenceManager)
  • isJdoPersistent, isJdoDeleted, isJdoDetached, isJdoDirty, isJdoNew, isJdoTransactional, getJdoTransactionalObjectId, getJdoVersion, getJdoObjectId, and jdoMakeDirty corresponding to the JDOHelper methods isPersistent, isDeleted, isDetached, isDirty, isNew, isTransactional, getTransactionalObjectId, getVersion, getObjectId, and makeDirty

Controllers have these attributes added to their MetaClass:

  • params (with Request attributes like in Grails)
  • session
  • request
  • response
  • servletContext

Grails Google App Problem

When generating a Google AppEngine complient web app in Grails, there is a mistake in the MyApplication/target/war/WEB-INF/datastore-indexes.xml file which causes the shell script

$APPENGINE_HOME/bin/appcfg.sh

from doing its job properly and eventually prevent you from deploying your application to the appengine.

You have to go into the datastore-indexes.xml file and remove the following line:
xmlns=”http://appengine.google.com/ns/datastore-indexes/1.0

Thats it…

Google AppEngine Data Store explained

Since the Data Store behind Google’s AppEngine is not a relational database I have been wondering all along how to manage one-to-many and many-to-many relationships. This links to the Java documentation:

http://code.google.com/appengine/docs/java/datastore/relationships.html

And here are some well explained examples in Python:

http://arbingersys.blogspot.com/2008/04/google-app-engine-one-to-many-join_26.html

http://arbingersys.blogspot.com/2008/04/google-app-engine-many-to-many-join_28.html

http://arbingersys.blogspot.com/2008/04/google-app-engine-better-many-to-many_30.html

Connecting NetBeans 6.7 to SVN on Ubuntu

These are the steps I had to take to establish a connection from within NetBeans 6.7 to my Subversion Repository via a https connection.

Install svn -> sudo apt-get install svn
Install an svn client, I chose RapidSVN -> sudo apt-get install rapidsvn
In NetBeans select Team > SVN>Check out… and fill in the Form. The path to the RapidSVN executable is /usr/sbin.
Restart NetBeans and you should be able to proceed in the wizard.

Mercurial and SSH-2 DSA on Windows XP

After installing Mercurial and TortoiseHG on Windows XP I subscribed to the SCM Hosting provider Sourcerepo.com and so far I am very pleased with their service. The subscription process was straight forward, the repository usable within minutes after subscribing and all of that for a very affordable price, I might add.

I had fun exploring Mercurial as a next generation distributed source code management system – until I hit that SSH wall, that is.  So here is a short description how to configure SSH on Windows XP:

  1. Download and install putty-0.60-installer.exe.
  2. Fire up the  PuTTY Key Generator, chose SSH2-DSA and fill in the form.
  3. Save the private key to a file.
  4. Copy the public key as it appears in the text area field (including the first line) to the server.
  5. Start up Pageant – if its running, an icon with a computer wearing a heat is visible in the system tray. Right-click on that icon and select “Add Key”.
  6. Tell Pageant where to find your private key.
  7. Append the follwoing line to the [ui] section of your .mercurial.ini file:
    ssh="/path/to/plink.exe" -ssh -i "/path/to/your/private/key"

Done! You should be able to clone and push to your server.