Friday, April 19, 2013

Sencha app upgrade from 2.0.1 to 2.1.1


Sencha has changed the way the application gets launched. 
In 2.0.1, the app.js is new an object:
new Ext.Application({
    launch: function() {
        new Ext.Panel({
            fullscreen: true,
            dockedItems: [{xtype:'toolbar', title:'My First App'}],
            layout: 'fit',
            styleHtmlContent: true,
            html: '<h2>Hello World!</h2>I did it!'
        });
    }
});

while in 2.1.1, it just calls a method
Ext.application({
        launch: function () {
            Ext.create('Ext.Panel', {
                fullscreen: true,
                html: 'Hello World!'
            });
        }
    });

If you take a Sencha 2.0.1 app and upgrade it to 2.1.1, then you will need to update the related code to make it work properly.

Tuesday, April 2, 2013

ASP.NET oData tutorial with Web API

Microsoft finally realizes it needs to provide some clean and simple functions to support developers, instead of leaving everything in developer's hands. To see a sample of this, just opening the IIS manager, the 40+ icons will make you feel you need to be a pilot in order to drive a car.
Web API is in the right direction to make things simple, and hope it can keep what it promised. The following are some steps for me to make the ASP.NET Web API oData tutorial work.
1. Install Visual Studio 2012 profiession.
2. Apply Visual Studio update 1
3. Apply Web Tool for Visual Studio 2012.2
4. Get Microsoft ASP.NET Web API OData NuGet package by console command (Why no a GUI tool, is console back in fashion?): "Install-Package Microsoft.AspNet.WebApi.OData"
5 In ProductsController.cs add using System.Web.Http.OData;
6. In WebApiConfig.cs, add using System.Web.Http.OData.Builder;
Now you should be able to build the project. From browser, navigate to the following link to show the sample data.
http://localhost:58478/oData/Products