Saturday, August 29, 2009

Watch Nordic Developer Conference 2009 from you favorite couch

If you also where unable to attend the NDC09 you’ll be happy to hear that the talks are now available for downloads go here and you can get them in a convenient torrent format so that you can download the whole shebang in one swoop (be warned though it’s a large download +30GB).

The speakers list of the  NDC09 was very impressive… Robert Martin, Craig Larman, Scott Hanselman, Phil Haack, Mary Poppendieck and Scott Bellaware just to name a few.

Thursday, August 27, 2009

Taking SQL Azure for a test spin (it’s dirt simple)

Earlier this week I received my invite to the SQL Azure CTP so I obviously threw myself at taking it for a test spin, and I must say that it was a sweet experience (a part from the fact that my SQL DDL is a little rusty). Anyway I figured that I should write a few lines about the experience but first let's just get some basic facts out of the way, what is SQL Azure?

Microsoft® SQL Azure Database is a cloud-based relational database platform built on SQL Server® technologies. With SQL Azure Database, you can easily provision and deploy relational database solutions to the cloud, and take advantage of a globally distributed data center that provides enterprise-class availability, scalability, and security with the benefits of built-in data protection, self-healing and disaster recovery.

The about quote is taken from the Windows Azure Platform site and as it states you can now deploy a relational database in the cloud and accessing it via the TDS protocol using ADO.NET and ODBC (there is even a driver for PHP if you need that).

Anyway enough with the chit chat let's get our hands dirty in some code... The app we will run through here is an extremely simple an silly notebook in the cloud which you can insert some reminders in a then go back and see what you should do (the whole application took less than one hour to get up and running, writing this post took far longer than that).

First out you have to activate your invite (if you haven't signed up you can do it here) and get your SQL Azure database provisioned. When you have done that you get to access the management portal:

Currently you can only manage your connection strings and create and drop databases, but since you can’t manage logins we might as well drop straight into the sqlcmd tool (in this version you can’t use the Management Studio it is not supported yet) and start by creating  a small database. When you create your databases and logins you need to be logged in to the master database.

Once you have fired up a command prompt we issue the following command to connect to the master database:

sqlcmd –U <admin>@<servername> –P <password> –S <servername>.ctp.database.windows.net –d master

Now let’s create a database called MyCloudDB and a user called MyCloudUser:

CREATE DATABASE MyCloudDB
GO
CREATE LOGIN MyCloudLogin WITH password='1tsCloudyInSeattle'
GO

Let’s switch over to our new database and create some tables and grant our user some access:


sqlcmd –U <admin>@<servername> –P <password> –S <servername>.ctp.database.windows.net –d MyCloudDB


Then we issue the following statements create a user and a table where we can store our notes:


CREATE TABLE CloudNotes (ID int IDENTITY(1,1) PRIMARY KEY, Note nvarchar(500))
GO
CREATE USER MyCloudLoginUser FROM LOGIN MyCloudLogin
GO
GRANT SELECT,INSERT,UPDATE,DELETE ON CloudNotes TO MyCloudLoginUser
GO

Now we are ready for some code, first let’s write the snippet needed to put the reminders up in the cloud:


    public void InsertNote(string note)
{
SqlConnection cn
= new SqlConnection("Server=tcp:<yourservername>.ctp.database.windows.net;Database=MyCloudDB;User ID=MyCloudLogin;Password=1tsCloudyInSeattle;Trusted_Connection=False;");
using (cn)
{
SqlCommand cmd
= new SqlCommand("INSERT INTO CloudNotes Values (@Note)");

cn.Open();

cmd.Connection
= cn;
cmd.Parameters.Add(
new SqlParameter("@Note", note));
cmd.ExecuteNonQuery();
}
}

And finally the code required to retrieve the notes so we don’t forget to but that milk on our way home:


    public List<string> ListNotes()
{
List
<string> result = new List<string>();

SqlConnection cn
= new SqlConnection("Server=tcp:<yourservername>.ctp.database.windows.net;Database=MyCloudDB;User ID=MyCloudLogin;Password=1tsCloudyInSeattle;Trusted_Connection=False;");
using (cn)
{
cn.Open();

SqlCommand cmd
= new SqlCommand("SELECT ID, Note FROM CloudNotes ORDER BY ID", cn);
SqlDataReader dr
= cmd.ExecuteReader();
while (dr.Read())
{
result.Add(dr.GetInt32(
0).ToString() + " - " + dr.GetString(1));
}
}

return result;
}

That’s all there is to it as I said in the title dirt simple :) if you want to read more about the limitations and how to get going checkout MSDN documentation on SQL Azure. I’ll probably post more as I dabble around with it.

