Askari and Java prototyping

The two most useful things I've found about my Rhino wrapper Askari are:

  • it gives me the easiest way I've found to quickly load, interpret and transform XML data
  • it allows me to use Java libraries without compiling Java code

Recently, I came across a nice example which allowed me to exploit both benefits. I wanted to be able to extract data from a series of web pages, but which unfortunately were being presented in HTML format rather than XHTMl.

Bringing it all together

I've always kept half an eye on the progress of the long, long, LONG awaited Perl 6, and more specifically on its cross-platform, dynamically typed VM at its base, Parrot.

One of the more exciting features of Parrot is its advanced language parsing features which make implementing a new grammar almost trivial -- the Parrot Grammar Engine (PGE). A humorous, but practical example of using PGE can be found in this LOLCODE implementation.

Yet Another Method to declare private methods and variables in Javascript

A number of people have described methods for private variables and methods within JavaScript.

In that spirit, this is another possible template. The main difference between this version and most others is that it uses the concise JSON notation for variable and method declarations.

File.Writer = File.Writer || function (filename, append, binaryMode) {  

Quality E4X articles

Unfortunately E4X documentation is very thin on the ground, even on the official Mozilla Rhino site, which has left a lot of developers either scrabbling through source code or relying on examples.

An invaluable article on the principles and practice of E4X can be found on the DevX site.

Entities in E4X

Note to self (since I keep forgetting the magic incantation) -- this is how you declare entities in E4X XML documents under Askari (my scripting-optimized version of Rhino):

js> var x = 
  <?xml version="1.0"?>
    <!DOCTYPE x [<!ENTITY nbsp '&#x20;'>]>
  <x>test&nbsp;non-breaking space</x>;

js> print(x);
test non-breaking space


What is Askari?

Askari is a custom version of the Mozilla Rhino Javascript Engine optimized for use in standalone applications and servlets. It is easily extensible either with Java libraries (SWT is bundled) or by adding to the included JavaScript library framework.

I have just released the very first public release version of the Askari system (0.1.2). It is very usable due to the maturity of the components used to assemble the system but far more still needs to be done.

Visit the Sourceforge Project site for more details.

10 rules for using REST and XML for web application

This just seems like common sense to me. But I see people building applications that break pretty much all of these rules all too often. Whatever happened to be liberal in what you accept?

Syndicate content