My Visual Studio Achievements

Finally, you can take a look at my achievements in Visual Studio as well!

My Visual Studio Achievements

You may do this as well!

Posted in Blogwelt, coding, Visual Studio | 1 Comment

String.GetHashCode() Internals

While I was eating dinner, I had this somehow suprising question in my mind: How is String.GetHashCode() implemented? Is it fast?

It needs a linear time based on the length of the string. This is understandable if you think about what it is doing. It needs to generate a “Fingerprint”-number based on its content, so you need to take a look at all the content at least once. So it is O(N).

I was going to do something more useful while I noticed all the precompiler conditions. That is very interesting! The function returns different results whether it is compiled for 32bit or 64bit. The debug version of the framework (Microsoft internal only?) even changes its resulting hashcodes with every buildnumber.

We want to ensure we can change our hash function daily.
This is perfectly fine as long as you don’t persist the
value from GetHashCode to disk or count on String A
hashing before string B.  Those are bugs in your code.

So you better avoid storing hashcodes and you should not exchange hashcodes across process-boundarys. Your communication partner may use a different number of bits!

Last but not least: the result is not stored but recomputed every time you call the function. The implementation is following the advice to not store its result itself.

Posted in .net, C#, coding | Leave a comment

Youtube wieder schneller im Firefox

While I had decided to write new articles only in English, the following article has a pure German audience so I figured out to make an exception for this article.

Wer wie ich seinen Internetanschluss bei der Telekom hat, dem kann nicht entgangen sein, dass Youtube Videos extrem langsam sind und man manchmal außer der drehenden Ladeanimation nichts zu sehen bekommt. Es war zuletzt wirklich sehr schlimm.

Es gab bis vor kurzem den Telekom Youtube Turbo, der zwar funktionierte, dies aber sehr geheimnisvoll gemacht hat. Es gibt keine Einstellungen und auch keine Beschreibungen. Er ist auch für den Firefox 8 nicht verfügbar.

Frustriert habe ich mich umgeschaut und gelesen, dass der Telekom-Proxy wohl schneller ist. Vermutlich hat auch der Telekom Youtube Turbe den verwendet. Ich wollte aber nicht, dass alle meine Seitenaufrufe durch den Proxy laufen, daher habe ich mir FoxyProxy besorgt, was viele Optionen erlaubt. Die Einrichtung geht in wenigen einfachen Schritten:

1. Das AddOn FoxyProxy in den Firefox installieren und den Firefox neu starten.

2. In den Optionen von FoxyProxy einen neuen Proxy anlegen* und ihn auf den Telekom-Proxy (www-proxy.t-online.de mit Port 80) einstellen.

Proxydetails einstellen

3. Bei den Url-Mustern noch ein Muster für Youtube hinterlegen:

Url-Muster für Youtube hinterlegen

4. Der FoxyProxy-Modus sollte “Verwende Proxies entsprechend ihrer konfigurierten Muster und Prioritäten” sein. Das sollte bei euch dann alles so aussehen:

Verwende Proxies entsprechend ihrer konfigurierten Muster und Prioritäten

Und nun wieder viel Spaß auf Youtube!

 

*Es gibt Bonuspunkte, wenn man den Proxy Magenta färbt Winking smile

Posted in Allgemein | Leave a comment