Archive for May, 2009

TechEd Video Interview: Dustin Campbell, Microsoft Visual Basic PM

TechEd Video Interview: Mehul Harry & Dustin Campbell

Check out this great Dustin Campbell TechEd video interview. In this video, Dustin and I discuss:

  • What a C# MVP does
  • How he became the Visual Basic Program Manager at Microsoft
  • CodeRush Origins (he was one of the early heroes who created the product!)
  • Using Visual Basic XML literals for ASP.NET MVC development
  • CodeRush performance in the latest release

Dustin is also very funny. To see what I mean, click the video image above and watch the full Dustin Campbell video interview.

Then drop me a comment here on any of the topics discussed in the video.

For reference, here's the links mentioned in the video:


ASP.NET GridView Multi-Row Edit Code Samples

Ever wonder how to edit multiple rows of the DevExpress ASP.NET GridView at the same time?

To help you with the various multi-row edit scenarios, the hard working guys on the ASP.NET team have created these great CodeCentral examples:

CodeCentral gives you a ton of benefits:

  • View source code online
  • Run sample online
  • Download and open sample project to your local Visual Studio

Check out this CodeCentral introduction video to learn how CodeCentral works. Then download one of the multi-row edit samples above and tell me how much you love CodeCentral.


What I like about OpenRasta

After having playing with the current bits of OpenRasta (OR) for a while, I  am now able to see great advantages in using this framework over other existing frameworks for building RESTful services such as WCF or the ASP.NET MVC.

Let’s explore some of the good features that make OpenRasta an excellent alternative at the moment of developing RESTful services.

1. Clean separation of resource representation from service implementation

If we take a look at a service implementation in OR, the operations in a handler receive or return a resource, but they never specify the final representation of that resource. Resource representation is a pure responsibility of the encoders configured for service implementation (a handler in OR).

In that way, we have a service implementation completely reusable for different resource representations.

public class CustomerHandler

{

    public OperationResult Get(int customerId)

    {

        return new OperationResult.OK

        {  

            ResponseResource = "Customer with id " + customerId

        };

    }

}

Once we have the service implementation, we only need to configure the encoders for that service, which could be encoders for Xml, Json, Atom or any other representation. You are free to configure all the encoders you want for the same handler.

ConfigureServer(() => ResourceSpace.Has.ResourcesOfType<Customer>()

    .AtUri("/customer/{customerId}")

    .HandledBy<CustomerHandler>()

    .AndTranscodedBy<OpenRasta.Codecs.JsonDataContractCodec>(null));

This is a different story in WCF. First of all, the content type (Xml or Json) has to be specified as part of the operation definition. If we want to support different content types, we need to replicate the same operation only to change the content type. Although this point has been improved considerably in WCF 4.0, some service implementations are still absolutely tied to the resource representation. For example, an operation that returns syndications feeds. In WCF, we have to return a concrete implementation of System.ServiceModel.Syndication.SyndicationFeedFormatter. It is not a simple as return a collection of entities or resources and specify somewhere that we want to represent them as entries in a feed.

This works much better in ADO.NET data services, where you can just return a resource or a collection of resources, and the framework itself will chose the best representation according to what the client initially sent in the “Accept” header. That representation could be Json or Atom, nothing changes in the service implementation (which is also automatically implemented). However, ADO.NET data services provide few extensibility points today for injecting custom code, and that is probably a good reason to move to OpenRasta.

2. URI resolution

In OpenRasta, the URI resolution to a handler is also part of the service configuration. This gives a great flexibility to have many URIs that resolve to the same resource instance.

A typical example is a parent-child relationship, for instance, a customer/orders relationship.

You might want to have different URIs to get access to the orders,

Customer/1/Orders/1 => Give me the order number 1 for the customer with ID 1

Or you might want to access to the order directly

Orders/1 => Give me the order number 1

In OR, you have a single handler implementation for orders (order is the resource in this case), and multiple URIs that resolve to an operation in that particular handler.

ConfigureServer(() => ResourceSpace.Has.ResourcesOfType<Order>()

    .AtUri("/customer/{customerId}/Orders/{orderId}")

    .AndAt("/orders/{orderId}")

    .HandledBy<OrderHandler>()

    .AndTranscodedBy<OpenRasta.Codecs.JsonDataContractCodec>(null));

This is a problem in WCF because the URI template is tied to the operation definition, if you want to have different URIs for the same resource, you basically have to copy/paste the same operation just to change the URIs.

[WebGet(UriTemplate="/Orders/{orderId}")]

public Order GetOrderById(int orderId)

{

  //implementation

}

[WebGet(UriTemplate = "/Customers/{customerId}/Orders/{orderId}")]

public Order GetCustomerOrder(int customerId, int orderId)

{

  //implementation

}

So, you will have as many operations as URI and content types you want to support in the service.

Comments Off more...

The My Links Web Part – It’s Not Just for My Sites #sharepoint

I’ve talked to a number of folks in recent months that have wanted to add the links stored in a user’s My Links list in their My Site to other SharePoint pages that weren’t in the My Site site collection. Up until yesterday, I had always thought this would require some custom programming.

If you aren’t familiar with My Links, it’s a great place to store those things you might normally store in your Internet Explorer Favorites or Firefox Bookmarks. The advantage to using My Links is that they are always available to you anywhere you are logged into SharePoint. So, if you log in on a different computer, your links are there. And the links can go anywhere; they don’t have to be links to SharePoint locations. Here is a screenshot of how My Links is usually accessed in SharePoint.
image

Yesterday, just for fun, I decided to try an experiment; and my experiment worked! I added a My LInks web part to my My Site. Then I exported it and saved it to my desktop.
image

Next I went to the home page of my portal, made the page editable, and clicked on Add a Web Part for one of the web part zones. I closed the Add Web Parts dialog by clicking on the link at the bottom for the Advanced Web Part gallery and options. This opened the Add Web Parts Tool Pane in the right-hand side of my browser. At the top I clicked on the down arrow beside Browse and selected Import.
image

I browsed to and selected the My_Links.dwp web part I had saved to my desktop and clicked the Upload button.

1

To finish, I just drug the My Links web part where I wanted it on the page and published the page. All my links were then showing up on the page and as I logged in as different test users, their links showed up as well, as expected.

image


Tip for jQuery & handheld device developers

This week’s usual “Friday short post” about using jQuery in handheld devices. If you are a developer who is using jQuery in applications that were developed for use in environments with small processing power such as handheld devices, mobile phones, PDA’s, etc. you will find this post useful. Anyway, back to the topic. For whatever reasons you chose to use jQuery in your application (I would

  • Sponsored Links

  •  

    May 2009
    M T W T F S S
    « Apr   Jun »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • .

    Copyright © 1996-2010 Answer My Query. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress