Go to content Go to navigation Go to search

Brokenwire.NET::M

Sign in to Windows Live using CardSpace
· 2008-03-19 19:52 by Thijs Kroesbergen for Brokenwire.NET

Did you know that you can use CardSpace to sign into the windows live services? By using CardSpace you don’t need to enter your password to sign into a service. This way you can use a longer, more secure, password and have the leisure to just show your card whenever you want to sign in (from your own pc).

It’s really easy, here is how to set this up:

  1. Install the .Net framework version 3.0 (already present if you use Vista)
  2. Get either IE7 or Firefox with a CardSpace plugin. I used Firefox with the Identity Selector extension.
  3. Assign a Card to your Live / Passport account on the Information Card management page. On this page you can associate a Card with your Windows Live ID.
  4. Sign into your favorite Live site. (for example, SkyDrive but also Hotmail)
  5. Never type your password again, just pick the Card whenever you want to sign in.

The CardSpace support in Windows Live is still Beta, but it is very usable. The .NET 3.0 homepage describes CardSpace in the following way:

Windows CardSpace is client software that enables users to provide their digital identity to online services in a simple, secure and trusted way. It is what is known as an identity selector:  when a user needs to authenticate to a web site or a web service, CardSpace pops up a special security-hardened UI with a set of “information cards”  for the user to choose from. Each card has some identity data associated with it – though this is not actually stored in the card – that has either been given to the user by an identity provider such as their bank, employer or government or created by the user themselves. Having the user as an identity provider sounds a bit strange on first acquaintance – who would trust the user? –  but this is a very common scenario: this is what we do every time we register at a web site. The CardSpace UI enables users to create Personal cards (aka self-issued cards) and associate a limited set of identity data. It also enables the user to import Managed cards from third party identity providers. When the user chooses a card, a signed and encrypted security token containing the required information (e.g. name and address, employer’s name and address, or credit limit) is generated by the identity provider that created the card. The user, in control at all times, then decides whether to release this information to the requesting online service. If the user approves then the token is sent on to this relying party where the token is processed and the identity information is extracted.

If you want to learn more about CardSpace and it’s role in the Identity Metasystem take a look a Kim Cameron’s IdentityBlog, he is one of the gurus in the identity area.

Permalink -

Singularity: open source C# Operating System
· 2008-03-07 11:16 by Thijs Kroesbergen for Brokenwire.NET

The source code for the Microsoft Research project "Singularity" has been published on CodePlex. I’ve written about Cosmos about a month ago and I’ve had many visitors looking for information about a C# operating systems.

I’ve not yet tried to actually run Singularity from the provided sources, but from the "About" page and the supplied documentation it seems that they have a pretty complete implementation.

From the include slide shows you can conclude that Singularity is actually written in SpeC#, a superset of C# (formerly A#). Their runtime is named "Bartok" and translates the MSIL code to x86 binary code.

The mentioned target scenario is "eHome digital-convergence" which means that Singularity could run on devices like Smart Remotes, Set-Top boxes and Media Servers and provide a common platform for these kind of devices.

If the network support is complete enough, Singularity could also be a nice start for embedded (home automation?) projects.

Furthermore they have include a slide deck which says something about the performance of Singularity in comparison with other OS’s (FreeBSD, Linux, Windows). From these slides you can conclude that the performance currently is very similar to these OS’s!

So far I know about three OS implementations in C#:

  1. Cosmos
  2. SharpOS
  3. Singularity

Concluding from my shallow investigations it seems like Singularity is by far the most complete project, with it’s network support and many demo applications. I’m amazed by the size of this project!

One final highlight for pong-addicts: "Pong.cs" is included!

Ps. for the non-native English speakers (just like me): I looked up "Technological singularity" and that actually means something like an intelligence explosion, caused by the self-improving intelligence of machines, which will eventually surpass human intelligence. Think about that for second, does this project prelude the end of mankind?

Permalink -

Synchronize watches!
· 2008-03-07 08:33 by Thijs Kroesbergen for Brokenwire.NET

