26 April, 2011

How to: Install WP7 tools on Windows 2008 Server (x64)

It actually is possible to install the WP7 tools onto a Windows 2008 server. Just stumbled upon this great tutorial: http://blogs.msdn.com/b/astebner/archive/2010/05/02/10005980.aspx

Update (29.06.2011): This method is confirmed to be working on WP7.5 (Mango) tools as well.

Update (25.05.2011): This method is confirmed to be working on WP7.1 tools as well.

As this is so valuable information, I’ve chosen to “backup” (copy/paste) this info here.

Taken from Stebner’s blog:

“There is a way you can work around the Windows Server 2008 setup block if needed. Please note that this is not officially supported, so if you try these steps, you are doing so at your own risk:

  1. Download the Windows Phone Developer Tools web bootstrapper and save it to your hard drive
  2. Extract the contents of the setup package by running vm_web.exe /x and choosing a path to extract to
  3. Go to the folder you extracted to in step 2 and open the file baseline.dat in notepad
  4. Look for the section named [gencomp7788]
    Note - you have to change this exact section - this is the one that controls the OS version blocking behavior in Windows Phone Developer Tools setup.
  5. Change the value InstallOnLHS from 1 –> 0
  6. Change the value InstallOnWin7Server from 1 –> 0
  7. Save and close baseline.dat
  8. Run setup.exe /web from the folder you extracted to in step 2
    Note - please make sure that you include the /web command line parameter in step 8. If you don't, setup will not attempt to download the packages it needs to install, and it will fail to install correctly as a result.”


Technorati Tags: ,

How to: Install Zune on Windows 2008 (x64)

Wow – it is not always easy to attempt to convert a Server into a development machine!

If you attempt to install Zune on a Windows 2008 server, you will be presented with an error-prompt saying that it is basically not possible. So what to do?

Here is how:
1) Download the Zune installation package (http://zune.net/en-US/products/software/download/default.htm)
2) Extract the zipped file using this syntax (from command prompt): ‘ZuneSetuppkg –64 /x’
3) Tab into the subfolder: /x64/packages
4) Install using this command: ‘msiexec /i Zune-x64.msi’

You might get presented with a dialog, just close this and let the installation run. After 1-2 minutes, you will se the familiar Zune icon on the desktop of your Server 2008 and all is well!

Technorati Tags: ,

15 April, 2011

WP7: How to control the startup window ?

If you’ve ever wondered where/what determines what window is selected as the startup window in a WP7 application (somehow it is always MainPage.xaml?), you are not alone. However, once you know where these properties are set, it is quite easy to change this if you so desire:


Set this to any valid path in your application, and this window will be the default startup window.

Technorati Tags:

WPF: How to make your application a single instance (machine-wide)

If you want to make sure only a single instance is running of your application on the machine at any time; you need to use system-wide Mutexes. But, where and how do you insert this code in a WPF-application? The Main-method is kind of hidden from you…

In WPF there is no native solution to this problem => you need to solve this yourself. The good news is though, that it is not all that hard to address this problem.

How to
This is a solution that allows you to control in fine detail what is happening in your application. You need first to overwrite the default Main-method to perform the check and make sure the default app is not started. See this post for how to do this: WPF- Where is the Main method- Or how to overwrite the Main method-

Next, you need to attempt to acquire a Mutex during startup. Mutexes come in 2 flavors, a local or a system-wide version. We are in this scenario after a System-wide Mutex, so that you will be the only one that can hold on to that Mutex on the entire machine. Mutexes become system-wide if you give them a name, hence if you attempt to acquire a named mutex, you are attempting to gain systemwide access. Below is the custom Startup class (MyApp.cs):

class MyApp
public static void Main(string[] args)
if (!IsFirstInstance()) return;

var app = new App();

public static bool IsFirstInstance()
//give the mutex a name => it will be systemwide.
var mutex = new Mutex(true, "somethingunique");
return mutex.WaitOne(TimeSpan.Zero, false);

If you succeed, you are the first instance on the machine, and you are good to go. When attempting to start two instances of this application, you will see in the TaskManager on Windows that only one process is running regardless how many times you attempt to (re)start the application.

Technorati Tags:

