• MohamedG's Log

    Selection of Majority in O(n)

    • 4 Comments
    Selection algorithms are very useful in many instances, like finding the majority. Given an array of size n that contains a majority item (an item that's repeated more than n/2 times), we can find that item in O(n). Basically, we can consider it as a...
  • MohamedG's Log

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

    • 1 Comments
    If you have an IDE that uses the MSSCCI provider, like VS 2003 or VB6, and you want to switch between TFS and VSS because you have projects on both systems, you will have to change the provider every time you switch. The thing is that setting is stored...
  • MohamedG's Log

    ?? Operator

    • 0 Comments
    The ?? operator is used to return the left operand if it's not null, otherwise, it returns the right operand. It's equivalent to (left != null ? left : right). string a = null ; object b = a ?? new object (); object c = b ?? "b is null!" ; int ? x...
  • MohamedG's Log

    Passing C++ Arrays by Value

    • 5 Comments
    Just in case you needed to, you can wrap an array into a struct/class and pass it by value to a function: template < typename T, int N> struct array { T value[N]; T & operator []( int i) { return value[i]; } }; template < typename T, int...
  • MohamedG's Log

    New keyboard shortcuts in Windows 7 Beta

    • 0 Comments
    For those who like the keyboard more than the mouse, here are some of the new keyboard shortcuts that Windows 7 is introducing: Win + Spacebar Aero desktop peek, just like that small rectangle at the right bottom corner next to the time display. Win ...
  • MohamedG's Log

    Proxy Design Pattern

    • 1 Comments
    One of the useful design patterns is the proxy design pattern, it allows you to control access to an object via a proxy and also saves you the startup and cleanup overheads as you instantiate only what you use upon request (lazy initialization). Take...
  • MohamedG's Log

    How to: View History of an Item Across Branches?

    • 1 Comments
    You can use tfpt history /followbranches to follow the history of an item across branches. We are looking into supporting this in the history dialog in the next version . You can see which versions are ported over during the merge operation if you use...
  • MohamedG's Log

    How to: Label items in a changeset using tf label?

    • 0 Comments
    We can specify the versionspec to tf label either by supplying the /v or /version argument (for example, /v:C1256), or by appending it to the itemspec (for example, foo.cs;C1256). Here's an example that attaches the "goodbuild" label to version 1256 of...
  • MohamedG's Log

    Nested For-each Loops in SQL

    • 0 Comments
    Usually, it's not recommended that you use loops in SQL unless you need to. You should use set-based queries instead. However, if you need to, there are many ways to loop, one of them is using cursors. For example, let's say that you have multiple DBs...
  • MohamedG's Log

    How to: Disable Multiple Check-out on a Folder?

    • 1 Comments
    There’s no direct way to do that. Multiple check-out is a property of a team project, it's not namespace specific. However, I can think of 2 alternatives using use the " Lock " feature, because that’s what TFS does when a team projects is set to exclusive...
  • MohamedG's Log

    Deny: Revisited

    • 3 Comments
    In a previous post , I talked about the deny option and how it’s evaluated. The documentation on MSDN is talking about conflicting permissions on the same level, however, in TFS2008 SP1, permissions are evaluated bottom up and the first match wins. If...
  • MohamedG's Log

    Tiny C++ Unit Test Framework

    • 0 Comments
    I was working on a small project for personal use that I wrote in C++ and I wanted to test it. Since it’s a tiny project, I didn’t bother installing a well-known test framework that ships with a plethora of features. I just wanted a simple test runner...
  • MohamedG's Log

    How to: Create Interfaces with Static Methods via IL?

    • 0 Comments
    If you try to add a static member to an interface, you will get the following error: The modifier 'static' is not valid for this item In this case, you should create an abstract class instead of an interface, because interfaces are contracts and should...
  • MohamedG's Log

    How to: Receive Daily E-mail Notifications?

    • 4 Comments
    You can receive a daily email that has a compiled list of notifications, but you will need to subscribe programmatically: IEventService eventService = ( IEventService ) new TeamFoundationServer ( "http://tfs:8080" ).GetService( typeof ( IEventService...
  • MohamedG's Log

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

    • 1 Comments
    In C++, if you call a virtual function form a constructor, it won’t be polymorphic, meaning that the following code won’t behave as you may have expected: class Foo { public : Foo() { whoAmI() ; } virtual void whoAmI() { cout << "Foo::whoAmI()"...
  • MohamedG's Log

    TFS Event Subscription Tool

    • 4 Comments
    You can subscribe to get email alerts when certain events occur in a Team Project using Project Alerts. There's another way to subscribe to Team Project events and to configure the subscription too, it's bissubscribe.exe, which can be found on the Team...
  • MohamedG's Log

    April's fool: BSOD screen saver

    • 0 Comments
    A nice harmless April's fool is to install BSOD screen saver , it looks so real and it can fake HDD activity! Just make sure your teammates won't restart your machine :)
  • MohamedG's Log

    Exclude file from source control

    • 2 Comments
    When you need to exclude a file in a project from source control, you can select that file in the Solution Explorer window, then go to File > Source Control > Exclude [filename] from Source Control. A red icon should appear to the left of that file...
  • MohamedG's Log

    How to: Show deleted item in Source Control Explorer?

    • 0 Comments
    You can use the /deleted switch with tf dir to list deleted items along with existent items. To undelete an item, you need to know its deletion ID, which will be a number preceded by X, for example: tf undelete $/proj/foo/bar.cs;X1234 To show deleted...
  • MohamedG's Log

    How to: Shrink TFS databases size?

    • 0 Comments
    You may try the following: Shrink SQL transaction log files using DBCC SHRINKFILE (see this KB ) Shrink SQL data files using DBCC SHRINKFILE or DBCC SHRINKDATABASE Destroy unneeded files (specify the /startcleanup flag) If you decide that you will need...
  • MohamedG's Log

    Reflector Visual Studio Extension - Enable Debugging

    • 0 Comments
    I’ve been using the standalone Reflector.exe for so many years now, and recently I’ve been using JustDecompile too. They have different accuracy levels and different set of distinguishing features, but the one I use in VS is Reflector. I was excited about...
  • MohamedG's Log

    Windbg

    • 1 Comments
    Using Windbg, aka Debugging Tools for Windows , is a great way for debugging, crash analysis, and reading dump files. If you’re not a keyboard person who likes to write commands and be in the driver’s seat, you might not like it at the first glance, but...
  • MohamedG's Log

    Alerts Editor

    • 1 Comments
    This July, TFS Power Tools introduce new features, one of which is the Alerts Editor. You can read all about the new features here: http://blogs.msdn.com/bharry/archive/2008/07/08/july-08-tfs-power-tool-preview.aspx
  • MohamedG's Log

    scanf() vs cin

    • 1 Comments
    It has been a while since the last time I wrote some C code, since I come from a C++ background, hence I seldom use scanf(). Without going into many details for the reasons why one should use scanf or cin , I just want to point out one difference on return...
  • MohamedG's Log

    How to: Diff Shelved Files?

    • 1 Comments
    You can run: tf diff /shelveset:shelvesetName;DOMAIN\ownerUserName Please note that this will diff the shelved changes against the unmodified version, not necessarily the latest version, just like what the you get from clicking compare in the shelveset...
Page 2 of 5 (117 items) 12345