MohamedG's Log

TW9oYW1lZCBFbC1HZWlzaA==

Warning: DataContractSerializer won’t call your constructor!

Consider the following naïve data contract: [DataContract] public class Data { private int[] array;...

Date: 02/05/2014

Filtering Event Log Entries by Event Code

When you filter event log entries bu event code using WMI, you can run a query like the following:...

Date: 02/04/2014

Running a SQL Statement on all Databases

exec sp_MsForEachDB 'SELECT "?", 1' The ? will be replaced by the current database name. To run a...

Date: 01/17/2013

Adding HTTP Headers to WCF Calls

To add HTTP headers, request messages have to be intercepted before they are sent to the server....

Date: 12/13/2012

Extending XElement to Match Child Elements by LocalName

If you want to ignore the child elements’ namespaces, and match by local name only, you can do...

Date: 10/26/2012

Using Fiddler on Local Windows 8 Machine

If you used Fiddler before, you would know that it doesn’t work out of the box on localhost. The...

Date: 10/23/2012

Reflector Visual Studio Extension - Enable Debugging

I’ve been using the standalone Reflector.exe for so many years now, and recently I’ve been using...

Date: 10/23/2012

Adding Custom SOAP Headers in WCF

First, you need to decide whether to create the custom header using the MessageHeader.CreateHeader...

Date: 10/21/2012

Overriding an Abstract Property vs. Passing a Parameter

An abstract class may require a value to be passed through the constructor like the following...

Date: 10/21/2012

Changing the Foreground Color of an Indeterminate ProgressBar

You would think that the following XAML changes the indeterminate progress bar’s foreground color:...

Date: 10/21/2012

Making HTML Elements Scrollable

I’ve been styling my blog recently to make it more Win8-like (thank you for noticing!). I...

Date: 10/20/2012

Windows Store App Settings Flyout

Prerequisites Please read the following articles first: Guidelines for app settings (Windows Store...

Date: 10/19/2012

Margin in XAML vs. CSS

According to W3C: “The 'margin' property is a shorthand property for setting 'margin-top',...

Date: 10/16/2012

DefaultNetworkCredentials in Windows Store Apps

Disclaimer: I'm still getting acquainted with Windows Store Apps, so I could be totally wrong;...

Date: 10/13/2012

Useful Segoe UI Symbols

I compiled a list of symbols that can be used to copy Windows 8’s style: Note: I can see all...

Date: 10/12/2012

Visual GCRoot via DGML

I was inspired by Lovett's post about Visualizing Runtime Object Graphs to create my first debugger...

Date: 03/02/2010

Tiny C++ Unit Test Framework

I was working on a small project for personal use that I wrote in C++ and I wanted to test it. Since...

Date: 02/28/2010

ExtensionDataObject is not Marked as Serializable

If you use Data Contracts, then probably your classes implement the IExtensibleDataObject interface...

Date: 02/15/2010

How to: Create Interfaces with Static Methods via IL?

If you try to add a static member to an interface, you will get the following error: The modifier...

Date: 02/07/2010

On Testability

Acceptance testing is basically black-box testing done by the QA team to sign off. It’s very...

Date: 02/07/2010

How to: Use Locks and Prevent Deadlocks?

Multi-threading is used in almost all real-life applications. I summed up my thoughts on use of...

Date: 01/29/2010

How to: Debug Deadlocks Using Windbg?

Attach the debugger to the process Load SOS ~* e !clrstack to view the CLR stack of all the threads...

Date: 01/28/2010

Cartoon #8: Subclass

Inheritance (C# Programming Guide)

Date: 11/24/2009

WCF Service Throttling

Throttling, generally speaking, is tricky. Get the limits low and you may be prone to DoS and...

Date: 11/07/2009

VSTS 2010 and .Net 4.0 Beta 2

Beta 2 is here, give it a try and let us know what do you think. div#widget { position: relative;...

Date: 10/24/2009

C++: Calling a Virtual Function From a Constructor is not Polymorphic

In C++, if you call a virtual function form a constructor, it won’t be polymorphic, meaning that the...

Date: 09/05/2009

Selection of Majority in O(n)

Selection algorithms are very useful in many instances, like finding the majority. Given an array of...

Date: 08/16/2009

Passing C++ Arrays by Value

Just in case you needed to, you can wrap an array into a struct/class and pass it by value to a...

Date: 08/08/2009

Proxy Design Pattern

One of the useful design patterns is the proxy design pattern, it allows you to control access to an...

Date: 07/18/2009

Test Patterns

Just like design patterns, the use of test patterns will make your life easier. A lot of the common...

Date: 05/14/2009

How to: Query All Labels on a Folder Recursively?

To do this, you can't call query labels with a wildcard character, you need to do the following: -...

Date: 04/29/2009

How to: Move a Shelveset to Another Branch?

A very handy power tool is tfpt unshelve. It’s capable of migrating a shelveset from a branch to...

Date: 04/29/2009

How to: Receive Daily E-mail Notifications?

You can receive a daily email that has a compiled list of notifications, but you will need to...

Date: 04/21/2009

Cartoon #7: Protected

protected (C# Reference)

Date: 04/20/2009

How to: Diff Shelved Files?

You can run: tf diff /shelveset:shelvesetName;DOMAIN\ownerUserName Please note that this will diff...

Date: 04/18/2009

How to: List Changesets Between Two Labeled Versions?

You can achieve that behavior by running:tf hist rootItemSpec /r...

Date: 04/18/2009

How to: View History of an Item Across Branches?

You can use tfpt history /followbranches to follow the history of an item across branches. We are...

Date: 04/18/2009

How to: Switch Between TFS and VSS in Old IDEs?

If you have an IDE that uses the MSSCCI provider, like VS 2003 or VB6, and you want to switch...

Date: 04/15/2009

How to: Force a Check-in to be Linked to Work Items?

Well, the answer to this one is pretty easy and straight-forward. You can accomplish that using a...

Date: 04/15/2009

How to: Change TFS Temp Folder?

TFS uses a temp folder to get files that you view. The location of that folder is %TMP%\TFSTemp....

Date: 04/13/2009

Handy Tips for tf.exe

Using tf.exe gives you more options and more control, here are some tips that might come handy: For...

Date: 04/12/2009

How to: Copy Workspace Mappings?

A common scenario that you may see is the need to share/sync workspace mappings amongst team...

Date: 04/12/2009

How to: Switch Branches in a Workspace Without Getting All the Files of the New Branch?

One of the new features added in VSTF 2008 SP1 is that you can switch to another branch in your...

Date: 04/11/2009

How to: Move Your Workspace to Another Drive?

A common problem occurs when the drive that contains your workspaces runs out of disk space, or when...

Date: 04/10/2009

How to Get List of Changes in a Shelveset Programmatically?

In a previous post, we used the command-line to list the changes in a shelveset. This time we are...

Date: 04/07/2009

Pitfalls of Baseless Merge

A previous post was dedicated to show the benefits of a baseless merge, this one shows the pitfalls:...

Date: 04/06/2009

Nested For-each Loops in SQL

Usually, it's not recommended that you use loops in SQL unless you need to. You should use set-based...

Date: 04/02/2009

Cartoon #6: Public

public (C# Reference)

Date: 04/02/2009

How to: List Changes in a Shelveset?

When you run tf shelvesets shelvesetName /format:detailed you get the shelveset’s name and some...

Date: 04/01/2009

Cartoon #5: Private

private (C# Reference)

Date: 03/29/2009

Next>