Thursday 11 June 2009

JavaScript WebEngine


Wouldn't it be cool if you could run Javascript applications like normal desktop applications, where each app has its own window and where Window Management and Composition is handled for you, and where events are passed easier and with better cross browser support. Well this is what I've been trying to achieve with my WebEngine project.


All that is needed is an xml file containing the location of the Javascript file, the initially executed function and a few other optional fields such as description. (There is an IconUrl tag as in the future applications will be launched from the cloud desktop)

Paint.js
Paint.png
Paint
load_init

Within the Javascript file for your app all you need to do if have the initially called function have the variable uID passed to it - this is the globally unique identifier for your application that the composition engine associates with the application.

function HelloWorld(uID) {

}

The first thing you need to go is get the HTML 5 canvas element thats been created as the graphics layer for your application, you can resize the canvas and it will resize the application window when the composition engine next renders.

function HelloWorld(uID) {
// Store the canvas and its 2d context
hw_canvas = wec_GetCanvas(uID);

// Resize the window
hw_canvas.width = 300;
hw_canvas.height = 120;
}

Hooking up events is as simple as passing the applications uID and the event handler function, all the backend hookup and cross browser work is done for you.


// Hook up some events
wec_HookMouseDown(uID, hw_MouseDown);

...


function hw_MouseDown() {
alert("The Mouse has been Pressed");
}

Event information can be retrieved by the following:

var evt = wec_GetLastEvent(uID);

The event contains properties of the time of the event, mouse position(relative to the window), keys pressed etc.

In the coming version there will be a common widget library so it will be even easier to quickly make powerful Javascript applications that run on the framework.

Monday 8 June 2009

Where the future takes me

Well I have finished my internship at Microsoft and now have the summer free to do a variety of different things, mostly I will be cycling around the country but still I have some spare time to do some coding.

So what should I be coding, well this started me thinking about whats to come with computers and so here are a few trends and themes that I believe will start to appear in applications and websites in the future.

Search Engines creating dynamic context based websites based on results.
Now what do I mean by this; well currently Search Engines such as Google or the new Microsoft Bing go off and find results and show the top 10 of a few million. Usually everyone goes to the top 1 or 2 sites, or more depending on the search term. Now I believe the style of Wolfram Alpha is the way forward where after guessing the context of the search information will be shown accordingly. Wolfram Alpha only showed many numerical information or facts; a bit like an encycopedia but where I see it, future search engines will parse pages (or hopefully in the futures webpages will expose sections for export) and a webpage will be dynamically created with information related to the search. 
In the mean time however I see better image and media searches; how hard would it be to use facial recognition on images to see hows in them - great for celeberities for example. Another good example is if someone searches for '[insert persons name] image gallery' it actually generates a gallery of images thus the person doesn't have to go through the individual pages. - well thats my 2 cents of web searches anyway.

Web Applications and Desktop Applications merging
With Silverlight, Google Gears and other toolsets its becoming easier and easier to create powerful web applications that can be pushed to the desktop. What I invisage is loading a website like an application where it takes the form of a host OS application window rather than a browser with icon and the like. To the regular user there would be little difference in usuability. This would take little effort, just a platform for the web applications to plug into and from there users could have the rich media experiences on their desktop. Silverlight has taken the first step into this domain with their offline support.

HTML 5 and standards
With HTML 5 on the way and all the cool stuff it brings to the table - the canvas control for me being the biggest win. Websites will be able to be radically improved as non-standard toolsets won't have to be learnt eg. Flash, Silverlight etc. With companies such as Google already setting the way in showing whats possible with HTML 5 and most modern browsers being able to support the toolset eg. Chrome, Firefox, Safari and Opera we will see IE dragging its heals into the 21st century. Hopefully IE may one day be standards complient (but I doubt it) and they will get rid of their properitery tools eg. Accelerators.

Computers in General - Cheap is cheerful
Moore's law is undeniable in the world of computers, where every 18 months the number of transistors in a PC of a price point doubles, usually resulting in a near doubling of speed. Though we have got to the point where most people's machines are capable of doing all they require and thus a faster, more powerful machine is no longer neccessary. Therefore I believe Moore's law will be turned on its head, where machines will get cheaper for the same performance and this can be clearly shown by the new craze in netbooks (though they will never beat my Psions that I hold so dear)

So really I have not much of an idea still what to code, but I may give  the dynamic search engine a go using the new HTML 5 technologies it brings to the table. Hopefully one day IE may even be able to render it correctly.