KBD

Keith Devens .com

Friday, July 4, 2008 Flag waving
And certainly both Horses were doing, if not all they could, all they thought they could, which is not quite... – C.S. Lewis (The Horse and His Boy, ch 10)

Archive: February 13, 2008

← February 07, 2008February 14, 2008 →

Daily link icon Wednesday, February 13, 2008

  1. The FAIL Blog.

       (0) Tags: [Fail, Funny]

Join a NameValueCollection into a querystring in C#

C# is ugly as heck:

private static string JoinNvcToQs(System.Collections.Specialized.NameValueCollection qs){
    return string.Join("&", Array.ConvertAll<string, string>(qs.AllKeys, delegate(string key){
        return string.Format("{0}={1}", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(qs[key]));
    }));
}

In Ruby, this would be (essentially):

e = URI.escape
qs.collect{ |k,v| e(k)+"="+e(v) }.join("&")
← February 07, 2008February 14, 2008 →
July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

Girls, please don't get breast implants

> And no, you will not be receiving​a picture.

:-(...

Keith: Jul 2, 6:05am

Javascript clone function

This is a clever way to clone an​object if you are using YAHOO UI.​Same tec...

Antonio: Jul 1, 12:47pm

I hate Norton Antivirus

Oh just one other thing norton is​great at keeping people out of your​compu...

kevin.sands: Jul 1, 12:50am

Terminator 3 was awful

I think the biggest reason why T3​totally blew was because Edward​Furlong g...

76.167.172.64: Jun 29, 3:06am

Generated in about 0.046s.

(Used 7 db queries)

mobile phone