Lively Kernel

Last updated
Lively Kernel
Developer(s) Sun Microsystems Laboratories, Hasso Plattner Institute
Stable release
2.1.3 / April 7, 2012;11 years ago (2012-04-07)
Written in JavaScript, Qt variant adds C++
Operating system Cross-platform
Platform Apple Safari, Mozilla Firefox, Google Chrome, Opera, iPhone/iPad, Microsoft Internet Explorer pre-version 9 only with extensions, but an experimental port, needing an added web browser plug-in, is available
Available inEnglish
Type Web development
License MIT
Website lively-kernel.org

The Lively Kernel is an open-source web programming environment, developed by Dan Ingalls when he was at SAP Research. It supports desktop-style applications with rich graphics and direct manipulation abilities, but without the installation or upgrade troubles of conventional desktop applications. [1] [2] Development began at Sun Microsystems Laboratories in Menlo Park, California, and later moved to the Hasso Plattner Institute in Potsdam-Babelsberg near Berlin.

Contents

Overview

The Lively Kernel is a graphical composition and integrated programming environment written fully in the programming language JavaScript using standard browser graphics (W3C Canvas or SVG). It is thus accessible to any browser as a web page, and it begins operating as soon as the web page is loaded. It is able to edit its own code and graphics, and through its built-in WebDAV support, it can save its results or even clone itself onto new web pages. Along with its application development abilities, it can also function as its own integrated development environment (IDE), making the whole system self-sufficient with no tools except a browser.

Shapes, widgets, windows, IDE all on a Web page

The Lively Kernel uses a Morphic graphics model to add behavior to a scene graph built from browser graphics. Simple graphics are thus assembled into such standard widgets as sliders, scroll bars, text views, lists and clipping frames. A simple window system built from these widgets offers object inspectors, file browsers and code browsers. Even the rudimentary demo pages thus have the ability to edit and test new code in a simple code browser while the system is running.

Lively has been used to build simple web sites, including its own tutorial, and also a client-side Wiki system that stores its pages in a versioned repository. Content can vary from relatively static pages of text to fully dynamic models that look and behave like Adobe Flash simulations. The Lively Kernel achieves complex dynamic behavior without any specific animation support (it does not use the animation features of SVG), but by simple scheduling of multiple green-thread processes in JavaScript.

Text and transformations

The Lively Kernel includes its own multifont text editor written in JavaScript. It includes support for centering, justification and similar rudimentary text composition abilities. Working in Lively thus has much the same feel as working in a web page design program, except that the on-the-fly text layout is not being done in an offline composition program, but it is the built-in dynamic behavior of text in the Lively Kernel.

The liveliness of Lively graphics becomes even more apparent when manipulating the scale and rotation handles for objects and text. The whole code browser can be used when tilted 20 degrees on its side. Because the text editor is made up entirely of lively graphics, it works perfectly well when rotated or scaled, just as do the scroll bars, clipping frames, and the rest of the entire user interface.

Cross-browser compatibility

The Lively Kernel depends on browser support for JavaScript and SVG or Canvas graphics, all now part of the W3C standards. As of 2009, this means that it runs in Safari, Firefox, Chrome and Opera browsers.

While this requirement might seem less compatible than HTML, Lively is actually more compatible across the browsers on which it runs than is HTML. This is because there is more uniformity among JavaScript, SVG and Canvas implementations than there is from one HTML implementation to another. Except for one small initial file, the Lively Kernel code base is entirely free of tests for which client browser is being used.

As of 2011, Lively Kernel runs best in WebKit-based browsers such as Safari for Macintosh, or Chromium or Google Chrome for Windows. Running in Internet Explorer (Windows) requires Google Chrome Frame. Testing in all popular browsers is planned for the next release.

Integrated development environment

Lively includes an integrated development environment of considerable power, designed to work via WebDAV with a local set of a dozen or so source JavaScript files synchronizable with a versioned repository. If the user opens a SystemBrowser, all the JavaScript source files are listed in the file pane of the browser. If the user clicks on one of these files, it will be read, parsed (by an OMeta JavaScript parser) and displayed similar to a Smalltalk browser with functions or class definitions listed and, for each class, all the method names are shown. The user can click on a method name, edit its code in the bottom pane, and then save the new definition. The new definition will be checked for syntax and, if correct, it will be stored back in the .JS file. Moreover, if in "eval mode" (the usual case), the method will be redefined in the system that is running. This allows non-critical changes to be made without any need to restart Lively or any of the applications being developed. When all the source files are loaded, a rapid scan will find every reference to a selected text, and present all the code bodies that match in a separate sub-browser.

