# Wednesday, June 30, 2010

With all the hoopla over the popular iPad, don’t count out the Kindle. Amazon started by selling us a dedicated reader and the eBooks at a lower price than their physical version. Then they introduced an application for the iPhone where you did not have to buy the dedicated reader, increasing the availability of their platform. (And protecting their core asset, book sales.) Then came a PC Version and this week (finally!) an Android version.

Of course there has been pushback from the publishers over price. Publishers don’t like that new releases they charge in physical form for $30 sell for $9.99 in electronic format. Some publishers have fought back by delaying their release dates in Kindle format.

Amazon has come up with something that will potentially change the publishing industry forever. Effective today there is a new program where you can get 70% of the revenues, less delivery costs (which are $0.15 per MB.) In order to qualify, you have to list your book under $10 and it has to be 20% less than the physical price.

By sharing more of the profits, Amazon, will win over more and more publishers and thus have even more titles in Kindle format. What people may not realize is that in a few years, after iPads and Google Pads take over the world and at the same time the Kindle format has critical mass, many authors will skip publishing altogether and publish only eBooks with the Kindle format the preferred format.  Just like some rock bands today skip the record labels and go straight to iTunes. The publishing industry will be changed forever, starting today.

posted on Wednesday, June 30, 2010 3:47:46 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Tuesday, June 29, 2010

I am proud to report that Telerik won the Microsoft Partner of the Year award for Central and Eastern Europe in the ISV/Solutions Partner category.

POY_Hungary_Color

It is a great honor to win this award; it reflects everyone at the company’s hard work and dedication to the customer. Thanks to our customers, this is really their award.

posted on Tuesday, June 29, 2010 1:33:02 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, June 28, 2010

A few months ago I wrote to you about why teams succeed. I talked about the “high bandwidth” team that stressed communication and collaboration. While I believe that communication and collaboration are the keys to success of any team, I always felt that there was another important component to the equation.

I visited a large retail global customer here in Hong Kong today. They are working on a large application for their product development group using Silverlight 4.0 and have teams in the United States, India, and Hong Kong. We were talking first about their use of Telerik tools and then the conversation moved on to teams and process. They are having success and are using the agile methodology Kanban. When I left, they were proud to show me their Kanban board with all of their user stories, tasks, features, and burn down.

clip_image001

That is when it hit me; the other component of highly successful teams is transparency. I started looking back throughout my career and looked at the high performing teams that had successful projects and the very successful ones were the ones that had the magic combination of high bandwidth and transparency.

I remember ten years ago building the original Zagat.com at the height of the .COM boom. We held “open staff meetings” where our weekly staff meetings were attended by other managers from around the company. Our own version of a Kanban board was posted outside the door of our main room. We were still using Microsoft Project and Gantt charts, each chart for each project was hanging outside of the room as well and updated daily. That level of transparency built trust with the organization and enabled us to work with the business closer.

I use to get pushback from the team about our transparency; the team did not like transparency when they were behind schedule. My argument was that we had to show the good, the bad, and the ugly. Besides, it is a well-known fact that we are motivated to work hard not by money, but by our creativity and the chance to produce something truly awesome. I figured that if we make that process more public and transparent, the employees would be even more motivated. By making our product development cycle public, the team took more pride in what they did since everyone was watching.

In addition, this process solved minor disputes between team members. Once when the VP of Marketing was at our open staff meeting, two developers were arguing over something petty. They forgot that the VP of marketing was there and later told me that they “looked bad” in front of the marketing VP. The next time I made sure that the founder of the company was at our staff meeting. Everyone on the team got the message and the transparency worked.

I was also very transparent with the business information coming into IT. I use to disseminate our monthly sales numbers (which were a closely guarded secret) to the whole department. The CEO asked me to stop since IT were the only people in the company besides the senior management to know this information. I responded with even more transparency and shared with the team our profit and loss information as well. (The CEO was not happy, but to her credit, she did not stop me.)

The Agile movement really helped push the importance of transparency forward. The very intention of the Scrum or Kanban board is to be public; same with the daily scrum meeting. If the business is engaged and attending your meetings, there is going to be more productivity and much less friction. Luminary Kent Beck wrote a white paper on agile tooling and teams where he stressed transparency. Beck says:

“When I started programming the weekly status report was sufficient. Here’s what I did this week, here’s what I’m planning to do next week. Press fast forward twice, though, and the weekly status report becomes as quaint as a debate about the relative merits of assembly language and higher level languages. … transparency is a choice you make to offer trustworthiness to you teammates. A transparent team can more cheaply and effectively coordinate their efforts towards shared goals. Acting transparently sends a signal to others that they can trust you. Trust, when realized, reduces the friction of development as people focus more on what they are accomplishing together and less on avoiding blame.”

Ten years after my experiences at Zagat, it is even easier to be transparent. There are many tools that help with transparency. Kent Beck also states in the white paper:

“One way out of the Reporting Dilemma is to stop explicitly telling people what you are doing. Instead, rely on your tools to infer your intentions from your activities and report that for you.”

Agile teams usually publish burn down charts and team velocity charts to report progress between iterations. In an effort to be both more transparent and more automated, the industry has moved to Agile Dashboards, dashboards that read from your repository and automatically publish your burn down and velocity charts as well as other vital information related to the iteration and build process (including my personal favorite, who broke the build.)

Several vendors offer an agile dashboard, such as i.e. Rally’s Team Status Dashboard, VersionOne, and of course Telerik. Our Agile Dashboard, a free tool, posts all the important details of a project on a dashboard for the whole world to see. This tool is meant to be on a large TV, hanging over the receptionist’s desk when you walk into a company complete the status of the current iteration, burn down charts, and even a photo of who last broke the build.

