Mac OS X Tiger

Like every other second-year law student in the middle of spring finals, I spent yesterday afternoon waiting in line at the Apple store for the release of Tiger (shitty mobile pics of the line). Yes, I realize that I could have pre-ordered it and not had to wait in line, but I really enjoy that part of it (especially putting the girl I’m dating through the ‘embarrassment’) and didn’t want to be cursing God if for whatever reason it got hung up in the mail.

I wish I could talk more about it, but like I said, finals begin in the next couple of days and I have to write less here to make it look like I’m studying (and not playing with Tiger). You know I’m going to wax ecstatic on the subject in the future, but until then, be sure to check out John Gruber’s living repository of things you likely haven’t heard about Tiger.

Full content RSS feed

I’ve finally fallen inline with a lot of my online colleagues and am now offering a full content RSS feed. If you are already subscribed, pay this announcement no mind as you’ve no doubt noticed the change. If you aren’t subscribed, what are you waiting for?

I’m not really sure why I stuck with the excerpt-only feed for so long; I think the only thing served by such restricted content was my ego (i.e., the page hits I’d get from people clicking their aggregators to read the rest of my posts). I’m over it.

Some impetus for the change has also come from the fact that I use Bloglines a lot on my mobile phone, which really exacerbates the annoyance of excerpt-only feeds: you have to click forward once to read the rest of the article and then click back twice to return to the list of feeds. While these are negligible motions on a fast connection (or within a regular browser where you’d simply open the links in background tabs), they quickly become irritating on a non-EDGE/UMTS/HSDPA/etc device. I don’t want my feed to be annoying.

What About Your Google Ads?

It’s true, my AdSense revenue might take a hit (I show Google ads on individual archive pages (i.e., those that are linked to in the RSS feed)), but I think that’s highly unlikely given that most of the people subscribed to my feed aren’t the type to click on an ad anyway. I think it’s safe to say that the only people who click on the ads are those coming from web searches, who won’t be affected at all by the change.

I’ve moved to Flickr

I’ve finally begun the transition to Flickr. Though I’ve had a free account for quite a while, I’ve been hesitant to move to a Pro account; something I’ve written about before. What pushed me over the edge was the free Pro account (for a year) I received from Richard (old Pro users were given some invites; a side effect of the Yahoo! acquisition).

As I mention here, I plan to use Flickr as my primary photo-storage medium (and my home machines as backup).

I’ve already moved all of my “public” pictures to Flickr (i.e., the picture sets that used to be on my photos page) and have described/titled/tagged all of them where applicable (see the sets on Flickr). The Flick Export Plugin for iPhoto is brilliant and was absolutely essential in moving these sets over.

I think I’m going to hold off for a while on putting all of my other pictures on Flickr. As it currently stands, there doesn’t seem to be a way to create “private” sets. All of my pictures are organized by event and/or month and I’d like to create sets that follow this convention but are only accessible to me.

If you create a set of “private” pictures (i.e., NO public pictures), the set will not be seen at all by the public. This, however, does not solve the case when picture sets that I upload and want to keep private contain pictures that are in public sets (for instance, the Personal Favorites set) — privacy settings are based on the picture, not the set, so if a picture spans multiple sets, the last privacy setting for that picture will be applied to every occurence of it (regardless of set), which will obviously make some of those sets that I wish to remain private, public. Yes, the pictures that I want to remain private, will stay private, but the set itself will be publicly viewable (and will cloud the “public” sets I want people to see).

WordPress find and replace

As much as I like WordPress, I’m still a little miffed from time to time by its shortcomings. Of all the things it should have, it’s missing a simple find/replace function. I’m not sure any excuse the WP team could come up with would make sense to me — this is not a “feature,” but rather a necessary tool.

As is the case with most things in life, there is a workaround (that requires very little SQL knowledge). To find/replace something in WP, all you really need is the following query:

update wp_posts set post_content = REPLACE(post_content, "X", "Y");

Where wp_posts is the name of the table that holds your WP posts (wp_posts is the default), X is what you want to replace, and Y is what you want to replace X with. You can obviously run this query directly or through phpMyAdmin if you have it setup (just click the SQL tab once you’re inside your database). Simple, right? Right, which is why I can’t figure out the reason it’s been left out of WP.

Future Plugin

I was a little suprised to come up empty when looking for a find/replace plugin (surely everyone needs/wants this?). I think I’ll probably write a plugin for this in the next couple of months if no one else does.

UPDATE: I’ve been told that there is a plugin to do this: Search and Replace. I might still write my own plugin that supports regex pattern-matching.

Help a brother out

A couple of days ago I added a “contribute” button to my project pages. I’m posting about it here to prod those who already use my code into contributing something to my “I’m a poor law student” fund. I was encouraged to add such an option after receiving several requests to use some of my code in a commercial setting. Depending on how lucrative (or not) this turns out to be, I might be compelled to put the button on all of the individual archive pages as well, you know, for those random surfers bent on giving away money.  :)

Implementation

I thought I’d elaborate a bit on the method I used to display the “contribute” button only on the project pages. For other “special” pages (i.e., yearly, monthly, and individual archives), I just run simple PHP “if” statements that use WordPress functions to check for the type of page we’re dealing with. Obviously though, my project pages exist completely outside of WP (i.e., I don’t use the WP “pages” feature and there’s no built-in function to discern a “project” page from any other page).

Because all of my project pages are located off of the “projects” directory in the URI, I use a simple regular expression to check for this in an “if” statement.

if (preg_match("/projects/i",$_SERVER['REQUEST_URI'])) {
    // Word found in URI
}
else {
    // Word not found in URI
}

There’s nothing more to it. If you are looking to do something similar, be sure that this check runs after all other checks (to the extent possible) if the word/phrase you’re looking for occurs somewhere in the title of your posts (assuming of course, that you use post titles in your archive scheme).

Use Gmail as a spam filter (three ways)

UPDATE: I’ve just been made aware that someone else posted a similar, though more detailed, description of the first method I talk about below.

This is something I meant to write about months ago, but just never got around to it. I don’t think the idea is new (perhaps it was when I thought to write this), but that shouldn’t deter me from sharing it with everyone.

I guess the title begs the question, “Why would I want to use Gmail to filter my spam?” Well, if you’re currently relying only on client-side filtering, the question is answered. If however, you have both a client and server-side solution, the answer isn’t so clear; perhaps you aren’t satisfied with the server-side filter or you just want to try something new.

Notwithstanding your current setup (and requirements), Gmail does a decent job of siphoning out the good e-mails from the bad, and while it’s certainly far from perfect, I’m sure that over time, partly because it can set filter rules based on the aggregate “report spam” actions of its users, it will become an excellent filter. I’ve come up with three different ways for you to take advantage of Gmail’s spam-filtering capabilities, all of which allow you to keep your current e-mail address.

Method One

You can only use this method if you have the ability to set server-side e-mail filter rules. It’s based on the fact that Gmail adds some extra information to the header of the e-mail before forwarding it along. There are a number of things you can predicate your rule upon and I’ll place a few of them at the end of this section. The method is outlined below.

  1. Forward the e-mail from your current account to Gmail.
  2. Forward your Gmail e-mail back to your current account.
  3. Gmail will filter your e-mail before forwarding it along.
  4. Setup a server-side filter rule to check for the existence of certain data in the header (see below) and forward it to Gmail if the header lacks this data; let it pass through to the inbox of your current account if it contains this data.

Like I said above, there are quite a few things that you can check for in the header and use as the basis of your forwarding rule. Three of the most obvious are:

  • X-Forwarded-For: user@gmail.com forwarded@to.com
  • X-Gmail-Received: some-random-number
  • Delivered-To: user@gmail.com

Method Two

This method is best for those that can’t edit server-side filters, but can create multiple mail accounts. The method is outlined below.

  1. Create a new mail account (the username doesn’t matter; no one will see it).
  2. Forward the e-mail from your current account to Gmail.
  3. Forward your Gmail e-mail to the account you just created.
  4. Gmail will filter your e-mail before forwarding it along.
  5. Use your new mail account (you’ll obviously want to set the “reply-to” and “from” fields to your current address and not the one you just created).

Method Three

