LM Tech's blog

Software Architecture & Design Patterns

In this post we see how to consume the RESTful service described in the post Design a RESTful service with .NET framework 4.0 using the Ajax functionality provided by jQuery.

jQuery includes some utilities to simplify the Ajax call. In our example we will use the jQuery.ajax() function to do them. jQuery.ajax() accepts just a single argument: an options object whose properties specify many details about how to perform the Ajax request.


jQuery.ajax({
    type: "GET|POST|DELETE|PUT",
    url: url,
    data: data,
    dataType:"text|html|json|jsonp|script|xml"
    success: success_callback,
    error: error_callback
});

More...



As explained in the post "Javascript Classes", javascript objects inherits properties and methods from its prototype objects. Due to this behavior is possible to extend a native object by adding custom properties to its  prototype object.

In Javascript is available the "String" native object which wrap the "string" primitive data-type and provides a number of helper methods (charAt(), indexOf(), slice(), split(), replace(), ...).

Lets see how to extend this native object with the "paddingLeft" and "paddingRight" functionalities: More...



Despite being javascript an object oriented language, it doesn't use classes. Infact JavaScript is prototype based, not class based.
With javascript you can define and create your custom objects in many ways.

Direct Instance:

var o = new Object();
o.fName = "John";
o.lName = "Smith";
o.getFullName = function(){ return this.fName + " " + this.lName; };

The example above creates a new object's instance and adds two properties and one method. More...



With the advent of Canvas and SVG (scalable vector graphics), developers now have better choices for doing graphics on the Web than in the past, when they had to implement myriad hacks and workarounds. Working with both graphics and design elements in Web development is now much easier for non-design-type developers because of technologies such as Canvas and SVG—and, of course, HTML5.

Before Canvas, plug-ins such as Flash or Silverlight were the standard way to create animations on the Web. The alternative was to create a collection of good old-fashioned HTML, JavaScript and images, and bundle them into a collection of moving parts—a tedious task at best.

Two primary types of graphics are used on the Web:

  • Raster graphics are arrays of pixels arranged on a grid, also known as a bitmap. Common raster file extensions are .jpg, .bmp, .png, .tiff and .psd. Because Canvas uses pixels, it is raster based.
  • Vector graphics use mathematical metadata contained in a file to describe the graphic. The V in SVG stands for vector. Common vector file types are .svg, .eps and .xps.

In this article Rachel Appel investigates the advantages and disadvantages of both Canvas and SVG and recommend when you should use one rather than the other.

Read full article on MSDN http://msdn.microsoft.com/en-us/magazine/jj159886.aspx.