tipsandtricks.runicsoft.com
C# Tips & Tricks: Efficiently Looping Over An Array
http://tipsandtricks.runicsoft.com/CSharp/ArrayLooping.html
Programming Tips and Tricks. C# Tips and Tricks:. Efficiently Looping Over An Array. This tip can improve the speed of programs that spend a lot of time looping over arrays. For example, take a look at this code:. Count = 0;. Omitted: fill myarray with some values. Count = myarray[i];. Here, we simply loop over all elements of the array and add them together. But what the compiler actually produces looks something like the result of this code:. I = myarray.Length). Count = myarray[i];. Count = myarray[i];.
tipsandtricks.runicsoft.com
Other Tips & Tricks: Word Stemming in Java with WordNet and JWNL
http://tipsandtricks.runicsoft.com/Other/JavaStemmer.html
Programming Tips and Tricks. Other Tips and Tricks:. Word Stemming in Java with WordNet and JWNL. This is a short article on how to create a Stemmer in Java with WordNet and JWNL. First a quick explanation of what stemming is:. Stemming means reducing a word to its base (or stem). For example, the words 'writing', 'wrote' and 'written' all have the stem 'write'. A stemmer takes a word, or a list of words, and produces the stem, or a list of the stems, of the input. Now, to a human, it's obvious that this...
tipsandtricks.runicsoft.com
C# Tips & Tricks: Non-blocking Per-Pixel Painting in Windows Presentation Foundation
http://tipsandtricks.runicsoft.com/CSharp/WpfPixelDrawing.html
Programming Tips and Tricks. C# Tips and Tricks:. Non-blocking Per-Pixel Painting in Windows Presentation Foundation. In a previous tip. I've shown how to implement and use a SetPixel method for a Windows Forms control. This time i'll show how to do the same in WPF. While WPF has some great advantages over WinForms, like the speed it gains by utilizing the hardware through DirectX, and its high flexibility, it has also become a bit more complex and complicated then WinForms. Width, height, rawStride;.
tipsandtricks.runicsoft.com
C# Tips & Tricks: Make Type Conversions With the 'as' Operator
http://tipsandtricks.runicsoft.com/CSharp/CastWithAs.html
Programming Tips and Tricks. C# Tips and Tricks:. Make Type Conversions With the 'as' Operator. Instead of a normal cast, you can convert types in C# with the 'as' operator. In almost all cases, you should prefer casting with the 'as' operator, instead of using a normal cast:. The 'as' operator never executes a user-defined conversion, and is thus more consistent. 3 'as' is guaranteed to never create temporary objects. This problem propagates to generic methods, which could receive both value and referen...
tipsandtricks.runicsoft.com
C# Tips & Tricks: Weak References - When and How to Use Them
http://tipsandtricks.runicsoft.com/CSharp/WeakReferences.html
Programming Tips and Tricks. C# Tips and Tricks:. Weak References - When and How to Use Them. Sometimes you have an object which is very large and needed multiple times, but not constantly, throughout your application. For example a huge lookup table, or the contents of a large file you need in memory for some algorithm. To work with this object, you traditionally have two options:. As a local variable inside the method that needs it. Usually, when an object goes out of scope, or is set to null, it is no...
tipsandtricks.runicsoft.com
General Programming Tips & Tricks: Code Performance Tips
http://tipsandtricks.runicsoft.com/General/Performance.html
Programming Tips and Tricks. General Programming Tips and Tricks:. These tips are the most important, and are applicable to all languages. 1 Prefer high-level over low-level optimizations. 2 Optimize for the common case. Even a small improvement in a method that is called a thousand times a second will be much more worth than a larger (and more developer-time consuming) inmprovement in a method that is only called once a second. 3 Know your data. 5 Know your language. 7 Use the right tool for the job.
tipsandtricks.runicsoft.com
C# Tips & Tricks: String Reversal
http://tipsandtricks.runicsoft.com/CSharp/StringReverse.html
Programming Tips and Tricks. C# Tips and Tricks:. Unfortunately, C#'s string class is missing a Reverse() function, so here are three ways to reverse strings:. The most obvious way is to reverse a string by manually walking through it character for character and building a new string:. Input = hello world. I = input.Length - 1; i = 0; i- ). Output = input[i];. The second way we can reverse a string is with the static Array.Reverse() method:. Input = hello world. Inputarray = input.ToCharArray();. Please ...
tipsandtricks.runicsoft.com
Other Tips & Tricks
http://tipsandtricks.runicsoft.com/Other/index.html
Programming Tips and Tricks. Other Tips and Tricks. This section contains Tips and Tricks for other languages, for some software, etc. Visual Studio HTML Export:. Copy&Paste code from VS as HTML. Word Stemming in Java:. Writing a Word Stemmer with WordNet and JWNL. Andreas Hartl, 2010-2011.
tipsandtricks.runicsoft.com
C# Tips & Tricks
http://tipsandtricks.runicsoft.com/CSharp/index.html
Programming Tips and Tricks. C# Tips and Tricks. This section contains Tips and Tricks for the C# language and the .Net Framework. Looping through an array without bounds checking. Using the and and operators to completely evaluate boolean expressions. Different ways to implement string.Reverse(). Drawing Pixels from a Background Thread in Windows Forms. Drawing Pixels from a Background Thread in Windows Presentation Foundation. Type Conversions with the 'as' Operator Instead of Standard Casts.
tipsandtricks.runicsoft.com
C++ Tips & Tricks: Avoiding Subtle Memory Leaks With Smart Pointers
http://tipsandtricks.runicsoft.com/Cpp/SmartPointerMemLeak.html
Programming Tips and Tricks. C Tips and Tricks:. Avoiding Subtle Memory Leaks With Smart Pointers. Sometimes even when you use smart pointers to avoid resource leaks, they can still occur if you are not careful. Assume we have the following function in our code:. Func (auto ptr MyClass m, int. MyClass is some class, and our intent is to not use raw pointers, but to use a smart pointer like std: auto ptr to prevent memory leaks. Func(auto ptr MyClass ( new. MyClass), 1, 2);. Assume it looks like this now:.