jQuery Grid Plugin with WCF

July 26th, 2009

One of best grid plugins out there for jQuery is jqGrid because of its good documentation and online samples.

There’s plenty of code examples with php/mySql as the backend but I wished they had one with WCF as the application tier. With a little plumbing in WCF and some trial and error testing, I was able to get a small jqGrid application up and running.

If you are thinking about implementing jqGrid in your application with WCF, this post will include some code samples and hopefully help you speed your development process.

jqGrid With WCF
Online sample below. . .
Read more. . . »

Posted in AJAX (2), WCF (2) | Comments (0)

Combining ASP.NET Authentication and Message Encryption with Silverlight 2

June 4th, 2009

Silverlight 2 as a Line of Business (LOB) application must be able to handle your company’s data securely. Out of the box, if your IDE is Visual Studio 2008, you can incorporate ASP.NET authentication by adding a “Silverlight-enabled WCF Service” item to an existing WCF project. You can also enable the Authentication Service provider in web.config by following MSDN’s tutotial. Ideally, this is implemented over SSL and will provide transport security for the application.

The above implementaion does not support message level encryption. Since Silverlight 2 only supports BasicHttpBinding, WS-* security features like message encryption and digital signing with X.509 certicates are not available.

However, Silverlight 2 does support symmetric key (”shared secret”) encryption using AES algorithm. Here is a descriptive series of articles on the topic. With a little bit of plumbing on the WCF service side, it is possible to create a custom authentication and message encryption security architecture for Silverlight 2.

Online sample below. . .
Read more. . . »

Posted in Silverlight 2 (5), WCF (2) | Comments (0)

AJAX with WCF

April 29th, 2009

With the upcoming release of ASP.NET AJAX 4.0, consuming and presenting cloud data in grid format without adding third-party components will be a reality. Until then, among the free grid components for ASP.NET for AJAX 1.0 that are out there, the one I found the most user friendly is the Ajax Data Controls Version 1.0. There are plenty of samples showing how the component can be used here.

I took a stab at implementing this component with WCF as the web service provider.

Read more. . . »

Posted in AJAX (2) | Comments (0)

Data Driven Application Demo with Silverlight 2

April 18th, 2009

Recently, I submitted an entry to the Silverlight.net Showcase based on some of my previous posts on custom sortables and path animation. In this application, users can drag and reorder the sortables to refresh the charts. The charts also support drill thru. The visual elements consume data from WCF REST, ATOM, and POX services and exchange notifications upon data binding. There are a few free charting solutions for Silverlight 2 and I decided to use the Visifire component.

Read more. . . »

Posted in Silverlight 2 (5) | Comments (1)

Path Animation with Silverlight 2 (Part 2)

April 14th, 2009

In my previous blog on path animation, a path element was given a “spinning wheel” effect by transforming the StrokeDashArray property. This time around, let’s animate some visual along a path element. I will reuse the spinning wheel project and it will serve as the target to move around with. The path element will be made up of a bunch of bezier curve segments. The final project should look like a planet with a spinning ring looping thru 3 irregular ellipses like this.

Read more. . . »

Posted in Silverlight 2 (5) | Comments (0)

Custom Sortables and Hit Test with Silverlight 2

March 30th, 2009

One common technique for implementing sortables in Silverlight 2 is to create a placeholder for the dragging element and exchange the positioning of the targeted dropped area where an existing element resides by using the “RemoveAt” and “Add” methods of an UIElementCollection object (i.e., the Children property of a StackPanel). I really like the simplicity, but not the visual presentation because the effect happens literally in a split second.

Here’s my interpretation of a sortable list implementation, that is more visually appealing and suitable for a menu component.

Read more. . . »

Posted in Silverlight 2 (5) | Comments (0)

Path Animation With Silverlight 2

March 19th, 2009

In a recent Silverlight 2 project, I wanted create my own ubiquitous “spinning wheel”. The implementation options are endless and my approach was to create the visual using the Path element and animate it to give it that spinning effect.

The visual looks like this:


Read more. . . »

Posted in Silverlight 2 (5) | Comments (0)

Sandboxing Asynchronous Processes

March 14th, 2009

Creating process boundaries offer the advantages of isolation and the ability to load and unload other processes within one main process. We can do this easily with AppDomains. But I also want the application that is running in another AppDomain to perform its processing asynchronously. Since I have little control over the remote class if it is faulting, I’m quite happy with a “fire and forget” strategy.

First, I’m going to create a class that sets and returns a List of some Type. Since I will instantiate this class in another AppDomain, this class must derive MarshallByRef. To make it easy for the calling program to invoke its methods, this class will also implement an interface. This interface exists in the same namespace of the calling and remote classes and is visible to both.

interface IParser<T> where T : class {         void Set_PENDING_PROCESSING_List();         List<T> Get_PENDING_PROCESSING_List(); } public class Parser: MarshalByRefObject, IParser<PENDING_PROCESSING> {     List<PENDING_PROCESSING> _pending_processing_list = new List<PENDING_PROCESSING>();     public Parser(string uploadPath, string file)     {             Set_PENDING_PROCESSING_List();     }     public void Set_PENDING_PROCESSING_List()     {             Thread.Sleep(5000);  //Implement actual code here.     }     public List<PENDING_PROCESSING> Get_PENDING_PROCESSING_List()     {             return _pending_processing_list;     } }

Read more. . . »

Posted in C# (2) | Comments (0)

Infer XML Schema Using Generics and Custom Iterators

March 6th, 2009

One common challenge for parsing large XML documents is trying to derive the Xml Schema Definition (XSD) so that we can maintain the parent-child(ren) relations inherent in the data.

The XmlSchemaInference class does exactly that and allows us to infer XSD from XML documents.

public void ParseFileForSchema(string filePath) {     XmlSchemaInference infer = new XmlSchemaInference();     XmlSchemaSet sc = new XmlSchemaSet();     sc = infer.InferSchema(new XmlTextReader(filePath));     foreach (XmlSchema myXmlSchema in sc.Schemas())     {         foreach (object item in myXmlSchema.Items)         {             if (item is XmlSchemaElement)             {                 XmlSchemaElement element = (XmlSchemaElement)item;                 if (element.SchemaType != null)                 {                     //Get Root Document Element.                     AddToSchemaElementList(element.Name, parentId, "parent");                     parentId++;                     parentBlockId++;                     if (element.SchemaType is XmlSchemaComplexType)                     {                         ParseParentBlocks((XmlSchemaComplexType)element.SchemaType);                     }                     else                     {                         // Parse as XmlSchemaSimpleType                     }                 }             }         }     } }

Read more. . . »

Posted in C# (2) | Comments (0)