The Lively IDE includes object inspectors and morph style panels for controlling fills, borders, and text styles. There are also facilities for debugging at error points and profiling for performance tuning, but these have not been pushed, owing to the improving quality of such run-time support in all the major browsers.

Lively Wiki

The IDE operates on its source code files in a versioned repository to manage evolution of the Lively code base. The same approach has been used to empower users with control over active web content in the form of a client-side Wiki. Because Lively includes facilities to edit the content in its worlds (scene graphs and other content), and to store that content as web pages, a WebDAV connection allows Lively to store new versions of its page content while it is being incrementally developed. As each new version is saved, it is viewable from the rest of the Internet and prior versions can be retrieved in cases of error or change of mind. It is notable that this Wiki style of evolving web content extends to all the textual, graphical, and scripting content in Lively, as well as to any new forms that may be defined, yet without any need for a Wiki server of any kind. [3] All that is required is a server providing a HTTP WebDAV interface. Increasing amounts of the Lively Project content is now maintained in this manner.

Lively for Qt

Lively for Qt is a new implementation of the Lively Kernel in which the "kernel" parts are replaced by functionality offered by the Qt framework. [4] Lively for Qt inherits most of the basic functionality (such as the implementation of widgets, layout management, core event handling and core JavaScript support) from Qt. Lively for Qt retains the exceptionally interactive nature (the "liveliness") of the Lively Kernel, e.g., by allowing the user interface and application source code to be edited on the fly. However, in Lively for Qt the development work is performed using the familiar, well-documented APIs of the Qt platform.

Example code

// ClockMorph: A simple analog clockMorph.subclass(ClockMorph,{defaultBorderWidth:2,type:"ClockMorph",// Constructor initialize:function($super,position,radius){$super(position.asRectangle().expandBy(radius),"ellipse");this.openForDragAndDrop=false;// Do not handle drag-and-drop requests this.makeNewFace();// Construct the clock face returnthis;},// Construct a new clock face makeNewFace:function(){varbnds=this.shape.bounds();varradius=bnds.width/3;varlabels=[];varfontSize=Math.max(Math.floor(0.04*(bnds.width+bnds.height)),4);varlabelSize=fontSize;// room to center with default inset// Add Roman numerals to the clock for(vari=0;i<12;i++){varlabelPosition=bnds.center().addPt(Point.polar(radius*0.85,((i-3)/12)*Math.PI*2)).addXY(labelSize,0);varlabel=newTextMorph(pt(0,0).extent(pt(labelSize*3,labelSize)),['XII','I','II','III','IV','V','VI','VII','VIII','IX','X','XI'][i]);label.setWrapStyle(WrapStyle.SHRINK);label.setFontSize(fontSize);label.setInset(pt(0,0));label.setBorderWidth(0);label.setFill(null);label.align(label.bounds().center(),labelPosition.addXY(-2,1));this.addMorph(label);}// Add clock hands this.addMorph(this.hourHand=Morph.makeLine([pt(0,0),pt(0,-radius*0.5)],4,Color.blue));this.addMorph(this.minuteHand=Morph.makeLine([pt(0,0),pt(0,-radius*0.7)],3,Color.blue));this.addMorph(this.secondHand=Morph.makeLine([pt(0,0),pt(0,-radius*0.75)],2,Color.red));this.setHands();this.changed();},// Set clock hand angles based on current time setHands:function(){varnow=newDate();varsecond=now.getSeconds();varminute=now.getMinutes()+second/60;varhour=now.getHours()+minute/60;this.hourHand.setRotation(hour/12*2*Math.PI);this.minuteHand.setRotation(minute/60*2*Math.PI);this.secondHand.setRotation(second/60*2*Math.PI);},// Will be called when the ClockMorph is placed in a world startSteppingScripts:function(){this.startStepping(1000,"setHands");// once per second }});

Related Research Articles

Multiple-image Network Graphics (MNG) is a graphics file format, published in 2001, for animated images. Its specification is publicly documented and there are free software reference implementations available.

Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium since 1999.

gnuplot Command-line and GUI plotting program

gnuplot is a command-line and GUI program that can generate two- and three-dimensional plots of functions, data, and data fits. The program runs on all major computers and operating systems . Originally released in 1986, its listed authors are Thomas Williams, Colin Kelley, Russell Lang, Dave Kotz, John Campbell, Gershon Elber, Alexander Woo "and many others." Despite its name, this software is not part of the GNU Project.

In HTML and XHTML, an image map is a list of coordinates relating to a specific image, created in order to hyperlink areas of the image to different destinations. For example, a map of the world may have each country hyperlinked to further information about that country. The intention of an image map is to provide an easy way of linking various parts of an image without dividing the image into separate image files.