This is the simplest method and the one you should use if you can’t setup server-side rules or create extra e-mail addresses. The first thing you’ll need to do is setup your current account to forward to Gmail. The next and final step is to setup your local mail client to access Gmail through POP.

Archiving and Privacy

All of the methods shown above (forwarding and POP) allow you to keep your Gmail messages in your inbox, archive them (i.e., keep a backup of your local mail), or trash them. All e-mail in the trash “folder” will be automatically deleted after 30 days. Keep in mind though that just because you delete a message doesn’t mean that it’s entirely gone. From Gmail’s Privacy Policy:

Because we keep back-up copies of data for the purposes of recovery from errors or system failure, residual copies of email may remain on our systems for some time, even after you have deleted messages from your mailbox or after the termination of your account.

They’ll never learn

And she wrote, “sigh… its hard to compete with all your gadgets!   :)”

I swear I warn them before I get involved.   :P

Sin City is phenomenal

I hardly ever write about movies here, but I had to make an exception for Sin City. Stop your download and actually pay for this one — it’s absolutely incredible. I’m not sure I’ve ever seen such wonderful cinematography. I’ll be the first to admit that I’m no Frank Miller fanboy, hell, I’ve never even seen/read any of his work (which is probably why my fascination with the film is so pronounced — I have no book-to-movie qualms), but this thing knocked me on my ass.

I guarantee that you will walk out of the theater going, “What the fuck was that?” It’s almost like they turned a comic book into one of those flip-book things to create the motion. The genius use of color, the CG, the lighting, the camera angles… brilliant.

Wikipedia + RSS

Is there a particular reason why Wikipedia doesn’t have a syndication feed for newly added articles? Technically, this would be a trivial addition and so I’m not quite sure why it isn’t offered. I’m an information whore and would love to be notified when new things are added to the wiki. If anyone knows of something that scrapes Wikipedia or of an official feed that I’m not yet privy to, pray tell.

Now if you’ll excuse me, I must get back to deciding whether I’m going to buy a PSP law school.

UPDATE: 10 minutes after writing this I actually found exactly what I was looking for; there is a “new pages” page with RSS/Atom feeds.

Related entries

About a week ago I started running the Related Entries plugin here. If you aren’t directed to this site either through a news aggregator or a search engine, there’s a good chance that you haven’t seen this plugin in action because I only have it running on individual archive pages. To get a feel for what it does, take a look at my initial post about the Smart Archives plugin. Notice the “possibly related” section in the menu. I chose this particular post because it’s a somewhat apropos example given its topic and it does well to highlight the accuracy of the plugin. The accuracy though isn’t always as good as it could be; there are a lot of posts where it just chokes and either returns nothing or posts that are totally unrelated. Time permitting, I’m going to dissect the source at some point and see if I can game it (i.e., modify the way that it “scores” posts for relevance) to give more deference to the content of the post; as it stands now, I think it looks only at the title of the posts if you supply no keywords. In the context of this plugin, keywords are user-defined, one word descriptions that help the plugin to return more meaningful results, but for obvious reasons, namely time, there’s no way in hell I’m going to add keywords to all of my entries (or even just to those whose titles don’t accurately reflect their content).

I installed this plugin with some trepidation, fearing that the server hit would be too expensive, but surprisingly, it’s pretty negligible (granted, we aren’t talking about searching through that many posts; I’m not sure how well it scales up).

Be Careful Where You Call It

As usual, before I take something “live” on this website I test it pretty heavily. While putting this plugin through the motions I came across some rather odd behavior which took me a few minutes to nail down. To sum it up, the function call to this plugin must be placed after the infamous WP loop, else you’ll get the dreaded “no related posts.”

I initially called the function after the “individual archive” section of the menu, which runs through “the loop,” so there were no problems there. After playing around with it some, I decided that the results should be displayed before the “individual archive” section. This meant that the function would be called before any iteration of “the loop” (because of the way my markup is structured, the menu is built before the rest of the page; if that were not the case, then there would be no problem because the “content” section of these archive pages goes through “the loop”). To avoid having to change the structure of my markup, I decided to simply throw in a “dummy” loop before I called the plugin.