Saturday, March 15, 2008
Excellent video: Dan Ingalls demos Lively Kernel at Google
The demonstration on the video is both impressive and serves as documentation if you want to experiment with the Lively Kernel yourself. As it is, the Lively Kernel is a good prototype but if the performance is improved a bit and the programming environment and IDE (which is like Squeak Smalltalk, only for Javascript) continues to improve, then Lively Kernel is on my (personal) radar for something that I will use in the future.
I remember getting a Xerox 1108 Lisp Machine in 1982 and I also wanted the optional Smalltalk environment which was not in the budget. However, a sales engineer at Xerox did let me use Smalltalk for a month on a trial basis. It is amusing to be able to get a smalltalk like programming environment like Lively Kernel for free that is hosted in a web browser. Something about Moore's Law and also about free software projects...
Off course, by far the best free Smalltalk experience is Squeak but Lively Kernel is still very cool, if only for its possible future use of quickly writing web interfaces using existing web services, etc.
Labels: Javascript, Smalltalk
Thursday, February 21, 2008
Heavy weight Javascript client applications vs. lighter weight AJAX
The big problem, as I see it, of client side Javascript frameworks is issues of maintainability. I have worked with Javascript heavy web applications that other people originally wrote and they are definitely much more difficult to jump into, understand, and modify compared for example to AJAX heavy Rails applications or GWT web applications.
That said, there is something tidy about the idea of writing web applications in two intertwined but separate tasks:
- Writing JSON web services and separately unit testing them
- Interactively developing the client side with a framework like Mjt
Labels: Javascript
Thursday, May 31, 2007
Google Gears: a sea change for web applications?
Labels: AJAX, Javascript, web applications
Tuesday, April 03, 2007
Interesting way to build rich client web applications: mjt
The freebase developers have released the mjt Javascript template library under a BSD-like license. This library enables you to write rich client applications based on web services that return JSON data. It takes more than a few moments to get used to the idea of client side templates but if you are used to server side tools like Java Server Pages (JSP), etc., the ideas are similar. I have done nothing with mjt (so far) except for reading the documentation and playing with the demos, but my first impression is that mjt would be very useful for developing web applications using back end services that are implemented in several languages/platforms that accept REST requests and return JSON.
I have been getting very comfortable with Javascript in the last year. I wrote an AJAX enabled web application for my customer yesterday and today using Common Lisp on the back end with client side implemented as Javascript, CSS, and HTML - a nice combination of REST web service calls to process AJAX calls and Lisp code to generate HTML as needed. If I was already fully up to speed on mjt, a reasonable alternative would have been to limit the back end Lisp code to just providing the REST web services and serving up static content. Anyway, mjt is well worth looking into.
Labels: Javascript
Monday, February 12, 2007
Java + AJAX in 18 lines
<form id="myForm2">The follow is a trivial server side JSP ajax_search.jsp that does nothing but returns the original query as an HTML snippet:
<input type="text" id="input_test_form_text" />
<input type="button" value="Search" onclick="getS()" />
</form>
<div id="searchresults"></div>
<script type="text/javascript" src="prototype.js"></script>
<script>
function getS() {
var params = 'query=' + $F('input_test_form_text');
var x = new Ajax.Updater('searchresults', '/ajax_search.jsp',
{method: 'get',parameters: params});
}
</script>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String req = request.getParameter("query");
out.println("<p>request for 'query' is:" + req + "</p>");
%>
Labels: AJAX, Java, Javascript, JSP
Wednesday, February 07, 2007
Heavy weight Javascript + AJAX vs. very light weight CSS + DHTML
After dinner last night, I re-wrote the web UI for my current commercial development project using minimal CSS, HTML, and a small amount of Javascript - although switching work contexts now requires fetching more resources from the server, the amount of data transfer is minimal and the web app is still very responsive, even factoring in slower network connections.
I have looked at Open Lazlo and other heavy weight client frameworks - they look great, but for someone like me whose primary work does not involve building web applications, I like reducing my own learning curve by choosing technologies that cover all of my requirements and simply using them unless some far more compelling comes along.
Labels: AJAX, CSS, Javascript
Sunday, January 28, 2007
True confession: programming in Javascript and loving it
I find HTML's DOM model to be unpleasant to work with, but Javascript the language is fun to use. I have been using the Dojo toolkit a lot lately and the authors of Dojo have done a fine job of building a platform that insulates programmers from the hassles of DOM and browser incompatibilities.
I am currently working on another AI book (using Ruby for the examples) but I would enjoy later writing a Javascript book from my own perspective (a developer who wants to use the same Javascript skill set when developing using Ruby on Rails, Java, Common Lisp, etc.).
Labels: Javascript
Saturday, January 20, 2007
Using the Dojo Javascript library in Ruby Rails
public/Again, the "src" directory contains the dojo source files (besides the dojo.js loader). Dojo will complain about rendered Rails web pages withot HTML and HEAD tags, so I added the following HTML with Dojo setup to the view for my main application controller:
javascripts/
dojo.js
src/
<html>Dojo is definitely "heavier weight" than the prototype.js Javascript library that is provided with Rails so you may not want to use Dojo for very high traffic sites.
<head>
<title>KBSportal KnowledgeManagement</title>
<script type="text/javascript">
djConfig = {isDebug: true};
</script>
<script src="/javascripts/dojo.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("dojo.io.*");
dojo.require("dojo.event.*");
dojo.require("dojo.widget.TabContainer");
dojo.require("dojo.widget.LinkPane");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.widget.LayoutContainer");
dojo.require("dojo.widget.Checkbox");
</script>
<style type="text/css">
body {
font-family : sans-serif;
}
.dojoTabPaneWrapper {
padding : 10px 10px 10px 10px;
}
</style>
</head>
Labels: AJAX, Javascript, Lisp, Ruby Rails
Saturday, November 25, 2006
AJAX tools for multiple development platforms
I have spent many evenings playing around with various release versions of the Google Web Toolkit (GWT) and it is very compelling, especially if you already are used to developing GUI applications in Java - the only new wrinkle worth mentioning is getting used to handling events asynchronously. The problem with GWT is that it really does tie you to the Java platform. I spend most of my time developing AI applications, but that said, who does not want basic knowledge and competence at building web applications?
I use Common Lisp, Java, and Ruby for development, so for the occasional AJAX tasks that I have, I have settled with the well respected dojo Javascript toolkit because it plays very well with both Lisp and Java JSP based web applications. Dojo is also easy to use with Rails, if you want an alternative to Rail's great AJAX support.
By using Dojo, I basically have to deal with just one learning curve no matter what platform I am developing on. Here is a simple example for a JSP page (assuming that this would be more interesting to most people than a Lisp example):
Add this to your <head> section on a top level JSP page:
Then try putting this somewhere on your JSP page (note: this assumes that you have another JSP page ajax.jsp that gets the form values and returns content to be placed into the DIV element with ID=ajxplydiv. Anthing that ajax.jsp writes using out.print() gets inserted asynchronously into the "ajxplaydiv" DIV element):
<script type="text/javascript">
var djConfig = { isDebug: true };
</script>
<script type="text/javascript" src="dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.io.*");
dojo.require("dojo.event.*");
</script>
The call to dojo.io.bind sends a request containing the form data to the ajax.jsp page, and whenever the results are returned then the Javascript functions "load" or "error" defined in the data block in my_onclick_button() is called. This is just one example of processing form data and adding HTML below the form without refreshing the page - but is a common use case for using AJAX. This example assumes that I have both the dojo "src" directory and dojo.js in my top level web resources directory. The great thing about dojo is that it encapsulates all asynchronous event handling, offers a good supply of visual components (that map to HTML elements) and is simple to use no matter what programming language you are using for a web application.
<h3>test AJAX Form:</h3>
<form id="myForm">
<input type="text" name="input_test_form_text" />
<input type="button" name="button1"
value="Try AJAX form" id="ajaxButton" />
</form>
<div id="ajxplaydiv">
initial context for AJAX play div
</div>
<script type="text/javascript">
var buttonObj = document.getElementById("ajaxButton");
dojo.event.connect(buttonObj, "onclick",
this, "my_onclick_button");
function my_onclick_button() {
var ajaxargs = {
url: "ajax.jsp",
load: function(type, data, evt){
dojo.byId('ajxplaydiv').innerHTML = data;
},
error: function(type, data, evt){
alert("Error occurred!");
},
mimetype: "text/plain",
formNode: document.getElementById("myForm")
};
dojo.io.bind(ajaxargs);
}
</script>
Labels: AJAX, Java, Javascript, Ruby, search
Tuesday, January 17, 2006
Rich clients and web applications
That said, I love it when web portals open up their systems with public APIs. Flickr's API is especially nice since they support REST, XML-RPC, and SOAP. For Mac OS X 10.4 users, there are two great Flickr rich ("fat") clients that I think are very cool: Flickr Export for iPhoto and tickr for Flickr which allows you to search on Flickr tags and see a scrolling list of matched thumbnail pictures that scroll up the right side of your desktop.
The important thing here is that Flickr did not have to write these fat clients - they just had to make a public web services API available.
Labels: CSS, Javascript
Subscribe to Posts [Atom]
