Dan Rigsby – Coding Up Style

Developer.Speaker.Blogger

Archive for September, 2008

SQL Server 2008 Error: Saving changes is not permitted

Posted by Dan Rigsby on 26th September 2008

If you have been playing with SQL Server Management Studio 2008 and are modifying tables in the designer, you may run into this error:

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created.  You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created.

Here is a screenshot:

SSMS1

In the 2008 , they have added a new option to prevent saving of changes that will require a table re-creation.  If you think about it, this is a good thing.  If you are running a production database, you want maximum performance.  If Management Studio needs to re-create a table to apply a change that means it needs to create a copy of the table, transfer the data, create the new table, move the data over, delete the old stuff, etc.  This can potentially be a major operation. 

However, if you don’t want this feature enabled or our just working with a development or test database, it is easy to turn off.  Just open up the Options window in Management Studio and go to “Designers –> "Table and Database Designers”, find the “Prevent saving changes that require table re-creation” option, and turn it off.

SSMS2

DotNetKicks Image

Posted in MSSQL, Tips | 16 Comments »

New Webcast: REST Support in WCF

Posted by Dan Rigsby on 25th September 2008

screencast1-thumb I have a new 10 min 12 sec training webcast up over adding REST support to a WCF application.  This video builds on top of the Understanding REST video.  If you have a decent understanding of REST, you don’t necessarily need to watch that video first, but in it I define the 4 tenets of REST which this video applies to WCF. This video also complements a recent presentation I have been giving called “RESTing on the Web with WCF”.

So what are you waiting for?  Head on over and check out the webcast!

The video available through JupiterMedia and can be viewed at http://www.internet.com/video/. Just look for the "Developer Video" titled "REST Support in WCF".

Direct links are:
http://link.brightcove.com/services/link/bcpid1431564240/bclid1433966034/bctid1815668056

DotNetKicks Image

Posted in REST, Wcf, Webcast | No Comments »

More Microsoft PDC 2008 News

Posted by Dan Rigsby on 24th September 2008

Bling4 The Microsoft PDC team has been making news left and right. Four major announcements have surfaced today:

  1. Mike Swanson announced that each attendee is getting a “pre-beta” copy of Windows 7.  We figured this would happen, but it’s always nice to see it announced.
  2. Four new keynote speakers have been added to the lineup, to bring the total to 8 speakers, most of the additions are Microsoft VPs: Scott Guthrie (VP of .Net Developer), Bob Muglia (Senior VP of STB), Steven Sinofsky (Senior VP of Windows and Windows Live Engineering), and David Treadwell (VP of Live Platform Services) have joined the lined up.  Ray Ozzie (Chief Software Architect), Rick Rashid (Senior VP of Research), Don Box (Software Architect), and Chris Anderson (Simple Geek) round of the rest of the keynote speakers.
  3. Two Symposia have been added to the last day of DPC.  Each symposium is made up of three related sessions.  They are:
    • Parallel Computing – A Detailed Look at How Multi-Core Architectures will Unleash Computing Power and Enable Innovation
    • Head in the Cloud, Feet on the Ground – A Practical Look at Architectural Challenges and Opportunities with Identity, Management, Data and Interoperability in the Cloud
  4. 17 new sessions have been added to the session line up bringing the total from 138 to 155.

As usual, here is my break down of new sessions and how they affected the topic tags:

+1 Surface (1 total)
+1 Sync Framework (3 total)
+17 Windows 7 (22 total)

The “Surface” tag is new this round.  I wonder if we will see more in this tag.  We can certainly expect to see a couple of Surface machines around the floor at PDC though.  It is interesting to see how much hype they will bring to Windows 7.  At the last session announcement on September 8th, there were only 5 Windows 7 sessions.  With these new sessions, plus the addition of the new Keynote speakers leads us to believe that there will be major feature unveiling.

However, this wasn’t one of the usual session announcements.  I think they added these new sessions in response to Mike’s announcements yesterday.  We should expect another announcement of sessions in early October to bring the total up to close to 200.  There will be even more sessions announced at PDC after the big announcements have been made in the keynotes.

