General Programming
|
Regular Expressions |
13 Feb 2012
Updated: 14 Feb 2012
Rating: 4.50/5
Votes: 4
Popularity: 2.71
Licence: CPOL
Views: 20,561
Bookmarked: 1
Downloaded: 0
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: 9,720
Bookmarked: 0
Downloaded: 0
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,141
Bookmarked: 3
Downloaded: 0
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,702
Bookmarked: 2
Downloaded: 0
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: 18,370
Bookmarked: 4
Downloaded: 0
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: 78,344
Bookmarked: 32
Downloaded: 0
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: 33,330
Bookmarked: 7
Downloaded: 0
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: 23,044
Bookmarked: 8
Downloaded: 0
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: 13,802
Bookmarked: 2
Downloaded: 0
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,400
Bookmarked: 5
Downloaded: 0
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: 17,561
Bookmarked: 0
Downloaded: 0
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,440
Bookmarked: 1
Downloaded: 0
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,530
Bookmarked: 4
Downloaded: 0
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: 17,186
Bookmarked: 1
Downloaded: 0
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,030
Bookmarked: 0
Downloaded: 0
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,261
Bookmarked: 2
Downloaded: 0
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: 60,785
Bookmarked: 18
Downloaded: 0
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,060
Bookmarked: 2
Downloaded: 0
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,120
Bookmarked: 4
Downloaded: 0
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: 87,094
Bookmarked: 8
Downloaded: 0
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,222
Bookmarked: 7
Downloaded: 0
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,100
Bookmarked: 1
Downloaded: 0
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,340
Bookmarked: 7
Downloaded: 0
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,500
Bookmarked: 3
Downloaded: 0
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,113
Bookmarked: 2
Downloaded: 0
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?
|