clip_image002

This decade will be remembered as the era when technology teams fully embraced transparency. As teams start to automate their transparency and look for ways to be more open, the quality of the software they produce will only improve. I look forward to this brave new (open) world.

posted on Monday, June 28, 2010 1:44:44 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Friday, June 25, 2010

The battle for mobile supremacy has really heated up. Apple and Goolge had round 1 back in January with the release of the Google Nexus One. With the release of the iPhone 4 and the Droid X we are well into round 2.  I am not going to debate which device is better or worse, that is for the market to shake out. Rather I want to comment on how the popularity of each device is strengthening its underlying platform. The iPhone 4.0 and iPad 1.0 run on iOS 4. Google’s mainline devices run Android 2.1 or will be upgraded to Android 2.2. “Froyo'”.  It has been reported that Google will release an iPad style “Google Pad” based on Android 2.x as well. Developers are lining up to write applications for these two platforms, each expanding from the phone to a slate/tablet device. It is possible you may see netbook style devices running iOS and Android soon. That said, looking ahead 5 years from now, which one will “win” the most mindshare?

Apple’s iOS is quite popular since the iPhone and iPad are selling so well. Developers are turned off by the AppStore’s approval process and Objective-C in general. Apple also maintains complete control over iOS and you can’t license it and put it on your own consumer electronics device. Android is more open and easier to program for since it uses the more mainstream Java language. It is also possible that you can use Android on other devices (I know a company here in Hong Kong building a consumer electronics device based on Android.) Also, Google’s marketplace is not restricted (hence you can download porn apps if you like.)

In the long term my money is behind Google for two reasons: it is easier to code for and it more open. Eventually what you will see is applications appearing first on the Android then on the iPhone, with some never making it over for AppStore reasons or for Objective-C reasons. (This already happened with several World Cup focused applications.) Applications are what make a platform, you can have a more “cool” platform with less apps and the less “cool” platform with more apps will still win. Think Mac v PC 15+ years ago.

Speaking of PCs, where is Microsoft in all of this? The Zune based Windows Phone 7 is not slated to come out any time soon. By the time WP7 ships we will be talking about iPhone 5.0 rumors, Android 3.0 rumors, and the next generation iPad. Microsoft has a lot of catching up to do.

posted on Friday, June 25, 2010 5:40:43 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Thursday, June 24, 2010

Read the other posts in this series:

In the previous blog posts listed above, I showed how Telerik’s new LINQ implementation works with WCF RIA Services. I showed how to build your own Domain Service, build custom query methods, and make a metadata class. In this post I will show how to expose your Domain Service as an OData feed.

The Open Data Protocol (OData) is a Web protocol for querying and updating data in a RESTful fashion. You create OData feeds when you want to set up feeds for 3rd parties to consume, typically without your knowledge. For example Twitter has a RESTful feed of all its public tweets and many applications will consume that feed.

You may use WCF RIA Services to create your application, however, you may want to expose parts of your application as a feed for others to consume. This is real easy to do. Let’s see how.

I will continue using the same project from the first three parts of this blog series. In the server (ASP.net) project you have to do three things. First set a reference to System.ServiceModel.DomainServices.Hosting.OData.

Next we have to configure an OData endpoint. You do this by adding the following to your web.config under the system.serviceModel node:

<domainServices>
  <endpoints>
   <add 
name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, 
System.ServiceModel.DomainServices.Hosting.OData, 
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </endpoints>
</domainServices>

Lastly, you have to tell RIA Services what methods of your DomainService you want to expose. The methods you expose have to be an IQueryable and parameterless (which means the query methods in Part II are ineligible) and decorated with the IsDefult=true attribute. I will expose our GetCustomers() method from Part I as shown here by adding the attribute to the method:

   1:  //enable OData
   2:  [Query(IsDefault = true)]
   3:  public IQueryable<Customer> GetCustomers()
   4:  {
   5:      return this.DataContext.Customers
   6:          .Where(c => c.Country == "Germany")
   7:          .OrderBy(c => c.CustomerID);
   8:  }

Now you can run your project and view the OData feed from a browser. The format of the URL is the namespace+typename for the DomainService with dots replaced by hyphens followed by “.svc/odata/”. (Note, I have found that this is case sensitive and requires the terminating /.)

So for example, our Namespace is SilverlightApplication6.Web and our Domain Service is DomainService1, so our url would be http://servername/SilverlightApplication6-Web-DomainService1.svc/odata/

My URL is the following and the results are shown below:

http://localhost:1055/SilverlightApplication6-Web-DomainService1.svc/odata/

clip_image002

Now let’s explore the OData feed. Being a RESTful service you will access the feed and each resource via HTTP. The resource in this case will be the names of your Entities. What is great is that the OData feed respects the business rules of your RIA Service (since it is using the same DomainService), so you don’t have to worry about data leakage, nor duplicate any work replicating your business rules. Let’s drill down into the CustomerSet:

http://localhost:1055/SilverlightApplication6-Web-DomainService1.svc/odata/CustomerSet

clip_image004

That is it. You can then consume the feed from an iPhone app, .NET application, Excel PowerPivot, or any other application that supports HTTP and XML (which is pretty much anything.)

Enjoy!

posted on Thursday, June 24, 2010 4:00:03 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Wednesday, June 23, 2010

Even though I played soccer as a kid, I grew up watching mostly professional baseball. Even though I did catch Pele play a few matches for the NY Cosmos as a kid, my love for professional soccer started when the US hosted the 1994 World Cup. My professional speaking career, however, seems to be linked to professional soccer.