WebKit is a browser engine developed by Apple and primarily used in its Safari web browser, as well as all web browsers on iOS and iPadOS. WebKit is also used by the PlayStation consoles beginning from the PS3, the Tizen mobile operating systems, the Amazon Kindle e-book reader, Nintendo consoles beginning from the 3DS Internet Browser, and the discontinued BlackBerry Browser. WebKit's C++ application programming interface (API) provides a set of classes to display Web content in windows, and implements browser features such as following links when clicked by the user, managing a back-forward list, and managing a history of pages recently visited.

Cairo (graphics) Vector graphics-based software library

Cairo is an open-source graphics library that provides a vector graphics-based, device-independent API for software developers. It provides primitives for two-dimensional drawing across a number of different back ends. Cairo uses hardware acceleration when available.

A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and extra scriptability.

<span class="mw-page-title-main">XMLHttpRequest</span> Web API to transfer data between a web browser and a web server

XMLHttpRequest (XHR) is a JavaScript class containing methods to asynchronously transmit HTTP requests from a web browser to a web server. The methods allow a browser-based application to make a fine-grained server call and store the results in XMLHttpRequest's responseText attribute. The XMLHttpRequest class is a component of Ajax programming. Prior to Ajax, an HTML form needed to be completely sent to the server followed by a complete browser page refresh.

A number of vector graphics editors exist for various platforms. Potential users of these editors will make a comparison of vector graphics editors based on factors such as the availability for the user's platform, the software license, the feature set, the merits of the user interface (UI) and the focus of the program. Some programs are more suitable for artistic work while others are better for technical drawings. Another important factor is the application's support of various vector and bitmap image formats for import and export.

The canvas element is part of HTML5 and allows for dynamic, scriptable rendering of 2D shapes and bitmap images. It is a low level, procedural model that updates a bitmap. HTML5 Canvas also helps in making 2D games.

This is a comparison of web frameworks for front-end web development that are heavily reliant on JavaScript code for their behavior.

Animation of Scalable Vector Graphics, an open XML-based standard vector graphics format is possible through various means:

<span class="mw-page-title-main">Origyn Web Browser</span> Discontinued web browser

Origyn Web Browser (OWB) is a discontinued web browser that was synchronized with WebKit and sponsored by the technology company Pleyo. OWB provides a meta-port to an abstract platform with the aim of making porting to embedded or lightweight systems faster and easier. This port is used for embedded devices such as set-top boxes, and other consumer electronics.

<span class="mw-page-title-main">SVG-edit</span>

SVG-edit is a web-based free and open-source vector graphics editor. It can be used to create and edit Scalable Vector Graphics (SVG) images from within a web browser, not requiring additional software installation.

<span class="mw-page-title-main">Google Swiffy</span> Software tool that converted SWF files to HTML5

Google Swiffy was a web-based tool developed by Google that converted SWF files to HTML5. Its main goal was to display Flash contents on devices that do not support Flash, such as iPhone, iPad, and Android Tablets. Swiffy was shut down July 1, 2016.

<span class="mw-page-title-main">Three.js</span> JavaScript library for 3D graphics

Three.js is a cross-browser JavaScript library and application programming interface (API) used to create and display animated 3D computer graphics in a web browser using WebGL. The source code is hosted in a repository on GitHub.

D3.js is a JavaScript library for producing dynamic, interactive data visualizations in web browsers. It makes use of Scalable Vector Graphics (SVG), HTML5, and Cascading Style Sheets (CSS) standards. It is the successor to the earlier Protovis framework. Its development was noted in 2011, as version 2.0.0 was released in August 2011. With the release of version 4.0.0 in June 2016, D3 was changed from a single library into a collection of smaller, modular libraries that can be used independently.

<span class="mw-page-title-main">KDE Gear</span> Set of applications and supporting libraries

The KDE Gear is a set of applications and supporting libraries that are developed by the KDE community, primarily used on Linux-based operating systems but mostly multiplatform, and released on a common release schedule.

This is a list of articles related to the JavaScript programming language.

References

  1. Ingalls, Daniel; Palacz, Krzysztof; Uhler, Stephen; Taivalsaari, Antero; Mikkonen, Tommi (2008). "The Lively Kernel a Self-supporting System on a Web Page". Self-Sustaining Systems. Lecture Notes in Computer Science. Vol. 5146. pp. 31–50. doi:10.1007/978-3-540-89275-5_2. ISBN   978-3-540-89274-8.
  2. The Lively Kernel Application Framework
  3. Lively Wiki A Development Environment for Creating and Sharing Active Web Content, Krahn Ingalls Hirschfeld Lincke Palacz, WikiSym ’09, October 25–27, 2009
  4. Lively for Qt: A Platform for Mobile Web Applications, Mikkonen Taivalsaari Terho, Mobility 2009, Sep 2-4