AdSense

I put AdSense on my blog about two years ago. I haven’t really been looking at it very often, but I just took a look, and I’m now up to $2.99 in earnings. It looks like Google doesn’t pay out until you reach $100, if I understand their chart correctly, so I guess I won’t actually see any money from them until about 50 years from now, if my current rate of earning remains constant. In terms of hits, I’m averaging about a dozen per day, most of which are probably bots.

Of course, my intention with this blog is not to make money. I recently started reading John Scalzi’s Your Hate Mail Will Be Graded, a collection of some of his blog posts, so this has gotten me to thinking a bit about the purpose of keeping up a blog. I’ve been blogging for longer than most people (since 2001), and I’ve been doing it with some consistency. My purpose has been, variously: to make note of certain events in my life, for future reference; to post information that may be helpful for anyone who happens to stumble across it; and to, in general, have an online “home” where people can find me and see a bit of what I’ve been up to.

Other sites have popped up to assume some of these roles of course. Facebook is the online “home” for most people, where their friends can find them and keep up with them, and where they can post photos, funny links, and whatnot. StackOverflow, Code Project, and similar sites offer a way for a programmer to give back to the community by posting useful information and sharing code. But I still think it’s a good idea to keep a blog going, especially when you’ve already been doing it for so long.

ASP.NET AJAX Control Toolkit bugs

We make fairly extensive use of the AJAX Control Toolkit at work. When I first started at my current job, I wasn’t quite sure about it. In practice, most of the stuff we used seemed a little buggy and kind of kludgey. As I learned more about it, though, I started liking it. When used correctly, it’s quite useful, and holds up well, in terms of cross-browser compatibility and stuff like that.

However, once in a while, I stumble across an annoying bug. The most recent one cropped up after upgrading to a newer version of the ACT on a client site. I’m always a bit leery about upgrading the ACT, since it does often expose bugs that weren’t present in the prior version, and that don’t surface in casual testing.

In this case, we encountered a bug that occurs when you have a ValidationSummary control and a ModalPopupExtender on the same page.

If you Google the problem, you will find multiple mentions of it on StackOverflow and on the ACT bug tracker on CodePlex. The solution, basically, is to inject a script with just a semicolon in it, right after the ValidationSummary. (See here for a simple explanation.)

There are indications that the bug has been fixed, but then other indications that it re-surfaced again later. I can tell you that I was using the latest ASP.NET 3.5 version of the ACT at the time, and it’s definitely still a problem.

I don’t necessarily mind having to use these kinds of workarounds. These days, it’s fairly easy to Google an error message, and find multiple links to your problem on StackOverflow and in CodePlex bug reports, and in various other places. (I’m old enough to remember the days when we didn’t have Google or StackOverflow, so I don’t take these things for granted!) But, I would really like to encourage anyone reading this to please do one little thing for me: If you’re implementing a non-obvious workaround like this in your code, please document it with an explanation and/or a link back to the bug report or StackOverflow page. There’s nothing quite like having to do maintenance programming on a system created by someone else, finding something like this workaround on the page, undocumented, and trying to figure out what the purpose of it was.

I think that this is a problem that plagues many ASP.NET and PHP systems, especially ones that were developed with fairly loose coding standards, no peer review, and that have been around for a few years. There are often oddball workarounds in the JavaScript, CSS, and server-side code that aren’t documented and that are often fragile if tampered with. Every time I have to do maintenance programming on a system like this, I try to leave it looking at least a little bit better than it was when I started. If I can remove some unnecessary workarounds, change some non-obvious variable names to useful ones, and add some comments to explain what’s going on, I try to do that.

Speaking of the ACT, I see that a new version was released this month. Stephen Walther has been doing a lot of work on the ACT lately. This most recent release includes major revisions to (or perhaps a complete rewrite or) the file upload control. Trying to get file upload functionality working nicely on a page that’s doing a lot of tricky async stuff is pretty difficult. I used the older ACT file upload control on a page recently, and it works OK, but it required a few… workarounds. (All of which I tried to document, of course.) I don’t think that this new one will require fewer workarounds, since the basic limitations inherent in doing a file upload from a browser will still exist, but at least it will allow for some nice feedback through HTML5 upload progress events, as mentioned in the blog post.

Motion Sickness of Time Travel

Found this person’s music via Warren Ellis’ blog. Here’s a link to all her stuff that’s on SoundCloud. And this is also good. And I might as well embed something:

Drupal 7 on Windows

I have a fairly reasonable “WIMP” stack (Windows, IIS, MySQL, PHP) running on my work machine now, and I wanted to document how I got there, for future reference, or for anyone who might stumble across this blog post. My setup has evolved over time, so I’m not 100% sure if these instructions would work exactly right from scratch.

There are some ways to get a Drupal-compatible “WAMP” stack (Windows, Apache, MySQL, PHP) running on Windows pretty quickly, but most of the stuff you really need to do in Drupal works OK in IIS. And I think that the approach I outline below gives you the most flexibility in terms of also using the components for stuff other than Drupal.

In these instructions, I’m creating a Drupal site named “drupal-7-test”, but it doesn’t really matter what you call it.

  1. Get Web Platform Installer from http://www.microsoft.com/web/platform/.
  2. Use Web Platform Installer to install “IIS 7 Recommended Configuration.” You may also need to install URL Rewrite if you don’t already have it.
  3. Install MySQL via the MySQL Installer for Windows. (Do not use Web PI.) Select “developer default” to get the MySQL Server, Workbench, and a few other useful things. For configuration, select “developer machine.”
  4. Install PHP 5.3.x from http://www.microsoft.com/web/platform/phponwindows.aspx with Web PI. (This will pull in a few other necessary components.) (Do not install the PHP for WebMatrix — click the link on the above page.) (Oh, and the page still says “PHP 5.3.5,” though the actual installer has been updated to a more recent version.)
  5. In IIS Manager, go to “default web site” and click “PHP Manager”. Make a note of the location of the config file and the error log. Click “configure error reporting” and select “Development machine”. Click Apply.
  6. Get phpMyAdmin from http://www.phpmyadmin.net and unzip it to c:inetpubwwwrootphpmyadmin. Go to http://localhost/phpmyadmin and run through the setup.
  7. In phpMyAdmin, create a user named “drupal_7_test”. Click the checkbox to also create a database of the same name, and give that user all rights to it.
  8. Get Drupal 7 from http://drupal.org/download and unzip it to c:inetpubwwwrootdrupal-7-test. (The standard Drupal 7 download includes a web.config that enables clean URLs for IIS, given the MS IIS Rewrite module.)
  9. Give IIS_IUSRS modify rights to sites/default/files.
  10. Go to http://localhost/drupal-7-test and run through the setup. Use the MySQL database & user created earlier.
  11. Go to the status report in the Drupal admin and check that everything is working OK.

Random follow-up notes
It’s June 10, and I’m setting up a WIMP environment on my ThinkPad. I’ve also recently set up a WIMP environment on my new work desktop, so I’ve got a few follow-up notes on this post.

  • You may need to enable CGI on your machine, if it’s not already enabled, to get PHP working. See here for details.
  • As an alternative to the full MySQL installer I linked to above, you can also use the stripped-down version that can be found here.

ASP.NET ListView notes

I jump around between projects a lot, and I often don’t get deep enough into any particular thing to really learn it inside and out. I got a chance to work on a fairly complicated ASP.NET page recently, though, and I picked up a few new things.

The approach I took with this page, since it had a number of independent parts, was to try to keep them isolated and only spin things up when needed. So, in one panel, where I had a ListView, I wanted to get it working without using a declarative data source. This turns out to require a little bit of extra work. I found this article helpful in getting the DataPager working correctly. And this post had the best advice on how to control the visibility of the DataPager.

I think I could probably write up a couple of more posts with hints on the AsyncFileUpload control, but I’ll save those for another day.

Reading and Music

I’ve been having a bit of a problem at home lately. They play music on Main St. now, for most of the day. They used to just do this around Christmas, but now they’re doing it all the time. They’ve got one set of songs programmed into the thing. It’s all basically soft rock, with a little jazz mixed in. Stevie Nicks, Seal, Sting, Sade, that kind of stuff. Lots of artists whose names begin with “S”, for some reason.

A few weeks ago, on a Monday night, the timer went wonky on it and it kept playing all night. Even with all the windows closed, and earplugs in my ears, I could still hear the music, and really couldn’t sleep at all that night. I (and at least one of my neighbors) called the police, but they didn’t know how to turn it off, or have contact info for anyone who could. (Supposedly, that’s been fixed if this happens again.)

While the music was bothersome before, this incident has reprogrammed my brain so that the mere hint of “Sweetest Taboo” (for example) starts to make me shiver and feel slightly nauseous.

This isn’t much of a bother on weekdays, since I only have to put up with an hour or two of it, between whenever I get home from work, and 8pm, when the timer (hopefully) turns it off. I’m generally watching the previous night’s Stewart and Colbert after work, so that drowns it out.

On weekends, though, I often like to sit around and read during the day, so this is a problem. I need to find some music I can listen to that drowns out the Main St muzak, but doesn’t distract too much from what I’m reading. I’ve been reading Zero History by William Gibson over the last week or so. I’m almost done with it. Yesterday, I used Fugazi’s Instrument soundtrack to down out the muzak. Today, I’m using turntable.fm, specifically the ambient/chillout and coding soundtrack rooms. I’ve discovered that I can get pretty good sound out of my iPhone by putting it in an old dock that I friend gave me a few years ago, and connecting that to my receiver via a mini-stereo to RCA cable, into the “tape” input. Previously, I’d just been connecting it by inserting the cable into the headphone jack, but the dock makes a big difference, for some reason.

I’ve really been digging Turntable.fm lately, by the way. This is one of those things that the internet is great for, but that usually goes wrong after a while. Right now, you can fire up turntable.fm, go into the right room, and there will be a few people with impeccable taste playing great songs for a crowd of maybe 50 or 100 people. No advertisements. No jokers coming in and playing Rick Astley. No spambots coming in and DJ’ing ads for boner pills. I’m not sure why it works, but I’m glad it does.

Also, about Zero History: good book! I’ve found that a number of things in it, sometimes just minor stuff, has sent me off to the internet to do a little research. Node Magazine and the Zero History blog have some good links. I’ve also found myself looking into Saharan guitar music and other odd stuff like that.

Reading

I realized, a few weeks ago, that I hadn’t been reading much of anything this year other than Drupal books. When the Harry Potter series was released in ebook format, I took the opportunity to get them all and download them to my Kindle. I started re-reading them a couple of weeks ago, and I’ve gotten through the first three. The first few are pretty quick reads, and fun. I don’t think I’ve re-read any of them since I first read them, quite some time ago. Knowing how it all ends does bring a bit of a different feel to some things, especially in the first book.

I’m taking a break now, and I just started Zero History by William Gibson.  He’s one of my favorite authors, and has been since Neuromancer came out. I’m really enjoying it, so far. I’ve been reading it slowly and carefully. It’s the kind of book that rewards careful reading, and attention, I think.