Click here to Skip to main content
15,886,806 members

Articles by Andreas Gieriet (Articles: 8, Tip/Tricks: 23)

Articles: 8, Tip/Tricks: 23

RSS Feed

Average article rating: 4.73

DevOps
Unit Testing
30 Jan 2012   Updated: 11 Mar 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 20,840     Bookmarked: 4   Downloaded: 137
Please Sign up or sign in to vote.
How to define RelationAssert as an extension to the VisualStudio Assert class.
General Programming
28 Oct 2010   Updated: 29 Oct 2010   Rating: 3.64/5    Votes: 14   Popularity: 4.18
Licence: CPOL    Views: 44,565     Bookmarked: 10   Downloaded: 0
Please Sign up or sign in to vote.
Some useful RAII C# helper classes for functionality that does not implement IDisposable
Algorithms
12 May 2012   Updated: 14 May 2012   Rating: 4.97/5    Votes: 18   Popularity: 6.12
Licence: CPOL    Views: 57,196     Bookmarked: 25   Downloaded: 0
Please Sign up or sign in to vote.
Make floating point equality and relation operators reliable based on a comparison epsilon value.
20 Jun 2012   Updated: 20 Jun 2012   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 18,792     Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Converting Postfix Expressions to Infix"
26 Sep 2010   Updated: 26 Sep 2010   Rating: 4.45/5    Votes: 7   Popularity: 3.76
Licence: CPOL    Views: 35,423     Bookmarked: 13   Downloaded: 174
Please Sign up or sign in to vote.
.NET 4 finally allows to define polymorphic extension visitors
Programming Languages
C#
22 Apr 2012   Updated: 21 Aug 2012   Rating: 4.90/5    Votes: 58   Popularity: 8.64
Licence: CPOL    Views: 767,324     Bookmarked: 89   Downloaded: 0
Please Sign up or sign in to vote.
Different possibilities to escape literals and names/keywords.
27 Mar 2012   Updated: 14 Oct 2014   Rating: 4.95/5    Votes: 28   Popularity: 7.17
Licence: MIT    Views: 77,928     Bookmarked: 56   Downloaded: 243
Please Sign up or sign in to vote.
This is an alternative for "Dynamically generate a LINQ query with a custom property".
26 Apr 2012   Updated: 26 Apr 2012   Rating: 4.94/5    Votes: 8   Popularity: 4.46
Licence: CPOL    Views: 29,023     Bookmarked: 15   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Mathematical Expression Parser Using Recursive Descent Parsing"

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.86