Because I’m already knee-deep into sync I wanted to share this: recently Google released a small Sync app to synchronize your Outlook calendar with your Google calendar. The app runs in the tray of your windows machine and it updates the calendars on a set interval.

The really cool thing about this is that you have your calendar always available and you could use this to get SMS-reminders of events on your outlook calendar!

Or maybe not…

From the Google Calendar FAQ:

If you’ve noticed that your reminder settings in Google Calendar and Microsoft Outlook events don’t match, keep in mind that while Google Calendar supports pop-up, email, and SMS reminders, Microsoft Outlook Calendar supports only pop-up event reminders. Accordingly, only pop-up reminders are synced between Google Calendar and Microsoft Outlook Calendar.

Also, Microsoft Outlook Calendar supports only one pop-up event reminder per event. So, if your Google Calendar events contain multiple pop-up event reminders, only one pop-up reminder will be transferred to your Microsoft Outlook Calendar events.

Ouch.. too bad…

But of course there are alternatives, like SyncMyCal which is free if you don’t mind the syncing manually and never look more than three days ahead or back. But this one does respect the default notification setting of your Google calendar and therefore it proves that the API will let you do such things.

So if Google Calendar Sync would respect my default notification type when transferring items from Outlook, or at least would let me specify a mapping between SMS in Google, and Pop-ups in Outlook that would be awesome.

Alternatively someone with a bit of time left could attempt to write a Sync Provider for the Microsoft Sync Framework and use that to make me happy!

Permalink -

Leaping in PowerShell
· 2008-02-29 14:04 by Thijs Kroesbergen for Brokenwire.NET

Because today is a special day, Leon decided to use C# to calculate a leap year. Because I'm in the PowerShell mood, I'll use that to do exactly the same thing!
Are you ready? Here it is:

[DateTime]::IsLeapYear($year)

Can you see the connection between C# and PowerShell?

Permalink -

Publishing test results to TFS
· 2008-02-28 09:06 by Thijs Kroesbergen for Brokenwire.NET

When running (unit-)tests outside your build process it is still possible to publish the test results back to the build you're testing. For this you can use MsTest.exe or Visual Studio and you need the Team Explorer bits installed. Because we implemented a fully automated system-integration testing system we wanted to use the command line to start the tests and have the results published back to TFS.

So, straight from the MsTest /?:

The following options are also available if Team Explorer is installed: /publish:[server name] Publish results to the Team Foundation Server. /publishbuild:[build name] The build identifier to be used to publish test results. /publishresultsfile:[file name] The name of the test results file to publish. If none is specified, use the file produced by the current test run. /teamproject:[team project name] The name of the team project to which the build belongs. Specify this when publishing test results. /platform:[platform] The platform of the build against which to publish test results. /flavor:[flavor] The flavor of the build against which to publish test results.

That's easy! Yes, but, hmm not so easy after all....

Here is the catch (which took me a lot of time to figure out): You need to specify the value for the platform parameter exactly the same as you have it defined in your build! Our build is configured with "Any CPU" but when passing "x86" seemed to work as well, except that the results would just disappear. This is what happened: when passing the wrong platform MsTest will publish your results to TFS, but you can not find them ever again! When you pass the correct parameters the results will be attached to the build tested (and they are visible in the build store) and results file (.trx) will be placed in the drop location for that build.

The 4 possibilities for platform are:

A full example of using the MsTest.exe command to kick the test and publish the results to TFS:

MSTest /nologo /testcontainer:"MyTests.dll" /runconfig:"localtestrun.testrunconfig" /resultsfile:"MyTestResults.trx" /test:MyUnitTest /publish:"http://TfsServer:8080" /publishbuild:"DailyTestBuild_20080227.1" /teamproject:"TestProject" /platform:"Any CPU" /flavor:Debug

Now if MsTest (or the TFS webservice) would just have returned an error if you passed in the wrong platform, that would have been much better (and saved me a lot of time)...

Permalink -

Using the Team Foundation Object Model with PowerShell
· 2008-02-26 12:45 by Thijs Kroesbergen for Brokenwire.NET

