.. is a kind of EDD (Exception Driven Development).
But first a small joke on which my contrived term is based upon :
In a distant future where all cars are almost perfect, the latest and greatest test is the cat test (habitability test) :
They place a cat in the car and watch what happens to the cat. First, the Peugeot team : They place the cat in the car and after two days the cat dies. The commission takes a note : The car is pretty air tight!
Next, the BMW team. After only one day the cat dies. The commission observes : the car is even air tighter!
After a little while the Dacia team mingles with the other teams :
"We've done the cat test too!!"
"No, kidding, you have fixed all your !@#$ing problems and managed to do the cat test too..."
"Yes we did" - the Dacia team manager replied
"And what did happen" - the others asked
"Well, we placed the cat inside..."
".. and wherever the cat managed to get its head out, we placed a patch".
...............
Therefore I intend to patent the CDD term as Cat Driven Design :
We have a buildable application. We run the application and manually test it. Wherever we click and it crashes we patch it. This is the meaning of CDD :)
126e567e-c535-4b39-b2ca-00a74a149eb1|0|.0
I presented the other day a simple way to implement a CAPTCHA user control in ASP.NET Webforms, in order to also illustrate a generic image handler (ashx) and help others better understand the HTTP protocol and the process of loading a web page.
I am posting here the slides and the code.
WebCaptcha-slides-english.zip (1.01 mb)
WebCaptcha-slides-romanian.ro.zip (1.01 mb)
WebformsCaptcha - code.zip (291.92 kb)
a6205c87-4ead-4e53-a531-379c7eee2930|0|.0
C++ has its place in the history of programming languages. Just as Caligula has his place in the history of the Roman Empire. (Robert Firth)
C++ is an atrocity, the bletcherous scab of the computing world, responsible for more buffer overflows, more security breaches, more blue screens of death, more mysterious failures than any other computer language in the history of the planet Earth. (Eric Lee Green)
Arguing that Java is better than C++ is like arguing that grasshoppers taste better than tree bark. (Thant Tessman)
Being really good at C++ is like being really good at using rocks to sharpen sticks. (Thant Tessman)
If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one? (Tom Cargill)
There are only two things wrong with C++: The initial concept and the implementation. (Bertrand Meyer)
C is often described, with a mixture of fondness and disdain varying according to the speaker, as “a language that combines all the elegance and power of assembly language with all the readability and maintainability of assembly language.” (MIT Jargon Dictionary)
C++ is the only current language making COBOL look good. (Bertrand Meyer)
Going from programming in Pascal to programming in C, is like learning to write in Morse code. (J P Candusso)
I view the landslide of C use in education as something of a calamity. (Nicklaus Wirth)
24a32d2b-6871-4bea-b796-db6ba1eebfe0|1|3.0
Just like a little game of guessing went, I want to present you another C# riddle
:
using System;
namespace AnotherRiddle
{
internal class Program
{
static void Main(string[] args)
{
var w1 = new Wee { bar = new Foo() };
if (w1.bar is Bar)
Console.WriteLine("A");
if (w1.bar.GetType() == typeof(Bar))
Console.WriteLine("B");
}
}
internal class Bar { }
internal class Foo : Bar { }
internal class Wee
{
public Bar bar;
}
}
1. What do you think the code snippet will print at the console?
2. What are all the differences between the two if constructs?
4919d78e-5523-42db-938a-22e77fe33a6c|1|5.0
I just found out a HUGE performance difference between these two. Tested on my cheap laptop (HP Compaq 615 : AMD Turion Dual core 2,2GHz, 3GB RAM, 7200 RPM HDD; 500$) on .NET 4.0 Beta2 after several test runs (averaged results), 1 million iterations, release mode and Stopwatch for time measurement (as opposed to DateTime.Now) :
var a = Request.UserHostAddress; // -> 240 microseconds
var a = Request.ServerVariables["REMOTE_ADDR"]; // -> 0,4 microseconds
What the f...rick?! 500x times faster?
What does Request.UserHostAddress to use so much more time? Let's fire up good ol' Reflector :
public string get_UserHostAddress()
{
if (this._wr != null)
{
return this._wr.GetRemoteAddress();
}
return null;
}
_wr is a HttpWorkerRequest (a public abstract class). The GetRemoteAddress is also abstract so I can't guess from Reflector. So I fired up Visual Studio 2010 again and saw that _wr was a Microsoft.VisualStudio.WebHost.Request instance. So much for my astonishment.. If it's hosted in the IDE it can be slow..
I still ponder if it's worth testing in a production environment whether it's faster or not (Request.UserHostAddress) significantly or not..
EDIT1 : Couldn't wait to test this at work under IIS 6.0 (Windows Server 2003, Intel Core2Duo 2,4 GHz, 4GB RAM) and Request.UserHostAddress takes 86 nanoseconds to be queried... Can't wait to get home and test again on IIS 7.5 (Windows 7 Ultimate RC)
EDIT2: At home on IIS7.5, same laptop, release mode etc. etc. 29 microseconds for Request.UserHostAddress. It's better than Cassini's 240 microseconds but it should have been at most 100 nanoseconds...that's one thousand times slower..
841b47d4-3c2f-4aea-9907-2257d6b835cd|0|.0
From the Tao programming :
There once was a man who went to a computer trade show. Each day as
he entered, the man told the guard at the door:
"I am a great thief, renowned for my feats of shoplifting. Be
forewarned, for this trade show shall not escape unplundered."
This speech disturbed the guard greatly, because there were millions
of dollars of computer equipment inside, so he watched the man
carefully. But the man merely wandered from booth to booth, humming
quietly to himself.
When the man left, the guard took him aside and searched his clothes,
but nothing was to be found.
On the next day of the trade show, the man returned and chided the
guard saying: "I escaped with a vast booty yesterday, but today will
be even better." So the guard watched him ever more closely, but to
no avail.
On the final day of the trade show, the guard could restrain his
curiosity no longer. "Sir Thief," he said, "I am so perplexed, I
cannot live in peace. Please enlighten me. What is it that you are
stealing?"
The man smiled. "I am stealing ideas," he said.
bfdb10f5-a6bd-41ea-849b-6f28d0396733|1|4.0
Just like "Fighting in the internet is like competing in the special olympics : even if you win you're still retarded" there is another "saying" about these issues :
ec7ed0a0-6649-4b59-9354-869a2cffe71a|2|4.5
This might seem like a useless midnight rant (at least it is midnight here :P ) but I hope it's not.
Why do most sites allow you (having JavaScript clearly activated) to submit the login form when at least one of the two textboxes are empty? Why allow the request to the server? You know downright that this request WILL fail. Is JavaScript so complicated?
Why?
77010e26-67ca-4a79-8f5a-ca20884b6abe|3|4.3
I've heard of RockScroll from Scott Hanselman a while ago in his blog entry. The Visual Studio plug-in basically replaces the vertical scroll bar with a real time thumbnail of the code. Plus it highlights words if you double-click them. It's niiiiceee!! I've soon downloaded it and used since then (more than a year).
However lacking the ease of using the window split, having parasyte double click highlightings and desynchronizing when you collapse a region of code annoyed me for a while...
Until today!!
Scott did it again and twitted about a good replacement for RockScroll : MetalScroll.
It does all RockScroll does plus :
double-clicking the scrollbar brings up an options dialog where the color scheme and scrollbar width can be altered.
the widget at the top of the scrollbar which splits the editor into two panes is still usable when the add-in is active.
you must hold down ALT when double-clicking a word to highlight all its occurrences in the file. RockScroll highlights words on regular double-click, which can be annoying when you actually meant to use drag&drop text editing, for example when dragging a variable to the watches window.
pressing ESC clears the highlight markers.
lines containing highlighted words are marked with 5x5 pixel blocks on the right edge of the scrollbar, to make them easier to find (similar to breakpoints and bookmarks).
multiline comments are recognized.
hidden text regions are supported.
it works in split windows.
it's open source, so people who want to change stuff or add features can do so themselves.
Here's how it looks in my VS :
Later edit : This also comes as a patriotic thing for me as the author is a fellow romanian like me, Mihnea Balta :)
655e7219-6c7b-4c7b-8f79-e4fd0abae04b|1|5.0
I've just set up a home banking account with a bank (ING) and I've asked the clerk if the account has browser limitations (as in "works only in IE" or stuff like that). As some of you might know about me, Opera is my favorite browser. So I've fired up Opera and tried to log in the account. Here's what I've got :
Yes, you've read right : their web application has failed because of the user agent string. Pathetic.
Consider this a counter example for the applications that you develop. It's 2009, almost 2010. A web application must be able to run on any (graphical, i.e.: not Lynx) browser. Just as a side note Opera 10.00 (which I've been using in this case) passes Acid 3 test with 100%.
f42546c5-81ef-4284-b332-ea8df26126d8|1|5.0