I know I keep saying this, but this PDC is going to be Legendary!  Registration is still open.   Do what you can to attend this event; you won’t be disappointed.  And if you can get out there the night before, meet up with me and others at Party with Palermo.

DotNetKicks Image

Posted in PDC | 1 Comment »

Microsoft PDC 2008: Software + Services PDC

Posted by Dan Rigsby on 23rd September 2008

PDC2008Brain I am going to repost a couple of blogs here, because this is a great continuation of the posts I have had over Microsoft PDC:

All of these posts stem from the latest Countdown to PDC video on Channel9 which was posts last night September 22nd.  These videos are usually time-boxed to 10 minutes, but this video was only 4.5 minutes and chalked full of interesting information.  The PDC 2008 Content Owner, Mike Swanson, announced what many of us have long assumed.  This will be the “Software + Services” PDC. PDCs in the past have had tended to have a focus or theme such as the “Longhorn” PDC, “.Net” PDC, etc.  This year we can expect a lot of content on Software + Services.

Software + Services (S+S) is a term coined by Ray Ozzie which is basically just a clever way of saying “local software and Internet services interacting with one another”.  It is really more than that though.  S+S is the merger of 5 very popular topics right now:

  1. Service Oriented Architecture (SOA) – Wcf, Biztalk, parts of Oslo, etc.
  2. Software as a Service (SaaS)
  3. Web 2.0 -  Social and networking collaborations, not just Ajax
  4. Rich Internet Applications (RIA) – Adobe Flex, Silverlight, etc
  5. Cloud Computing – Live Mesh, parts of Oslo, etc

The latest ArcReady series is focusing on S+S as well, which is where this definition came from.  It seems everywhere you look at Microsoft, S+S is being marketed more and more.  This will be the next BIG thing.  It is already a hot topic and in many ways is already a “BIG thing”.  As an SOA/Wcf/Cloud kinda guy, I am getting quite pumped up about what is to come.

The Countdown to PDC video also stated a few other things:

  1. No matter what we thing, we will be surprised at PDC.  They have read the blogs and the speculations, but there are surprises.
  2. Most big announcements are around S+S
  3. There will be an announcement of a comprehensive services platform.  This will probably tie in big with Oslo and Live Services such as Mesh.
  4. Windows 7 will get a lot more attention.  Right now there are 5 sessions on the PDC session list, but there will be over 20 when all sessions are announced.  I expect a beta or CTP release date, and all of those Microsoft commercials as of late are probably leading up to this.

The last big announcement in the video is how the bits will be delivered to the attendees”.  In the past, they have delivered the bits on CD and DVD.  At PDC 2005, they had 35gig of content that spanned 6 DVDs.  This year, they will have a lot more data.  So attendees are getting a nice “branded” 160GB USB2 external hard drive with all of the bits loaded on.  In many ways 160GB is small, but its a good size for storing your music collection or a backup of your primary OS and files.  The best part though is getting the data, demos, presentations, binaries, etc.  this will give us a chance to play with the new technology and hopefully spawn many new blog posts.  Here are a couple of pictures of the drive:

PDCharddrivePDC2008%20Hard%20Drive

I am looking forward to the next session announcement list which should come up in early October if not before.  It will be interesting to see what they add.  I will do another synopsis like I did for the last session list to compare what areas are getting the most new additions and changes.

Registration for PDC is still open.  I highly recommend attending this event, if you can.  If you do make it out, drop me a line and maybe we can meet up.  If you can’t attend, at least watch the live feeds of the keynotes and watch for the session videos.   You really should understand what the future and direction is as a .Net developer.

If you are attending PDC, you should check out the videos on Channel 9 tagged PDC08 to see what all of the pre-announcements are.

DotNetKicks Image

Posted in PDC | 1 Comment »

Using IContextChannel Extensions to Store Custom Data

Posted by Dan Rigsby on 21st September 2008

Wcf offers numerous extensibility points.  The best example of this is how the REST extensions were added in .Net 3.5.  Nothing was rewritten.  The entire Web Programming Model was built on the Wcf extensibility points and provided as an additional library that could be included in your projects(System.ServiceModel.Web).  We have looked at a couple of the extensions points on this blog in the past (ObservableServiceHost & Extending InstanceContext). Another extension point is an IContextChannel Extension. This type of extension can be used for many things.  Like any other IExtension, there is an Attach method and Detach methods that are called when working with the target object.  In our case, the target object is an IContextChannel.  You can use this to “extend” the incoming channel and “attach” information to it. This extended data isn’t available to the clients and is stored on the server only.  You could use this to store a variety of data.

In our example, we are going to store a custom connection Id on the channel in the service.  Usually you can uniquely identify a client by the SessionId, but occasionally you may want to use your own custom Id or just store some additional information on the channel.

Creating an IContextChannel Extension

ConnectionIdExtension

The extension itself is very straight forward.  We can either store the ConnectionId in the object before it is attached to the channel, or if the ConnectionId is null, then a new one will be created when it is attached to the Channel.

public class ConnectionIdExtension : IExtension<IContextChannel>
{
    private string m_ConnectionId = String.Empty;

    public string ConnectionId
    {
        get
        {
            return m_ConnectionId;
        }
        set
        {
            m_ConnectionId = value;
        }
    }

    public ConnectionIdExtension()
    {
    }

    public ConnectionIdExtension(
        string connectionId)
    {
        m_ConnectionId = connectionId;
    }

    #region IExtension<IContextChannel> Members
    public void Attach(IContextChannel owner)
    {
        // If there is no connectionId, create one
        if (String.IsNullOrEmpty(m_ConnectionId))
        {
            m_ConnectionId = Guid.NewGuid().ToString();
        }
    }

    public void Detach(IContextChannel owner)
    {
    }
    #endregion IExtension<IContextChannel> Members
}

Attaching ConnectionIdExtension in an Operation

For our example service, we just have a method that returns the ConnectionId.  It firsts checks the extensions collection on the channel to see if there is a ConnectionIdExtension applied. If there isn’t, a new one is created and added to the extensions collection.

[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)]
public class MyService : IMyService
{
    public string GetConnectionId()
    {
        IContextChannel channel = OperationContext.Current.Channel;

        ConnectionIdExtension connectionIdExtension =
            channel.Extensions.Find<ConnectionIdExtension>();

        if (connectionIdExtension == null)
        {
            connectionIdExtension = new ConnectionIdExtension();
            channel.Extensions.Add(connectionIdExtension);
        }

        return connectionIdExtension.ConnectionId;
    }
}

Calling the Service and Observing the Behavior

If you use the WcfTestClient to test this method, you should see the same ConnectionId being used for each and every call from the client.  However, if you select the “Start a new proxy” option on the client, then the Id will be different with each call.  This option tells the client to create a new proxy instance with each call, so there is a new connection being used.

context

You can download a complete sample of the code discussed in this article here: http://www.danrigsby.com/Files/Rigsby.ChannelContext.zip

DotNetKicks Image

Posted in Wcf | 1 Comment »

Installing Alien Game on a Zune using XNA Game Studio

Posted by Dan Rigsby on 19th September 2008

This post is a little more “101” than most of my posts, but I think it’s useful to show how easy it is to install and debug a game on the Zune using XNA Game Studio. For this series of steps, we are going to look at getting the game “Alien Game” up and running on a Zune from scratch.  Once you have done this, you should know the basics to install other games, or deploy your own.

Steps to Install

1. Download Zune 3.0 firmware or greater

2. Install XNA Game Studio 3.0 Beta or greater

You will need to have Visual Studio 2008 installed or Visual C# 2008 Express installed first.

3. Open Visual Studio and ensure XNA Game Studio is installed

You can do this by checking the “About Visual Studio” window located in the “Help” menu item.  Scroll down until you find the XNA Game Studio:VSXNA1

4. Download “Alien Game” and extract to your local disk

5. Open the AlienGameZune.sln file in Visual Studio

When opened you should see the AlienGameZune project and all of its files and resources:

AlienGame

6. Connect Zune to your PC via the Usb Cable (not Wifi)

