Slinky, a PHP class for URL shortening/lengthening

A few weeks ago, I tweeted that I was writing a PHP library for shortening/lengthening URLs using some of the common/popular services. I said it was going to be called Slinky, and that it’d support a bunch of different services. Well, it’s now available for download and I think it’s pretty cool, even if I do say so myself 😉

Please grab a copy, try it out and let me know what you think. It hasn’t actually been used for anything useful yet, so I’m also interested to hear what you’re using it for!

I’m Speaking at WordCamp Los Angeles


wordcampla-2009_125x125
I’ll be speaking at WordCamp Los Angeles, which is being held at Loyola Marymount University on September 12th.

I’m going to do a talked called “Meet the Family”, where I’ll introduce some of the other WordPress powered (and related) projects that you might not have heard of, but which are likely to be interesting to WordPress folks.

Come by and check it out if you’re interested in WordPress!

Quick PHP Tip

If you’re coding in PHP and checking variables to see if they have a strlen() == 0, or isset() or a variety of other possibilities, you might consider using empty() instead. It’s quite versatile and is nice because it doesn’t trigger any warnings or notices if you use it on a variable which hasn’t been set yet. Here are some examples to show you what it will match against:

<?php

$zero_string  = '0';
$zero_int     = 0;
$false        = false;
$empty_string = '';
$array        = array();
$obj          = new stdClass();

echo empty( $zero_string ) ? "'0' = empty\n" : '';
echo empty( $zero_int ) ? "0 = empty\n" : '';
echo empty( $false ) ? "false = empty\n" : '';
echo empty( $empty_string ) ? "'' = empty\n" : '';
echo empty( $array ) ? "array() = empty\n" : '';
echo empty( $obj ) ? "stdClass() = empty\n" : '';
echo empty( $foo ) ? "foo is empty (and the variable was never set)\n" : '';

microformatsDevCamp

Over the weekend, I attended microformatsDevCamp here in San Francisco. It was a chance for a bunch of people who are interested in microformats to get together and hack on some projects that used microformats to Do Cool Things. I ended up being the instigator of one of the projects we worked on, because I had a concrete “system” in mind that would leverage microformats to meet a real need.

The project was to create a web service that would scrape URLs and pull out any content marked up in hCard content (e.g. my contact page) and would then load that content into an LDAP directory. The reason for this is that most Address Book/Contact applications can plug into an LDAP directory to populate their details, so this would provide a direct pipe between client-side contact storage and web-based, decentralized information. The web service would periodically check the URLs it knew about for updates and update LDAP appropriately. If people update their hCard-based information, the LDAP directory would automatically pick up that change and update itself. I’ve talked about this idea before.

Building (or even tinkering with) this system required that we learned about LDAP, and as it turned out, none of us knew much more than the very basic concepts involved with LDAP, so we had a lot of learning to do. I’m putting together a list of LDAP basics that I’ll publish once they’re straightened out a bit. In the meantime, a specifically big thank you to Tantek for organizing ufDevCamp, to Stephen Weber for working with me on the LDAP/code side of things (and showing me how to get started on github.com, and to Mark Ng for setting up an OpenLDAP server for us to play with, and for helping figure out some of the configuration options etc required to get it all working.

Oh, and there’s some code over here if you’re interested, and we made a page on the microformats wiki with some info on our progress.

Simple Activity Streaming with SimplePie

A few different people have asked me recently how I created the activity stream/life stream you see in the sidebar of Dented Reality. It’s actually really simple, and all it does is load up the feeds from a few different locations, combine them in date order and then output them on my page using an HTML “UL” (unordered list). Based on the source of each feed, it also adds a CSS class to each list element (LI) so that I can add an appropriate icon. Here’s the complete code that I use, and then I’ll explain some parts of it, and some of what makes it tick: (more…)

Idea: “LiveJournalish” WordPress Plugin

I’ve been doing a lot of work with LiveJournal/WordPress lately, and have been seeing that there are some passionate LJ users who are loyal to the platform largely for a few specific reasons/features. It seems like those features would mostly be pretty easy to replicate on WP though, given its flexible plugin system.

The main features that LJ supports that WP is (or was) “missing” seem to be:

  • Robust permissions (create a group of people, grant them access to view a post, but no one else, etc)
  • Support for integrated “metadata” on posts such as Current Music, Current Mood, etc
  • Reply to comments directly via the notification emails you get
  • Threaded comments
  • Userpics

(more…)

Updated to WordPress 2.8

I’ve just updated this site to WordPress 2.8, using my favorite method for handling a WordPress install, Subversion. Here’s what I typed at the command line to upgrade:

svn switch http://svn.automattic.com/wordpress/tags/2.8/

Once that was complete, I logged into my admin panel and completed the DB upgrade, then I had to check some plugins. I had these problems/changes:

  • TinyMCE Advanced had an update available, so I did that,
  • One Click Plugin Updater seems to clash with the new Plugins page, and I don’t really need it now anyway since its functionality is in core, so I deactivated it and then deleted it
  • IntenseDebate seems to clash with some of the JavaScript now used in the admin, but I work with those guys now, so I’m working on a new version of the plugin to address those issues! My comments are a bit ugly while I deal with this, but I figure that’s a good motivation to get it done ASAP.

Have you upgraded yet?

KRead: a simple feed reader for the Kindle 2

It’s Saturday, and I just got a Kindle 2 this week. I’ve been thinking it’d be neat to be able to read feeds on the Kindle (since it has a built in Web Browser and internet connection), so I whipped up KRead. It’s a super-simple, mostly-text-only feed reader for the Kindle which just requires you to enter the URL of a single feed (or a website, it supports auto-discovery) and it’ll give you the content of the feed in a simply-formatted list so that you can read through it.

Check out the KRead project page for some more details or jump over to http://kread.beaulebens.com/ and try it out.

Twitter’s Missing Features

I’ve been sketching some random thoughts and plans for a new Twitter client, and rather than restrict it to my notebooks and condemn it to the fate of so many other ideas of mine that never see realization, I’m putting my wish-list for what a decent Twitter client should allow me to do here. Feel free to roll these into another client and let me know so that I can just use it, rather than have to build it 🙂

Read the full list after the break

Secret Decoder Ring

I’ve been doing a lot of work lately with raw WordPress options (what’s stored in the database), and started getting annoyed at manually unserializing the ones that are serialized to see what’s in them. I was also working with a lot of content that was JSON encoded, so it was all getting a bit tedious. Enter the Secret Decoder Ring!

This is a super-simple (basic, dodgy, hackish), fun little script that allows you to quickly decode “encoded” information in a variety of formats. I have it in my browser toolbar as a bookmark so that I can get at it easily. All you do is copy-paste something into it, and then click the appropriate button to get decoded output. Click the link below and give it a shot.

Secret Decoder Ring

It’s also handy if your WordPress install gets hacked (hi Dreamhost! 🙁 ) and someone adds a bunch of base64_encoded() junk in your files, because now you can quickly and easily decode it and see what it says.