It all started at my very first TechEd: TechEd Europe 1998 in Nice, France. Prior to 2006, TechEd Europe was held in early summer, always causing me to spend the July 4th independence day outside of the United States. Back in 1998, France was hosting the World Cup and subsequently won it all. While I got caught up in all of the hoopla, I also had to speak at an event in London the next week and the entire country of France shut down, making it impossible for me to travel. Thus began the link with my professional speaking and soccer.

As the years went by I found myself speaking in Barcelona six times and went to FC Barcelona matches each year and they became my favorite team. in 2005 I found myself in Turkey when the European Cup was going on (and had to deal with the traffic since the speaking venue was right near the stadium). In 2006 I found myself in Egypt during the Africa Cup and was in a taxi trying to get to my speaking event in standstill traffic as the entire city tried to obtain tickets for the final match. I had to get out of the taxi and run 3km to the venue to make my talk in time. (I called Patrick Hynds to stall the crowd, but did make it with 5 minutes to spare.) I watched Egypt win the finals on penalty kicks a few days later in the middle of the street in Luxor with about 20 locals surrounding a tiny black and white TV while Kathleen shopped. We all smoked shisha together to celebrate and the shop owner (who was ignoring Kathleen and watching the game) gave us an additional 50% discount on all sales. After Kathleen finished buying her stuff, all of us, including Goksin’s 7 year old daughter, started running through the streets to celebrate.

One of the most memorable experiences was also in Egypt. in 2004 FIFA stated that Egypt, Morocco, and South Africa were the favorites to host the 2010 World Cup. I was in Egypt and Morocco during that time and met up with several MVPs for dinner. They all asked me: “Do you support an African World Cup?” I said yes and said that I will travel back to Africa to watch the world cup in 2010.

This weekend I kept my promise. I had a nice long weekend in South Africa and went to a few matches, keeping my promise to the African MVPs. (You can even look closely at this photo, besides my Team USA jersey, I am wearing my 2010 MVP jacket, and boy did I need it, it was coooold!)

Most of the non-African world hates the vuvuzela horn. The vuvuzela is an uniquely African (mostly South African) cultural experience. You can’t enjoy soccer in southern Africa without it. Showing my support for the African World Cup, I went native and blew that horn all night long.

IMG_1721

I am glad that I was able to keep my 6 year old promise. It seems that professional soccer and my speaking career are linked. Any Brazilian MVPs/RDs want to put me up in 2014?

posted on Wednesday, June 23, 2010 2:21:51 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, June 22, 2010

Tuesday, June 29, 2010
Parallel Programming with .NET 4 and Visual Studio 2010

Subject:
You must register athttp://parallelcomputingtalk.eventbrite.com/ in order to be admitted to the building and attend.

In the past, introducing concurrency and parallelism into libraries and applications was difficult, time consuming, and error-prone. However, as the hardware industry shifts towards multi-core and manycore processors, the key to high-performance applications is parallelism. The .NET Framework 4 and Visual Studio 2010 offer solutions to help make coding, debugging, and profiling concurrent applications significantly easier. In this interactive deep-dive, we’ll examine Parallel LINQ-to-Objects (PLINQ), the Task Parallel Library (TPL), new coordination and synchronization types, and Visual Studio tooling support in order to provide a look at the next generation of parallel programming with .NET.

Speaker:
Stephen Toub, Microsoft
Stephen Toub is a Principal Program Manager on the Parallel Computing Platform team at Microsoft. He’s excited to be back in Manhattan, where he lived and worked for several years.

Date:
Tuesday, June 29, 2010

Time:
Reception 6:00 PM , Program 6:15 PM

Location: 
Microsoft , 1290 Avenue of the Americas (the AXA building - bet. 51st/52nd Sts.) , 6th floor

Directions:
B/D/F/V to 47th-50th Sts./Rockefeller Ctr
1 to 50th St./Bway
N/R/W to 49th St./7th Ave.

posted on Tuesday, June 22, 2010 4:48:59 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Monday, June 21, 2010

Read the other posts in this series:

In the previous blog posts listed above, I showed how Telerik’s new LINQ implementation works with WCF RIA Services. I showed how to build your own Domain Service as well as build custom query methods. In this post I will show how to build a metadata class. (Note: future versions of the OpenAccess LINQ Implementation will produce the metadata class for you automatically.)

The WCF RIA Services metadata class is a separate class from the DomainService that contains information about the entities. In this class you can write custom validation logic, set attributes of the properties of the entities or indicate whether the property is to be generated on the client or not.

To create this class, create a new class in Visual Studio and name it: YourDomainSeriveClassName.metadata.cs. For example, our DomainService is DomainService1, so the metadata class is: DomainService1.metadata.cs.

Erase everything in the class and then replace it with the following, using the proper namespace in your project:

 

   1:  namespace SilverlightApplication6.Web
   2:  {
   3:      using System.ComponentModel.DataAnnotations;
   4:   
   5:      // The MetadataTypeAttribute identifies CustomersMetadata as the class
   6:      // that carries additional metadata for the Customers class.
   7:      [MetadataTypeAttribute(typeof(Customers.CustomersMetadata))]
   8:      public partial class Customers
   9:      {
  10:          internal sealed class CustomersMetadata
  11:          {
  12:              // Metadata classes are not meant to be instantiated.
  13:              private CustomersMetadata()
  14:              {
  15:              }
  16:              public string Address { get; set; }
  17:              public string City { get; set; }
  18:              public string CompanyName { get; set; }
  19:              public string ContactName { get; set; }
  20:              public string ContactTitle { get; set; }
  21:              public string Country { get; set; }
  22:              public string CustomerID { get; set; }
  23:              public string Fax { get; set; }
  24:              public string Phone { get; set; }
  25:              public string PostalCode { get; set; }
  26:              public string Region { get; set; }
  27:          }
  28:      }
  29:  }

