Tuesday, 27 July 2010

Use SubInACL Grant Access to Windows Services

If you ever need to grant access to a service account or user account over a windows service, SubInACL is the tool you need.

Wednesday, 14 July 2010

WCF Extensions

Using WCF extensions you can change the default behaviour of WCF.

Programatically provide custom Json exceptions: http://blog.manglar.com/how-to-provide-custom-json-exceptions-from-as-wcf-service/

Wednesday, 7 July 2010

WPF: Updating UI Elements Using Dispatcher and BackgroundWorker

If you run a BackgroundWorker object and try updating a UI element in the DoWork method, you'd get this error message:
{"The calling thread cannot access this object because a different thread owns it."}
The reason is that DoWork() method runs in a new thread and the UI elements are owned by the main thread.
A workaround is to use the Dispatcher object as shown in the following example in WPF. When Start button is clicked, a background worker runs and updates the label message:
public partial class Window1 : Window
BackgroundWorker aWorker = new BackgroundWorker();

public Window1()
aWorker.WorkerSupportsCancellation = true;
aWorker.DoWork += aWorker_DoWork;
aWorker.RunWorkerCompleted += aWorker_RunWorkerCompleted;

private delegate void UpdateDelegate(int i);

/// <summary>
/// Handles the DoWork event of the aWorker control.
/// This runs in a new thread
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
private void aWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
for (int i = 0; i <= 500; i++)

if (aWorker.CancellationPending)
e.Cancel = true;
UpdateDelegate update = new UpdateDelegate(UpdateLabel);
Label1.Dispatcher.BeginInvoke(DispatcherPriority.Normal, update, i);

private void aWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
if (!(e.Cancelled))
Label2.Content = "Run Completed!";
Label2.Content = "Run Cancelled!";

private void UpdateLabel(int i)
Label1.Content = "Cycles: " + i.ToString();

private void btnStart_Click(object sender, RoutedEventArgs e)

private void btnCancel_Click(object sender, RoutedEventArgs e)

Sunday, 4 July 2010


Wi-Fi Enabled Device:
A device which can connect to the Internet via wireless networks around it (Access Points, Hotspots) such as personal computer, video game console, mobile phone, MP3 player or personal digital assistant.

Wi-Fi Hostspots:
A wireless network which is to be used for anyone having a Wi-Fi enabled device and who 1) is within the range of the network 2) is allowed to use the Hotspot.

Free Wi-Fi Hotspots:
Some companies provide Wi-Fi free within their range.

Ad-hoc Mode in Wi-Fi communications (Client to Client):
Devices can communicate with each other directly without a router for example a Wi-Fi enabled laptop can communicate directly with another Wi-Fi enabled laptop.

In this mode, no router or access point is needed, miracle!

This mode is mainly used with multiplayer handheld game consoles, digital cameras.