How to get text value from HtmlTextWriter in C#

HtmlTextWriter is very nice tool to generate HTML in C#, but it lack ability to get generated HTML as a string. Here is a simple solution: HTmlTextWriter uses internally StringWriter which uses StringBuilder. So you first create StringBuilder and StringWriter, pass them to HtmlTextWriter and when you are done you simply call ToString() on the …

The value of beautiful code

During my rather short period of Pair Programming I have learned something valuable, but there is also something I’ve learned after that. Michal Tehnik left the company and I continued to work on code we wrote and then refactored and polished together several times. It is probably the best piece of code we have now …

On pair programming

Several times I programmed in pair and I want to share my experience with it.  What are the main benefits of pair programming? The code is of better quality, because there is always the other person watching over your shoulder and seeing what you have overlooked. Wikipedia says that defect rates are about 15% to …

Convert local time to UTC time in Javascript

This might come in handy. Simple function which converts local time to UTC (Universal Coordinated Time). It accepts single argument of type Date. //converts local time to UTC (Universal Time) function toUTC(/*Date*/date) { return Date.UTC( date.getFullYear() , date.getMonth() , date.getDate() , date.getHours() , date.getMinutes() , date.getSeconds() , date.getMilliseconds() ); } //toUTC()

Problem with printing background images

I have recently wasted almost two hours trying to figure out why some HTML based report wont display logo in its header. I am quite sure this will make someone else’s life easier, so I am sharing it. The problem is that most browsers ignore background-image and background-color. So whatever I did I could only …

I’ve started using Memolane

Recently I have stumbled across an interesting startup called Memolane. It is an unorthodox aggregator of various social media sites, YouTube, RSS feeds et cetera. I find it very useful. We all publish and share bits of our life to various sites, with different groups of friends, and Memolane collects them all back together, so everything is …