LinkedIn .NET User Group Online Presentation Tomorrow

by Stian Solberg 9. March 2010 22:54

We will hold an online, free presentation showing what you can do with Gaia Ajax when building next generation web applications in a fast, lightfoot and intelligent way. Jan Blomquist will demonstrate the power of our latest 3.6 version and why abstracting away JavaScript and developing in a managed language is crucial for time-to-market.

5 winners will be chosen at random from the list of attendees. Each of them will win an annual subscription of Gaia Ajax (worth $595).

Wednesday March 10, 2010, 11:00AM (PST)
Get local time

LIDNUG event info

Direct link to Live Meeting

 

 

 

Async loading with Non-blocking UI in ASP.NET with Gaia Ajax

by Jan Blomquist 18. January 2010 14:40

 

We've just published a new sample that demonstrates how to create a web page that loads items as they become available and doesn't block the UI. That means you can fully use the Web Application while another thread is spinning on the server doing the hard work.

Click here to view the sample from our nightly published samples application:
http://nightlysamples.gaiaware.net/Combinations/WebUtilities/AsyncLoading/

Or you can pickup a nightly drop here:
http://build.gaiaware.net/Trial/

The idea behind this is not new, but Gaia Ajax makes this so simple to implement and so fast thanks to the automatic diff/merge capabilities of the DRIMR technology which was introduced in Gaia Ajax 3.6. Click here to view a view about Gaia Ajax DRIMR
Sometimes Web Applications are dropped in favor of traditional Desktop applications because of performance requirements. It's not viable to create web applications that requires long time before responding. However, many functions still require lots of processsing before they can return data at all. The ideal way to solve this is the following

  1. Serve up the UI instantly.
  2. Allow the user to start the time consuming task
  3. Deliver the data for consumption in the UI as it becomes available -leaving the application operational. 

Creating the UI for this kind of application is hard enough as it requires you to dig into multi-threading and it's many pitfalls. Creating the UI as a Web Application becomes almost unthinkable as it adds yet another layer of complexity that makes the project run the risk of blowing up. That being said, any sane person reverts to the good old locally installed application with it's drawbacks to solve the problem.

Does it really have to be like that? I will argue in this blog that it's just as easy -or easier? to create a scalable, robust, multi-threaded web application in ASP.NET that doesn't block the UI -than to revert to writing desktop applications.

The reason is partially because ASP.NET is multi-threaded in itself. Each web request is tied to a Worker thread that lives throughout the duration of that page lifecycle. The process of running the lifecycle and generating the control tree is very in-expensive. In Gaia Ajax, the lifecycle running time is even chopped an additional 30%. Almost always the most expensive operation is your I/O threads. These threads often deal with files, databases, webservices and anything else which is not (in-process). I/O is so dramatically more expensive (realtive to worker threads) that Microsoft introduced the Async pattern in ASP.NET 2.0

"The problem with the ASYNC pattern is still that no WebPage is being delivered before all I/O threads are finished with their work". I argue that another option is to serve the WebPage with few or no I/O threads at all. The delivery time of the web application becomes instant.

Does that make any sense?
These I/O calls where there for a reason wheren't they? -Yes, and I am not saying that they are not going to be executed. I am simply saying that you can deliver the results over ajax by using a diff/merge strategy. In Gaia Ajax 3.6 you get automatic diff/merge for free! :-) Also the A in Ajax stands for asynchronous so they don't block the UI either.

But isn't multithreading Evil?
Yes it's evil and if you can avoid it -so you should. However, in .NET we've gotten lots of tools, code, patterns and various ways of dealing with the issue of concurrency. Modern CPU's are not scaling in terms of higher clock speed, but more cores (Link to Intel 48 cores). The LINQ to Parallells project  is now going shipped as part of .NET Framework 4.0. Instead of being afraid of the beast, I think it's time we deal with it and create the next generation of modern web applications utilizing all these cores available to us.

