Dan Rigsby – Coding Up Style

Developer.Speaker.Blogger

Microsoft PDC 09: Day 1

Posted by Dan Rigsby on November 17th, 2009

PDC09Bling_BeforeAfter_136 Ray Ozzie

Fashion form and function are changing how we look at PCs, gaming devices, and media PCs.  This gives us the ability to look for new innovation on the client.  In particular at how cloud computing can bring all of these devices together.

For users…
seamless multi-screen experiences

for developers and IT…
skills leverage and investment leverage

Microsoft is continuing with the “3 screens and a cloud: Mobile, PC, TV” mantra.  All developers need to be thinking about all of these potential devices when developing applications.  Ray promises that “IE will be the best browser for Windows”, but it looks like Silverlight will be more and more key for bridging client on each of these devices.

The first 3rd party demo to show off some of the work in the “3 screens” space was given  Seesmic.  They announced that their Twitter client for Windows rewritten in Silverlight.  The difference in this application is that it is more of a platform than other twitter clients out there.  There will be an api to write extensions to the client to add new abilities to the client.

Azure Timeline:

October 27th PDC08: Azure is announced
November 17th 2009 PDC09: New Azure announcements and features
Jan 1st 2009: Azure moves into production
February 1st 2009: Azure is open for billing

Some of the new Azure features will include:

  • REST based service management APIs
  • Multiple sizes of VMs
  • Now support any kind of windows code including Java, Tomcat, MySql, Apache, Php, etc
  • Now support for any number of roles
  • Entity group transactions
  • Custom blob domain names
  • XDrive: mountable durable virtual volumes

Wordpress Demo:

Automatic, the developer of Wordpress, will be one of the first OEMs to go public with Azure.  If you didn’t know, Wordpress is all about php, apache, and MySql.  The thought of having all of this running one Azure a year ago was probably unthinkable.  However, it really shows how serious Microsoft really is about embracing the non-Microsoft world and helping to include them in their vision.

“I can has cheezeburger” and their sister sites like “FailBlog” run on Wordpress and were eager to show off how Azure under Wordpress could help handle their spikes in traffic. Starting today, November 17th, They are launching OddlySpecific.com which will run on Azure.

Microsoft Pinpoint:

A unificed catagoy of services and businesses to help you grow your business.  This will be integrated into Windows Azure and give developers the ability to leverage services against other items on the web.  This seems a lot like other Marketplace applications out there, but the idea is to bring a community around extending services the use inside of Azure.

Codename “Dallas”:

An open catalog for and marketplace for data.  Its a unified location for accessing all of the data that might be fore sale like customer data, user data, metrics, etc.  These vendors of data exist today, but bringing them under a single marketplace allows users to discover data that they may not have known was available.

The Dallas marketplace seems to be running on DataServices and will give you the ability to download proxies for accessing the data.  The beauty of this is that it might be easy to find free data by doing some simple web searches, but finding the “for pay” data can be hard.  There are many realms of applications that can be built by bridging this data.  I immediately think of “Mashups”, but it will be interesting to see what can be developed and what kind of free data will be out there for developers to play with.

NASA Pathfinder Challenge:

The Pathfinder Challenge being put by the US government, users can work with the Mars data and use it to make interesting applications.  The website is http://beamartian.jpl.nasa.gov/welcome.  I like that the government is working towards service delivering instead of building all of the infrastructure themselves.  Seems like a better use of tax payer money.  Let the community do the work for you. NASA doesn’t always have the best ideas, and its nice to see this data being delivered to the masses.  www.data.gov will bring even more data over time which will hopefully extend much beyond the Mars data.

Bob Muglia

Bing runs across over 100,000 pcs worldwide.  It does this through an infrastructure called “Auto Pilot” which allows a few administrators to manage all of these machines.  This was a great prototype, but wasn’t something could be easily brought to Windows Server.  However, Azure changes all of this and these techniques can be brought to the masses.

History of the server platform:

1970s: Mainframe
1980s: Client / Server
1990s: Web
2000s: SOA
2010s: Cloud

The Cloud brings us us the “Cloud Application Model” through: multi-tenancy, staged production, elasticity, federation, always available, scale out, service orientation, and model driven design. 

