Tuesday, December 23, 2008

How To Sign Up for Windows Azure

There are three services to sign up for: Windows Azure, .NET Services and SQL Data Services. You sign-up for all of these services here: http://go.microsoft.com/fwlink/?LinkID=129453

You will NOT receive your tokens immediately. It make take awhile. Also, there are different tokens for different services and they may arrive at different times. This can be confusing, but basically you just need to be patient. You will need TWO invitation tokens to receive access to all three services.

Windows Azure - provides computation services, hosting for ASP.NET applications and access to Azure Storage (blob, queue & table). Requires invitation token with the form XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, where 'X' is [0-9A-F]. Access via the following URL: http://lx.azure.microsoft.com/fs

.NET Services & SQL Data Services - provides access to Service Bus, Access Control Service, Workflow Service and SQL Data Services. Requires invitation token with the form: XXX-XXXX-XXXX, where 'X' is [0-9A-Z]. Access via the following URL: http://portal.ex.azure.microsoft.com/

Please note, Azure Storage != SQL Data Services. Azure Storage provides rudimentary database support via the table storage. SQL Data Services provides more conventional database concepts.

Saturday, December 20, 2008

Windows Azure for Powershell

The Azure SDK includes a setenv.cmd batch file for an Azure Command Prompt. But I haven't used the Command Prompt in ages! Powershell or bust! So.. Here's my Azure PowerShell Prompt script. Add it to the end of your profile.ps1 in the %USERPROFILE%\Documents\WindowsPowerShell folder and go make something cloudy!

# AzureCmdPrompt.ps1

function SetupAzure($installPath, $netPath)
$curPath = $env:path;
$binPath = $installPath + "bin";

$env:PATH = $binPath + ";" + $curPath + ";" + $netPath;
$env:ServiceHostingSDKInstallPath = $installPath;

echo "Windows Azure SDK PowerShell";
$host.ui.RawUI.WindowTitle = "Windows Azure SDK Environment"

if (!$env:ServiceHostingSDKInstallPath)
if (test-path "hklm:\software\microsoft\microsoft sdks\servicehosting\v1.0")
$installPath = $(gp "HKLM:\Software\Microsoft\Microsoft SDKs\ServiceHosting\v1.0").InstallPath
$net64Path = "$env:SystemRoot\Microsoft.NET\Framework64\v3.5";
$net32Path = "$env:SystemRoot\Microsoft.NET\Framework\v3.5";

if (test-path $net64Path)
{ SetupAzure $installPath $net64Path }
elseif (test-path $net32Path)
{ SetupAzure $installPath $net32Path }
{ echo "Please install the .NET 3.5 Framework."; }
{ echo "Please install the Windows Azure SDK."; }

Tuesday, June 17, 2008

Using C# 3.0 in ASP.NET 2.0

C# 3.0 has a lot of great features to help with ASP.NET 3.5 web projects. However, you can also use SOME C# 3.0 features in SOME .NET 3.0 and 2.0 projects if you're using Visual Studio 2008. The gist of it is, if you create a new "ASP.NET Web Application" solution (File -> New -> Project... -> Web -> ASP.NET Web Application) you can use most C# 3.0 features (lambdas, vars, anonymous types, etc.) The exception being LINQ, expression trees and extension methods, which require additional classes/attributes that are only present in the 3.5 base class library. This works because the compiler is generating all of the code for your site into DLLs which have to be deployed along with your pages, and .NET 2.0, 3.0 and 3.5 all target the .NET 2.0 CLR.

However, if you are creating an "ASP.NET Web Site" solution (File -> New -> Web Site... -> ASP.NET Web Site), all bets are off. With this type of solution, you are relying on the framework to compile your application at run time. Thus, the target framework's C# compiler will be used. Because the C# 3.0 compiler is only available in .NET 3.5, you can not use C# 3.0 features with this feature of ASP.NET prior to v3.5.

There are a few ways around these limitations. First, you can use LinqBridge. LinqBridge recreates several of the classes from the 3.5 framework in the 2.0 framework, effectively letting you use nearly all C# 3.0 features in your .NET 2.0 projects. Expression trees are the only feature you won't be able to use. Extension methods, LINQ to Objects and query expressions all work just fine. However, you must be using the C# 3.0 compiler to use LinqBridge, so ASP.NET Web Site solutions are still left out in the cold.