Ok, so how does this relate to Gaia Ajax?
Gaia makes this paradigm easy to implement with no javascript, no bloat and only the state changes are merged down to the client. Also Gaia implements an ajax request queue which only dispatches 1 ajax request at a time allowing for no concurrency issues there. You still have to deal with concurrency, race conditions, etc in your web application, but like I said that's a lot easier with all the stuff that's available to us there.

The following code snippets outline how this simple example was written. It contains 1 aspx file with a button, datagrid and timer and in the codebehind we toggle enabled and visibility properties and kick off the work which goes on in the BackgroundWorkerTask.cs file. The sample was written to be minimalistic and simple and serves more as a proof-of-concept than production ready code. The code is available in the sample too, but I'll paste it in here for your convenience.

Markup (ASPX/.aspx)

   1:   
   2:  <gaia:Button 
   3:      ID="zButton" 
   4:      runat="server" 
   5:      Text="Start Async Operation" 
   6:      OnClick="zButton_Click" />
   7:      
   8:  <gaia:Image 
   9:      ID="zImageLoader" 
  10:      ImageUrl="ajax-loader.gif" 
  11:      runat="server" 
  12:      Visible="false" />
  13:      
  14:  <gaia:GridView 
  15:      runat="server" 
  16:      ID="zGrid" 
  17:      Width="100%"
  18:      AutoGenerateColumns="false"
  19:      CssClass="async-grid">
  20:          <RowStyle CssClass="itemEven" />
  21:          <AlternatingRowStyle CssClass="itemOdd" />
  22:          <Columns>
  23:              <gaia:BoundField 
  24:                  HeaderText="Time" 
  25:                  DataField="ActivityDate" 
  26:                  DataFormatString="{0:HH:mm}" />
  27:              
  28:              <gaia:BoundField 
  29:                  HeaderText="Name" 
  30:                  ItemStyle-Width="50%"
  31:                  DataField="ActivityName" />
  32:              
  33:              <gaia:BoundField 
  34:                  HeaderText="Contact" 
  35:                  ItemStyle-Width="25%"
  36:                  DataField="ContactPerson" />
  37:          Columns>
  38:  gaia:GridView>
  39:   
  40:  <gaia:Timer 
  41:      ID="zTimer" 
  42:      runat="server" 
  43:      Milliseconds="1000"
  44:      OnTick="zTimer_Tick" 
  45:      Enabled="false" >
  46:  gaia:Timer>
  47:   
  48:   