Saturday, August 22, 2009

Getting the dreaded "The fully qualified file name must be less than 260 characters" when publishing test results in TFS 2008

During the last week I've had some issues with getting an old set of tests to run in the automated build process. The reason they had been excluded before was that the author had used .xml files to drive his test suite and was unaware of the functionality in MSTest that let's us specify deployment items through the .testrunconfig file (provided that you run you tests using a .vsmdi file).




Anyway, even though I don't particularly fancy the approach of using external files to drive the test (there are good scenarios but in my opinion they should be oriented more towards simple parameter driving of test not complex object serialization, but that is a post in itself if I get around to it sometime).



The problem once I got the test to run on the server (some shmuck had deselected the deploy alternative for the assembly containing the unit tests in the build targeted by the automated build), that the testrun results simply wouldn’t publish instead we got this message in the log:



Waiting to publish... Publishing results of test run tfsservice@LIVMSRV228 2009-08-21 12:56:49_Any CPU_Release to http://livmsrv246:8080/Build/v1.0/PublishTestResultsBuildService2.asmx... ....The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.


What happened was that the tests ran ok and you’d see the results ok in the log but as soon as Team Build tried to publish the results we ended up with a complaint about a too long path. Unfortunately no matter what amount of logging you switch on the log won’t tell you which file is the problem and in our case this particular test result file was actually on of the shorter paths :). So after a fair amount of head-butting I managed to get it working and guess what the problem resided in the deployment items that we selected using the .testrunconfig. Our structure was heavily nested with long self-explanatory names for readability :) which is good, but since they somehow are involved in the publishing step (I haven’t had the time to drill down into what happens here so if you have some insight into this feel free to comment about it) and thus you are restricted to the 260 characters for the fully qualified path name of the deployment item.

Simplify Photo & Simplify Music ... It's got to be one of the coolest iPhone Apps so far!

Just felt that I had to share the joy. I just installed and tried out the coolest app to date for my iPhone (the app works for iPod Touch as well). It's a company called SimplifyMedia and they have produced a piece of streaming software available for PC,MAC and Ubuntu which let's you share your photos and music from a machine at home and then access it thrue an application called:

Simplify Photo (about 1$)
and not to mentioned what could well be a worthy rival to the long awaited Spotify iPhone/iPod client, altough you are limited to your own music collection which will most likely have trouble matching the depth and breath of Spotify's music archive.
Simplify Music 2 (about 6$)
After you've downloaded and setup an account and selected the folders to share your ready to go and can access your photos and music from everywhere.

Monday, August 10, 2009

Tips n Tricks: Moving TFS to another server and getting Error 3154: The backup set holds a backup of a database other than the existing database

Another issue that I ran across today when trying to restore our TFS backup onto the freshly installed TFS server what the fact that due to various discrepancies in the environments I ended up getting the following error message when trying to restore my Reporting Services and SharePoint databases:

Error 3154: The backup set holds a backup of a database other than the existing database

So after banging my head awhile I did a bit of searching and sure enough I stumbled upon the following post that explains how to get around it.

To sum it up it is quick simple you have to switch back to TSQL mode and open up a query window and make sure you are currently in the master database and then issue the following command:

RESTORE DATABASE YourDatabase
FROM DISK = 'C:\YourDatabaseBackup.bak'
WITH REPLACE



That’s all there is to it, so far I’ve only encountered this issue with the Reporting Services and SharePoint databases, never with the TFS databases.

Tips n Tricks: Moving TFS to another server and getting "Scale-out deployment" is not supported in this edition of Reporting Services

Today I was mucking about with restoring our TFS environment on a different server to create a backup environment where we can do our migration testing and bumped into some minor issues. I Figured that I should post them, if not for anything else they'll server as a reminder to self the next time around.

Anyway the problem concerns getting the following error message when you try to access your reports:

The feature: "Scale-out deployment" is not supported in this edition of Reporting Services

So what’s the deal with this then? Well as the documentation states:

A scale-out deployment refers to two or more report server instances that share a single report server database

This functionality is not available in the standard edition of SQL Server and the problem I ended up with is that once you follow the steps in the guideline document (How to: Move Your Team Foundation Server from One Hardware Configuration to Another).

My problem was that once I had restored the encryption key for my Reporting Services I ended up with two entries when running RSKeyMgmt –l, to get around this I ran RSKeyMgmt –r OLDDTInstanceID.