As you can see this class has each of the properties of your entity (lines 16-26), now you can set them as required, specify a length, or validate with a RegEx pattern. You can also specify that a property should not be sent down to the client. Of course you can specify much more sophisticated rules, you can even write your own methods.

Let’s do a quick example on the CompanyName property, we will set it to required, set an error message to be displayed if the field is not entered as well as set a length of 32. This is done with two attributes:

   1:  [Required(ErrorMessage = "CompanyName is Required!!")]
   2:  [StringLength(32)]
   3:  public string CompanyName { get; set; }

Now when you perform databinding, RIA Services will enforce these rules for you on the client. For example, if try to edit our data in the application built in Part II, RIA Services automatically adds validation for us and passes on the error message we specified in the attribute. (Note you have to add an UpdateCustomer method to your DomainService1 class to enable editing.)

clip_image002

Enjoy!

posted on Monday, June 21, 2010 6:55:05 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Friday, June 18, 2010

In my last blog post, I showed how Telerik’s new LINQ implementation works with WCF RIA Services. In that post I built a Domain Model from the Northwind database as well as a RIA Services Domain Service. I then showed the drag and drop features of RIA Services and created a simple Silverlight application with no code. Today we are going to take that example one step further by creating some custom server side Query Methods.

A query method is just a facility to query a data source. In RIA Services, you define a query method explicitly so it can be used on the client. This is pretty straight forward with RIA Services. Let’s create a query method to query the Customer table by its primary key (CustomerID) in the database. To do this, open the project we used in the previous blog post and add this code to the DomainService class in the server project.

   1:      //This query method will return only 1 customer
   2:      [Query(IsComposable = false)]
   3:      public Customer GetCustomersByID(string customerID)
   4:      {
   5:          //must also include the Germany restriction
   6:          //to keep in sync with the GetCustomers business logic
   7:          return this.DataContext.Customers.SingleOrDefault
   8:              (c => c.CustomerID == customerID 
   9:                  && c.Country=="Germany");
  10:      }

 

This method will return one customer and you need to specify that by the attribute IsComposable=False (Line 2). Everything else is pretty basic, you have a method signature that accepts a parameter (Line 3) and a LINQ statement that filters the data by CustomerID as well as by country (lines 8-9). We are filtering by country as well because in our original business logic (in Part I) we had a GetCustomers() method that filtered all of the records by the country Germany. This new GetCustomersByID method knows nothing of the GetCustomers() method so we have to replicate that business logic here. (We have hard coded the value of Germany, in a production application, you would most likely obtain this value from a database or cookie after authentication.)

Let’s create a second query method, one that will filter the Customer data source by the ContactName field and return a collection, not a single item. We define an IQueryable collection of Customer as the return value in the method signature (Line 3) and accept a parameter. This parameter is used in our LINQ statement to filter the data source (Lines 9-10). In addition, just like the previous example, we must also filter by the country Germany; also replicate the OrderBy of our GetCustomers() method (Line 11).

   1:  //This query method will return a collection of customers
   2:  //filtered by the letters passed in on the contact name
   3:  public IQueryable<Customer> GetCustomersByLetter(string letter)
   4:  {
   5:      //must also include the Germany restriction
   6:      //to keep in sync with the GetCustomers business logic
   7:      //also since we are returning a collection, must
   8:      //respect the OrderBy as well from the business logic
   9:      return this.DataContext.Customers.Where
  10:          (c => c.ContactName.StartsWith(letter) == true
  11:              && c.Country == "Germany").OrderBy(c => c.CustomerID);
  12:  }

 

Now that we have defined two query methods, let’s wire them up to our XAML form in the Silverlight application.

In our Silverlight application, delete the grid that we had dragged onto the form in Part I. Replace it with two labels, two text boxes, two buttons and a grid (set the grid’s AutoGenerateColumns property to True.) Your XAML page should look something like this:

image

Now we have to write some code.

In the last blog post we were able to use the drag and drop features of RIA Services and not write any code. Today I will show you how to perform similar and more advanced functions with just a little bit of code. First we need two using statements in order to get working:

using SilverlightApplication6.Web;
using System.ServiceModel.DomainServices.Client;

Next we need to create a global variable for the RIA Services DomainService’s context.

   1:  //domain context for all RIA operations
   2:  private DomainService1 domainContext = new DomainService1();

 

Next we will load the grid with all of the data the first time the XAML form loads. We load the data by calling the GetCustomers() method we created in the previous blog post (we use the domainContext global variable in line 6.).

   1:  void MainPage_Loaded(object sender, RoutedEventArgs e)
   2:  {
   3:      //since we are going across the wire, must explicitly tell
   4:      //RIA Services that we are going to load data 
   5:      LoadOperation<Customer> loadOperation = 
   6:          domainContext.Load<Customer>(domainContext.GetCustomersQuery());
   7:      //the actual binding of the results, RIA takes care of the async
   8:      this.dataGrid1.ItemsSource = loadOperation.Entities;
   9:  }

 

This code does the same thing as the drag and drop did in the previous blog post, call GetCustomers() (Lines 5-6) and bind the results (line 8). Notice in the codegen on the client, RIA Services appends the word “Query” to all query methods.  In the previous blog post this was done automatically, but today we did it via code. If we run this it will give us the following view:

