Microsoft

C#: lamer by the moment

Posted in Coding, Microsoft on November 4th, 2008 by Cory – Comments Off

To my disbelief, you can’t inherit from generic type parameters in C#. Something like this is currently impossible:

class Foo<T> : T
{
}

It’s sad, really, how Microsoft continues to focus on other crap but leaves out basic things like constraint-based overload resolution or simple inheritance. And still no Spec# features.

Visual Studio 2010 CTP now available

Posted in Coding, Microsoft on October 28th, 2008 by Cory – Comments Off

Coinciding with the 2008 PDC, the first Visual Studio 2010 CTP is now available for download.

At first glance, it includes a few interesting things for C++:

  • Partial C++0x support: lambda expressions, rvalue references, static assertions, and “auto” are now supported.
  • Revamped IntelliSense: now faster and more accurate.
  • Parallel Pattern Library: a modern C++ library that allows easier and safer use of today’s multi-threaded computing.

I’ll be posting more as I take a closer look at these and other features.

More on Japanese in Windows

Posted in Japanese, Microsoft on September 29th, 2008 by Cory – Comments Off

If you just ripped your Japanese music collection only to find out Windows Explorer can’t display any of the tags, you probably used ID3 v2.4.  Windows does not support 2.4 – if you downgrade the files to ID3 v2.3, everything will display just fine.  A good tool that can do this en masse is Mp3tag.  This doesn’t only affect the UTF-8 fields: Windows won’t be able to read album art or anything else if you use v2.4.

Visual Studio incompatibilities

Posted in Coding, Microsoft on September 10th, 2008 by Cory – Comments Off

Hopefully someone reading this won’t have to waste a few days trying to figure this stuff out:

If you install Visual Studio 2008 Team Explorer, you’ll want to install it before VS2008 SP1 or stuff will break.

Internet Explorer 8 Beta 2 breaks the Windows Mobile 6 SDK Refresh – try to click on Platforms in the project creation wizard, and it’ll cancel the dialog.  Uninstalling IE8 (Control Panel->Programs->View installed updates->Windows Internet Explorer) fixes the issue.

RTM hits for SQL Server 2008, Visual Studio 2008 SP1, .NET 3.5 SP1

Posted in Coding, Microsoft on August 7th, 2008 by Cory – Comments Off

SQL Server 2008, Visual Studio 2008 SP1, and .NET 3.5 SP1 have all been RTMed!

Converting SVG to XAML

Posted in Coding, Microsoft on June 1st, 2008 by Cory – Comments Off

While I understand (and even agree with some of) the reasons behind Microsoft reinventing the wheel and not using SVG for their WPF, I find myself constantly wishing they at least offered it as a supported image format. There is so much SVG out there, it’s a shame to not be able to use it.

On my search for a SVG to XAML converter I came across a few really old and out of date tools, one recent but still sub-par tool, and finally one almost perfect tool: Michael Swanson’s Adobe Illustrator to XAML Export plugin.

As the name suggests, it is a plugin for Adobe Illustrator. It works great, but It’s a bit odd to use – by default, it exports to a canvas which, for everything I’ve ever wanted to use a XAML image, is the wrong choice. Luckily it also supports exporting to a DrawingBrush if you hold down the right shift key when you click save in Illustrator.

DrawingBrush isn’t my first choice of format, but you can easily change it into a DrawingImage resource, which lets you use it just like any other ImageSource. To do so you just take what it spits out:

<Viewbox
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Rectangle>
   <Rectangle.Fill>
      <DrawingBrush>
         <DrawingBrush.Drawing>
            <DrawingGroup>
               ...
            </DrawingGroup>
         </DrawingBrush.Drawing>
      </DrawingBrush>
   </Rectangle.Fill>
</Rectangle>
</Viewbox>

And move it’s root DrawingGroup over like so:

<ResourceDictionary
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DrawingImage x:Key="someImage">
   <DrawingImage.Drawing>
      <DrawingGroup>
         ...
      </DrawingGroup>
   </DrawingImage.Drawing>
</DrawingImage>
</ResourceDictionary>

Now you can use it just like any other resource:

<Image Source="{StaticResource someImage}"/>

All in all, it’s a fantastically useful tool. If it had some form of UI to select export options instead of asking you to use the shift key (really, wtf??), it would get an A+.