It turns out there is a sort of work around to compile an ASP.NET Web Site solution with C# 3.0, as long as you don't mind sacarificing dynamic compilation. From the Website menu, select "Start Options". Click on "Build". Change the Target Framework to 3.5 and clear the "Build Web site as part of solution" checkbox and click OK. Now click on "MSBuild Options" and set "Output Folder" to a path outside of your solution's source tree. I'd like to say I know why you have to do that, but I don't. You'll get an error from MSBUild if you specify an output folder within your solution's source tree. Boo. Hiss. Moving on. At this point, you will no longer be able to build your project in Visual Studio. However, you can build it with MSBuild. If you fire up a VS2008 command prompt, change to your web site solution's folder and type "msbuild", your project will compile with the C# 3.0 compiler. Please note that you are compiling your web site to DLLs, so you will not be able to make code updates. Still, it's potentially a nice interim solution until you can move your web projects over.

Here's a feature capability table:

Solution TypeProjectWeb Site
.NET Framework Version3. with LinqBridge3.53.02.0
Expression TreesYNNNYNN
LINQ/Query ExpressionsYNNYYNN
Extension MethodsYNNYYNN
"var" keywordYYYYYNN
Anonymous TypesYYYYYNN
Automatic PropertiesYYYYYNN
Object InitializersYYYYYNN
Collection InitializersYYYYYNN

Sunday, May 25, 2008

This is for Sally

Where to put the screwdriver. Lefty loosey!

Tuesday, May 20, 2008

How do you *know* it's a witch?

Wow.. The ALT.NET blogs have been downright hostile to the Entity Framework. Admittedly, I'm a total noob in this arena. I've done some work with IoC containers, but I haven't done much with the various and sundry ORM frameworks. I played around with Hibernate quite awhile ago and was very impressed (yes, I've written Java; no, it's not contagious), but NHibernate was in very early beta at the time.

Anyway. I think it's a bit premature to call for the pitchforks and torches with respect to the Entity Framework. From what I've read, the EF appears to force you to weld your code to it, which is annoying. But remember, this is 1.0 product and Microsoft has never, ever released a decent 1.0. I think it might be best to sit out this first version, but I wouldn't be surprised to see some interesting things coming from the mothership in the coming years.

What kinds of things? I'm glad you asked! The Entity Framework requires numerous XML files to work. Those XML files integrate seamlessly into C# and VB projects. In fact, Microsoft has a quite bit of history blending XML with their projects. So much so, that VB9 allows you to write XML directly in your code. C# doesn't have that feature (yet), but it does have LINQ. While LINQ isn't XML, it is a language in its own right. Then we have WPF, which comes in both XML and API flavors. Windows Workflow - same story. All of these things lead me to one conclusion:

Visual Studio will become a polyglot programming environment. I believe Microsoft is thinking beyond source code (the horror!) to an environment that allows us to write some code and literally draw other bits of code. Right now, it looks pretty ugly, but it should get better. The biggest flaw in my crystal ball is the fact that you can't mix .NET languages in a single project right now. Maybe multi-language source files are something we can expect in CLR 3.0? Imagine drawing data entities, writing utility classes in C#, contracts in IronRuby and orchestrating the whole thing with F#!

What a long, strange trip it will be.

Friday, May 9, 2008

The Best SATA/IDE-USB Adapter Ever

The Vantec CB-ISATAU2 adapter is marvelous! 99% of the time, I just want to hook up a drive and copy some data off of it. This normally means finding an appropriate enclosure, taking it apart, swapping out a drive, putting it together again and finally plugging it in and getting the data off of it. This adapter eliminates all but the last step. It has 2.5", 3.5" IDE and SATA connectors, a power connector and a USB connector. Plug in drive, plug in USB connector - done.

Buy one!

Sunday, May 4, 2008

Undermount sinks - awesome and sucky

All at the same time. It looks fantastic, but it's an unbelievable bear to install. It's no wonder people end up paying 30k-40k to have their kitchens updated - IT SUCKS! As nice as this sink is, I don't think I'd do it again. It's a sink. It doesn't need to look like a masterpiece, it needs to hold dirty dishes until I get them into the dishwasher. So next time, over-mount sink. I think that makes more sense anyway, with weight-loading and what-not.

Also, I got black caulk in my hair, which really pisses me off. Don't get me wrong - I'm sure a lot of people love black caulk, I'm just not one of them.

Oh well.. I'm just impressed I managed to drill 14 holes into the bottom of the countertop WITHOUT popping through the other side.

Here's a lovely piccy. Weekend over. Who needs a drink?

Tuesday, April 29, 2008

Public Transit FTW

Today is the first day that I'm taking public transportation to/from work. It takes longer than driving, but it's LOADS cheaper. I'm leaving my car at work during the week so if I need it for anything while I'm at work, I'll have it. It takes about an hour on the train, so I'm going to try working, reading and blogging.

But right now, I'm listening to This American Life, which has me thoroughly distracted. It's about cryonics, which is both fascinating and frightening. It seems the first cryonics group was run by "some guy" and all of his scientific advisors quit early on. Quite an auspicious start...

Saturday, April 26, 2008

Countertops are looking good!

We're using a product called Paperstone, which is an eco-friendly material made from recycled paper and a resin. It cuts like wood, but it's incredibly strong and non-porous... If you nick it, you can just break out some sandpaper and sand it out.

This doesn't really show it, but we have an egregious amount of counter space - which is awesome. I can't wait to cook again!

Thursday, April 24, 2008

Powershell Prompt

With my recent re-dedication to working with UAC, I find myself constantly wondering if I'm running Powershell in Admin mode not. After a little poking around, I found that the "SESSIONNAME" environment variable is missing when running as an administrator. Odd, but whatever. The upside of this is, I can now tell if I'm running in Admin mode and throw up a different prompt. So! Here is my new, revised Prompt function for Powershell:

function Prompt
  if (($env:SESSIONNAME).Length -gt 0)
    $host.ui.RawUI.WindowTitle = $(get-location)
    $host.ui.RawUI.WindowTitle = '[Admin] ' + $(get-location)

Thursday, April 17, 2008

The gift of music

If you were going to rickroll a mix CD for someone, would you do it at the beginning, middle or end of the CD? Assuming, of course, that you don't put the song on the track list. I see merits to all three, but I suppose middle makes the most sense.

This is completely hypothetical, obviously...

Sunday, April 13, 2008

The front yard

Looking good! This is before the application of bark dust. I took the pic now because the sun will soon disappear for God knows how long. Ahh Portland!

Mobile blog test

Trying to send a mobile blog entry with a pic..

I'll be damned.. It worked - and without signing up for MMS from Sprint. This is our cat Celeste and some of our new bamboo floor. Not terribly exciting, but unspectacular test results are sometimes the best kind, eh?

Saturday, April 12, 2008

Big Day Out!

With the sun a'shining as it is, it's time to get outside and start deweeding our insanely overgrown front yard. I'll try to take some pics and post them when I'm through - if it looks reasonable. Before that, I'll probably work on a logo or something for ze blog. I've got an idea - I'm just not sure how it's going to pan out... Then tonight - it's bookstore and Fry's time! Woooo!

Oh, and the cat has stopped coughing, which is great. But she's taken to shedding, which is not. We're going to be able to build another cat with all of this fur...

Monday, April 7, 2008

Books I Want

LINQ In Action
Consider Phlebas
Broken Angels
The Ghost Brigades

Saturday, April 5, 2008

Less Annoying UAC For Vista

When I first got Vista, I ran with UAC fully enabled. I did so to fully experience what users would experience when running UAC and thus, avoid being part of the problem when writing user-land code. It drove me completely bonkers.

When I switched to 64-bit Vista, I decided enough was enough and I turned it off altogether, but I always felt a little guilty. I tried the "elevate without prompting" approach, but it felt like cheating - although I guess it's good that you still get file and registry virtualization. Plus, it seems a great many of MS bloggers insist on keeping UAC turned on for the same reasons that I originally left it on.

Now however, I think I've found the best of both worlds. I leave UAC on, set to "Prompt for consent", but I turn OFF the Secure Desktop. It saves just a fraction of a second when UAC prompts appear, but it makes all the difference. And it's much less visually distracting. Give it a shot if you hate UAC (who doesn't?).

Run the Local Security Policy application and change the "Local Policies\Security Options\User Account Control: Switch to the secure desktop when prompting for elevation" policy to "Disabled".

Friday, April 4, 2008

Reunion Time!

Alright! Alright! Keep it down in here you three! And send me links to your blogs, eh? So *I* can put you in *MY* Google Reader! EDIT: It's too late - I've already found you!

Oh, and I'm on twitter too.. twitter.com/xinmyname

Still need to do more work on the blog. I'll probably do that tomorrow morning whilst the missus is sleepin'.

Sunday, March 30, 2008

Google Lying Zeitgeist

I googled all of the leading presidential candidates names followed by the word "lies". The number of pages returned are as follows:

"McCain lies" : 19,400
"Obama lies" : 26,100
"Clinton lies" : 53,600
"Bush lies" : 207,000

And of course, no set of statistics would be complete without a bar graph...

Pretty much entirely useless - but look at the graph! Oh my God!

Friday, March 28, 2008

Hola Amigos

Konichiwa bitches! I know it's been awhile since I rapped at ya. Oh wait - it's been never. Anyway... I'm starting to flesh out the blog a bit. Still got some work to do though. Mostly in the color department. I've also got to update my IoC container spreadsheet with the latest Unity drop so I can post it.

Oh.. and this theme has GOT to be wider.. 660 pixels? Seriously? I got, like, a gallion pixels on this crazy wide screen - I'll bump it up a bit later...

Now - on to kitchen cabinet assembly!