Crazy piece of code: Checking query parameter

Dec 17
2007 22:47 (ASP.NET, Development) · Русский (3,969 views)

How often you are laughing out loud when looking on the someone’s code? Today I found great code in my current project and I can’t hold posting this to my blog. So,

if (Request.QueryString.HasKeys())
{
    string[] keys = Request.QueryString.AllKeys;
    foreach (string k in keys)
    {
        if (k == "memberpagemode" && (string)Request.QueryString.GetValues(k).GetValue(0) == "edit")
        {
            pSett.ChangeFormViewMode(FormViewMode.Edit);
        }
    }
}

And how do you search through the hash for a key with specified value?

What the fuck? Are Developers of Facebook client libraries for ASP.NET stupid?

Sep 18
2007 17:49 (ASP.NET, Development, Facebook) · Русский (6,438 views)

Last week I faced strange bug in Facebook Developer Toolkit. When I tried to call setFBML method (I mentioned it in my previous post) I’ve got an exception about invalid signature. “Haha” I said and downloaded toolkit sources. After some debugging, I’ve found a few lines which just killed me:

// Compute the MD5 hash of the signature builder
hash = md5.ComputeHash(Encoding.Default.GetBytes(
                           signatureBuilder.ToString().Trim()));

Read the rest of entry »

Crazy PHP world

Sep 14
2007 00:56 (PHP) · Русский (6,170 views)

We are living in XXI century, but PHPists can’t decide yet how to write: "text $b" or 'text ' . $b. I’m going slightly mad.

via Artjom Kurapov’s blog.

 
Copyright © 2005 - 2008, Dmytro Shteflyuk