on the Curl Web Content Markup Language

on the Curl Web Content Markup and Programming Language from www.curl.com and www.curlap.com

Wednesday, June 27, 2012

Curl versus prototype.js

Here is what the prototype.js site suggests:

var Person = Class.create({
  initialize: function(name) {
    this.name = name;
  },
  say: function(message) {
    return this.name + ': ' + message;
  }
});

var Pirate = Class.create(Person, {
  say: function($super, message) {
    return $super(message) + ', yarr!';
  }
});

Here is my Curl equivalent

{define-class public Person
  field public-get private-set name:String
  {method public {say msg:String}:String
    {return {String self.name, ": ", msg}}
  }
  {constructor {default name:String}
    set self.name = name
  }
}

{define-class public Pirate {inherits Person}
  {constructor {default name:String}
    {construct-super name}
  }
  {method public {say msg:String}:String
    {return {String {super.say msg}, ", yarr!"} }
  }
}

Now here is my naive test code:
{output {{Pirate "Long-John"}.say "ahoy matey"}}
and here is the output:
Long-John: ahoy matey, yarr!

Note the lack of sigil's, var's and strange parenthetical matings.
But Curl also has 3D graphics and 2D paths and db interfaces and an IDE ... and now generates Android app's. Oh ... and a debugging environment with graphical inspectors and color outline  and fill debug inspection highlighters ... and is almost Smalltalk-ish LISP.
And from the same DARPA project as WWW.  SCSK Curl  (formerly MIT Curl).
Did I mention multiple inheritance? Mix-in's ? Anonymous proc's? Async workers?

{after (10s * long-wait) do
   {more-than-HTML-JS-lib for-the-web}
}
|| public classes, library classes, packages, imports, includes, macros, enums, Array-2-of
|| abstract classes, final classes, sealed classes, shared, serializable,deprecated,open ...

Tuesday, June 19, 2012

Kanji of the Day


Because a collection of Curl objects underlies the Kanji by Grade pages at http://www.aule-browser.com/kanji/kanjidic2-grades.html the pages now have a Kanji of the Day feature with only a minimal change (a variable's value replaces a character literal and a procedure is called with two integers to delimit a safe and reasonable range.)

The Kanji character for the session is placed as the default in the search text field. A student clicks the 'Find' button to jump to the definition for that Japanese kanji character.

Within the applet, the kanji character is found by using a factory method on the class Random and a seed from a DateTime instance. The instance of a Random type is likely LinearRandom as Random is itself an abstract  class.

The same class declaration 'scurl' file is included by all of these kanji-by-grade applets.

Note: I also generalized the search function today by using one more instance of GuiMark.




Sunday, June 17, 2012

Find a haiku: GuiMark and TextSearchPattern


It was time to put a search panel into the views of Bashō haiku, so that was done today using the Curl GuiMark facility and the TextSearchPattern class.

What you see below is ぬ夜の雪 entered into the TextField next to the FIND button and the ScrollBox has scrolled down to place that poem at the top of our view.


This will now be the norm for these Curl applets on the web pages at aule-browser.com

Note added June 19: this is now generalized as a search using rotating GuiMark's.


Friday, June 8, 2012

Kanjidic2 Japanese kanji by School Grade

There is a new set of 12 Curl applets for studying Japanese kanji this morning.

They are linked at http://www.aule-browser.com/kanji/kanjidic2-grades.html

Here is a snapshot of the applet for combined Grade 9 and Grade 10 Japanese kanji from kanjidic2 with meanings and both on and kun readings in katakana and hiragana:


These pages require the MIT Curl Surge RTE browser plug-in from www.curl.com

Monday, June 4, 2012

Varying Joyo kanji order of presentation

re: varying the order of presentation of Joyo kanji definitions without edits of the text original

By using the serialization technique of my last note, the pages from Kanjidic2 can be varied in their order without touching the text original or using a DB.

A Curl applet could use SQLite, MySQL or JSON to achieve the same, but this varying order of presentation can also be accomplished using just the one web language, namely, MIT's Curl from www.curl.com

serialization of an off-line text resource


To see the effect of my Curl serialization effort look at the speed of the small daily pages such as http://www.aule-browser.com/kanji/poets/basho-mee-indexed.html

The new daily page generated fast and it loads very fast. I have already cycled twice through the BIN serialization files as I find minor transcription errors in the principal text resource - but that text resource now does not need to reside on the applet web server !

Here is a snapshot for 見





Sunday, June 3, 2012

serialization for text source integrity


I now have a Curl applet up using only serialized data as the source - this will make all of the "Learn Kanji" applets faster hereafter and help keep my fingers off my input text source !

The applet uses the {deserialize } macro to load its data and does not reach the original source.

The approach will result in much faster "kanji of the day" applets using the Basho Haiku as their learning resource as no iteration through the data will occur at load time and the applets are one degree away from the vulnerable source.

This will be even more significant when working with no SQL and no JSON for the large JMDict Japanese resource as well as the smaller Kanjidic2 and its Edict2.

Entire arrays are serialized with a simple call to a stream to write one object.  The object classes are declared as serializable and all affected fields have at least a default value.

The result is that my own annotations are kept independent of the source file.

I may turn this same approach to an applet for viewing the tags in my 9000+ Firefox booksmarks so as to avoid both HTML and JSON.

Here is a snap: