Ernst Kuschke

     Arbitrary thoughts and musings on life, the universe and everything else

Syndication

News

    ernst kuschke (v1.0)

    My Photos

    Microsoft Most Valuable Professional

    Member in good standing

    View Ernst Kuschke's profile on LinkedIn

    Add to Technorati Favorites

Blogs I read

Books I recommend

General Links

February 2004 - Posts

Anyone planning on being hungry after the Security seminar? Should be nice to meet some of you guys - let's have dinner / drinks afterwards. Hit the Feedback button to make suggestions!

Posted by Ernst Kuschke | 2 comment(s)
Filed under:

Armand donated a book to the SADeveloper site, which they put up for grabs in a competition.

So I received this cool book from SADeveloper yesterday, which I immediately dove into. It's lovely. Now, if only I could get my hands on a copy of “Whidbey”, I'd be one happy man.

I'm really looking forward to the Microsoft seminar on Security down here, as I'm also receiving a bottle of wine from SADeveloper that day.

Man, I love that site!

From ITWeb : “SA ranks 35th out of 62 countries in the technology component of the latest Globalisation Index compiled by research firm AT Kearney and Foreign Policy magazine.”

Check out the article for yourself. We are way behind Botswana(30th), and while I know that their economy is in pretty good shape, I fail to understand how they could be seen as more “globalised” than us. Oh well, what do I know about globalisation?!!! (Except whatever's in global.asa, etc.)

Posted by Ernst Kuschke | with no comments
Filed under:
I recently wrote an introductory article on programming for the .NET Garbage Collector, titled GC101.
Posted by Ernst Kuschke | with no comments
Filed under:
You gotta see this.
Posted by Ernst Kuschke | 1 comment(s)
Filed under:

Saw this today, which I find pretty alarming. In the words of someone on the OT-list:

Perhaps I should stop worrying about when to implement IDisposable and
how to release event subscriptions and just start stockpiling water?

Posted by Ernst Kuschke | 4 comment(s)
Filed under:

According to the Gematriculator, my site is 31% evil, and 69% good. Being a concerned citizen, I took the liberty of rating something close to our (“our“ referring to us geeks) very fibre of being:

linux.com:                 60% evil vs. 40% good

microsoft.com:        50% evil vs. 50% good

Conclusive prove that Microsoft is “more good” than Linux, but that still doesn't mean it's not bad!!!

Posted by Ernst Kuschke | 2 comment(s)
Filed under:

There's certainly been mixed feelings regarding the much bespoken “leak” of Windows source code. Is Windows going to be hacked to pieces by viruses? Will hackers now be able to exploit buffer overruns? All these questions will soon be answered, but it sounds to me as if the danger is not as big as many anticipate.

According to folks that have seen it, it's pretty damn fine code. All obvious buffer overruns are being checked, and since the code is dated around 2000, most obvious flaws would be patched by now. A look at the source also reveals that, contrary to accusations by *NIX fanatics, no open source code has been stolen by Microsoft.

Microsoft fears that companies like Apple or IBM might use the leaked source for their own purposes, but that is also pretty unlikely. It seems that consensus has been reached that the origin of the code is a Linux server at Mainsoft.

Some interesting bits about the code:

Certain bugs from previous OS versions had to be retained in newer versions to keep certain applications working.

There are apparently numerous 'hacks' to get around some issues. Then there are hacks calling hacks, and this produces potential danger.

Mostly the new code is excellently loose coupled, but earlier coding mistakes in both OS and software still haunts them. Backwards compatibility...

There are many, many swearwords in comments!

The leaked source comprises of 30,915 files.

The codebase of the whole Windows OS amounts to hundreds of millions of lines of code - a BIG problem in itself, since the OS, GUI and most other functionality is *apparently* all one big chunk.

The leaked source OBVIOUSLY does not compile into anything usable :)

Now, all of these seem to me like real common software issues for most software developers. (Except maybe the high number of LOC!)

Whatever the case might be, I would advise anyone who wishes to keep their Windows-based PC alive, to apply the latest security patches from Microsoft, who responded quick enough.

Posted by Ernst Kuschke | 4 comment(s)
Filed under:

Well worth a read is the new blog of Michael Platt. I particularly enjoyed the post on Architects and Developers - read the comments section to see which you are. I now classify myself as a “lateral-thinking architect / developer“, although my job involves much more time spent developing than architecting.

