Uninstall Hell


In the past 2 weeks, I’ve had to install quite a number of software tools and products ( namely MS CRM 4.0, TFS 2008, VS 2008 ) on servers and workstations for my project. On 2 ocassions due to minor glitches I had to uninstall a CRM tool (via an MSI File) as well as VS 2008 due to something weird happening with Team Explorer and VS 2008 SP1. I encountered the most annoying “Cannot uninstall application due to some error, setup will now end” type of errors. A possible cause may be some screw-up in the registry and the uninstaller is unable to proceed….so what do you do now??? Here are some tips.

Read the rest of this entry »

Tip: Smart way to ‘check all’ with JQuery


I came across a very nice post to have a “check all” functionality using JQuery. Great stuff and I’m sure will come in useful for many developers.

Check it out here.

Enjoy.

Posted in JQuery. Tags: . 1 Comment »

Tip/Tricks: Glimmer Tool for JQuery


If you’re new to JQuery and want to learn or already know enough, but lazy to write JQuery code by hand, have a look at Microsoft’s Glimmer Lab. Glimmer is a free tool you can download and there are wizards you can use to spit out Html, Css and JQuery code in a .js file for you. Some cool things you can at the moment are DropDown Menus and Tooltips.

Just follow the wizard and you get your cool effects in a flash! This is Version 1.0 and I’m looking forward to see more cool things to be made available for developers. Simply awesome.

Posted in JQuery. Tags: . 2 Comments »

Tip: Use specific port number when hosting WCF service in Cassini Web Server


When you are hosting a WCF service in Visual Studio, a Cassini Web Server will spin up and assign a random port number, e.g. http://localhost:61447/MyService. If you add a Service Reference, it will use that port number currently assigned by Cassini. This is all good until you stop the Cassini Web Server, or restart VS IDE. Where did my old port number go???

Read the rest of this entry »

Handling Cross-Threading in ObservableCollection


One of the best things I reckon in WPF is the introduction of ObservableCollection<T>. With this class, databinding becomes a breeze and developers no longer need to write custom code to get the same effect with INotifyPropertyChanged.

I was playing with some multi-threading code today to update my ObservableCollection and ran into an Exception with this message “This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.” Woah, what have I done? 🙂

Read the rest of this entry »

Posted in WPF. Tags: . 3 Comments »

Tips/Tricks: Importing Visual Studio 2008 item and project templates


My colleague was having problems today importing a project template into Visual Studio 2008. He was setting up a Virtual Machine, which has some guidance package install, but the project templates were not showing up.

If you are encountering similar issues, this article on MSDN should help heaps.

How to: Locate and Organize Project and Item Templates.

Note: Remember to zip up your .vstemplate file, plus other necessary files, e.g. .csproj, .cs, etc  files. VS 2008 will recognize it only if it’s in a .zip file.

WPF Tip: Collection Changed Event


Hi, quick tip for WPF. I’m set to leave for my 2 week vacation today, so this will be a quick one.

I was building a physics simulation in WPF (still to be completed), and as usual I binded my ObservableCollection to a Custom Canvas control, which I specified in my ItemsControl‘s ItemPanelTemplate. If you have noticed, all the WPF “container” controls like ListBox, ItemsControl, etc all have an ItemsSource propery where you can specify your data source. So what happens when I add/remove something from that data source, how do I get notified???

I did some digging around, but realised there’s no such event that gets triggered. The trick is to look at the the Items property, which is of type System.Windows.Controls.ItemCollection. It inherits from a CollectionView, which implements the INotifyCollectionChanged interface, which has the CollectionChanged event. Bingo, here we go…

This is sample code that demonstrates how to use this.

public Window1()
{
    InitializeComponent();
    particles.Add(CreateParticle());
    ((INotifyCollectionChanged)itemsControl.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(Window1_CollectionChanged);
    itemsControl.ItemsSource = particles;
}

void Window1_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
    if (e.Action == NotifyCollectionChangedAction.Add)
    {
        // do something
    }
}

So you will now be notified of changes in your control’s Items due to changes in your data source. You might also want to learn more about the NotifyCollectionChangedEventArgs, it has some useful properties in there. Also you should have a look at NotifyCollectionChangeAction enum values to learn more about what kind of notification actions are available.

Share this post :
Posted in WPF. Tags: . 3 Comments »