Activate your free membership today | Log-in

Sunday, September 28th, 2008

jQuery finds its way into Microsoft and Nokia stacks

Category: .NET, Ajax, jQuery

Just as jQuery kicks off its first jQuery conference adjunct with The Ajax Experience in Boston tomorrow, it gets an energy boost from some big double-barrel news:

Microsoft and jQuery

Microsoft is looking to make jQuery part of their official development platform. Their JavaScript offering today includes the ASP.NET Ajax Framework and they’re looking to expand it with the use of jQuery. This means that jQuery will be distributed with Visual Studio (which will include jQuery intellisense, snippets, examples, and documentation).

Additionally Microsoft will be developing additional controls, or widgets, to run on top of jQuery that will be easily deployable within your .NET applications. jQuery helpers will also be included in the server-side portion of .NET development (in addition to the existing helpers) providing complementary functions to existing ASP.NET AJAX capabilities.

Scott Guthrie talks about the news and details some of the features. His blog shows intellisense at work, and more.

Scott Hanselman then wrote an tutorial that shows jQuery working with ASP.NET libraries such as the ASP.NET AJAX 4.0 Client Template work.

Here is the sample code that shows the weaving of jQuery and Client template APIs. The script src at the top is to an "intellisense" version of jQuery, which includes the addition of special comments to make Intellisense work. The Open Ajax Alliance is trying to standardize on this metadata so we can share it between the various tools (e.g. Aptana has a very nice sdoc that does this, and allows you to put it external to the file so you don't have to have clients download it).

JAVASCRIPT:
  1.  
  2. var bikes; 
  3. Sys.Application.add_init(function() { 
  4.     bikes = $create(Sys.UI.DataView, {}, {}, {}, $get("bikes"))
  5.     $(".colorfilter").click(function(e) { 
  6.         LoadBikes($(this).val())
  7.     })
  8.     LoadBikes()
  9. })
  10.  
  11. function LoadBikes(q) { 
  12.     qq= q|| "Red"
  13.     var svc = new Sys.Data.DataService("bikes.svc")
  14.     svc.query("/Products?$filter=Color eq '" + q + " '&$top=5", OnProductsLoaded)
  15. } 
  16.  
  17. function OnProductsLoaded(result) { 
  18.     bikes.set_data(result)
  19.  
  20.     $("ul li:even").css("background-color", "lightyellow")
  21.     $("ul li").css("width", "450px").css("font-size", "12px")
  22.  
  23.     $("div.bikerow").mouseover(function(e) { 
  24.         $(this).animate({ 
  25.             fontSize: "18px"
  26.             border: "2px solid black" 
  27.         }, 100)
  28.     }).mouseout(function(e) { 
  29.         $(this).animate({ 
  30.             fontSize: "12px"
  31.             border: "0px" 
  32.         }, 100)
  33.     })
  34.  
  35. } 
  36. Sys.Application.initialize();
  37.  

Nokia and jQuery

Nokia is looking to use jQuery to develop applications for their WebKit-based Web Run-Time. The run-time is a stripped-down browser rendering engine that allows for easy, but powerful, application development. This means that jQuery will be distributed on all Nokia phones that include the web run-time.

To start Nokia will be moving a number of their applications to work on the run-time (such as Maps) and building them using jQuery. jQuery will become part of their widget development platform, meaning that any developer will be able to use jQuery in the construction of widgets for Nokia phones.

How will these companies work with the project?

Microsoft and Nokia aren’t looking to make any modifications to jQuery (both in the form of code or licensing) - they simply wish to promote its use as-is. They’ve recognized its position as the most popular JavaScript library and wish to see its growth and popularity continue to flourish.

In fact their developers will begin to help contribute back to the jQuery project by proposing patches, submitting test cases, and providing comprehensive testing against their runtimes. As with any contribution that comes in to the jQuery project it’ll be closely analyzed, reviewed, and accepted or rejected, based upon its merits, by the jQuery development team - no free ride will be given.

A significant level of testing will be added to the project in this respect. The jQuery test suite is already integrated into the test suites of Mozilla and Opera and this move will see a significant level of extra testing being done on Internet Explorer and WebKit - above-and-beyond what is already done by the jQuery team.

This is great news for the jQuery project.

Posted by Dion Almaer at 2:01 pm
17 Comments

++++-
4.2 rating from 127 votes

Wednesday, August 20th, 2008

Ra Ajax: Ajax for .NET

Category: .NET

Thomas Hansen is a vocal member of the community, and worked on Gaia Widgets in the past. Now he has moved on to create his own opensource library Ra Ajax, an Ajax library for .NET. (He has posted the bloody details of how he "left").

He is experimenting, and writing up a series of "how to write an Ajax library" as he does just that. He has already started with:

Check out the project release on Google Code as well as the project homepage and let him know what you would like to see.

UPDATE Thomas just posted about getting sued by Gaiaware due to a non-compete. I am not a lawyer, and have no idea about the law there, what was signed, etc..... but this seems totally out of bounds and they should leave him alone.

Posted by Dion Almaer at 8:01 am
6 Comments

+++--
3.2 rating from 23 votes

Friday, July 4th, 2008

Talking to .NET on the server with Jaxer

Category: .NET, Aptana

What does your CEO do? Paul Colton, CEO of Aptana, gets his fingers dirty. He just wrote a post about accessing COM objects from JavaScript with Jaxer.

This is possible as the JavaScript is running on the server, and this server is running on Windows. You can download the source code to check it all out.

HTML:
  1.  
  2.      <body>
  3.          <script runat="server-proxy">
  4.              function rotate(angle)
  5.              {
  6.                  var img = COMObject("ImageProcessor.ImageProcessing");
  7.  
  8.                  img.LoadImage(Jaxer.request.documentRoot + "/photo.jpg");
  9.                  img.RotateImage(angle);
  10.                  img.SaveImage(Jaxer.request.documentRoot + "/new.jpg");
  11.              }
  12.          </script>
  13.          <input id="angle"/>
  14.          <input type="button" value="Rotate"
  15.                         onclick="rotate(document.getElementById('angle').value);
  16.                                 document.getElementById('img').src =
  17.                                 document.getElementById('img').src + '?' + new Date()"/>
  18.          <br />
  19.          <img id='img' src="new.jpg"/>
  20.      </body>
  21. </html>
  22.  

Posted by Dion Almaer at 6:56 am
4 Comments

+++--
3.6 rating from 25 votes

Tuesday, April 29th, 2008

Fast Streaming Ajax Proxy

Category: .NET, Performance

Omar AL Zabir, the co-founder & CTO of Pageflakes has written about a continuous streaming Ajax proxy that solves the common problem that all Ajax proxies have, the double delay in downloading content on server first and then delivering to the browser.

Omar talks about the continuous proxy that can help solve the problems. The approach for the continuous proxy is:

  • Read bytes from external server in chunks of 8KB from a separate thread (Reader thread) so that it's not blocked
  • Store the chunks in an in-memory Queue
  • Write the chunks to ASP.NET Response from that same queue
  • If the queue is finished, wait until more bytes are downloaded by the reader thread

Making a difference

And if you wonder what difference this can make:

Content Proxy served about 42.3 million URLs last month which is quite an engineering challenge for us to make it both fast and scalable. Sometimes Content Proxy serves megabytes of data, which poses even greater engineering challenge. As such proxy gets large number of hits, if we can save on an average 100ms from each call, we can save 4.23 million seconds of download/upload/processing time every month. That's about 1175 man hours wasted throughout the world by millions of people staring at browser waiting for content to download.

There is even more detail on how the proxy has created.

Posted by Dion Almaer at 7:02 am
2 Comments

+++--
3.3 rating from 29 votes

Thursday, April 3rd, 2008

JavaScript, C#, and ExtSharp

Category: .NET, Ext

Colin Ramsay thinks that JavaScript and C# can be scarily similar as he shows an ExtJS example:

JAVASCRIPT:
  1.  
  2. var win = new Ext.Window({
  3.     title: 'Order Viewer', layout: 'border',
  4.     width: 500, height: 500,
  5.     modal: true, resizable: false, closable: false, draggable: false,
  6.     items: [ frm, lst ]
  7. });
  8.  
  9. win.on('render', function() {
  10.     load(5);
  11. });
  12.  
  13. win.show();
  14.  
C#:
  1.  
  2. var win = new Ext.Window{
  3.     Title = "OrderViewer", Layout = Layout.Border,
  4.     Width = 100, Height = 200,
  5.     Modal = true, Resizable = false, Closable = false, Draggable = false,
  6.     Items = new [] { frm, lst }
  7. };
  8.  
  9. win.Render += delegate {
  10.     load(5);
  11. };
  12.  
  13. win.show();
  14.  

This works well for ExtJS since it is written in a style that leads itself to this similarity. Colin also points out ExtSharp, a project that lets you write your Ext application in C#:

I really love Ext but coding in javascript just gives me the chills. So I went out and found a way to use my favorite js library (Ext) and my favorite programming language (C#) at the same time. By using a project called Script# I am able to write C# code and have it converted into javascript, similar to GWT. Building on that, Script# also allows you to code against external APIs, but you need to create the types, methods, properties, etc. for everything in the javascript library. So what I did was write a little console app that parses all of the ExtJS source files extracting out the script comments and writing C# files for each class. The end result is a programmable C# API to access all of the Ext objects and I threw in a couple new things to make life a little easier.

Posted by Dion Almaer at 6:06 am
3 Comments

++++-
4.4 rating from 50 votes

Wednesday, March 19th, 2008

Google Visualization joins the Ajax APIs

Category: .NET, Google, JavaScript

Yoah Bar-David & Itai Raz of Google have introduces the latest Ajax API: Google Visualization API, a new API designed for visualizing structured data.

There is a large visualization gallery that can show you some of the visualizations that you can use.

You tie into the API as you do with other Google Ajax APIs:

JAVASCRIPT:
  1.  
  2. google.load("visualization", "1");
  3.  
  4. var q = new google.visualization.Query(DATA_SOURCE_URL);
  5. q.setQuery("select A, sum(D) group by A");
  6. q.send(responseHandlerCallback);
  7.  

Take a look at this very cool example that the Gapminder team came up with (click on play)

This complements the Google Chart API, which just lifted its limits on the number of calls for charts.

NOTE: Google I/O is a conference being held at San Francisco on May 28-29 2008. APIs like this will be talked about. I will be there. And lots of good folks will be there (Steve Souders, Mark Lucovsky, Guido van Rossum, Jeff Dean, Chris DiBona, Josh Bloch).

Posted by Dion Almaer at 11:56 am
6 Comments

++++-
4.4 rating from 24 votes

Monday, March 3rd, 2008

Json.NET 2.0

Category: .NET, JSON

James Newton-King has quickly released a new version of Json.NET that has a new easier syntax for querying and and creating JSON.

Creating JSON

JAVASCRIPT:
  1.  
  2. JObject o = JObject.FromObject(new
  3. {
  4.   channel = new
  5.   {
  6.     title = "James Newton-King",
  7.     link = "http://james.newtonking.com",
  8.     description = "James Newton-King's blog.",
  9.     item =
  10.         from p in posts
  11.         orderby p.Title
  12.         select new
  13.         {
  14.           title = p.Title,
  15.           description = p.Description,
  16.           link = p.Link,
  17.           category = p.Categories
  18.         }
  19.   }
  20. });
  21.  

Querying JSON

JAVASCRIPT:
  1.  
  2. var categories =
  3.   from c in rss["channel"]["item"].Children()["category"].Values<string>()
  4.   group c by c into g
  5.   orderby g.Count() descending
  6.   select new { Category = g.Key, Count = g.Count() };
  7.  

Check out the project.

Posted by Dion Almaer at 6:11 am
8 Comments

+++--
3.7 rating from 24 votes

Wednesday, February 13th, 2008

AjaxDataControls v1.0 Ajax Extensison for .Net

Category: .NET, Ajax

We've been trying to get more .Net-related content on Ajaxian and luckily we were contacted by the AjaxDataControls team about their new v1.0 release.

The AjaxDataControls is a DotNetSlackers.com's open source project built on top of Microsoft Asp.net Ajax Extension. Currently it contains GridView, DataList, Repeater and Pager controls. The main goal of this project is to provide a similar kind of data controls in the client side which the asp.net developers are already familiar with while working with the server side version. The Server side versions of these controls were developed long before the Ajax came into scene, so there is no client side API which the developer can utilize and it is also not possible to bind data which is returned from a Web Service or Page Method call. On the other hand, AjaxDataControls was specially developed keeping these things in mind. It Provides:

1. Exact same API as the Original Server Side version.
2. Exact same declarative model in aspx page.
3. Full Design time support.
4. Lots of extra features like drag and drop, animation, etc.

It is also possible to use these controls in non-MS platform.

Live examples are hosted:
http://dotnetslackers.com/projects/AjaxDataControls

Source:
http://www.codeplex.com/AjaxDataControls

Forum:
http://dotnetslackers.com/community/forums/71.aspx

Posted by Rey Bango at 9:36 am
5 Comments

+++--
3.6 rating from 45 votes

Tuesday, February 12th, 2008

LINQ to JSON

Category: .NET, JSON

James Newton-King has posted a new bit of code called LINQ to JSON which is a .NET LINQ style API over JSON.

For example, here is how you could get out categories and how often they are used:

JAVASCRIPT:
  1.  
  2. var categories =
  3.   from c in rss.PropertyValue<jobject>("channel")
  4.               .PropertyValue<jarray>("item")
  5.               .Children<jobject>()
  6.               .PropertyValues<jarray>("category")
  7.               .Children<string>()
  8.   group c by c into g
  9.   orderby g.Count() descending
  10.   select new { Category = g.Key, Count = g.Count() };
  11.  

There is also a project, JSLINQ which is an implementation of LINQ to Objects implemented in JavaScript. It is built using a set of extension methods built on top of the JavaScript Array object. If you are using an Array, you can use JSLINQ.

Posted by Dion Almaer at 7:00 am
6 Comments

++++-
4 rating from 24 votes

Thursday, January 17th, 2008

CommandProxy: Integrating AIR and .NET

Category: .NET, Adobe

CommandProxy is a proof of concept by Mike Chambers (Adobe AIR team) that offers a solution to a feature that Ben and I have wanted in AIR.... the ability to talk to native code:

Two of the most requested features for Adobe AIR have been the ability to launch native executables from an AIR application, and the ability to integrate native libraries into an AIR application. Unfortunately, neither feature will be included in Adobe AIR 1.0.

However, this does not mean that you cannot build an AIR application that has closer / tighter integration with the underlying operating system. This lower level of integration is possible, but it requires some work on your part. I have put together a proof of concept project, which shows how to integrate Adobe AIR applications with c# / .NET code on any operating system that Adobe AIR currently runs on (Mac and Windows). The project is called CommandProxy. It provides a communication proxy between an AIR application and the underlying operating system and could theoretically work with other web based desktop runtimes (such as Mozilla Prism).

How does it work?

The general concept behind the project is similar to the now defunct Artemis project (which was Java based). The AIR application communicates with the CommandProxy process to communicate and integrate with the underlying operating system. Currently the command proxy supports launching processes (and getting the output from the processes) as well as taking a screenshot of the user’s current screen. However, the framework is built in such a manner that it is possible to add new functionality to the proxy.

The project is opensource and more info is available on the project page on Google Code.

Posted by Dion Almaer at 1:27 pm
5 Comments

++---
2.7 rating from 18 votes