# Saturday, 23 June 2007

Previously, I discussed a web-based source code editor for IronPython, which is part of a larger application that I am working on.  Most of the editor is complete, just working out the details on handling multiple source code files.  Today we will drive IronPythons’ interactive interpreter, using a web-based console, which is also part of my application.

 

Using the console, we can whip up a simple Windows forms application in seconds:

And here is the output:

The console is based on two components, one is Sam Stephenson’s Prototype JavaScript framework and the console GUI is brought to you by Jeff Lindsay’s Joshua, which I modified to work with IronPython.

 

Running a web console over the internet presents a few challenges.  Everywhere you read, AJAX is the sh!t.  I use a ton of it in the app I am building.  A stands for Asynchronous and therefore, as some have stated, synchronous over HTTP is bad form mate.  Well, in the case of a console application, I think a synchronous call is one (only?) way to make it “really” work:

 

//synchronous call to the server passing the IP string command and returning the response  

function getFile(url, passData)

{

    if (window.XMLHttpRequest)

    {

        AJAX = new XMLHttpRequest();

    }   

    else

    {

        AJAX = new ActiveXObject("Microsoft.XMLHTTP");

    }

    if (AJAX)

    {

        AJAX.open("POST",url,false);

        AJAX.setRequestHeader("Content-type", "text/xml");

        AJAX.send(passData);

        return AJAX.responseText;

    }

    else

    {

        return false;

    }

}

 

One nit pick with the ASP.NET AJAX framework is that you can’t do synchronous.  I would hope that the framework would support this option as a) other frameworks provide it and b) I want it man!  The point of a framework is to provide options so that a variety of similar, but different business requirements can be met with “one” AJAX framework.  I am already using 3 AJAX frameworks as each one brings a unique piece of functionality that I require.  Who knows, maybe it will be more by the time I am finished.

 

If you look at the console closely, you will see one small GUI  issue.  When parsing interactive = true with Python, visually, the next line of Python code should reside beside the “…” and not on the next line beside the command prompt (i.e. >>>).  Also note that the 4 spaces indent after the def statement does not work at the moment.

 

Aside from a couple of GUI issues, and a missing blinking cursor, there is one last feature to be implemented and then the console will be complete.

 

The astute reader may notice that the Windows application is running in a Terminal Services session, which is being hosted in my web browser. Did I remote into the web server? No.  On the client computer? No.  Where is the Windows application running?

 

January 30, 2008 Update - Global System Builder is available for download at: http://www.codeplex.com/gsb/

Official web site: http://globalsystembuilder.com

Saturday, 23 June 2007 00:16:31 (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
© Copyright 2009 Mitch Barnett - Software Industrialization is the computerization of software design and function.

newtelligence dasBlog 2.2.8279.16125  Theme design by Bryan Bell
Feed your aggregator (RSS 2.0)   | Page rendered at Thursday, 25 June 2009 13:31:34 (Pacific Daylight Time, UTC-07:00)