Be sure that you don’t have any other Zune software running since Visual Studio needs full control of the device.

7. Add Zune to the XNA Game Studio Device Center

You can access the XNA Game Studio Device Center via the start menu or through the Tools menu in Visual Studio.
VSXNA2

One in the XNA Game Studio Device Center, Click “Add Device”:

XNA1

On the next screen select “Zune” and continue:

XNA2

If your Zune is connected correctly, you should see it in the list with the device name.  More than one Zune will appear, if you have multiple devices plugged into the PC.  If you don’t see your device, double check your connection.

XNA3 

Once you have selected your device, you need to make sure you have it selected as your “default Zune device”.  If you only have one Zune you are using, then this is automatically selected for you.

XNA4 

Now that the wizard is finished, you should see your Zune device with a “green checkmark” that indicates that it is ready:

XNA5 

8. Simply run the debugger from Visual Studio by pressing F5

You should see all of the files transferring down to the Zune.  Once the game is running, you can play the game, set breakpoints in Visual Studio, etc.

Nabbing Screenshots

One other little tip, is that you can snag screenshots of the an executing game on the Zune.  This won’t work unless you are currently running a game from your PC to the Zune.  All you need to do is to right click on the device in XNA Game Studio Device Center and select “Take Screen Capture”.

XNA6

Here are a couple of screenshots nabbed from “Alien Game”:

DanR-2 DanR-1

DotNetKicks Image

Posted in XNA | 2 Comments »

XNA Game Studio 3.0 Beta – Released with 64-Bit Support

Posted by Dan Rigsby on 19th September 2008

XNA Game Studio is Microsoft’s cross platform game development extensions for Visual Studio and .Net.  With it you can target games and applications for either Windows, Xbox 360, or Zune (running >= the 3.0 firmware).

A few months back I blogged about the release of the CTP of XNA Game Studio 3.0 and about how there was no 64-bit OS support.  Well, a couple of days ago, Microsoft released the first Beta of the Studio. This release was heavily overshadowed by the release of the Zune 3.0 software and firmware.  However, I am pleased to find that there is finally 64-bit support, and I have it up and running.  This Beta release requires Visual Studio 2008 (2005 is no longer supported).  If you don’t have Visual Studio, but want to try out XNA Game Studio, you can always download Visual C# 2008 Express (which is free) and install XNA Game Studio on it. The only language supported is still C#.

Once you have XNA Game Studio installed, you can start creating projects by using one of the predefined templates:

xna1

Notice that there are 2 different templates for each of the 3 target project types (Windows, XBox 360, and Zune).  When a project is created, each target platform project has a different Icon:

xna2 

This makes it a bit easier to tell what a project is targeted for.  You could also look for the XnaPlatform node in the xml for the .csconfig file:

<XnaPlatform>Zune</XnaPlatform>

The 3 possible values are “Zune”, “Xbox 360”, and “Windows”.

You can download XNA Game Studio 3.0 Beta here: http://creators.xna.com/en-us/3.0beta_mainpage

If you are interested in doing Zune work, the game “Alien Game”, which was introduced in the CTP, is back for the Beta.  You can download it here: http://creators.xna.com/downloads/?id=199 and start tweeking it.

DotNetKicks Image

Posted in XNA | 6 Comments »

Build It Better with MSDN Events

Posted by Dan Rigsby on 16th September 2008

msdnthumb-thumbMicrosoft has announced their October/November MSDN Events, and once again they are making a stop in Indianapolis!  It’s good to see them showing us some love.  The Indianapolis event occurs the Tuesday before Microsoft PDC 2008 and 3 weeks after IndyTechFest.  I think there are plenty of Microsoft development events in October to keep even someone such as myself satisfied.  I hope to see many of you there!

The Indianapolis event will be held:
Tuesday, October 21, 2008 1:00 PM -  5:00 PM Eastern Time
Welcome Time: 12:30 AM

At:
Indianapolis Marriott East
7202 East 21st Street
Indianapolis Indiana 46219

Click here to register:
http://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&EventID=1032388496

Check the MSDN Events site for other locations:
http://www.msdnevents.com/fall08/

Event Details:

Join MSDN Events for the latest tips, tools and technical information you need to build powerful applications and engaging user experiences. We’ll show you how SQL Server 2008 delivers new development capabilities, including support for Spatial Data types, a fresh storage mechanism and more. You’ll also learn how to leverage the Silverlight platform to build next generation applications for consumers and business, and how Visual Studio Tools for the Microsoft Office System (VSTO) addresses some of the toughest challenges facing today’s Office solution developers. Don’t miss these free, live sessions near you.

Session 1: What’s New in SQL Server 2008 for Developers
SQL Server 2008 adds numerous new capabilities for developers – from support for Spatial Data types to a storage mechanism for SQL BLOB data using the NTFS file system, and much, much more. The new release also delivers several improvements to development-related areas, from T-SQL to SQLCLR to XML. This presentation will provide a technical dive into the latest and greatest features you’ll find in SQL Server 2008, while offering insight into how to effectively apply them to your upcoming development projects.

Session 2: Power up your Office applications with VSTO
In this presentation, we’ll focus on the power and productivity of Visual Studio Tools for the Microsoft Office System (VSTO) – a .NET Smart Client technology. We’ll give you tips and tricks for designing and building smart client applications with VSTO, which allows you to create managed code applications with .NET languages including Microsoft Visual Basic .NET and Visual C#. VSTO also makes it simple to manifest the functionality of those applications in the rich user interfaces of Microsoft Office Excel, Word, PowerPoint, Visio, Outlook and others from the Office stack. VSTO addresses some of the biggest challenges that Office solution developers are facing today, including separation of data and view elements, server-side and offline scenarios, seamless integration with the Visual Studio tools, deployment and updating. Join us for this eye-opening session and learn just how easy it is to build and deploy powerful applications with VSTO.

Session 3: Build next generation applications with Silverlight 2.0
acrossamerica_logo_120Silverlight provides a powerful platform for building the next generation of rich interactive applications on the Internet. In this session, we’ll take a look at the programming model and tools that developers and designers can leverage to build these true next generation experiences for consumers and business, and demonstrate how to build a rich interactive application (RIA) using Silverlight and Microsoft .NET. We’ll explore how to use Microsoft Visual Studio to create applications, and how to create UI using XAML markup and code, controls, and File I/O. We’ll also discuss networking, how to retrieve data from a Web service, and various other aspects of building Silverlight applications.

DotNetKicks Image

Posted in Community | No Comments »

Zune 3.0 and Windows Server 2008 64-bit

Posted by Dan Rigsby on 16th September 2008

I have been looking forward to today for weeks now.  Version 3.0 of the Zune software was released and adds a slue of new features.

My laptop runs Vista-64 and it upgraded to version 3.0 with no issues.  However, when I tried to update the software on my Windows Server 2008 Workstation, I received the following error:

zuneerror

Hmm, doesn’t it looks like it tried to upgrade to the 32-bit version of software?  Well, I explicitly went to the Zune site and download the 64-bit version.  And guess what… I got the exact same error!  Version 2.5 runs fine on this OS.  This is very disappointing

Anyone else encounter anything like this?  I’ll update this post again if I discover more.  Until then, Windows Server 2008 64-bit users may be out of luck.

DotNetKicks Image

Posted in Zune | 12 Comments »

New Webcast: Understanding REST

Posted by Dan Rigsby on 11th September 2008

screencast1 I have a new 12 min 0 sec training webcast out over REST.  This video is designed to explain REST at an architectural level, without diving into how to implement it in any specific language. This complements a recent presentation I have been giving called “RESTing on the Web with WCF”.

The video available through JupiterMedia and can be viewed at http://www.internet.com/video/. Just look for the "Developer Video" titled "Understanding REST".

Direct links are:
http://link.brightcove.com/services/link/bcpid1431564240/bclid1433966034/bctid1788889483
http://www.internet.com/player/index.php?bcpid=1431564240&bclid=1433966034&bctid=1788889483

DotNetKicks Image

Posted in REST, Webcast | 4 Comments »