Codebehind (C#/.cs)

   1:  namespace Gaia.WebWidgets.Samples.Combinations.WebUtilities.AsyncLoading
   2:  {
   3:      using System;
   4:      using UI;
   5:      using Utilities;
   6:      using WebWidgets.Effects;
   7:   
   8:      public partial class Default : SamplePage
   9:      {
  10:          const string CollapsedText = "Click here for more details ...";
  11:          const string ExpandedText = "Click here to hide again";
  12:   
  13:          protected void Page_Init(object sender, EventArgs e)
  14:          {
  15:              SetTimerPollingBasedOnNetworkLatency();
  16:              zViewResponse.Text = CollapsedText;
  17:          }
  18:   
  19:          protected void Page_Load(object sender, EventArgs e)
  20:          {
  21:              if (!IsPostBack) BackgroundTask = null;
  22:          }
  23:   
  24:          protected void zButton_Click(object sender, EventArgs e)
  25:          {
  26:              if (BackgroundTask.IsRunning) return;
  27:              BackgroundTask.Data.Clear(); 
  28:              BackgroundTask.RunTask();
  29:              ActivateUiTaskRunning();
  30:              DataBindGridViewToProcessedItems();
  31:          }
  32:   
  33:          protected void zTimer_Tick(object sender, EventArgs e)
  34:          {
  35:              DataBindGridViewToProcessedItems();
  36:              if (!BackgroundTask.IsRunning) DeactiveUiTaskRunning();
  37:          }
  38:   
  39:          private void DataBindGridViewToProcessedItems()
  40:          {
  41:              zGrid.DataSource = BackgroundTask.Data;
  42:              zGrid.DataBind();
  43:          }
  44:   
  45:          private void SetTimerPollingBasedOnNetworkLatency()
  46:          {
  47:              zTimer.Milliseconds = WebUtility.IsLocalhost ? 500 : 1000;
  48:          }
  49:   
  50:          private void DeactiveUiTaskRunning()
  51:          {
  52:              zImageLoader.Visible = false;
  53:              zTimer.Enabled = false;
  54:              zButton.Enabled = true;
  55:          }
  56:   
  57:          private void ActivateUiTaskRunning()
  58:          {
  59:              zTimer.Enabled = true;
  60:              zButton.Enabled = false;
  61:              zImageLoader.Visible = true;
  62:          }
  63:   
  64:          private CustomBackgroundWorker BackgroundTask
  65:          {
  66:              get
  67:              {
  68:                  return Session["worker"] as CustomBackgroundWorker ??
  69:                      (Session["worker"] = new CustomBackgroundWorker()) 
  70:                      as CustomBackgroundWorker;
  71:              }
  72:              set { Session["worker"] = value; }
  73:          }
  74:   
  75:          protected void zViewResponse_Click(object sender, EventArgs e)
  76:          {
  77:              /* some effects for show-off */
  78:   
  79:              bool show = zViewResponse.Text == CollapsedText;
  80:              zViewResponse.Text = show ? ExpandedText : CollapsedText;
  81:   
  82:              if (show)
  83:                  zCodeResponse.Effects.Add(
  84:                      new EffectParallel(
  85:                          new EffectMorph("width: 650px; height: 450px;", 0.5M),
  86:                              new EffectAppear(0.5M)));
  87:              else
  88:                  zCodeResponse.Effects.Add(
  89:                      new EffectParallel(
  90:                          new EffectMorph("width: 0px; height: 0px;", 0.5M),
  91:                              new EffectFade(0.5M)));
  92:          }
  93:      }
  94:  }

Codebehind (C#/.cs)

   1:  namespace Gaia.WebWidgets.Samples.Combinations.WebUtilities.AsyncLoading
   2:  {
   3:      using System;
   4:      using System.Collections.Generic;
   5:      using System.Threading;
   6:      using Utilities;
   7:   
   8:      public class CustomBackgroundWorker
   9:      {
  10:          private bool _isRunning;
  11:          public bool IsRunning
  12:          {
  13:              get { return _isRunning; }
  14:          }
  15:   
  16:          public void RunTask()
  17:          {
  18:              lock (this)
  19:              {
  20:                  if (_isRunning)
  21:                      throw new InvalidOperationException("The task is already running!");
  22:   
  23:                  _isRunning = true;
  24:                  new Thread(DoWork).Start();
  25:              }
  26:          }
  27:   
  28:          private ICollection _data;
  29:          public ICollection Data
  30:          {
  31:              get { return _data ?? (_data = new List()); }
  32:          }
  33:   
  34:          void DoWork()
  35:          {
  36:              try
  37:              {
  38:                  for (int i = 0; i < 15; i++)
  39:                  {
  40:                      lock (Data)
  41:                          foreach (CalendarItem item in CalendarController.CreatItems(new Random().Next(1, 3)))
  42:                              Data.Add(item);
  43:   
  44:                      Thread.Sleep(new Random().Next(300, 2000)); // Random Sleep to simulate variance
  45:                  }
  46:              }
  47:              catch  { /* Task failed (suppress exceptions in demo) */ }
  48:              finally { _isRunning = false; }
  49:          }
  50:      }
  51:  }

Though simple in nature -the async sample demonstrates a truly powerful concept which could give your web applications a boost you'd never thought possible. So give it a spin and if you like it, please drop us a message by email or use our forums : http://nightlysamples.gaiaware.net/Combinations/WebUtilities/AsyncLoading/

 

Gaia Ajax 3.6 Beta now available!

by Stian Solberg 21. October 2009 16:00

We're moving fast towards a final release. Current code is more and more stable, but we'd like the final release to be top quality and that's why we are releasing a beta.

Work done between Alpha and Beta:

Links and downloads

Get Free Download Gaia Ajax 3.6 Beta
Includes Visual Studio Integration and 100++ Samples

Changelog-Gaia-Ajax-3-6-Beta.pdf (106.52 kb)
Click here for Tar.gz binaries + source - for open source projects
Click here
if you are a subscription customer (requires login)

 

Comments and feedback are very welcome at our forum. Enjoy the new bits!

Kind regards
The Gaiaware Team


Time's up! Gaia Ajax 3.6 Alpha Released!

by Jan Blomquist 13. September 2009 21:01

Thank you for your patience and continued belief in our product. It is our vision to bring you the finest quality for ajax development on the ASP.NET platform. The 3.6 version comes with practical innovation previously unavailable to ASP.NET developers. Hopefully it will bring "goosebumps" similar to the ones we had the first time Microsoft unveiled ASP.NET almost a decade ago. 

"3.6 is backwards compatible and introduces a paradigm shift called adaptive rendering"

Links and downloads

  • Click here to download Gaia Ajax 3.6 "alpha"
    Exe with Visual Studio Integration 30 day trial

  • Click here to download Gaia Ajax 3.6 "alpha" - Tar.gz binaries + source - for open source projects
  • Click here to download Gaia Ajax 3.6 "alpha" commercial (requires subscription) 

Highlights from the Gaia Ajax 3.6 release

1. Adaptive Rendering
Adaptive Rendering is a mind-blowing concept that enables dynamic insertion, removal, moving and replacement of individual controls. The concept has far reaching implications and is the breakthrough technology that will make you hunger for Gaia as the building blocks for your UI layer

  • Click here for a sample that demonstrates dynamic inserts and removals of controls and compare it to the usage of traditional partial rendering
  • Click here for a sample of the chess game featuring dynamic control moves
  • Click here for a sample of our "PageFlakes" sample that also features dynamic moves
  • Click here to check out a sample that demonstrates all features of adaptive rendering, including control replacements via databinding
Jan Blomquist has written an extensive review of Adaptive Rendering on his personal blog.

2. Ajax GridView
The Gaia Ajax GridView is a premier example of adaptive rendering as it enables the worlds most advanced GridView for ASP.NET without much code at all. The GridView still supports all the operations like ( filtering, sorting, selection, deletions, updates, etc ) and it's all ajaxified thanks to adaptive rendering.  

  • Click here for a sample that demonstrates the Gaia Ajax GridView in action

3. 100++ new Samples!
In the package you will find a total of 128 samples ranging from minimalistic ones to extensive, almost full applications in themselves. This is all packaged into a new samples framework that simplifies navigation, code view, VB.NET code availability, etc. 

Note: The samples are now utilizing the WAP project type

More...

How To Create An Async Ajax Google Search with ASP.NET And Gaia Ajax

by Stian Solberg 26. May 2009 06:30

Recently we decided to add a searching feature for the different sites we run on gaiaware.net: main site, blogs, forum, tracker, docs and API reference. We wanted to be able to search each site separately and still have all the results presented in a intuitive way. And of course, it should be built using Gaia Ajax, so it could be quickly developed (our customers say they increase the productivity by 30-50% on the ASP.NET platform when using Gaia Ajax) and give a responsive and ajaxified user experience.

Async Search with ASP.NET Ajax

We have purchased a Google Site Search subscription so we don't have to reinvent the wheel again and make our own site spider. The Google Site Search gives us the search results in XML, and we can parse and present them in any way we would like.

The challenge: multiple search sources with ASP.NET

Since we wanted to present the results from each sub site in separate sections, we needed to overcome some limitations of what Google Site Search gives us. E.g. you can return max 20 results per search. Since we wanted to separate the results in each sub domain (e.g. forum.gaiaware.net) we needed to use the useful "site:" parameter in a Google query. That meant that we needed to fire off 5-6 Google searches for each search we executed on our own page. Our immediate concern was how long time it would take to perform so many Google searches, return them, parse them and present them on our ASP.NET page.

More...

Gaia Ajax training 10-11th June in Norway

by Stian Solberg 12. May 2009 07:30

We're excited to announce the first official Gaia Ajax course. Many have been asking for this and now it's here!

This course will teach you how you can build everything from small web portals to enterprise applications using Gaia Ajax on the ASP.NET platform. We will be spending most of our time in Visual Studio.NET exploring required ASP.NET skills and the essential Gaia knowledge.

Early Bird Offer

Quick Facts

Registration: Via contact form or email us: support@gaiaware.net with number of participants.

Target Audience: .NET Developers
Max Participants: 12
Language: English

Date: June 10-11th at 09.00 - 15.30
Price: EUR 1100 Incl.lunch. excl.hotel

Location: Gaiaware HQ (Klosterøya), Skien – NORWAY
57 km from Torp International Airport
134 km from Oslo
View map

Hotel suggestions:
Thon Hotel Høyers
Clarion Collection Hotel Bryggeparken

Agenda

  • Quick introduction 
  • Important ASP.NET semantics 
  • Get to know the Gaia Server Controls 
  • Unleash your productivity with Aspects in Gaia 
  • Effect library 
  • Skinning Gaia 
  • Extending Gaia 
  • Data management with Gaia 
  • Debugging, error handling and security with Gaia

At the evening we're planning to do a bit of socializing and exchange experiences with building web applications using Gaia.

Instructor: Jan Blomquist (MVP)

Jan Blomquist (MVP)Jan Blomquist has many years experience in software development and is one of the core architects behind Gaia Ajax. Jan has also been awarded Microsoft MVP (Most Valued Professional) since 2005. Jan Blomquist has trained thousands of people in building software and has often been a presenter at various Microsoft events. Jan has also appeared on DotNetRocks TV (http://dnrtv.com), which is a very popular TV show for .NET developers worldwide.

Includes complete course on DVD

The entire course will be screen-recorded for later viewing. Each student is granted a non-transferable viewer license to the course recordings. The student will receive the videos on a DVD or in a downloadable package either on-site or at a later time.

 

Gaiaware HQ in summer
Gaiaware HQ in summer


Gaiaware HQ entrance
Gaiaware HQ entrance

Clarion Collection Hotel Bryggeparken - in walking distance
Clarion Collection Hotel Bryggeparken - in walking distance

Vote for Gaia Ajax: asp.netPRO Readers' Choice 2009

by Stian Solberg 23. April 2009 08:48

We're proud to announce Gaia Ajax as one of the nominated in this years asp.netPRO Readers' Choice awards. The competition is hard and many well established software vendors are represented with their products.

The voting expires the 25th of April, so you still have a couple of days to let your voice be heard and give an up-and-coming .NET vendor a helping hand!

Vote for Gaia Ajax for Best Component Set now! 

Inherit Gaia Ajax Dynamic Image to make it Selectable

by Jan Blomquist 9. February 2009 06:00

Gaia Ajax allows you to create scalable web applications by utilizing the full power of the server and server control framework in ASP.NET. We encourage all our users to utilize the server control pattern when building modular and scalable web applications. You can use many approaches to build such controls. One pattern we visited in the Creating an Ordered ListControl in C# was the encapsulation w/ proxy pattern or composition if you like. In this blog we're going to discuss direct inheritance. This is something you would want to do when you need to extend the behaviour/functionality of your controls.

More...

Easily create Drag & Drop dashboards in ASP.NET

by Jan Blomquist 5. February 2009 10:20

Modal Ajax Messagebox for ASP.NET in Gaia

by Jan Blomquist 5. February 2009 09:15


Introduction

Most applications today utilizes some kind of messagebox to either give feedback to the user or halt the execution of the application, until the user performs a choice. Typically Ok, Yes, No or Cancel. Creating such a control for the web can be a daunting task, but it doesn't have to be. By using Gaia Ajax we can pop out a fairly feature rich MessageBox in a short amount of time. In this blog I am going to create the MessageBox and use it in a simple sample. The code will be provided for download if you find it useful. 

More...