Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Development   (RSS)

WCF Service Throttling

Throttling, generally speaking, is tricky. Get the limits low and you may be prone to DoS and clients timing out trying to connect to your service in vain; Get them high and you may end up with an overloaded service that’s eating up machine resources
Posted by mohamedg | 0 Comments
Filed under: ,

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 following code won’t behave as you may have expected: class   Foo   { public :     Foo()   {        
Posted by mohamedg | 1 Comments
Filed under: ,

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 function: template < typename T, int N> struct array { T value[N]; T & operator []( int i) { return value[i]; } }; template < typename T, int
Posted by mohamedg | 5 Comments
Filed under: ,

Proxy Design Pattern

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
Posted by mohamedg | 0 Comments
Filed under: ,

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 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
Posted by mohamedg | 0 Comments
Filed under: ,

scanf() vs cin

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
Posted by mohamedg | 1 Comments
Filed under:

Windbg

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
Posted by mohamedg | 1 Comments
Filed under: ,

!exploitable

!exploitable is a crash analyzer plug-in for windows debugger (windbg) that does post-mortem analysis of a crash and assists its security risk, very cool! The project is licensed under Microsoft Public License (Ms-PL) and you can download it at codeplex
Posted by mohamedg | 0 Comments
Filed under: ,

How to: Tell if files are identical using TFS APIs?

In a previous post, I answered this question using Diff APIs, which will require the items to be downloaded first. Here's a faster way to do it (thanks to MichalMa ): Use GetItem or GetItems method to get the Item objects for the files. If ContentLength

How to: Listen to TFS event notifications?

If you need to listen to TFS event notifications, you can subscribe to checkin event and make the server deliver the event info to a SOAP address , a web/ WCF service , or even a TCP listener that waits for that data and doesn't have to have access to
Posted by mohamedg | 0 Comments
Filed under: , ,

How to: Diff files using TFS APIs?

You can use the Difference.DiffFiles method which compares two files using the internal diff engine, and return the linked list of DiffSegment s: DiffSegment ds = Difference.DiffFiles(fileA, FileType.Detect(fileA, null), fileB, FileType.Detect(fileB,

Impersonation

Impersonation lets you execute code using another user identity. In the WindowsIdentity class, there's a method called Impersonate, it allows you to impersonate the user specified by the WindowsIdentity instance. Just remember to call Undo to get back
Posted by mohamedg | 0 Comments
Filed under:

?? Operator

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 = null
Posted by mohamedg | 0 Comments
Filed under:

Nullable Value Types

Can you assign null to int?? Read carefully before you answer, this is a trick question! You can do that by using nullable value types: int? x = null ; To check if the nullable value has a value, you can use the .HasValue property. If the value is null,
Posted by mohamedg | 0 Comments
Filed under:

Declare and set properties all at once

I used to use this technique in ActionScript, and I really like to use it C#: TextBox textBox = new TextBox () { Text = "Hello!" , Enabled = false }; TextBox textBox = new TextBox { Text = "Hello!" , Enabled = false }; // Thanks, kfarmer Point point =
Posted by mohamedg | 2 Comments
Filed under:
More Posts Next page »
 
Page view tracker