Saturday, September 26, 2009

Custom Classes In GI

A few notes about creating classes in General Interface:
  • Each class gets its own .js file. The name of the file (less the extension) is the name of the class.
  • Use a call to static method jsx3.lang.Class.defineClass to define a class. The first parameter is the name of the class as a string. It can include package-like qualification, but the qualification doesn't actually have to correspond to the location of the .js file. All that matters is that the unqualified name of the class matches the name of the .js file. The second parameter is a reference to the super class and the third parameter is an array of references to implemented interfaces; use the null keyword if either one of these parameters is irrelevant. The forth parameter is a function that declares the class.
  • The function that declares the class must receive two arguments. The first is an object to be used as a prefix when declaring static members in the body of the function; the second is for instance members.
  • Within the body of instance methods, use the this keyword to reference the instance. Use the unqualified name of the class to reference static members.
  • A method named init is required; this acts as the constructor, i.e. it is called for each instance at the time it is created. If there is a superclass (other than the default, jsx3.lang.Object), it's constructor must be called from within init. This can be accomplished by calling the standard jsxsuper() method of the instance, passing any arguments needed by the constructor.
  • Declare an instance of the class by using the new keyword followed by the fully-qualified name of the class, followed by arguments to the constructor wrapped in parentheses. For example:
var ratingControl = new gui.ImageButtonGroup();


Monday, September 14, 2009

Upgrade to Google App Engine 1.2.5

My primary interest in upgrading to the new release is a Windows version of Google App Engine Launcher, which has been available on the Mac side for a long time. Unfortunately, I got a message about the installation failing because of error 2908.

After some Googling, I found a solution. First, I ran the installer again and selected the "remove" option. Second, I launched RegEdit (Start > Run... > regedit) and deleted this "key" (folder):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\
Installer\UserData\S-1-5-21-1123561945-1935655697-1060284298-1003\
Components\AD95649F068525549B26938D7D18FEA7

Finally, I reinstalled GAE. No errors this time. But when I launched Google App Engine Launcher from the Start menu, I received a different error:




An uninstall using Add/Remove Programs followed by another install didn't help. I looked in the referenced log file and found this:

wxPython is not available
wxPython is not available
wxPython is not available
wxPython is not available
wxPython is not available

A little research suggested wxPython is a GUI library for Python upon which the GAE Launcher is built, so I downloaded and installed it (I selected the Win32 version for Python 2.5). But kept getting the same errors.

More research. MSVCP71.dll does not appear to be part of wxPython; instead it's a standard Microsoft C library, one that ships with many different pieces of software. It appears, though, that sometimes software developers forget to include it because it's almost always present on Windows machines.

I downloaded the DLL from DLL-Files.com and copied it to C:\Windows\system32. Ta da! Google App Engine Launcher is up and running! Maybe I didn't need to install wxPython after all?

Within a couple minutes I had added my application and was up and running.