Monday, August 27, 2007

Links relating to Curl 5.0 as RIA + CSPD

Client-side persistent data or CSPD may be out of favor in the current "I'm OK, stateless's OK" buzz but I like the 'public library' model: I return a book and the only record of my having borrowed it is my own record. Just try to sell that to the Barnes&Noble / Borders / Amazon / BlockBuster / BestBuy / NetFlix "we've got your number crowd". The more radical option is the 'purchase' card whose record does not belong to a bank or credit card conglomerate: I pick the 'bank' for transactions based on interest rate. Talk about competition! Having data 'client-side' need not mean 'local to this box' but rather, "not on your server". On this model your medical records would not be held by doctor PA's, hospitals or insurers. And your privacy could be in much better hands. Ok, I'll give it a REST ...

But my links to Curl which are not links to cURL are slowly coming alive ... and Curl is CSPD friendly. It has not yet seen that client-side 'store' should be opaque to the server, but it may get there. Not middleware. Call it 'periware' and 'exolayer'.
Buy a book at Borders and then go borrow a book at your library. Now make a return at each (don't cheat and read that new book!) Now ask where your medical records belong ( "we know you are in pain, but we need at least 24 hours notice to have your records sent up." I only had to hear it once.)
Having my records at my beck-and-call does not mean that I can 'access' them. It means that I decide who can access them short of a court order. And when. And where. And that is just my medical records.
The fine print on your savings account book may explain that your money is not always available for withdrawal. And in some countries you pay to have an account and fill out forms to make any withdrawal. PayPal is as foreign to those 'service' banks as is client-side data in the current praise for HTTP.
Many years ago, when TCP/IP turned 15, we were asking when the protocol would be replaced altogether. About the same year as we asked 'Is this the year of Unix?' Perhaps the year that I finally see overhead wires go underground, I will see the system of record no longer be the central system, but the peripheral system. Periware. Exolayer. The Exonet, adumbrated. How apposite.

Friday, August 24, 2007

Rebol dialects and Groovy builders

I am working on a blog post over at eclectic-pencil on DSL (domain-specific languages) in Rebol and Groovy. It is an area that the folks at PDC Prolog got into a few years back and that I first explored using Java + Amzi! Prolog with DCG's in Eclipse. I hope to get a piece up on Groovy and categories as mix-ins in comparison to exploring categories and protocols in Logtalk. In the meantime there is a great deal of activity on the SWI-Prolog mailing list often relating to their Java programming interface. And Plone has a new release just as I wait for Rebol3. And I have a new version of the Curl 5.0 Web SDK to check out. And the MindTouch Deki-Wiki up on VMWare as I watch for the Gemstone/S + Seaside beta. Too much!
My opinion of the out-of-print 'Official Guide' to Rebol 2.3 keeps improving: I wish I could say the same of Manning's 'Groovy In Action' or the APress 'Grails' book. Neither of my favorite bookstores had 'Programming Groovy' on the shelves, which might have been a better choice than the former. Of course there is no book on Logtalk to recommend ... yet.

Sunday, August 12, 2007

Documenting a Curl Surge Lab Interface class

Surge Lab had been marketed as the name for the Curl IDE. The IDE has a feature that you may recognize if you use eclipse or Aptana: you can flip from one perspective to another. But the IDE gives only a glimpse of Curl interaction for the developer because, like Smalltalk Seaside 'halos' on a web page, Curl offers a Ctrl-Right-Click which opens text and graphic inspectors on objects embedded in a 'live' web page.

The ctrl-right-click pop-up menu includes viewing and editing the Curl source, inspecting objects and both 'Start Profiling' and 'Start HTTP Monitoring'. (Curl also offers test-coverage tools for HP's Mercury QTP.)

The inspectors are toolbar driven and almost feel like a Smalltalk object inspector becuase one toolbar item is 'Evaluate' which is just like the JavaScript popup in FireFox developer tools. Unfortunately, the inspectors lack some features of a typical Smalltalk inspector. The first that I would add to be Curl-ish would be a 'select-text-F1' event-handler to get the fine Curl doc viewer to popup.

What I will do this morning is include a Curl snippet of what you might browse in such a popup; it demonstatrates how the doc viewer is driven.

The following snippet is copied from

I:\Curl RTE\Surge\6\ide\editor-interface
EditorInterface.scurl
Snippet:
{doc-next
{purpose
This class defines the interface that an editor must support
to be integrated with Surge Lab.
}
{details
An external editor needs to implement this class, and define
a top-level variable named {monospace surge-lab-editor} which
is an instance of its implementation of this class.
}
}
{define-class public open abstract EditorInterface

{doc-next
{purpose
Initialize the editor.  An interface back to Surge
Lab is provided for the editor.
}
}
{method public open abstract {initialize
surge-lab-interface:SurgeLabInterface
}:void
}

The behavior of the default Curl editor is not my favorite side of Curl at the moment: high-lighting a '{' offers a context popup to view the '{' in a class browser instead of the handy behavior when you add a '}' which is to blink the matching '{' in red.
Adding a '}' and then placing a CR in front has the disconcerting behavior of aligning the '}' with the matching '{'. This is annoying if it is your habit to end a line using a 'do' with an opening brace ( as required by many script interpreters such as Tcl and which is {script-style} for many programmers.)

But the little annoyances in the default editor come to nothing because there is an interface for external editors.

Over at eclectic-pencil I will add a page with a working HTML example of an embedded Curl {example} macro using a TreeControl object. Install the plugin and Ctrl-Right-Click. Cool.

Tuesday, August 7, 2007

GRAILS and Groovy tip

If you try out groovy Grails on Windows as an open-source web application framework, I suggest you install it as a sub-directory of your Groovy directory.
You will want to knwo that your groovy is running fine: in my case I added
set CLASSPATH=I:\groovy-1.0\groovy-1.0.jar;%CLASSPATH%
to my groovy-1.0\bin\groovyConsole.bat I also have three ENV variables defined: GROOVY_HOME, GROOVY_JAR and GRAILS_HOME and both HOME var's are in my path with \bin appended to them.

With that done, you can go into the Grails bin and edit the
grails.bat
I think that there is no point avoiding at least this much:
set CLASSPATH=
because even with my own classpath tool it is just too much grief. Grails does not need your classpath but having one is a problem. The top of my grails.bat now reads
REM set groovy_home=I:\groovy-1.0
REM set GRAILS_HOME=%GROOVY_HOME%\grails-0.5.6
REM set path=%groovy_home%\bin;%grails_home%\bin;%PATH%
REM set GROOVY_JAR=groovy-1.0.jar
set classpath=
To test that things are running start in the grails\bin with
grails help
which should run error-free and list the grails commands. From there you should be OK following the Grails Quick Start steps. Until help comes up error-free, you have an issue.

One last tip: Grails will create your web app root directory in the directory you are in at the time you execute
grails create-app
which in my case is running
I:\groovy-1.0\grails-0.5.6\scripts\CreateApp.groovy
so you do not want to be in .\grails\bin on your command line. If you have not installed the Microsoft Power Toy Open Command Window which launches CMD.exe from any folder in the file explorer, you will want to do so ... whether you are using Grails or Rails without an IDE.

RIFE-Jumpstart

RIFE is such a terrific example of using continuations in a web application framework that it is too bad if giving it a try has glitches from the get-go.
The RIFE-Jumpstart will use Jetty so you will want to go into the Jetty subfolder and edit the jetty.xml such that the port value is something other than 8080. After that you will reach RIFE as something like
http://localhost:28282
You simply must confirm that your OS has the JAVA_HOME env variable set to a JDK. I am using RIFE for Java5 so mine set to
i:\java5\jdk
I tried using my own ClassPath tool from LogiqueWerks to get around this by being sure to hit the right tools.jar and javac.exe but I could not escape
class file has wrong version 49.0, should be 48.0
when launching from the RIFE-JUMPSTART directory with
ant run
This also means that you must have ant in your path.
It is annoying that most HTTP frameworks install without politely asking for an alternative to port 8080. OracleXE and SUN Application Server are the latest to do this to me.
There are some good video podcasts on RIFE - one at Google is about an hour long.
If I add some RIFE pages they will be over at eclectic-pencil.com Useful links include rifers.org and a Confluence link on DWR.