After my first steps in PowerShell I wanted to do something more. I wanted to manipulate the TFS build store from within PowerShell (because I installed TFSDeployer which responds to "Build Quality Changed events" from TFS). So after some Google-ing I found the "get-tfs.ps1" script written by James Manning. His script wraps the Team Foundation Server SDK (which is .NET object model to access TFS) into one nice PowerShell script.

The only thing his script could not do, was manipulate the build store. But with the addition of one line I made this possible. His version also was a "script-as-function" while I'd rather have just a separate function that I could put in my script library. The script now look like this:

function get-tfs ( [string] $serverName = $(Throw 'serverName is required') ) { # load the required dll [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client") $propertiesToAdd = ( ('VCS', 'Microsoft.TeamFoundation.VersionControl.Client', 'Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer'), ('WIT', 'Microsoft.TeamFoundation.WorkItemTracking.Client', 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore'), ('BS', 'Microsoft.TeamFoundation.Build.Common', 'Microsoft.TeamFoundation.Build.Proxy.BuildStore'), ('CSS', 'Microsoft.TeamFoundation', 'Microsoft.TeamFoundation.Server.ICommonStructureService'), ('GSS', 'Microsoft.TeamFoundation', 'Microsoft.TeamFoundation.Server.IGroupSecurityService') ) # fetch the TFS instance, but add some useful properties to make life easier # Make sure to "promote" it to a psobject now to make later modification easier [psobject] $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($serverName) foreach ($entry in $propertiesToAdd) { $scriptBlock = ' [System.Reflection.Assembly]::LoadWithPartialName("{0}") > $null $this.GetService([{1}]) ' -f $entry[1],$entry[2] $tfs | add-member scriptproperty $entry[0] $ExecutionContext.InvokeCommand.NewScriptBlock($scriptBlock) } return $tfs }

The way this works is that the "propertiesToAdd" array is looped through, and the $tfs powershell object is extended with a new object with the names of the first array element. The actual objects are retrieved from the third array element and they are retrieved from the assemblies in the second array element.
This function is used to create a $tfs object, like this:

$tfs = get-tfs http://YourTfsServer:8080

Next, you can use one of the properties of the $tfs object to do cool stuff.

VCS gives you access to the version control server. For example, you can download a single file, without an active workspace mapping:

$tfs.VCS.DownloadFile("$/Test Project/ClassLibrary1/ClassLibrary1.sln", "C:\ClassLibrary1.sln")

Or you can map a temporary workspace to retrieve all files in a specific folder:

$workspace = $tfs.VCS.CreateWorkspace([System.Guid]::NewGuid().ToString(), $tfs.AuthenticatedUserName) $workspace.Map("$/Test Project/Dev/Branch/SomeFolder", "C:\SomeFolder") $workspace.Get() $workspace.Delete()

WIT lets you use the work item store. For example, you can retrieve the uri, title and state of a workitem:

$tfs.WIT.GetWorkItem(1) | Format-List uri, title, state

BS is the wrapper for the build store. Let's do something more complex: retrieve the last successfully completed build and once this build is found, update the Build Quality.

$build = $tfs.BS.GetListOfBuilds("Test Project", "TestBuild") | where {$_.Buildstatus -eq "Successfully Completed"} | sort -property FinishTime -desc | select -first 1 $tfs.BS.UpdateBuildQuality($build.BuildUri, "Ready for Initial Test")

CSS contains the ICommonStructureService interface. This interface gives you access to the more common properties of you TFS server. For example, retrieve all projects on your server (which is just a bit boring...):

$tfs.CSS.ListAllProjects()

The last one, GSS, gives access to the group security service interface. The next two lines of script will give you a list of all the groups (both windows and application groups) a specific account is a member of:

$groups = $tfs.gss.ReadIdentity('accountName', 'YourNTAccountName', 'direct').memberof $groups | foreach-object -process { $tfs.GSS.ReadIdentity('sid', $_, 'none') } | fl type, displayname

I know I like working with TFS & PowerShell a lot, and I hope you do too. Enjoy!

Permalink -

Previous Next