image

Now let’s wire up the buttons so we can perform the filters. First we will wire up the button that will search by CustomerID. That button click event will call the GetCustomerByID query method (lines 11-13) and bind the results (line 15.) We have to pass in the data the user entered in the text box, make sure in production to validate this data!

   1:  private void button1_Click(object sender, RoutedEventArgs e)
   2:  {
   3:      //disable the buttons during the async load
   4:      //to prevent the user from clicking twice while waiting
   5:      button1.IsEnabled = false;
   6:      button2.IsEnabled = false;
   7:   
   8:      //since we are going across the wire, must explicitly tell
   9:      //RIA Services that we are going to load data 
  10:      //Also here is where you pass the parameter in 
  11:      LoadOperation<Customer> loadOp = domainContext.Load
  12:          (domainContext.GetCustomersByIDQuery(textBox1.Text), 
  13:              CustomerLoadedCallback, null);
  14:      //the actual data binding, RIA takes care of the async
  15:      dataGrid1.ItemsSource = loadOp.Entities;
  16:  }

As part of the operation, RIA Services will handle the asynchronous processing for you. The problem is that users are not used to async operations, so they may try to click on the button more than once. We account for this by disabling the buttons (lines 5-6) until the operation is complete.  We have to catch the end of the async operation in a callback function and pass that in as a parameter to the operation (line 13). The callback function is here:

   1:  //callback function for when the load is complete
   2:  private void CustomerLoadedCallback(LoadOperation<Customer> loadOperation)
   3:  {
   4:      //re-enable our buttons
   5:      //if you want to display an "IsBusy" graphic
   6:      //this is where you would remove it
   7:      button1.IsEnabled = true;
   8:      button2.IsEnabled = true;
   9:  }

 

Let’s run this and test it out. If you filter by “ALFKI”, the results look like this:

image

Now let’s do the same for the the filter by ContactName. The code behind the button event is here:

   1:  private void button2_Click(object sender, RoutedEventArgs e)
   2:  {
   3:      //disable the buttons during the async load
   4:      //to prevent the user from clicking twice while waiting
   5:      button1.IsEnabled = false;
   6:      button2.IsEnabled = false;
   7:   
   8:      //since we are going across the wire, must explicitly tell
   9:      //RIA Services that we are going to load data 
  10:      //Also here is where you pass the parameter in 
  11:      LoadOperation<Customer> loadOp = domainContext.Load
  12:          (domainContext.GetCustomersByLetterQuery(textBox2.Text),
  13:              CustomerLoadedCallback, null);
  14:      //the actual data binding, RIA takes care of the async
  15:      dataGrid1.ItemsSource = loadOp.Entities;
  16:  }

Similar to the previous example, we are calling the query method, this time GetCustomersByLetter (lines 11-13) and passing in the value the user typed into the text box. When we run this and filter by all contacts that start with the letter H, it looks like this:

image

Hopefully with these two examples you can see the power of using Telerik’s new LINQ implementation and WCF RIA Services.

Enjoy!

posted on Friday, June 18, 2010 5:20:56 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Thursday, June 17, 2010

With the Q1 release of Telerik OpenAccess ORM, Telerik released a brand new LINQ Implementation and supporting Visual Entity Designer. With the upcoming Q2 release next month, we will introduce full WCF RIA Services support. If you want to get started now you can wire up the services yourself pretty easily. Let’s take a look at how to get your feet wet with RIA Services and Telerik’s LINQ implementation.

Before you get started, you will need a few things installed:

  • Visual Studio 2010
  • Silverlight 4
  • WCF RIA Services for Visual Studio 2010
  • Northwind sample database
  • Telerik OpenAccess ORM Q1 Service Pack 1 or higher

Getting Started: The Easy Stuff

Let’s create a new Silverlight application first. In the New Silverlight Application dialog, check the “Enable WCF RIA Services” checkbox. This will enable RIA Services.

image

The next step is to create a new Telerik Domain Model in the server (ASP.NET) project. I have a detailed walk through here on how to do that. We’ll create a new Domain Model by right clicking on the server project and selecting “Add” and choosing the Telerik Domain Model from the menu. Then we will map all of the tables from Northwind using the wizard. We’ll also keep the default model name of NorthwindEntityDiagrams.

image

We’re in good shape. So far if you have used the new LINQ Implementation nothing is new (or LINQ to SQL/EF for that matter.)  Now let’s add the RIA Services stuff.

Housekeeping-Adding References

Since our RIA Services support is still beta, you have to wire up a few things manually, including some references. You need to add:

  • Telerik.OpenAccess.Ria.Extensions.dll (found under “Browse: Program Files|Telerik|OpenAccess ORM|Bin)
  • System.ServiceModel.DomainServices.Server.dll
  • System.ServiceModel.DomainServices.Hosting.dll
  • System.ComponentModel.DataAnnotations.dll

image

Now we are ready to create the domain class.

Creating the Domain Class

Add a new Domain Service Class by right clicking and selecting Add|New Item and choose Domain Service Class.

image

Accept the defaults in the dialog and then we are ready to go. (Note at this time OpenAccess does not support creation of the class for metadata, but will soon, possibly even before Q2.)

image

Once you accept this dialog, a new empty class is generated.

   1:      [EnableClientAccess()]
   2:      public class DomainService1 : DomainService
   3:      {
   4:      }

 

We need to add a using statement so we can make sure our DomainService uses the OpenAccess model: using Telerik.OpenAccess;