General Programming
Regular Expressions
13 Feb 2012   Updated: 14 Feb 2012   Rating: 4.50/5    Votes: 4   Popularity: 2.71
Licence: CPOL    Views: 21,361     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
A "single-liner" to decode quoted-printable data.
String
24 Feb 2012   Updated: 24 Feb 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 10,170     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
This alternative is not substantially different, it simply splits the function into two:one for clippingone for comparingpublic static string ExtClipRight(this string a, int n){ return (n < 0 || a.Length <= n) ? a : a.Substring(0, n);}...public static bool...
18 Apr 2012   Updated: 18 Apr 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 9,311     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "String.Insert - insert a separator on given positions"
Programming Languages
C#
1 Jun 2012   Updated: 1 Jun 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 17,942     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "How to split an array into multiple arrays"
12 Jan 2013   Updated: 12 Jan 2013   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 19,410     Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
Short tip to show a convenient use of the lesser known xor operator
3 Apr 2012   Updated: 9 Apr 2012   Rating: 4.96/5    Votes: 17   Popularity: 6.11
Licence: CPOL    Views: 80,045     Bookmarked: 32   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "How to use the IEnumerable/IEnumerator interfaces"
21 May 2012   Updated: 22 May 2012   Rating: 4.00/5    Votes: 3   Popularity: 1.91
Licence: CPOL    Views: 34,310     Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
How Linq extension methods benefit from interfaces inheriting from interfaces
27 Jan 2013   Updated: 28 Jan 2013   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 24,164     Bookmarked: 8   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Sorting using C# Lists"
23 Apr 2012   Updated: 23 Apr 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 14,172     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Converting InFix to PostFix using C#"
18 Jun 2015   Updated: 18 Jun 2015   Rating: 4.75/5    Votes: 3   Popularity: 2.27
Licence: CPOL    Views: 5,550     Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
A generic fluent implementation for a prioritized IComparer class
26 Feb 2012   Updated: 28 Feb 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 18,711     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Great analysis!I found out that Regex can be accelerated by a factor of about two.Instead of new Regex(@"\n", RegexOptions.Compiled|RegexOptions.Multiline);you can speed up by using:new Regex(@"^.*?$", RegexOptions.Compiled|RegexOptions.Multiline);But admittedly, nothing beats...
21 Dec 2010   Updated: 21 Dec 2010   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 7,720     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
For those who like dense code, here is a sample :) - Make the dictionary static readonly, init directly- Swap the arguments in the lambda expressions and call by direct pop from the stack- Make the regex simpler and put the logic of parsing into the Exec (the regex only tokenizes the...
13 Mar 2012   Updated: 15 Mar 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 11,990     Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Partial DateTime Object Equality"
27 Dec 2010   Updated: 5 Jan 2011   Rating: 4.40/5    Votes: 4   Popularity: 2.65
Licence: CPOL    Views: 18,716     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
This topic is also covered by the RAII topic as described in RAII (Resource Acquisition Is Initialization) C# Helper Classes[^].Applying the RAII pattern results in more expressive code:using (new RAIIGuard(()=>owner.Cursor, c=>owner.Cursor = c)){ owner.Cursor =...
24 Feb 2012   Updated: 24 Feb 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 12,311     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
I prefer the [Conditional("DEBUG")] attribute over #if DEBUG.This is especially advised for your logging example.E.g.[System.Diagnostics.Conditional("DEBUG")]private void Validate() { /* check instance integrity */ }or[System.Diagnostics.Conditional("DEBUG")]public static...
14 Jun 2012   Updated: 14 Jun 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 8,411     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "How to Toggle String Case in .NET"
18 Apr 2012   Updated: 14 Apr 2013   Rating: 4.97/5    Votes: 13   Popularity: 5.54
Licence: CPOL    Views: 63,208     Bookmarked: 18   Downloaded: 0
Please Sign up or sign in to vote.
Make loops behave deterministic-by-construction
20 Feb 2012   Updated: 20 Feb 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 9,210     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
How about transforming first into a Regex and then letting the Regex do the work? E.g.:public static Regex GetRegex(string wildcard){ string pattern = Regex.Replace(wildcard, @"([^?*]+)?([?*])?", m => Regex.Escape(m.Groups[1].Value) +...
11 Nov 2012   Updated: 11 Nov 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 12,720     Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
XML Serialize versus hand crafted CoDec (as alternative to "Advance String Split and Joiner")
30 Apr 2012   Updated: 4 Dec 2013   Rating: 4.83/5    Votes: 4   Popularity: 2.91
Licence: CPOL    Views: 90,964     Bookmarked: 8   Downloaded: 0
Please Sign up or sign in to vote.
Wrapping Interlocked.Exchange to mimic a thread safe one-shot bool flag
C# 4.0
5 Jun 2012   Updated: 5 Jun 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 15,672     Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Sorting Strings based on the position of the block letter"
24 Feb 2012   Updated: 25 Feb 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 6,360     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
To not having spoiled the client code with #if DEBUG, you might use the following:[STAThread]static void Main(){ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Debugging.DebugSetupConsole(); ...
C++98
7 Feb 2012   Updated: 12 Feb 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 25,830     Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
HTML page with all syntax/grammar productions of C++98/C++11
Visual Basic
19 Jun 2012   Updated: 19 Jun 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 9,781     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Call Functions Until One Meets Condition"
Web Development
HTML
15 Feb 2012   Updated: 15 Feb 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 11,513     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
I think the following Regex and HtmlDecode would do:string html = ...;string textonly = HttpUtility.HtmlDecode( Regex.Replace(html, @"|", ""));Any HTML construct that would not be stripped off properly by this?

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Founder eXternSoft GmbH
Switzerland Switzerland
I feel comfortable on a variety of systems (UNIX, Windows, cross-compiled embedded systems, etc.) in a variety of languages, environments, and tools.
I have a particular affinity to computer language analysis, testing, as well as quality management.

More information about what I do for a living can be found at my LinkedIn Profile and on my company's web page (German only).