www.migniot.com

The experiments of a geek

Jan. 31, 2015, 12:04 p.m.

The experiments of a drunken monkey

This post is about

For the impatient : [1] [2] [3]

At first I wanted to forge a legend, because the principles explained thereafter deserve a good exposure and a long annotated explanation. Let's just get to it :

After revieweing the works of Raymond Smullyan on self-replication, a long time ago I decided to implement a self replicating page.

Believe me, self-replication is this blog's important and central point.

Demonstration

Give me something to click on

Have a look at http://sling.migniot.com/Editor/Replicant_v4.html :

http://migniot.com/static/www_migniot_com/replicant_1_drag.png
  • Open it
  • Drag and drop files
  • Click save

The Replicant page is a zip-like file. Now that you opened it you both have

  • The source code of my Replicant project
  • A simple HTML document for holding zip entries
  • An HTML5 application capable of extension, notably storing and evaluating new javascript plugins
http://migniot.com/static/www_migniot_com/replicant_2_save.png

As a self-saveable file, this zip Replicant can be your everyday zip & mail tool.

Concepts

The "Replicant" has the following properties

  • It contains a static view of the (required) data
  • It is modifiable at runtime
  • It contains code to interact with the static view
  • It is serializable

Those properties allow such proof-of-concept demonstrations like the original Replicant

http://migniot.com/static/www_migniot_com/replicant_3_source.png

Generalization

Now that we have a "document application", we can imagine

http://migniot.com/static/www_migniot_com/replicant_5_editor.png
  • A self modifying diagraming application - see below

  • An excel-like sheet that produces graphs and filtering on the fly using the excellent http://d3js.org

    Which I let as an exercise for the reader [REF: ex1]

UML, a primer metapackage

Let's now move to http://sling.migniot.com/Uml/index.html

http://migniot.com/static/www_migniot_com/replicant_4_uml.png

As you may notice, this page contains UML diagrams, which is more visible in the source directly - custom tags may puzzle you if you're not familiar with the current specification.

http://migniot.com/static/www_migniot_com/replicant_7_source.png

This is the first version of http://sling.migniot.com/Uml/editor.html . This document-application "Replicant" fulfills the following needs :

  • always contain a static view of the data in the form of <uml-class /> and other tags
  • incorporate a polyfill for those custom tags for rendering
  • statically when possible, dynamically for links between classes
  • allow drag-and-drop and edition by simple text or from eclipse (see below)

So you have

  • A uml editing tool in one page
  • While still retaining the zip behaviour (remember ?)
  • Plus the source code

Notice the LGPL behaviour introduced by only such things as maths - guru meditation

Eclipse and uml diagrams on the fly

  1. Open the one-liner shortcut http://sling.migniot.com/Uml/editor.html
  2. Now click on the text icon (3rd one) and enter the name of the class on top, followed by ENTER
  3. Go in eclipse, select some attributes and functions in the outline view. Press CTRL-C
  4. Go to the browser and in the textarea, Press CTRL-V
  5. Finish by a newline with a single DOT at the end (ENTER [.])
  6. Watch the class appear
http://migniot.com/static/www_migniot_com/replicant_6_umldesign.png
  1. When attributes are of already entered type, the link is materialized
  2. Now press on the 4th icon to generate

8.1 a zip file

8.2 containing a pom.xml file

8.3 able to start a CRUD server for your model using

8.3.1 mvn clean install tomee:run

8.4 which you unzip in eclipse, run and then go to

  1. Go to http://localhost:8080/admin/ to begin entering data
http://sling.migniot.com/Uml/replicant_8_run.png
  1. And now write an export template for [REF: ex1]

Such an implementation now exist, see This article

Final point

This blog was started

Then exported to a Replicant editor document

  • Published as is to the blog address you're reading now
  • And sent to a mailing list of involved users.

For reading till the end, thank you:

We are Penguins. Resistance is futile. You will be assimilated.
 omedeto. ^^