Now change the inheritance of DomainService1 to this:

   1:  [EnableClientAccess()]
   2:  public class DomainService1 : OpenAccessDomainService<NorthwindEntityDiagrams>
   3:  {
   4:  }

Now we have one last step to create our DomainService, we have to add the CRUD methods. (In the future all of this will be done automatically for you!)

   1:  {
   2:      public IQueryable<Customer> GetCustomers() 
   3:      { 
   4:          return this.DataContext.Customers; 
   5:      }
   6:   
   7:      public void InsertCustomer(Customer c)
   8:      {
   9:          this.DataContext.Add(c);
  10:          this.DataContext.SaveChanges();
  11:      }
  12:      public void DeleteCustomer(Customer c)
  13:      {
  14:          this.DataContext.Delete(c);
  15:          this.DataContext.SaveChanges();
  16:      }

These are the methods of your DomainService. You can also add business logic here. Let’s do that with our GetCustomers() query.  I will write some business logic that filters all of the customers by the country of Germany. Of course you would have more complex business logic here, however, I just want to demonstrate the point. All clients that use this DomainService will inherit this business logic, even if you expose your service as an OData feed. Our implementation is here:

   1:  public IQueryable<Customer> GetCustomers() 
   2:  { 
   3:      return this.DataContext.Customers
   4:          .Where(c=> c.Country=="Germany")
   5:          .OrderBy(c=> c.CustomerID); 
   6:  }

 

Now you are done. Compile and let’s get cracking on a Silverlight client.

Creating the Silverlight Client

This is the easy part. We’ll use the RIA Services drag and drop features. Open MainPage.XAML in the Silverlight application and in the Data Sources window, drag and drop the Customer entity to the XAML form. (Tip: if the Data Sources window is blank or not showing up, you can manually force it to come up via the “Data” menu option on the main menu in Visual Studio.)

Once you drag and drop the entity to the form, a grid will automatically show up.

image

Now press F5 and see the application running.

image

That's it! We just created an OpenAccess based RIA Services application!

Of course there is a lot more to RIA Services than just binding a grid, however, this demonstration should show you that once you create your DomainService class, all of the RIA Services “stuff” just works for you. In future posts we will look at more RIA Services features as well as creating a query method.

Enjoy!

posted on Thursday, June 17, 2010 9:06:30 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [3] Trackback
# Wednesday, June 16, 2010

The true power of OData is that the programming model is the same for any feed. I spend a lot of time building and demoing my own feeds- usually building an OData service around Northwind or AdventureWorks. To realize the power of OData you also need to know that you can consume public feeds. Let’s take a look at consuming the Microsoft TechEd Sessions OData Service. The TechEd service can be found here: http://odata.msteched.com/sessions.svc/

Being a RESTful service, we can drill down a little and investigate our data. I will do some URL querying and look at a list of all the speakers as well as their sessions. For example I can drill down to see all speakers named “Forte”

http://odata.msteched.com/sessions.svc/Speakers?$filter=SpeakerLastName eq 'Forte'

Or all of my sessions:

http://odata.msteched.com/sessions.svc/Speakers(1621)/Sessions

This is the beauty of OData, we don’t know how it was created, we also don’t care. All we care is if we can consume it easily. Let’s do so with an ASP.net application and the OData client for ASP.NET.

To get started, create a new ASP.NET application. In the application, right click on the References folder of the project in the Solution Explorer and select “Add Service Reference”. Put in the public URL of the TechED 2010 OData Service. This creates a proxy so you can code against the service locally and not know the difference.

image

Next set a reference to System.Data.Services.Client. This will enable us to use the OData client library and LINQ on the ASP.net client. Then drag a textbox, button, and a gridview to the ASP page. We’ll fill the gridView with the Speaker data filtered on the last name field based on what was typed in to the textbox. We accomplish this with the following code on the button click.

   1:  //set a reference to ServiceReference1 and System.Data.Services.Client
   2:  ODataTENA10Entities dat = 
   3:      new ODataTENA10Entities(new Uri("http://odata.msteched.com/sessions.svc/"));
   4:              
   5:  //LINQ statement to filter by the textbox
   6:  var result = from s in dat.Speakers
   7:                  where s.SpeakerLastName.StartsWith(TextBox1.Text.ToString())
   8:                  orderby s.SpeakerLastName
   9:                  select s; 
  10:   
  11:  //bind the results
  12:  GridView1.DataSource = result;
  13:  GridView1.DataBind();

 

Line 2 and 3 sets the data context and the LINQ statement is on lines 6-9. Line 7 is where we do the filtering based on the textbox. Pretty easy stuff.

image

Enjoy!

posted on Wednesday, June 16, 2010 7:19:13 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, June 15, 2010

Last month I participated in a World Cup themed skit about information worker productivity at the launch of Office 2010 and SharePoint 2010 in Hong Kong. You can watch the skits here. It was a lot of fun and shows off a ton of new features in Office and Sharepoint, including PowerPivot.

Enjoy!

posted on Tuesday, June 15, 2010 4:56:51 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, June 14, 2010

Last week at TechEd North America I did DEV303, Building RESTful Applications with the OData Protocol. I really enjoy doing this session since I get to code on the fly and talk about building applications. At a high level we covered:

  • What is REST, comparison to Web Services (REST is resource based, Web Services is RPC/method based)
  • What is OData, who is using it
  • When to use OData vs RIA Services (OData is for exposing data as a service across boundaries, RIA is for a VB6 style RAD application development)
  • Using WCF Data Services to build an OData Service
  • Consuming the WCF Data Service in Silverlight asynchronously –yes everyone had to suffer and watch me code
  • A Bill Gates joke
  • WCF Data Services Service Operations, Data Interceptors (Query and Change), Data paging
  • Consuming OData Services in ASP.NET (select and add, we even got to see my custom error raise)

You can download the slides and code here.

posted on Monday, June 14, 2010 8:25:55 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Thursday, June 10, 2010

Telerik won the “Best of TechEd” award in the “Best Components and Middleware” category last night at TechEd in New Orleans, LA. Our premium collection was judged as the most innovative and best value over all the other vendors.

All 200+ of the Telerik employees around the world feel honored and those of us here of course took time to celebrate on Bourbon street. Now we’re back to work and hope to live up to our customers high expectations. (If you are still at TechEd, swing by the booth and take a look at the award, we are here until 3pm today when the Expo closes.)

Thanks again to all of our customers, you make us better and we do it for you.

31691_1451994147381_1459091054_31166546_61564_n

Here are the Telerikers left standing late last night in the French Quarter in New Orleans.

posted on Thursday, June 10, 2010 12:34:20 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, June 08, 2010

Thursday, June 17, 2010
10 Practices Every Developer Should Start Right Now

Subject: 
You must register at https://www.clicktoattend.com/invitation.aspx?code=149217 in order to be admitted to the building and attend.
Based on Caleb’s popular blog series, these are the 10 things that if you or your company starting doing today, it would drastically change the way that you write and deliver software!
Topics hit on: Object Oriented Principals, SOLID Coding, Security Concerns, Software Patterns, Automated Testing, Source Control - Branching and Merging Strategies, Continuous Integration, Agile | Scrum | XP | Lean, Team Dynamics, Continually Learning

Speaker: 
Caleb Jenkins, Proaction Mentors
As a long time community leader and former Microsoft Developer Evangelist Caleb is well known for his engaging speaking style, depth of knowledge and creative energy. Caleb is the Principal Mentor and founder of Proaction Mentors - a Software Architecture and Development Mentoring Company.
Working as a Microsoft Certified Solution Developer, Certified Trainer and .Net Architect Caleb has helped to design and implement enterprise .Net solutions for some of the largest companies in the world; Six Flags, Countrywide Mortgage, American Airlines, CGI-AMS, Dollar Thrifty Automotive Group and Sunoco Inc. to name a few.
You may also recognize Caleb from his previous work with Improving Enterprises, or from his work as an active national speaker for the International .NET Association (INETA), a Microsoft MVP for ASP.NET, a Certified Scrum Master. He’s worked as a technical editor for Wrox Press, and was recently a featured presenter on xTrain and Adobe.TV. Caleb is also the host, cameraman and editor for CommunityCast TV (CommunityCast.wordpress.com).

Date: 
Thursday, June 17, 2010

Time: 
Reception 6:00 PM , Program 6:30 PM

Location:  
Microsoft , 1290 Avenue of the Americas (the AXA building - bet. 51st/52nd Sts.) , 6th floor

Directions:
B/D/F/V to 47th-50th Sts./Rockefeller Ctr
1 to 50th St./Bway
N/R/W to 49th St./7th Ave.

posted on Tuesday, June 08, 2010 7:54:32 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, June 07, 2010

Yesterday Joel and I did the day long Agile precon at TechEd in New Orleans, LA. We had a great crowd and were able to keep them engaged for 8 hours. You can download the materials here.

We used an “Agile presenting” technique where we put the agenda in an “Agenda Backlog” and we reprioritized after every sprint (agenda item) and let the audience decide what we would talk about next. To our surprise the audience voted against two planned sections and we did two new sections on the fly. We talked about:

  • Agile theory and agile methodologies (XP, Scrum, FDD, DSDM, *DD, Kanban, etc)
  • Intro to Scrum
  • Agile Estimation
  • Challenges to Implementing Agile in General
  • Challenges to Implementing Agile: In the Enterprise
  • Challenges to Implementing Agile: Remote Teams
  • Tools
  • QA and Documentation

We got into a discussion on what happens when the team finishes early, do you stop the sprint, or give them more work to do. (Joel and I both go against the agile literature and give the team more work!)

We also took a few micro-breaks to rest our brain to talk about the iPhone v Android, how I buy Joel clothes, and movie quotes from the Matrix (I know Kung Fu) and What about Bob (Baby Steps).

We also recommended a book, one of my favorite management books of all time: Peopleware. For those of you non-techies reading this blog (I don’t know why!) if you manage teams, this book is also for you.

Hope to do this seminar again soon!

posted on Monday, June 07, 2010 12:04:51 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Friday, June 04, 2010

While connecting flights in Japan today en route to TechEd, the security wanted to re-run my bag. They kinda freaked out as to what was in it. They took everything out that was electronic and ran it again. The electronics took three bins, here is what it was:

  • Dell laptop
  • Laptop plug
  • Adapter (my plug uses Hong Kong prongs)
  • Cat5 wire
  • USB external hard drive
  • Wireless mouse
  • Kindle
  • Kindle wire
  • Bose noise cancellation headphones
  • Zune
  • Zune wire
  • Canon G10 Camera
  • Camera battery charger
  • Camera wire
  • Android Nexus One Phone
  • Charger

By now the only thing left in the bag was my notebook, business cards, a pen, and my passport. I would have taken a photo but they had my camera!

posted on Friday, June 04, 2010 6:31:17 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Thursday, June 03, 2010

Last week Telerik released a service pack for OpenAccess Q1. The service pack fixes a few issues with Telerik’s new LINQ implementation working under Visual Studio 2010. In addition, the service pack shipped the Data Services Wizard; the Data Service Wizard is no longer a separate install. You can use the Data Service Wizard with traditional OpenAccess classes or the new LINQ implementation. Today I will show show you a new feature of the wizard: automatically creating a styled Silverlight application from your domain model. Future blog posts will show how to use RIA Services as well as SQL Azure.

To get started open up Visual Studio 2010 and create a new ASP.net application. Create a new domain model by right clicking on the project and say Add|New Item and choose Telerik OpenAccess Domain Model from the dialog.

image

This will bring up the OpenAccess ORM Data Wizard to create your domain model by mapping tables to entities. Let’s use Northwind and map all tables and use the default model name: NorthwindEntityDiagrams. While there are other advanced features of the wizard, like T4 templates to override the default codegen, let’s just accept the defaults and finish.

image

Once you click Finish the wizard will add a new domain model to your project.

image

Now that we have our domain model, it is time to run the Data Services Wizard to automatically create the a RESTful service using WCF Data Services. (The data service wizard also gives us the ability to create a WCF endpoint as well.) This can be done from the Telerik|Data Services Wizard menu option from the Visual Studio main menu (or right clicking on the EntityDiagrams1.rlinq file.) The first page of the wizard asks you where the domain model lives and what project to place the new service in. We’ll do it all in the same project.

image

The next page of the wizard asks you what entities you want to expose in your service as well as if you want to generate a Silverlight Application. If you check this you are given the option to use the standard Microsoft Silverlight controls or the Telerik controls (if you have them installed.) If you choose the Telerik controls, you will also be able to choose a theme for your Silverlight application. The drop down will show you a list of all of the installed themes. I’ll go ahead and choose the Windows7 theme.

image

After you click through the finish page of the wizard, the next step is to hit F5 and run your application. A basic, but styled, Silverlight application is created for you, getting you started with all of the CRUD methods. The Telerik version has all of the features your would expect, built in sorting and filtering, grouping, etc. I know that you will want to change the baseline application, but this is a great start, eliminating all of the asynchronous CRUD code that you have to write. Not bad for about 30 seconds of work!

image

Enjoy!

posted on Thursday, June 03, 2010 3:41:03 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Wednesday, June 02, 2010

I found this over on Jeff Atwood's blog today. Jeff was explaining issues around the Stack Exchange on Stack Overflow and spoke about what motivates employees. What is interesting is that money was not the top item on the list. Jeff was influenced by Dan Pink of the RSA org’s TED talk and other works. 

The notion that money motivates employees comes from classical economics study of the Industrial Revolution. Back then people did tasks and built widgets, the more tasks they did, the more widgets they built, the more profit the company made. Today most people work in a knowledge economy. Dan Pink makes the argument that once someone have to use their brain at work, money is less and less of a motivator. I am republishing Dan’s video from YouTube about the “Surprising truth about what motivates us.” Worth watching.

 

posted on Wednesday, June 02, 2010 4:29:37 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Tuesday, June 01, 2010

I’ll be speaking at TechEd North America in New Orleans next week and hope to have a front row seat to some Microsoft announcements. Microsoft practices CDD or “Conference Driven Development” where major announcements have been made only at large trade shows like PDC, MIX, and TechEd. Since there is no PDC this year, TechEd is an opportunity for Microsoft to make some BI, developer or IT pro announcements. There are two keynotes by “Microsoft executives” and I’ll be looking (hoping) for Microsoft to make the following announcements, in order of probability:

iPhone Development Kit

This one has been rumored for a while. While I am sure we may see some kind of minor Windows Phone 7 announcement at Teched, is there going to be an iPhone SDK for Silverlight and Visual Studio 2010?

Azure Pricing Changes

Windows Azure seems to have been accepted by the Tech community as something that is well architected and very stable, but the general consensus is that it is a tough sell to customers privacy/cloud wise and cost wise. While I don’t have a major problem with Azure pricing, it could have more competitive pricing plans in place in order to do a land grab on adoption.

Silverlight 5.0 Roadmap

It is too early for a beta, but it would be great to have some info on Silverlight 5.0, what it will support, what it will look like, etc. Microsoft has been so quick to ship new iterations of Silverlight that people expect the same out of Silverlight 5.0. For example, Silverlight 2.0 shipped in October 2008 and Silverlight 3.0 beta appeared in March 2009, only 5 months later. Silverlight 3.0 shipped in July 2009 and Silverlight 4.0 beta 1 shipped in November 2009, only 4 months later. Silverlight 4.0 shipped in April 2010, so June 2010 is a reasonable timeframe for Microsoft to talk about Silverlight 5.0 features and design goals, if not a beta timetable.

Windows 8 Sneak Peek

OK I admit it, I love Win7 and have zero complaints or don’t even have a wish list for Win8. But it is the geek inside of me that wants a sneak peek of Win8. I am pretty sure that this will not happen, but Vista shipped in January 2007 and we had an alpha in October 2008, so not unheard of. I don’t need an alpha, just a sneak peek.

SQL Server 2012 Info

Ok, if it too soon to talk about Silverlight and Windows, then why not SQL Server 2012? TechEd is more of an IT Pro conference and it is co-located with the BI Conference, so maybe, just maybe we will get some info on SQL.next.

Steve Ballmer’s Retirement

Don’t laugh. At TechEd in Boston in 2006 it was announced that Bill Gates was retiring. Steve has been in charge a long time, while I don’t expect a leadership transition at this point in time, you never know.

Free Windows 7 Phone

Hey, Google gave out new Android phones at I/O twice. Microsoft gave us all a tablet at the PDC. Why not a phone?

posted on Tuesday, June 01, 2010 10:52:51 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback