KBD

Keith Devens .com

Sunday, October 12, 2008 Flag waving
"What is truth?" – Pontius Pilate

Archive: March 24, 2006

← March 23, 2006March 28, 2006 →

Daily link icon Friday, March 24, 2006

  1. Tim Bray writes about the WS tower of Babel. "I can’t help but feel for the [programmers] who are going to have to do the work". That's what I keep thinking in regards to all of this WS stuff.

       (0) Tags: [Programming]

.NET standard library has holes

The .NET standard library is good, but it feels like it has lots of "holes" in it, even in 2.0. For instance, why is the Converter delegate used separately on Array's and List's ConvertAll rather than being defined on a Collection or an Enumerable so that I could use ConvertAll on things like Dictionary.KeyCollection? The answer, of course, is that Collection and Enumerable are actually ICollection and IEnumerable and are not classes.

So, Microsoft didn't choose to duplicate ConvertAll everywhere it'd be useful, just in a couple of places. What this means as well is that even though you can use a foreach loop on something, you can't necessarily do a ConvertAll on it (or use the other higher-order methods). In contrast, look at Ruby, where as long as you have an each method (IIRC), you get everything associated with it for free.

Also see Adam's description of GetValue and SetValue on properties and accessors, another case where Microsoft has the same method names for similar functionality on multiple classes but no common interface or base class between them, so they can't be used interchangeably. (Insert comment about the utility of duck-typing here...)

As an aside, I also feel like it's just darn hard to find things reliably in Microsoft's documentation.

  1. Here's some quick Perl I used to unescape some form-encoded data:

    while(<>){
        s/\+/ /g;
        s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge;
        print;
    }
       (0) Tags: [Code, Perl]
← March 23, 2006March 28, 2006 →
October 2008
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
262728293031 



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

Recent comments XML

I hate PHP

Elliot Anderson,

Dude!! You the​man! The reverse replacement for​array_u...

Alex Ndungu: Oct 11, 1:35am

Call a function from a string in Python

?!code:
some_object.__getattribute​__('method_name')()
?!/code

is​the s...

Patrick Corcoran: Oct 8, 3:53pm

Spider solitaire

I have won 185 games of Spider​Solitaire at the "Difficult" level.​ What is...

75.179.28.113: Oct 8, 12:42pm

Sed one-liners

Hi.

I wanted to let you know​that I wrote an article "Famous Sed​One-Lin...

Peteris Krumins: Oct 8, 3:05am

Timesheet Calculator

Hadn't seen it before now, but my​company already uses a time​tracking prog...

Keith: Oct 7, 10:44am

Girls, please don't get breast implants

Hey everyone, 

I am new to this​blog and I have enjoyed reading all​your...

Sarah.M.: Oct 6, 9:45am

Generated in about 0.058s.

(Used 7 db queries)

mobile phone