Connectivity in Azure can be done with Data Services, the Service Bus, Access Control Services, and a new low level tool called “Project Sydney” which gives you the ability to connect your existing internal services with services running on SQL Azure through a tool called teh “Project Sydney” Connectivity Agent.

Next year, you will be able to create your own Windows Azure virtual machine images and mount them such that you can access them via remote desktop and control your environment.  Theses virtual machines can then be easily deployed back up to the cloud.

AppFabric was announced which looks to be the official name of “Dublin”.  It will give us caching, workflow hosting, monitoring, service bus, service hosting, access control, etc.  This will run on both Windows Server and Azure.

We knew that “Oslo” would have a couple of name changes at PDC this year.  The “Repository” has been renamed to “SQL Server Modeling Services” and will be a storage mechanism for these models just as the original vision of the “Repository” was working to accomplish.  I will be curious if this includes all of “Oslo” or if at least the DSL tools or other pieces will be made to not be so SQL Server specific.

Demos:

Don Box and Chris Anderson jumped in and gave a demo of some of the Azure changes since PDC08 including SQL Azure, OData, and OAuthWRAP.

Another 3rd Party demo was done by Kelley Blue Book showing off how they are making use of Azure and SQL Azure Data Sync.  At the end of the data, Kelley Blue Book is a data provider.  They have a interesting Silverlight web application today, but getting their data out there in a scalable format will really help them grow.

Posted in PDC | No Comments »

Microsoft PDC 2009: My Tentative Schedule

Posted by Dan Rigsby on November 15th, 2009

I am heading out to Microsoft’s PDC this year and thought I would share my tentative schedule.  There are a number of good sessions that I had a hard time choosing.  I hope to see a lot of you there.  It will be a blast!

Monday, Nov. 16th

Tuesday, Nov. 17th

  • (Available for Breakfast)
  • 8:30AM-10:30AM: Keynote
  • 11:00AM-12:00PM: Data Programming and Modeling for the Microsoft .NET Developer (403AB)
  • 12:30PM-1:15PM: ???
  • 1:30PM-2:30PM: Microsoft ASP.Net Futures (Petree Hall D)
  • 3:00PM-4:00PM: Evolving ADO.NET Entity Framework in Microsoft .NET Framework 4 and Beyond (Petree Hall D)
  • 4:15PM-5:00PM: Booth duty at the MS Dev Partner Booth
  • 6:30PM-9:00PM: (private) Elevate Lounge
  • 6:50PM-8:20PM: (private) Partner Evangelist Focus Group, 2nd Level West Hall, Room 514

