The programming diaries
Sun Jul 16, 2006 17:45 EST (UTC -5)

Whoowee. There's nothing like a little late night programming to get the juices flowing. Well, not really. Yesterday after uploading my fourth Greasemonkey user script to userscripts.org, I decided it would be a good idea to make my own little namespace for them all. So I've created a Greasemonkey page that has links to the scripts and an explanation of what Greasemonkey and user scripts are.

All the scripts I've successfully written are really simple. But last night, I got an idea for another one that would take some effort. It would be for MySpace, and it would hide links to bulletins posted by certain friends. I spent two and a half hours working on it. After the first hour or so I got it working on the main home page, or so I thought, but I spent the rest of the time trying to get it to work in the expanded list of bulletins. I learned how to use JavaScript to remove rows from a table, but I couldn't remove the right rows. I know it sounds so simple, but it wasn't... for me. The script would remove the first bulletin successfully, but after that it might leave some that it was supposed to get rid of or vice versa. See, it would count which row the bulletin was in and then remove that row. But after that, the table would have a different number of rows, so if it kept chugging along, the numbers would be all out of whack. I tried everything I could think of to get the counter not to increment after removing a row, but the result was the same.

So, after two and a half hours, it was almost 1:30 in the morning, so I decided to hit the hay. I hadn't given up, though. I woke up a little after 7:30, probably because it was hot and bright and noisy and I was uncomfortable in bed -- not to mention that I had had unsettling dreams about my malfunctioning script. Even after a frustrating session of programming and so little sleep, I thought I could continue. I went back to the computer, which had hit a snag while shutting down and was still on. After spending some time trying different ways to fix the problem, I gave up. Then, because I was so tired, I tried to take a nap, but I never can, so I decided to tackle my problem from the opposite direction by guzzling a can of soda. Maybe I'll read this in a few months and get inspired to give the script another whack. After all, it is potentially useful. Another idea I had was to filter bulletins with certain words in their titles. That would be just as much work, if not more.

Anyway, there's a lesson to be learned here, and that lesson is this: if you try to do something, try really hard until you have no choice but to give up.

Gabbly is a pretty cool site that allows you to have a live chat with other people who are viewing any web page. Go to the site to see what I mean.

How much do you know about atheism and atheists? This YouTube video, "Atheist," challenges the popular notion that atheists are horrible people. I recommend that everyone watch it.

One year ago: "I don't know what beer tastes like."
Two years ago: "In my June 22 post, I talked about the Linux operating system and listed four reasons why I might someday switch to it."


2 comments

#1 by Alice H | Mon Jul 17, 2006 18:40 EST (UTC -5)

Can you start from the bottom of the rows and work your way up, instead of working from the top down?

#2 by Jordon | Mon Jul 17, 2006 18:57 EST (UTC -5)

Actually, I guess I could. That's a clever idea. Thanks!

Leave a Comment

Name (required) ...Leave the following field blank:

E-mail (optional, will not be displayed)

URL (optional)

Comment (required)

RSS 2.0 feed for comments on this post