Enabling IPv6 and PNRP in Windows Vista

Posted in Microsoft on May 14th, 2008 by Cory – Comments Off

Windows Vista is the first version of Windows to support IPv6 out of the box. Even those of us with an IPv4 connection can make use of this, using a technology called Teredo to get IPv6 connectivity over IPv4. With Google finally getting IPv6, now seems like a good time for others to start too.

The steps to enable IPv6 are simple:

  1. Open up a command prompt with administrator privileges. Start->All Programs->Accessories, right click on Command Prompt and select Run as administrator.
  2. If you aren’t on a router, or if your router supports UPNP, enter netsh interface teredo set state client.

    If you want to manually forward a port or your router doesn’t support UPNP, enter netsh interface teredo set state client clientport=12345, substituting 12345 with the port you want to use. You will have to forward UDP over this port to your computer.

  3. Now wait for a minute or so, and run netsh interface teredo show state. It should show “qualified” under State.
  4. Now if you run ipconfig, it should come up with a Tunnel adapter Local Area Connection with an IPv6 address starting with 2001:0.
  5. You can test if it’s working by visiting Google IPv6, or the KAME project’s famous dancing kame.

Now for the second part of the post. PNRP (Peer Name Resolution Protocol) version 4.0 was also introduced in Windows Vista. With PNRP, every computer can have a hostname pointing to it that allows any XP SP2, Vista, and Server 2008 computer to connect to it via the internet. This can be incredibly useful if you’re on the go and wish to remote in to your computer. Another use I’ve found for it is to enable it on relative’s PCs for those inevitable tech support calls that we geeks despise so much.

PNRP functions solely over IPv6, so you will need to have a valid IPv6 address to make it work. The above Teredo instructions should work fine if you don’t. Here’s how you enable it:

  1. Open up a command prompt with administrator privileges.
  2. Run the command netsh p2p pnrp peer set machinename publish=start autopublish=enable.
  3. Now if you run netsh p2p pnrp peer show machinename, it should show you a hostname to use in the format p.<random hex here>.pnrp.net. Record this name, and you can use it to talk to your machine remotely just like any other hostname.

Developers aren’t left out either: Windows comes with an extensive P2P framework, and PNRP is only one of the things built on it. WCF for instance has full integration with P2P.

WCF is pretty neat

Posted in Coding, Microsoft, Scalability on April 21st, 2008 by Cory – Comments Off

I haven’t worked with .NET extensively since a little bit after 2.0 was released, so when I took on a new job developing with it, I had some catching up to do. WCF was the easy part. In fact, I’m really enjoying using it. I can tell they put a lot of thought into making it scalable.

For those that don’t know, WCF is Microsoft’s new web services framework, meant to replace the old Remoting stuff in .NET 2.0. It lets you worry about writing code – classes and methods etc., and it manages transforming it into SOAP and WSDL in the background.

The coolest thing about WCF is the support for completely async design. You start a database query, put the method call into the background, and resume it when the database query is done. This allows the server to run thousands of clients in only a couple threads, improving cache and memory usage greatly.

One funny thing I learned from this is that ASP.NET has full async support too, it just doesn’t get a lot of advertising for some reason. The one thing that annoys me about all modern web development frameworks is the lack of async support making you pay for 20 servers when you should only need one, and here it was under my nose all the time. Imagine that!

Visual C++ 2008 Feature Pack is now available

Posted in Coding, Microsoft on April 7th, 2008 by Cory – Comments Off

The Visual C++ 2008 Feature Pack I talked about before is finished and ready for download.  This includes a bulk of the TR1 updates (sadly, still no cstdint) and some major MFC updates.

Life in Windows 2008

Posted in Microsoft on March 31st, 2008 by Cory – Comments Off

Given that I got a free copy of Windows Server 2008 at the big launch, I thought I’d try it out on my desktop. They are basically the same OS, just different artificial limits. Following Vijayshinva Karnure’s directions, I had a fully functional desktop in no time.

I’ve only run into a couple minor issues. Half-Life 2 doesn’t seem to have a proper codec to play their intro video, and the “Windows Live Messenger Download” link in the start menu takes you to an installer that refuses to run on a server OS.