13 April, 2011

How to disable IE Enhanced Security in Windows Server 2008

If something is annoying, I would vote for the “Enhanced Security” IE feature put on you by the Empire. On Client OS’s it’s quite easy to take away, but on the Server family – it is hidden “somewhere” ;-)


That “somewhere” took me some time to find today, but as a point of reference to myself (and others), here is the location you need to go:

Server Manager –> Root Node –> Configure IE Sec (turn it off)

Technorati Tags:

12 April, 2011

Enable the Aero experience on Windows Server 2008

When you use the Windows server 2008 as a backend server, you have little use for a nice graphical UI of the computer. But, when you start using it as a desktop system (maybe due to development requirements), you kind of miss the nice looking UI you’ve become used to from Windows 7.

Fear no more, it is almost possible out-of-the-box. By selecting Features –> Add Feature –> Desktop Experience, you can gain a similar UI on Windows 2008 Server.


Update: You do of-course need to start the Themes-service in Windows Services to see the effect.


Technorati Tags:

Maintain and Model your system configuration using Visio 2010

I’ve recently been presented with a system that had it’s system components (Bill Of Materials) modeled in Visio 2010. Actually, pretty clever setup as it gives the people responsible for the system configuration a tool that’s intuitive and pretty straight forward to use (i.e. Visio 2010). And might I add, this person does not have to be developer or some other person “burdened” with some deep technical knowledge (like yours truly ;-)).

Now, this situation gave me an idea about how you could extend this to also include other artifacts as well. Using the templates found in Visio 2010, you can easily create e.g. an Organization Chart (see example below).

Visio 2010 Organization Chart

Visio will support the user when creating this diagram, and data can even be retrieved/stored in a relational database if you so desire.

Well – this is grand. Now, how do you go about exporting this into some underlying technical system that can read this configuration (organization chart) and use it for runtime operation? Basically, I’m after the below scenario; to be allowed to “read” the Visio Chart programmatically.

Data flow

This actually turned out a lot easier than I feared. In Visio 2010, you can export data using the “Org Chart” menu + the “Export” button.

Export -> (excel, .txt, .csv)

This leaves you with 3 options:
1) Microsoft Excel workbook
2) Tab Delimited (.txt)
3) Comma Separated (.csv)

Choosing the last option (.csv), you gain a .csv file that looks like this. Note that the hierarchical information is present as well (via the ‘Reports_To’ column), so that e.g. ‘John Polik’ reports to ‘Eric Idle’.

CSV export file

Now – reading this text is as easy as using String.Split(‘,’) and you are good to go.

string[] splittedString = csvFileLine.Split(',');


Technorati Tags:

11 April, 2011

How to: Conditional formatting using XAML in WPF

It is often needed to change some UI-property based on a condition of your objects displayed in the UI. An example would be the color of some text (red/green) based on some boolean condition. This is actually quite nifty made in XAML using the Style attributes of XAML-elements.

By letting the Style-binding control the appearance of the TextBlock, you can actually make this change color of the TextBlock based on some condition (a boolean value in this case). Theoretically, you can make any comparison here as long as it makes sense to express this in a textual (string) way.

image    vs.    image

This is the XAML-formatting that controls the foreground color of a TextBlock.

Style x:Key="txtRunning" TargetType="TextBlock">
DataTrigger Binding="{Binding Path=IsRunning}" Value="True">
Setter Property="Foreground" Value="Red"/>
Setter Property="Text" Value="Running..."/>

DataTrigger Binding="{Binding Path=IsRunning}" Value="False">
Setter Property="Foreground" Value="Green"/>
Setter Property="Text" Value="Done..."/>

The TextBlock is referencing this Style using this syntax. As you can see above, the text property of the TextBlock; is also changed via the Style (“Running…” vs. “Done…”), hence there is no need to set this property in the below TextBlock XAML-control.

<TextBlock Style="{StaticResource txtRunning}"/>

The ViewModel to which the above XAML binds is this one.

private bool m_isRunning;
public bool IsRunning
get { return m_isRunning; }
m_isRunning = value;
NotifyPropertyChanged(m => m.IsRunning);

How easy can it be….?

