Submit to Community Credit 1.0 plug-in released

Submit to Community Credit I happened to stumble upon the new Windows Live Writer SDK post and the example of announcing the post on Twitter and I realised I finally had a simple and effective way of publishing my blog posts to Community Credit.

I’d previously looked at the Community Server plug-in with the intention of rewriting it and integrating it into the SA Developer .NET community site but in the end I simply ran out of time and the effort required to go through the Community Server SDK documentation far exceeded the desire to get it integrated. However I stumbled upon Keyvan Neyyeri’s post about his Community Credit Service Library 1.0.

So after looking at the Twitter Notify sample from the Windows Live Writer SDK I quickly mashed together the Submit to Community Credit plug-in. The great thing about it is that it works with all blogging engines that Windows Live Writer supports. I’ve tested it with Community Server 2008 and WordPress 2.6 but it shouldn’t make any difference as it requires no server-side support.

You can download the binaries from here. I intend to build a simple installer and release the source code in the coming weeks. I look forward to user feedback and feature requests.

What’s New in Silverlight 2 beta 2

Microsoft SilverlightThe Silverlight SDK blog has an overview of what new features to expect from the Silverlight 2 beta 2 release coming this week.

Highlights for me include:

  • DataGrid improvements: Autosize, Reorder, Sort, Performance increase, and more
  • Improved Templating Model: Visual State Manager
  • Including controls in the runtime instead of having them packaged in app package
  • Limited keyboard support in FullScreen mode (arrow, tab, enter, home, end, pageup/pagedown, space) – This opens up Silverlight 2 for gaming.
  • Cross Domain support in Sockets
  • Cross Domain security enhancements
  • BrowserHttpWebRequest and WebClient callable from BackGround Threads
  • Duplex communications (“push” from Server to Silverlight client)
  • Significantly improved SOAP interop
  • ADO.NET Data Services support
  • Changes in application model for multilingual apps (one xap per supported locale)
  • CurrentCulture and CurrentUICulture Isolation

This looks like its going to be an awesome new beta.

[tags]Silverlight,Silverlight 2,news[/tags]

Silverlight 2 beta 2 releasing this week

Microsoft SilverlightSome cool news coming out of Tech-Ed North America 2008 today from Bill Gates himself. Firstly Silverlight 2 beta 2 will be available this week including a commercial Go Live license and updated developer tools such as Microsoft Expression Blend 2.5 June 2008 Preview and Microsoft Silverlight Tools for Visual Studio 2008 beta 2.

This is great news for all Silverlight developers out there. From what I’ve read online this new release is going to break some compatibility with beta 1 but increase compatibility with Silverlight 1 and add a whole bunch of new and improved features as well as improved controls.

In addition we’ll see Internet Explorer 8 beta 2 out in August.

[tags]Silverlight,Silverlight 2,news,Tech-Ed 2008[/tags]

Silverlight 2 with Brad Abrams

Brad Abrams Yes you heard it here first! Brad Abrams, the man, the legend, is coming to South Africa and is taking time out of his busy schedule for SA Developer .NET events in Johannesburg and Cape Town.

Before you ask how I can speak so highly of the man, take a look at his bio and you’ll realise that he isn’t some newbie developer at Microsoft Corp, he is one of the geeks that make us geeks happy with new technology:

Brad Abrams was a founding member of both the Common Language Runtime, and .NET Framework teams at Microsoft Corporation where he is currently the Group Program Manager for the UI Framework and Services team which is responsible for delivering the developer platform that spans both clients and web based applications as well as the common services that are available to all applications. Specific technologies owned by this team include ASP.NET, parts of Silverlight, and Windows Forms.

Brad has been designing parts of the .NET Framework since 1998 when he started his framework design career building the BCL (Base Class Library). Brad was also the lead editor on the Common Language Specification (CLS), the .NET Framework Design Guidelines and the libraries in the ECMA\ISO CLI Standard.

Brad co-authored Programming in the .NET Environment, and was editor on .NET Framework Standard Library Annotated Reference Vol1 and Vol2 and the Framework Design Guidelines.

Brad graduated from North Carolina State University in 1997 with a BS in Computer Science. Find recent musings from Brad on his blog at: http://blogs.msdn.com/BradA/

So take a moment and register for an event:

So what are you waiting for? Remember, the events are FREE to attend so tell your friends about it, register and we’ll see you there.

[tags]SA Developer .NET,Brad Abrams,event,Silverlight,Silverlight 2[/tags]

Devs4Devs

Microsoft is hosting a Saturday morning event for speakers in the Gauteng region to come and show what they are passionate about. Currently there are 5 out of 10 speaker slots filled, so why not put your name down and present something you’re passionate about for a mere 20 minute slot.

Join us for a jam-packed morning of developer technical sessions.  We’ve invited community developer presenters to come present on their favourite topics.  It’s going to be to the point, concise, each presentation limited to 20 minutes.  It will be a great learning experience for all of us!

Some of the topics we’ll have presentations on, include “Introduction to Microsoft Sync Framework”, “Liberating Synchronous Processes from the Tyranny of Timeouts”, “WPF Data Binding Explained!” and more.  View an updated list of presenters and topics – http://dotnet.org.za/eben/archive/2008/05/19/devs4devs-saturday-7-june-2008.aspx.

Space is going to be limited so make sure you book your seat early to avoid disappointment.

[tags]Microsoft,event,community[/tags]

How to switch Silverlight UserControls

One of the guys on the official Silverlight community forums posted an interesting question, namely how does one change the currently visible UserControl in a Silverlight 2.0 application. To put things in context the new Silverlight 2.0 project template creates two classes for you: a System.Windows.Application derived class named App with the associated App.xaml and App.xaml.cs files; as well as a System.Windows.Controls.UserControl derived class called Page with the associated Page.xaml and Page.xaml.cs files.

The App class takes care of the initialization and basically you assign a new instance of your Page class to the App.RootVisual property and through the power of Silverlight it appears on your screen. 🙂

So if you wanted to change the currently displayed UserControl for another instance naturally you’d try and set the App.RootVisual property to another instance of a UserControl. This sounds great in theory but it seems that its a single assignment property. Pete Brown’s blog post happens to make mention of this.

So in a quest to solve the problem I’ve implemented a very simple UserControlContainer class that allows the developer to switch controls at runtime without having to deal with the set once RootVisual property.

Simply create a new UserControl called UserControlContainer and copy the following into the UserControlContainer.xaml.cs file:

    public void SwitchControl(UserControl newControl)
    {
        LayoutRoot.Children.Clear();
        if (newControl != null)
        {
            Height = newControl.Height;
            Width = newControl.Width;
            LayoutRoot.Children.Add(newControl);
        }
    }

Next set your Application instance RootVisual to an instance of the new UserControlContainer in the Application_Startup method.

    private void Application_Startup(object sender, StartupEventArgs e)
    {
        // Load the main control
        this.RootVisual = new UserControlContainer();
        Page page = new Page();
        ((UserControlContainer)this.RootVisual).SwitchControl(page);
    }

Then wherever you need to switch out the active control, simply call the following if you are inside App.xaml.cs:

    TestControl1 testControl = new TestControl1();
    ((UserControlContainer)this.RootVisual).SwitchControl(testControl);

Or the following if you need to switch controls from elsewhere:

    TestControl1 testControl = new TestControl1();
    ((UserControlContainer)Application.Current.RootVisual).SwitchControl(testControl);

If you find this useful or find any issues with this method, let me know so I can improve it for all.

 

Updated 2008-03-13: Added Application_Startup example. Thanks to Maurice for pointing this omission out.

[tags]Silverlight 2.0,code,example[/tags]

Xbox LIVE getting XNA games and more

XNA Finally the marriage between Xbox LIVE and XNA has been announced. Major Nelson live blogged it from GDC (Game Developers Conference) in San Francisco on his twitter feed and promptly posted about it.

It was just announced at GDC that we are introducing a new, open distribution service for games created by the community. Games created with the XNA Game Studio will be available over Xbox LIVE. Later today, seven games created by the community will be available for download over Xbox LIVE.

Up until this announcement community and hobbyist game developers have been rather limited in terms of distribution of their games. XNA games produced using the awesome (and free) XNA Game Studio 2.0 have only been able to distribute XNA games through the paid for XNA Creators Club. An open distribution service sounds like an awesome new facility that could seriously blow open the casual gaming market for hobbyist and community game developers.

Other highlights I happened to notice on Major’s live blogging feed up to this minute include:

  • XNA games are coming to the Zune. This could be a huge leap for the Zune mobile media player that could start to encroach on the iPod’s market share.
  • There will be over 1,000 games on the Xbox 360 by the end of the year.
  • The Halo 3 community is uploading approximately 100,000 pieces of user generated content per day, that is 30% more content than all of the daily uploads on YouTube.
  • As of 2007, gaming is bigger than music on a global basis. Wow, I’m sure the music executives can’t be too happy about that, watch out film industry, you’re next. 😉

Watch this space for more interesting tidbits as they get announced.

[tags]Xbox 360,XNA,Zune[/tags]

The pain of SQL Server and working with dates

How many times have you tried to design an efficient database table design in SQL Server only to stumped with the problem of storing pure date values. Yes the currently released versions of SQL Server (up to 2005) don’t support a pure date only data type. Note that SQL Server 2008 add the new DATE data type which should make this post semi-redundant. This can prove painful when you wanting to store values for a specific day. So you end up getting creative. My normal solution is to put a check constraint on the column to enforce that the date value represents the start of the day or 00h00. Oh and I generally make sure I store all my date and time values in UTC so I can render to any time-zone that my application desires.

Here is an example of how I’d do a check constraint on column UtcDate. Note how I effectively truncate the floating-point representation of the date and time value and check that it equals the column value. Also I store it as a SMALLDATETIME as I’m not needing more than 1 minute accuracy. Oh and I’ve tried to reformat the examples to be easier to read on the web, I hope it works. 🙂 

CREATE TABLE [dbo].[Foo]
(
 [UtcDate] SMALLDATETIME NOT NULL
            CONSTRAINT [CK_Foo_UtcDate]
             CHECK (FLOOR(CONVERT(FLOAT,[UtcDate]))=CONVERT(FLOAT,[UtcDate]))
) ON [PRIMARY]
GO

This method works great for me but in searching for a way to truncate the minutes of a DATETIME to a specific interval I found another approach that not only looks more elegant but most likely performs a lot better. I haven’t run any proper performance tests so I’d appreciate some feedback from those that have done some testing.

CREATE TABLE [dbo].[Foo]
(
 [UtcDate] SMALLDATETIME NOT NULL
            CONSTRAINT [CK_Foo_UtcDate]
             CHECK (DATEADD(DAY,DATEDIFF(DAY,0,[UtcDate]),0)=[UtcDate])
) ON [PRIMARY]
GO

It looks a lot more efficient than my previous approach, hopefully it is. Oh and take a look here for more very useful tips and tricks when working with dates and times in SQL Server.

[tags]SQL,SQL Server[/tags]

Visual Studio 2008 released

Yeah its official, Visual Studio 2008 and the .NET Framework 3.5 was officially released today. You can read Somasegar’s announcement post over here. If you have been chomping on the bit waiting for the release then head on over and download 90-day trial editions, the Express editions and the full ISOs which are available to MSDN Subscribers from here.

Congratulations to the Visual Studio and .NET Framework teams, they have certainly delivered great product this time around.

[tags]Visual Studio 2008,Orcas[/tags]