Click here to Skip to main content
15,851,387 members

Articles by FDW (Tip/Tricks: 8)

Tip/Tricks: 8

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 3.64

Desktop Programming
Windows Forms
25 Mar 2011   Updated: 25 Mar 2011   Rating: 4.92/5    Votes: 10   Popularity: 4.92
Licence: CPOL    Views: 11,040     Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
Maybe this is helpful, it tries to switch to the first running instance:namespace UltraSimple.Win{ static class Program { [System.Runtime.InteropServices.DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd); [STAThread] ...
General Programming
Regular Expressions
6 Dec 2011   Updated: 6 Dec 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 4,980     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
This is less expensive:For any of the next strings, it gives 8:"Mr O'Brien-Smith arrived at 8.30 and spent \t $1,000.99"" Mr O'Brien-Smith arrived at 8.30 and spent \t $1,000.99""Mr O'Brien-Smith arrived at 8.30 and spent \t $1,000.99 "" Mr O'Brien-Smith arrived at 8.30 and...
Threads
2 Dec 2011   Updated: 25 Dec 2011   Rating: 1.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 31,801     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
Lock multiple (up to 2) objects, non blocking
Programming Languages
C#
17 May 2011   Updated: 17 May 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 4,480     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
What about a more complete approach?Define a few caches:private static GenericAlias.Dictionary aoCompositeValues = new GenericAlias.Dictionary();private static GenericAlias.Dictionary aoArrayOfValues = new GenericAlias.Dictionary<Type,...
3 Jun 2011   Updated: 5 Jun 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 4,310     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Here is a couple for String and StringBuilder. The String versions are handy (compared to the already existing instance versions (that are actually being used)) because they work against null values (e.g., ((string)null).IsNullOrEmpty()).public static class ExtensionMethodsString{ ...
9 Jun 2011   Updated: 9 Jun 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 6,240     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
This is what I would do:using System;using NUnit.Framework;using System.Reflection;namespace Profix.Utils.Xpo.UnitTests{ [TestFixture] public class Functions { private void Tax() { Console.WriteLine("Computed Tax."); } private void Sale() {...
SQL
3 Nov 2011   Updated: 6 Nov 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 12,941     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
How to define a one to one relation
Visual Basic
24 Jun 2011   Updated: 24 Jun 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 6,121     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
I do think the approach is over complicated, but in some cases there may be (a small) benefit. As an alternative I would offer:First version (no common test):((Action)(() =>{ if (!Step1()) return; if (!Step2()) return;}))();Second version (common...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
FDW
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.