Wednesday, Nov. 18th

  • (Available for Breakfast)
  • 8:30AM-11:00AM: Keynote
  • 11:30PM-12:30PM: Microsoft Perspectives on the Future of Programming (Petree Hall C)
    Microsoft Silverlight Roadmap and Futures (Hall F)
    Windows Identity Foundation Overview (403AB)
    Developing REST Applications with the .NET Framework (Hall E)
    Building Data-Driven Applications Using Microsoft Project Code Name "Quadrant" and Microsoft Project Code Name "M" (408B)
  • 1:00PM-2:20PM: Central Region Meet-up, MS Dev Partner Booth
  • 2:00PM-3:00PM: ADO.NET Data Services: What’s New with the RESTful Data Services Framework (515B)
  • 3:15PM-4:15PM: ???
  • 4:30-5:30PM: REST Services Security Using the Access Control Service (403AB)
  • 7:00PM-9:00PM: GeekFest
  • 7:00PM-1:00AM: The Underground @ PDC09 (http://undergroundatpdc.com/)

Thursday, Nov. 19th

  • (Available for Breakfast)
  • 10:00AM-11:00AM: What’s New for Windows Communication Foundation 4 (Petree Hall D)
    A Lap Around Microsoft Visual Studio and Team Foundation Server 2010 (Petree Hall C)
    11:30AM-12:30PM: Microsoft Project Code Name “Repository”: Using Metadata to Drive Application Design, Development, and Management (515 B)
  • 12:45PM-1:30PM: ???
  • 1:45PM-2:45PM: Application Server Extensibility with Microsoft Project Code Name “Dublin” and Microsoft .NET Framework 4 (Petree Hall D)
    Scrum in the Enterprise and Process Customization with Microsoft Visual Studio 2010 (408A)
  • 3:00PM-4:00PM: Automating "Done Done" in the Team Workflows with Microsoft Visual Studio Ultimate and Team Foundation Server 2010 (Petree Hall D)
  • I am open the rest of the day for talking, hanging out, etc.  Just let me know!

Friday, Nov. 20th

  • 7:20AM: Flight back to Indianapolis and a couple of enjoyable days digging into the new bits from PDC

Posted in PDC | No Comments »

New Screencast: Working with Property Grids

Posted by Dan Rigsby on June 29th, 2009

screencast1thumbthumb-thumb1 I have a new 8 min 7 sec training webcast up over working with the PropertyGrid control in Windows Forms applications.

The video is available through JupiterMedia and can be viewed at http://www.internet.com/video/. Just look for the "Developer Video" titled "Working with Property Grids".

Direct links are:
http://www.internet.com/video/?bcpid=1534611832&bclid=1433966034&bctid=27475045001

DotNetKicks Image

Posted in Webcast | 1 Comment »

Oslo May 2009 CTP: Intellipad Changes

Posted by Dan Rigsby on May 27th, 2009

oslo_thumb3The May 2009 CTP of “Oslo” introduces a lot of new features and enhancements to the existing toolset.  As a developer, my primary “Oslo” tool has been Intellipad.  It does seem much faster and more stable after a little over an hour of use.  Previous CTPs were memory hogs and would occasionally crash.  I will be upgrading all of my demos and work projects over to the latest CTP over the next week, so I will get to see how much more stable it really is.  Here is an overview of some of the UI Change:

Shell

For the most part we have the same familiar interface.  You have the same basic layout shell which is a mixture of a standard application frame and menu bar in one.  Everything else in Intellipad is a workspace window which can be docked any number of ways inside this shell.  The shell itself has a couple of new features:

  1. A new icon  (same icon used by Quadrant)
  2. The build number is now displayed next to the control box
  3. Menu items now appear to use much less white space, display proper “…” labels on items that open new windows, and a few other UI adjustments

image_thumb11

Workspace Window

Each workspace window has its own title bar as always.  The title bar appears to be the same.  We still have the document name, zoom level, a drop down to change “Modes” and a close button.  However, now the the active workspace window is highlighted in “Oslo Green”.  This is a minor change, but really comes in hand when working with multiple documents.

The “Edit” menu item for windows has a number of new features.  Check out the list of commands:

image_thumb14

We have our standard Undo/Redo/Cut/Copy/Paste/Delete/Find/Replace/GotoLine options which we had before, but now we have:

  1. Disable External Changes:Behaviors
    1. Selection Highlight: This is really neat! With this option as you select text in the document, it will be highlighted in “Oslo Green” and other uses of that same text in the same document will also be highlighted in blue.
    2. Error Squiggles: Whether or not to show the red squiggle under errors.  if you turn this off, you will still see errors in the error window, but you will have no visual indicator on the document, nor will you have the error tooltips
    3. Column Indicator:
    4. Link Navigation:
    5. Work Wrap: Wraps the text at the end of the line
    6. Line Numbers: Provides line numbers to the left of the document

This screenshot shows the “error squiggle” and “selection highlighting” in action:
image_thumb16 

There is new a View menu item which generously gives us support for quickly launching the three most important developer windows: Minibuffer, Errors, and Notifications.
image_thumb26

There is also a new Help menu item for displaying an “Intellipad Primer” document in Rich Text mode:
image_thumb25

Mini-Buffer

The mini buffer has change dramatically.  It use to pop up a kind of modal WPF dialog which allowed you to enter in commands.  This would occasionally cause Intellipad to crash on me.  In May CTP, it is now a standard document window where you can enter in commands and see previous commands much like if it were a command line window.

image_thumb18

Some people may dislike this little change, but personally I like this change as it is more consistent with the rest of the UI and user friendly.

DSL Authoring Mode

The “DSL Authoring Mode” is a 3-Windows view inside of Intellipad which contains:

  1. The document containing the DSL
  2. The input: some document were you could enter in data to test against the DSL
  3. The output: The AST tree that was generated from the input via the DSL

This mode is the preferred way to write a DSL as you can see how changes affect the schema in real time.

In previous CTPs you had to launch a Intellipad with special command line options to be able to work in what was known as “DSL Authoring Mode”.  This usually meant selecting “Intellipad (Samples Enabled)” from the start menu instead of just “Intellipad”.  This was annoying at best.  In the May CTP however, you can now enter “DSL Authoring Mode” from the standard launch of Intellipad.  Just open a document in “DSL Grammar Mode”, and there is a new DSL menu item called “Split New Input and Output Views” which launches the 3-Window view.

image_thumb21

image_thumb22

DotNetKicks Image

Posted in Oslo | No Comments »

Oslo May 2009 CTP: Released

Posted by Dan Rigsby on May 27th, 2009

oslo It’s been many long months since the last drop of Oslo (January 2009).  Last night, Chris Sells and others announced the May 2009 CTP of Oslo (version 0.4.2).  Each new CTP brings more features, more documentation, and more stability.  The May CTP holds true with many new features including:

  1. The first public release of Quadrant
  2. Major updates to Intellipad (including a built in authoring mode)
  3. A unified tool set for all “M” languages
  4. A new installer (themed like Intellipad and Quadrant)
  5. UML Domain support (Use Case, Activity, Class, Sequence, Component diagrams, etc) and a loader to import UML diagrams in XMI format into the repository
  6. CLR Domain support and a loader to import .NET assemblies into the repository

I was told that we would have support for most of the command line tools in Intellipad for this release such as being able to compile and deploy to the repository. However, after having played with Intellipad for 30 minutes this morning, I can’t find any of these commands.  They should be some simple customizations via python scripts and modifying some xml files.  Hopefully the team will release these additions as well.

Download the CTP here: http://www.microsoft.com/downloads/details.aspx?FamilyID=827122a5-3ca0-4389-a79e-87af37cbf60d&displaylang=en

Install Experience

The install experience has been greatly improved. (Be sure to install any previous versions first) Here are some screenshots:

image image image
image image image

image

   
DotNetKicks Image

Posted in Oslo | No Comments »

Visual Studio 2010: Extension Manager

Posted by Dan Rigsby on May 21st, 2009

Since PDC 2008 we have been hearing about the Managed Extensibility Framework (MEF) support in Visual Studio 2010.  Now that the Beta has been released, we can start to see how it is coming together.  To access the MEF extensions, just open the Extension Manager from the menu bar: Tools –> Extension Manager.

5-21-2009 1-15-49 PM

It appears that we will have a host of categories for different types extensions.  You can choose from “Installed Extensions” or browse the “Online Gallery”. The major categories are:

  1. Controls
    1. ASP.Net Controls
    2. Framework & Libraries
    3. Sharepoint Controls
    4. Silverlight Controls
    5. Windows Forms Controls
    6. WPF Controls
  2. Templates
    1. Windows Forms
    2. WPF
  3. Tools
    1. Build
    2. Coding
    3. Data
    4. Documentation
    5. Modeling
    6. Other
    7. Performance
    8. Programming & Languages
    9. Reporting
    10. Setup & Deployment
    11. Source Control
    12. Team Development
    13. Testing
    14. Web

Currently there are only 12 extensions available, and none appear to be new UI controls. Some of them are pretty interesting, but I am excited about what this could lead to. You seem to be able to extend quite a few areas of Visual Studio now!

Some of the more interesting existing extensions are:

Intellisense Presenter
A new way to view your intellisense in a WPF fashion.
image
RegEx Editor
Regular expression syntax highlighting, intellisense, in place testing, and more right from your code.
image
Image Insertion
This allows you to insert images into code files.  Great for adding developer documentation, but not sure what else it would be useful for.
image

 

I haven’t been able to find the WPF xml document visualizer that they showed off at PDC 2008. Hopefully this will show up in the gallery soon along with other useful nuggets.

I wonder if this will turn into a platform for pushing out new controls to use in our applications in between releases.  It was disappointing to not find any new controls in the toolbox when working with WinForms or WPF.  It is also unclear about how a developer can submit new extensions that be browsed through the gallery.

DotNetKicks Image

Posted in Visual Studio | 1 Comment »

Entity Framework 4.0: Scalar and Void Functions

Posted by Dan Rigsby on May 20th, 2009

One feature that was sorely missing in the first version of Entity Framework was the automated ability to work with stored procedures that didn’t return back entities.  This could have been sprocs that returned void, a scalar value, or some other custom construct. 

Entity Framework v1

In Entity Framework v1 you could create a “Function Import” from these stored procedures types, but there would be no generated code that would give you access to them directly in the ObjectContext object.  You could only access them via pure Entity SQL.

To add a “Function Import” you would just add the sproc to your entity model as your normally would, then right-click on the “Function Imports” in the “Model Browser”, and select “Add Function Import…”.  This would bring up the following screen which would allow you to add your function.

5-20-2009 10-32-34 AM

If you selected that the function returned an Entity, then you would be able to access that entity in the ObjectContext. However, if you selected scalar or void, then you would have to manually write some kind of Entity SQL.  It would be nice if these “Function Imports” appeared as operations in the ObjectContext as well.

Entity Framework 4.0 Solution

Microsoft finally completed the story for “Function Imports” in Entity Framework 4.0. As you can see in the image below, the “Add Function Import” dialog is virtually the same except for the new option to return a complex type.

5-20-2009 5-42-25 PM

You can select the None and Scalar return types as you could before.  However, when the “Function Import” is created, some new code is injected into the Model code behind file that materializes the stored procedure into an operation on the ObjectContext itself:

public ObjectResult<Nullable<global::System.Int32>> GetProductCountByCategoryId(

    Nullable<global::System.Int32> categoryID)

{

 

    ObjectParameter categoryIDParameter;

    if (categoryID.HasValue)

    {

        categoryIDParameter = new ObjectParameter("CategoryID", categoryID);

    }

    else

    {

        categoryIDParameter = new ObjectParameter(

            "CategoryID", 

            typeof(global::System.Int32));

    }

    return base.ExecuteFunction<Nullable<global::System.Int32>>(

        "GetProductCountByCategoryId", 

        categoryIDParameter);

}

 

A couple of nice things about this are:

  1. No matter what we select as the return type, it wraps it as a Nullable type since a database value can always be null
  2. The results are wrapped in an ObjectResult which makes it consistent with all other queries.

And as we expect, we can directly access these operations in our code:

using (var context = new NorthwindEntities())

{

    ObjectResult<int?> result =

        context.GetProductCountByCategoryId(1);

    

    MessageBox.Show(

        result.FirstOrDefault().Value.ToString());

}

 

New “Execute” operations

If you look at the last line of the code generated by “Add Function Import”, you might notice is making a call to a new method called ExecuteFunction<T>.  This method isn’t marked public, but there are two new methods on ObjectContext that we can use to execute functions:

  1. int ExecuteStoreCommand

    This method seems to work like “ExecuteCommand” and returns in int representing the result

  2. T ExecuteStoreQuery<T>

    This appears to be more of a combination of “ExecuteScalar”, “ExecuteNonQuery”, and “ExecuteReader”.

These methods give us the ability to run any imported stored procedure in a variety of ways.  Most users, will want to just stick with the generated operations, but its always good to have options!

DotNetKicks Image

Posted in Entity Framework | 3 Comments »

New Screencast: Custom Sprocs in Entity Framework

Posted by Dan Rigsby on May 20th, 2009

screencast1thumb-thumb I have a new 8 min 35sec training webcast up over using custom stored procedures in Entity Framework.  This video introduces how to use custom sprocs in your Entity Framework model for inserts, updates, deletes, and custom sprocs for searching.  The video briefly talks about how to work with void and scalar sprocs, but doesn’t get far into these as this is a feature that is getting more attention in the next version of Entity Framework.

The video is available through JupiterMedia and can be viewed at http://www.internet.com/video/. Just look for the "Developer Video" titled "Custom Sprocs in Entity Framework".

Direct links are:
http://www.internet.com/player/index.php?bcpid=1534611832&bclid=1433966034&bctid=22915014001

DotNetKicks Image

Posted in Entity Framework, Webcast | No Comments »

New Webcast: ADO.Net Data Services

Posted by Dan Rigsby on May 19th, 2009

screencast1thumb-thumbI have a new 7 min 55 sec training webcast up over developing ADO.Net DataServices.  This video demonstrates how to create and consume  a simple ADO.Net Data service.

The video is available through JupiterMedia and can be viewed at http://www.internet.com/video/. Just look for the "Developer Video" titled "ADO.Net Data Services".

Direct links are:
http://www.internet.com/video/?bcpid=1534611832&bclid=1433966034&bctid=13662214001

DotNetKicks Image

Posted in Webcast | No Comments »

Entity Framework 4.0: Pluralization

Posted by Dan Rigsby on May 19th, 2009

One of the new features in Entity Framework 4.0 (EF v2) is a service call “Pluralization”.  This service is used to convert names of objects form singular and/or plural forms.  For instance, if you have a table in the database that has a plural name such as “Customers”, then Entity Framework will automatically generate both object Name and Entity Set Name to “Customers” as well.  The result is that in your code, the name will look like this:
 
Customers c = new Customers();

Ideally, it would have been nice for EF to see that the table was a plural name and set the object Name to a singular form.

Now, you may be thinking that this is pretty trivial since you can manually change the generated name, but when when you have dozens or hundreds of tables this can be tedious at best.

To use the PluralizationService when generating an Entity Framework model, you just select the option"Pluralize or singularize generated object names”:

Pluralization

Or if you are using the EDMGen.exe tool, you can opt in using the /pluralize option.

Example

In the Northwind database, all the tables have plural names. (Note: It is typically recommended to name your tables in the singular form).

 Pluralization3

When this database is generated using the PluralizationService, the names are set correctly.

Pluralization1 Pluralization2 

Manually using the PluralizationService

The PluralizationService is in the System.Data.Entity.Design.dll under the System.Data.Entity.Design.PluralizationServices namespace.

Pluralization4

It is an abstract class and hence, can’t be directly instantiated.  However, there is a static CreateService method on the class to access instances of the service for various cultures.  At this time, the only culture implemented is “en-us”.

It would have been very nice if this were implemented at a more core level of .Net since this could potentially be useful for a lot more than just for Entity Framework design.  Here are some examples using the service:

// Create an instance of the service for

// a particular culture (only 'en-us' atm)

PluralizationService ps =

    PluralizationService.CreateService(

         CultureInfo.GetCultureInfo("en-us"));

 

// Convert strings to plural or singular

string pluralName = ps.Pluralize("Goose");

string singularName = ps.Singularize("Territories");

// Note: Correctly returns Geese and Territory

 

// Check if strings are plural or singular

bool isPluralName = ps.IsPlural("Sheep");

bool isSingularName = ps.IsSingular("Sheep");

// Note: Correctly sees both of these as true

Adding your own pluralization mapping

There is an interface using by the PluralizationService called ICustomPluralizationMapping that isn’t publicly exposed.  However, since it is implemented, you can cast the service to this interface and make use of the AddWord method to add your own mapping.Pluralization5

In this example, we add a new word called “Foo” with the plural version being “Foos”:

// Create an instance of the service for

// a particular culture (only 'en-us' atm)

PluralizationService ps =

    PluralizationService.CreateService(

        CultureInfo.GetCultureInfo("en-us"));

 

// Cast to the mapping interface

ICustomPluralizationMapping mapping =

    ps as ICustomPluralizationMapping;

 

// Add a new word mapping

mapping.AddWord("Foo", "Foos");

You could then use the service to generate the metadata or use it in some other context:
EntityModelSchemaGenerator generator =

    new EntityModelSchemaGenerator(

        entityContainer,

        ps);

 

var edm = generator.GenerateMetadata(); 

DotNetKicks Image

Posted in Entity Framework | 4 Comments »