Developing Delicious applications
I am developing a little piece of software that interacts with Delicious through HTTP API. Using Delicious API puts you
Read moreI am developing a little piece of software that interacts with Delicious through HTTP API. Using Delicious API puts you
Read moreI am using WebBrowser control to show preview of automatically generated HTML. Users can select options and preview pane reflects those changes automatically. WebBrowser control has some problems that have been here for years already. Here is my example about how to show custom HTML in WebBrowser control.
Read moreAgile Principles, Patterns, and Practices in C# by Robert C. Martin and Micah Martin describes how to write software using C#. Book covers also most important design patterns and object-oriented development principles. There are very good, close to reality examples for every topic and that makes this book pretty easy to read and understand.
Read more.Net Framework 4.0 introduces memory mapped files. Memory mapped files are useful when you need to do in-memory data manipulation and your data structures are large. For large in-memory data the performance of memory mapped file is the best. It is much faster thanMemoryStream. And like files on hard disc, memory mapped files can be shared between different programs. MemoryMappedFile and other classes for memory mapped files can be found from System.IO.MemoryMappedFiles namespace.
Read moreI have class library that contains some XML-files as embedded resources. Reading these files at runtime is very easy. It takes only couple of lines of code.
Read moreMy previous posting was about performance of Fibonacci numbers algorithms. In this posting I will introduce you some problems related to limits of our usual integers and introduce you new feature in .Net Framework 4.0 – big integers. Big integers are useful when solving different mathematical problems. Also they are used in cryptography.
Read morePerformance of algorithms is important topic if you want to write programs that work fast and doesn’t eat too much resources. In this example I will show you two implementations of famous Fibonacci numbers algorithm and let you compare how these two implementations perform. This posting will be also introduction to my next posting to keep it smaller and to keep focus on point.
Read more.Net Framework 4.0 has parallel computing extensions for LINQ. Previously it was possible to download parallel extensions for LINQ separately from CodePlex. Of course, you can still use these extensions if you have older version that 4.0. I wrote a little, simple and pretty pointless example that illustrates how parallel queries work in .Net Framework 4.0.
Read more.Net Framework 4.0 introduced a new class called Lazy
ASP.NET provides us with System.Drawing namespace where we can find classes we can use to manipulate with images. There are many people out there who mistakenly think thatImage.GetThumbnailImage is best choice for image resizing. You can easily create crappy images if you follow the code examples in previously pointed article. In this post I will show you how to resize images without negative side effects.
Read moreLoggers are one of most popular examples about interfaces for sure. And there are a lot of implementations of loggers. Some implementations are simple and yet powerful, some implementations may be more complex. All we have to is to select implementation we need and integrate it to our application. It seems like good idea at first place but as soon as we need to switch from one implementation to another we discover nasty dependencies we have to change in all places where we are logging. Let’s see how to avoid these dependencies.
Read moreI’m sure you have seen classes that initialize a lot of objects in their constructor. These classes may be hard to test because of those object creations I mentioned. To get around this problem we use Extract and override factory method refactoring so we can extend these classes and override some factory methods.
Read moreSometimes you are not able to use Extract Interface refactoring because interface of parameter may be too large or there may be no interface at all. You just have class to pass in and you are not able to fake it or extend it to get class testable. In this case you have to use Adapt Parameter refactoring to create adapter that is seen through common some common class of interface.
Read moreIn good code variables are used as short as possible. Often we can see code where variables are defined in wider scope than it is necessary. There are many examples about too wide scopes. One of fuzziest of them is variable that is defined in class scope but it used only by one method and this method uses this variable as local variable. But variable life time can also be reduced in local scope. To achieve this we use refactoring method called reduce variable scope.
Read moreCasting to types using keyword as is one powerful features of C#. It allows exceptionless casting of reference types. If cast is not possible then null is returned. Although this is powerful language feature it opens also door to some questionable uses.
Read moreIn legacy code you may find classes with constructor where some objects are created and initialized. These classes are not easily testable because they depend on other classes and therefore when you unit test these classes they may also throw exceptions of classes they depend on. In these cases we can use parameterize constructor refactoring.
Read moreHere is my little example about how to catch run console program and catch the output. I used similar code to read the output of OpenSLL.
Read moreExtract interface is one of the most common refactoring techniques. Motivation behindextract interface refactoring method is to avoid direct dependencies between classes. Instead of using classes in method calls we use interfaces so we can also use subclasses of those classes we used before. Also we can create brand new classes that use follow these interfaces and we can use these classes instead of current ones.
Read moreCustom C# application and Exchange Server 2003 integration over WebDAV was one of the tasks I lately worked on. I made posting about how to log on to Outlook Web Access when FBA is used but I didn’t mentioned that I had to read data from Exchange public folders. There are some stuff that may drive you nuts but there are also some tricks to use to get everything work as expected.
Read moreOne of the simplest refactoring methods is called Rename method. There are many reasons why one may want to change the name of some method. I think that main reason to rename a method is to give it a name that describes better what method is supposed to do.
Read moreOne way to write messy code is to use constant values in code without any explanations about their values or purpose. Sometimes it feels like too small problem to think about, specially when there are only couple of constants, but I am sure that hard coded constants may waste developers valuable time more than one may think at first place. To make this kind of code easier to read and understand we can use refactoring method called introduce constant.
Read more