3 things you should know to speed up HttpWebRequest

HttpWebRequest LogoThose who work with the. NET framework and occasionally used the HttpWebRequest class, may have stumbled about the phenomenon that it seems to be quite slow in some cases. Especially if you use HttpWebRequest in combination with threading to get responses as quick as possible, the HttpWebRequest class quickly becomes a party pooper.
Initially you might assume that the problems rely on the Internet connection, but at least after a speed comparison with wget or curl, you should recognize that the “problem” must be at the. NET implementation.
No products found.In the following article I will focus on three points that can help you, to speed up the HttpWebRequests class.

1. Increase DefaultConnectionLimit
All instances of the HttpWebRequest class are using some properties of the ServicePointManager. One of these porperties of the ServicePointManager is the “DefaultConnectionLimit”. By default, this limit […]

How to solve representation/encoding errors in C# Winforms applications

I know the title of this post hurts, but I wasn’t able to describe the problem with fewer words. But let us get to the point. As part of the development of my cloud downloader I encountered (among much others) the following problem. Korean characters were displayed as blank boxes, even though they were shown in the source code editor correctly. Those of you, who wonder now,  from where you can get the Korean characters on your keyboard, should just stop by Google Translate. (The screenshot below illustrates the problem once again. Please click to enlarge the image.)
Koreanische Zeichen falsche Darstellung
On the Internet I found only very few solutions. And almost all were, in my opinion, rather suboptimal. In most cases the following solution was proposed:
It is recommended that you call the SetCompatibleTextRenderingDefault() method with the parameter true. In […]

How to make simple syntax hightlighter in PHP

PHP SyntaxhighlighterIn the following article I will show you how you can write your own syntax highlighter with a few lines of PHP. By use of the following PHP snippet you can easily display PHP code on your homepage.
The whole thing is much more easily than you think. Most of the work is done by an internal PHP function named highlight_file. This function reads a file and formats the source code in color. We then merely have to count the lines of the file and output the line numbers, as well as preformat the font.
Since the snippet is not that long, I think the comments in the snippet itself are sufficient. If you still have any questions, just write a comment.

<?php
function highlight_sourcecode($file)
{
//Count the lines of the input file
$amount_of_lines = count(file($file));

//Create a list with all line numbers
$list_linenumbers = range(1, $amount_of_lines);

//Format […]

How to add DLL to Visual Studio projects

Some days ago I received an email, in which I was asked, how to embed/include .dll-files to into Visual Studio projects. So here comes the answer to the question: How to add dlls to an ongoing Visual Studio project?
The solution to the problem is closer than some of you might think. First you right-click on the “references”-label in the Solution Explorer and click in the context menu on “Add reference” . (Fig. 1)
Now click on the “Browse” button, select the desired (. NET compatible) DLL and confirm your selection by clicking on the “Ok” button. (Fig. 2)
In the last step you can add the appropriate using directives in your source code for an easier access to the methods of the obtaining DLL. (Fig. 3)
Visual Studio - Verweise  Dlls auswählen