I'm not particularly fond of Linux these days; there's just too much fracturing in the Linux space, too few standards, and generally just too many oddities to make it a pleasant and productive place to be, for me anyway. One thing I have always admired about the true Linux propeller heads though is their ability to get things done. Mastery of regular expressions along with tools like egrep, sed, awk and of course Perl means the true whizzes can accomplish incredibly daunting tasks in next to no time. Wouldn't it be great if we could do the same with Microsoft tools as well?
I got O'Reilly's book 101 Spidering Hacks for Christmas. It looked like a pretty interesting topic to cover and I've always had something of a fascination with intelligent computing - getting the computer to do the mundane time sucking things that we all do every day, either out of habit of necessity. Almost all the examples in the book though are centered around Perl, so I had to go and learn that. I got hold of ActiveState's awesome Perl implementation for Windows, and the EPIC plug in for Eclipse (because I do love my IDE's) and started coding. It's been a bit of a struggle getting my head around the simplicity of Perl but I'm at last beginning to to see some benefits from the study. I have a script that runs every day as soon as I turn my computer on which hits the BBC Radio Times website and searches for TV shows that I like. I don't get a lot of time to watch TV these days, and I don't have a TiVo, so this is the next best thing for me. It downloads the show details, produces an RSS log, and I can fire off selected entries to Heather to set up the DVD recorder to grab them when they come up on TV. I also wrote a couple of scripts to copy a bunch of directories off my computer onto a removable storage device and then restore them. This has been a godsend for me because it lets me switch from one computer to another in seconds, and have all my work, email, IE links and so on on the second machine just as if I were using the first, and without requiring me to setup a domain controller with roaming profiles.
Each of these tasks though has taken me quite some time. I'm a .NET developer, not a Perl one, and I tend to suffer long breaks between my Perl coding stints during which I forget many of the idiosyncracies of the language and have to re-learn them. Working on some Perl scripts last night to analyse log files from an online game I play, I started thinking "Wouldn't it be great if I could do all this stuff in C#".
It is totally possible to do anything a Perl script does in C# but the advantage Perl has is that the resulting program is smaller, a lot smaller, than the C# program. So, I'm thinking, why not take Microsoft's My namespace idea from Visual Basic 2.0 and extend it. It would be so cool to be able to write a program in C# like this
static void Main( string[] args ) { foreach ( CPerl.File file in CPerl.CurrentDirectory( Modified.ThisWeek )
{ if ( file.Content.Matches("/<a href=.*/")
WirteLine("Got a match : {0}", file.Content.MatchList.ToString() ); } }
You could also extend the library to do a bunch of stuff with the web a lot quicker than the current .NET framework lets you (code wise). For example a method to just grab a page to a string, set up request headers instantly to conform to a specific browser and so on. Basically the idea would be to take all the really neat, really terse but powerful stuff that Perl can do and implement it in a very simple easy to use library just for getting simple stuff done. That way if you needed to search a bunch of log files for something you could just fire up an editor, or Visual Studio, bang out a few lines of code, csc it, and you're done. All the simplicity of Perl, but with a really cool powerful language and IDE.
I have no time for this right now but it's playing on my mind so much that I think I may just have to start on this when I do have some.
1:54:20 PM
|
|