Posted by Ernst Kuschke | with no comments
Filed under:

Up till now, serial device communications had to be done (in .NET) via COM interop. Check how it will be done in the next .NET! Look for the “Serial Support Demo“ heading, and download the C# code.

Finally.

Posted by Ernst Kuschke | 1 comment(s)
Filed under:

This is one of the mission-impossible's for anyone in the software industry, particularly in the field of custom solutions.

One small subset of our solution has yet to be completed satisfactorily. We've been quibling and scratching our heads for the last year now, writing prototypes and user-testing them. User requirements (should I rather call them user wishes) have changed significantly from each prototype to the next, and we end up with, amongst others, increasing blood pressures.

Let me thus explain utmost and important fact (lesson) number 1 in the software-world: USERS DO NOT KNOW WHAT THEY WANT. GUIDE THEM.

I have finally managed to gather all the role-players around the same table, and we discussed, designed and re-evaluated the business processes involved during the whole of last week. I just realised how important it is not to only get *every role player* involved when doing innitial system specifications, but also to:

1) meet around the *same* table, everyone involved,

2) until all specifications are documented and agreed upon.

Specifications” would include functionality, formulas, use-cases, and all the rest of the whole shebang. Finally we are at a stage where we can reasonably say when they can expect what they want, and give them just that.

[UPDATE: Of course, this should be standard procedure in any company. Common knowledge. But yet it is often the place where the big flaws / impairments originate!]

Posted by Ernst Kuschke | with no comments

An interesting conversation took place between some excellent developers a while ago. The topic: “What cool questions do you ask candidates in a job interview?”

A few cool questions were suggested, but one that stirred up a violent discussion/argument was asking the candidate to reverse a string.

An obvious solution is to use the StrReverse() function in VB. Curiously, someone pointed out that this function does not work for combining diacritic codepoints. The following:

System.Console.WriteLine("{0} reversed is {1}", "`e", StrReverse("`e"))

produces: `e reversed is `e

Someone else posed the following solution:

unsafe static string Reverse(string s)
{
    fixed(char* p = s, char* q = s + s.Length - 1)
    {
        while (p != q)
        {
            *p ^= *q;
            *q ^= *p;
            *p ^= *q;
            p++;
            q--;
        }
    }
    return s;
}

Besides the fact that it goes into an eternal loop for strings with an even length (which could easily be fixed), it modifies the allegedly *immutable* string on the heap!!

I liked a simple VB solution:

Private Function Reverse(ByVal str As String) As String
    Dim rev As New StringBuilder(str.Length)
    For x As Integer = str.Length - 1 To 0 Step -1
        rev.Append(str.Substring(x, 1))
        Next
    Return rev.ToString
End Function

Slightly imroved:

void Reverse(string source) {
    if(source == null) return null;
    if(source == "") return "";
    StringBuilder sb = new StringBuilder(source.Length);
    for(int i = source.Length-1; i > -1; --i)
        sb.Append(source[i]);
    return sb.ToString();
}

This eliminates the need to cycle through null or zero-length strings...

I can't resist posting this final VB suggestion:

Public Function Reverse(ByVal s As String) As String
    s = String.Copy(s)
    Dim h As GCHandle = GCHandle.Alloc(s, GCHandleType.Pinned)
    Try
        Dim p As IntPtr = New IntPtr(h.AddrOfPinnedObject().ToInt64())
        Dim len As Integer = s.Length
        Dim e As Integer = len - 1
        len -= 1
        len *= 2
        For i As Integer = 0 To e Step 2
            Dim c As Int16 = Marshal.ReadInt16(p, i)
            Marshal.WriteInt16(p, i, Marshal.ReadInt16(p, len - i))
            Marshal.WriteInt16(p, len - i, c)
        Next
        Return s
        Finally
            h.Free()
    End Try

End Function

Woah!!! ;p

My point is that the simplest question in this world has no correct answer - it all depends on context! Since the original question doesn't state any context, the candidate might have suggested a custom-built chip that does purely string-reversing. Guaranteed this will outperform any unsafe bit-twiddling :)

Posted by Ernst Kuschke | 2 comment(s)
Filed under:

MMM

There's a pretty cool article by Eric Sink (SourceGear-fundi) over here.
Posted by Ernst Kuschke | 1 comment(s)
Filed under: