Archive for the 'ThisSite' Category

Note: I've reorganized this site to use tags; the category archive remains to support old links. Only posts prior to April, 2006 are categorized. Tag Archive »

Bugs

If you see any bugs around the site (especially for the next day or two), shoot me an email (link is on the right). I’m in the process of implementing per-category RSS feeds, as well as Autodiscovery for the new feeds. Of course, Blosxom provides per-category feeds naturally if you request the correct URL, but unless your RSS template is aware of the possibility, your category feeds will be titled just like your site feed.

Autodiscovery is sorta working; if you’re in Firefox, go to a category index page (click a category on the right, or the story category at the bottom of this post), and then click the RSS icon on the toolbar. You should see two options… one for the main site feed, and one for the category feed. If I ever add comment feeds, they could be handled the same way.

At any rate, it’s been a little harder than I expected, since I haven’t hacked on Blosxom in a while. I’ve forgotten some of the finer points. I’ve also had to update my storystate plugin to get this working. Anyway, it’s still in flux, so appologies if something is broken. Not sure I’ll get finished tonight. Once the kinks are ironed out, I’ll post a rundown on all the newness, along with some instructions for those who want to do the same. I’ll also post the updated storystate if I keep the changes.

Search jclark.org via Firefox Search Bar

This will likely be of use to nobody but me, but then, it’s my site. Since I’ve been too lazy to implement a site search feature (even a lazy “search this site via Google” type gadget), several months ago I created a Firefox search plugin to search Google for just my site. If you don’t know what I’m talking about (and you’re using Firefox), look at the Google search box next to the address bar. If you click the “G” icon, you can select other places to search. You can also install other engines. There are hundreds available- I use the Dictionary.com engine all the time. The one I made searches Google for jclark.org pages (using Google’s site: search directive).

Of course, when I upgraded Firefox versions, it disappeared, and when I use other computers (there are 4 active in my home, plus a couple at work) it’s not available unless I take the files with me. So, I’ve set up an installer script. Click here to install the jclark.org/Google search plugin.

Calendar Bug

Once again, Storable.pm is causing me grief. From time to time, my whole site goes all “500 Server Error” until I can log in and check it out. Every time it seems to be a problem with the Calendar plugin’s cache file, as managed by Storable.pm. Normally, I just nuke the old cache file, Calendar automagically creates a new one, and all is well. This time however, deleting the old cache file is having no effect; a new one is created, but Storable still blows a gasket whilst magic number checking it.

So, for now, I’ve taken the low road, and disabled Calendar entirely. I’ll try to have a closer look tonight and see what’s going on. As usual, if I learn anything that could be useful to others, I’ll post it here.

Update: Tried turning it on again a few days later (deleted cache again), and now everything’s fine. shrug

Monday Night Football

The Philadelphia Eagles are on Monday Night Football tonight, playing the Vikings. Should be a great game. Being an Eagles fan, I’ve been meaning to add an Eagles stylesheet to my style switcher for a while. Found a round tuit under the cushions in my sofa this weekend, so I gave it a whirl.

The Eagles stylesheet is the first on the site to use images. I tried to go for a subtle effect, noticible when you focus on it, but not distrating when you try to read the text. I think it came out okay, your milage may vary. And of course, it all looks MUCH better on a Mac.

If I updated my site correctly, the Eagles stylesheet should be the new default, and any selection you previously made on the styleswitcher should be forgotten. If not, choose the Philedelphia Eagles style in the switcher menu on the right (scroll down) and check it out.

GO BIRDS!

Update: Eagles 27, Vikings 16. Styleswitcher has reverted to your previously saved settings, but the Eagles stylesheet is still available. Go Birds!

On A Roll

So I finally completed a website update that’s been on my list for ages: I’ve added a blogroll (on the right, scroll down past the category tree). I decided a long time ago that I didn’t want to maintain a blogroll by hand. Of the various websites that help you create a blogroll, Bloglines seemed like the best fit- Bloglines is my aggregator, so it already knows what sites I read.

Bloglines offers several ways to share your blogroll. The most basic is your public url, which is a publicly viewable version of your subscriptions within the Bloglines interface. This is a great way to let others see what you read, but not to embed a blogroll within your site.

The next way to create a blogroll via Bloglines, and the option actually designed for the purpose, is the Bloglines Blogroll Wizard (accessible after you’ve logged into Bloglines). It provides an HTML version of your blogroll in two ways- via script or literal HTML. For example, to include my blogroll, I can add the following to my page:

<script language="javascript" type="text/javascript" 
src="http://rpc.bloglines.com/blogroll?id=jclark"></script>

Of course, I really don’t like the idea of using script to build my page. You can get the same HTML that the script would insert via direct URL, but the HTML generated by Bloglines isn’t laid out the way I want. Here’s an excerpt of the HTML generated by Bloglines for my blogroll:

<div class="blogrollmain">
<p /><div class="blogrollfolder">Corporate</div>
<div class="blogrollitem">
    <a href="http://weblogs.oreilly.com/">O'Reilly Weblogs</a></div>
<div class="blogrollitem">
    <a href="http://www.macdevcenter.com/">MacDevCenter.com</a></div>

I don’t mind the <div> wrapped around the entire blogroll, but wrapping every website link in a <div> is a little over the top. And using an empty <p /> tag for page layout? How 1999 is that? The blogroll is just a list of folders, each containing a list of links (assuming you use folders). I wanted to set this up the same way my Categories list is laid out- as a <ul> containing nested <ul> blocks.

Fortunately, there’s another way to get your blogroll data from Bloglines. From the public view, you can choose to “export” your subscriptions. This gives you an OPML file containing all of your blogs and folders. Since OPML is XML (and so is XHTML), this seems like a prime use for XSLT.

I had set out to create a blogroll from Bloglines’ OPML via XSLT months ago, but I got hung up on the mechanics. I had intended to have my webserver retrieve the Bloglines OPML, and to transform it on the webserver. To this end, I asked my hosting company to install an XSLT library for Perl, but I asked for XML::XSLT instead of XML::LibXSLT, and found that XML::XSLT was not complete enough to be effective. I ended up shelving the idea for a while.

When I decided this weekend to finally get my blogroll online, it occurred to me that my blogroll doesn’t change very often. With updates so infrequent, I really don’t need to put the maintence of the blogroll on the server. Instead, I wrote a perl script which retrieves my Bloglines OPML file, converts it to XHTML using an XSLT Stylesheet, and uploads to results to my website, where I use Nelson Minar’s File Plugin for Blosxom to include the file in my page output. I just run this script from my Powerbook whenever I update my Bloglines subscriptions.

A few notes about the script and stylesheet: you might notice that I upload the blogroll into a state/file directory. I’ve modified my copy of the File plugin to look for files in $plugin_dir/state/file, in keeping with the informal standard for Blosxom plugins. Also of interest is the FTP upload code. I didn’t see any need to write my XHTML out to a file just so I could FTP it, but I couldn’t figure out how to upload the contents of a scalar via FTP using the common Perl FTP modules. I ended up using the command line utility curl to perform the FTP upload. Curl will accept a file from stdin, which works perfectly from perl by opening a pipe to the command. The stylesheet uses no id attributes, and only one class attribute for attaching my CSS. This class, set on the outermost <ul>, is ‘categories’, which is the same as my category tree. By sharing rules, I didn’t have to write any new CSS for the blogroll to fit into my layout. Also note that as written, the XSLT doesn’t properly handle top-level subscriptions (those not assigned to a folder in Bloglines). If/when I fix that, I’ll repost the XSLT and make a note here.

Dear Weblog

Dear Weblog,

I know you think I’ve forgotten you. You think we’ve grown apart. I know it’s August 30, and this is my first update for August. I know I made a New Year’s resolution to hit 300 entries, and that this is only entry 173. I know, I know.

The truth is, I haven’t forgotten. My computing time (outside the office) has been in a dramtic slump for months. My Bloglines account is overflowing with unread content. Even as I type this, my Powerbook is busy downloading OS X Software Updates that are months old.

What does this mean for you, my weblog? Only time will tell. I have no plans to let you go, but I hate to see you languish. The good news is, I’m doing web development at work for the first time in years; this is definately putting me in the mood to catch up on my reading (and writing). I’ve already got several posts rattling around in my skull. The bad news is, Summer is ending and the kids are about to head back to school (and extracurriculars), so life’s only going to get busier.

Besides, look at the bright side… with no recent comments, those nasty comment spammers have been largely ignoring you. I know how dirty they make you feel.

Comments Return

After a three week hiatus due to comment spammers, comments have returned to jclark.org. I have cleaned up all of the spam- at least I think so. If you should see any lurking in the comments, please shoot me an email.

I’ve also made some changes to (hopefully) reduce spam. It isn’t perfect, but it should prevent the types of attacks I’ve been seeing. Time will tell, I suppose. I’m not going to release any details about my changes yet; I want to see how they work, and I’d rather not let the cat out of the bag just yet. I’ll probably end up posting the details later, although increased usage will probably lead to the spammers working around it. Spammers are scum.

The rest of you, however, are invited to leave me a comment!

Abuse

I’ve been on a blogging sabatical for the past 6 weeks, as I’ve just been too busy between work and home to keep up with my usual online time, be it reading, posting to this blog, or spare-time coding. I’ve been trying to check my email daily, to keep an eye open for comments to the blog, especial comment spam. I usually have to clean up a piece or two once a week, which takes about a minute to remove, and a minute to IP ban the poster. No big deal; just the unfortunate price of having a blog these days.

Today I had the rare treat of feeling like an A-list blogger. Not because of site traffic or inbound links, but because of blog spam. I had 50 spam comments posted to this site today - that’s an average of about 1 for every 3 posts on the whole site. I can’t tell you how special I feel.

For now, I have disabled both the posting and viewing of all comments on this site until I’ve had a chance to clean up the mess. This is one case where Blosxom’s simplicity works against me. Each story’s comments are stored in a separate file, in a directory structure that mirrors the category hierarchy of the site. So to clean up the mess, I’ll need to download the whole comments tree, check each file, and re-upload it.

Before I put anything back online, I intend to review the list of IPs involved, which I have not done yet (I wanted to shut things down before they got worse). I do log the IP address for every comment posted, but I also want to take a look at my server log. Unfortunately, I can only view a portion of it via my host’s web interface, and I won’t be able to download a tarball of today’s log until tommorow. I suspect that there will be a number or IP addresses involved, suggesting a coordinated attack, quite possibly using compromised machines. If you aren’t running a virus package and a malware filter (such as Adaware), just do the rest of us a favor and unplug your computer from the web right now. Go on, do it.

To those of you still online, who don’t post spam to this site, sorry for the rant and the partial down-time. To those of you who post spam to this site or others, [list of violent suggestions omitted - some of us actually have principles].

Fixing the Comment System, Part 1

I’ve never made a secret of the fact that I don’t like my comment system. I even had a warning on the comment form about how bad my comment system was. No line breaks. No linking. No HTML of any sort… well, except that <p> and <br /> seemed to work, but no one used them. It’s basically the raw writeback plugin for Blosxom. The only enhancements I made were to capture timestamps and IP addresses, and to send myself email notification of new comments. Hardly noticable when trying to read the comments.

I’ve been meaning to do something about it forever. Tonight I finally got started. My main requirements for the new system were:

  • Easy to use
  • Typical feature set: links, bold & italic, code would be nice
  • Maintain valid XHTML, but don’t require the users to understand XHTML.

It was the last feature that really dictated terms to the rest of the crowd. Fortunately, there’s already a fantastic tool for generating valid XHTML easily, with many common features - Markdown. I’ve been using it for a couple of months to author all of my posts, and I love it. Using it for comments seemed like a logical next step.

Markdown only generates valid XHTML, but it passes through any XHTML in the original text unchanged. This would allow any comment to invalidate my XHTML. (It should be noted in the interest of fairness that comment form itsself is not valid XHTML at the moment. It’s on my list.) My solution was to change Markdown to encode all XHTML (and other uses of < and >) entered by the user. In addition, I had to hack a few templates as well as the writeback plugin. So far it’s working pretty well. All comments are now rendered via Markdown. If you see any that look strange, shoot me an email.

One of the best features of Markdown in my mind is that its useful even if you don’t know it, since it borrows from email idioms. Blank lines start new paragraphs. *Emphasis* and **strong emphasis** are easy to do. URLS wrapped in <> become hyperlinks. Code can be wrapped in \backticks`to format it and escape any nasties. Blockquotes work like email, just prepend>` to each line.

Of course, there’s lots of other features that it helps to know something about ahead of time, such as code blocks and referntial URLs. Plus, occasional surprises can occur; writing about the interpolate_fancy plugin requires a backslash before the underscore if you don’t use backticks, or you invoke <em> mode. For this reason, I’m going to add a mandatory preview prior to posting. I’ll also add some Markdown tips to the comment form. Preview isn’t ready yet, but Markdown-enabled comments are.

A Few Tweaks

I’ve just finished making a few tweaks to the site. Please shoot me an email if you see anything untoward. The updates are mainly for the benefit of search engines. Here’s what I’ve done:

  • Added <meta name="robots" ... /> tags to control what pages are indexed. I’ve set them up so that permalinks (individual posts) should be indexed, but index pages (main page, category pages, date archive pages) are not. This should prevent Google from listing dozens of hits for what is really a single post. For more info, see this old post (which I’m just getting around to acting on).

  • Added the post title to the page title on permalinks. This way, all my hits on Google won’t be titled “jclark.org”. There are a few Blosxom plugins that can do this; I’m using storytitle. I only made one small code tweak to the plugin, to remove dates from the page title on date archive views. It wasn’t implemented correctly (any date link, including year or year/month/day links, put the year and month in the title), and I didn’t feel like fixing it, so I shut it off. The info is at the top of the page, and Google doesn’t need page titles for index pages now (see prior bullet).

Now I just need to setup a robots.txt, at least to prevent downloads (e.g., source code for Blosxom plugins) from being indexed. I still need to add search, but I’m lazy and Googling is so much easier… just include site:jclark.org in my search and I’m set. In fact, I even created a custom Firefox search extension to let me search my site via Google from Firefox’s toolbar search box… but that’s another post.