Technorati Tags:

09 April, 2011

How to: Make a Hierarchical treeview binding in WPF

It has really proven a difficult task to find a simple (and understandable) example on how to perform XAML-databinding to a Hierarchical treeview as seen below. So - as a simple example and as a point of reference, here is how.
public interface IFolder{
    string FullPath { get; }
    string FolderLabel { get; }
    List<IFolder> Folders { get; } 

This is what we have to work with; a folder list as you would expect to see in the left-hand pane in Windows Explorer. The data is presented to the View using the ViewModel seen below. This ViewModel exposes a list of IFolders (List<IFolder>) as a property; a property to which the View can bind.

class ViewModel : INotifyPropertyChanged {
    public ViewModel()
        TEST = "jubba";

        m_folders = new List<IFolder>();

        //add Root items
        Folders.Add(new Folder { FolderLabel = "Dummy1", FullPath = @"C:\dummy1" });
        Folders.Add(new Folder { FolderLabel = "Dummy2", FullPath = @"C:\dummy2" });
        Folders.Add(new Folder { FolderLabel = "Dummy3", FullPath = @"C:\dummy3" });
        Folders.Add(new Folder { FolderLabel = "Dummy4", FullPath = @"C:\dummy4" });

        //add sub items
        Folders[0].Folders.Add(new Folder { FolderLabel = "Dummy11", FullPath = @"C:\dummy11" });
        Folders[0].Folders.Add(new Folder { FolderLabel = "Dummy12", FullPath = @"C:\dummy12" });
        Folders[0].Folders.Add(new Folder { FolderLabel = "Dummy13", FullPath = @"C:\dummy13" });
        Folders[0].Folders.Add(new Folder { FolderLabel = "Dummy14", FullPath = @"C:\dummy14" });


    public string TEST { get; set; }

    private List<IFolder> m_folders;
    public List<IFolder> Folders
        get { return m_folders; }
            m_folders = value;

    void NotifiyPropertyChanged(string property)
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(property));

    public event PropertyChangedEventHandler PropertyChanged;


The interesting part in this context is the View which details the XAML-syntax. It is seen below. Note that the binding between the ViewModel and the View is declared in the XAML directly:


So, configuration of the bindings is seen below.

Simple Binding (flat structure):As seen, a simple root-level binding is achieved by using a standard <TreeView.ItemTemplate><DataTemplate>… syntax.
        <!-- simple root level binding-->
        <TextBlock Text="Simple root binding}" Foreground="Red" Margin="10,10,0,0" />
        <TreeView ItemsSource="{Binding Folders}" Margin="10">
                    <TreeViewItem Header="{Binding FolderLabel}"/>

Non-simple Binding (hierarchical structure):The Hierarchical view is achieved using the <TreeView.ItemTemplate><HierarchicalDataTemplate>… syntax. Do note that you need to inform the HierarchicalDataTemplate of the datatype to display. This is done using the DataType attribute on the HierarchicalDataTemplate XAML-element. Do note also that the ItemsSource need to be an IEnumerable<T> implementation (List<T> in this case).
        <!-- hieracical binding -->
        <TextBlock Text="Hierarchical root binding}" Foreground="Red" Margin="10,20,0,0"/>
        <TreeView ItemsSource="{Binding Folders}" Margin="10" Height="200">
                <HierarchicalDataTemplate ItemsSource="{Binding Folders}" DataType="{x:Type local:IFolder}">
                    <TreeViewItem Header="{Binding FolderLabel}"/>

Sourcecode is here: https://onedrive.live.com/redir?resid=95576c544a336590!258599&authkey=!AGyR8mLn6nL23qY&ithint=file%2czip

Technorati Tags:

01 April, 2011

Flipcard - a new and refreshing way to viewing your blog

Google at times come up with something unique. Or are they inspired by a “tile-concept” from some guys in Redmond (US)? Regardless – I really appreciate the new flipcard way of presenting your blog:


Use this link to see the blog in flipcard-mode: http://blog.clauskonrad.net/view/flipcard#!/

InRiver: Not loading your extensions?

(You really need to in the loop to appreciate the issue this post addresses). Man, I've been fighting this problem for hours before I ...