Archive for Projects

SmugMug Tweaks

SmugMug Admin Rating Sample

Lately, I’ve been working on some SmugMug tweaks to take advantage of their offer of a free lifetime account for developers who use their API. The first one was a quick hack which uploads some recent SmugMug photos to your Flickr account. This allows people who switched to SmugMug to still keep up with their Flickr network. More information is available on the project’s page.

The second and more interesting one is some JavaScript that adds the ability for SmugMug users to rate their own photos. This is the first of two projects to aid my work flow. Eventually I want to be able to upload a bunch of photos in a private album, rate them, and then in one fell swoop move all photos with a rating higher than X to a public album.

I provide two installation options which both pull the script from my server and inject it into the pages. This should allow for invisible upgrades. Savvy or cautious users can install it other ways.

Another interesting aspect of this project is its integration with SmugMug’s API. First, we’re using the API on SmugMug’s own site. This isn’t the typical use case of a photo site’s API. Secondly, the script gets proper API authorization behind the scenes, without asking the user for any information. Provided that the user is already logged in to SmugMug’s site, then my script gains that user’s credentials when interacting with API. This is not evident in the API docs and requires a bit of a hack.

Any users should be aware of security concerns whenever external JavaScript is inserted into your page.  Protect yourself as you see fit.

Comments

ActiveRecord in PHP

I’ve been meaning to release this code for quite some time. I’ve finally had a bit of time and motivation to sit down and take care of it. Ever since I started working with Ruby on Rails, I would cringe whenever I had to write yet more PHP code to do simple CRUD actions. Furthermore I really enjoyed the Rails syntax that you use to interact with its implementation of the ActiveRecord pattern. As such, I went forward and built a clone using PHP5. So far it has been used for a few projects and has been a joy to use.

Props to my employer, Gospel Communications, who allowed me to spend some time on this during work hours, as well as give me full copyright of the code.

More information and documentation over on the project’s home page.

Comments

Search Along A Driving Route

I recently went on a 3000 mile road trip, and as I was preparing for the trip, I wanted to know the answer to questions like “Where are all the Speedway gas stations that are within a mile of my route?”. I couldn’t find anything that would allow me to search for businesses near a given driving route, instead I could only search for things near a given point or city. I decided to build a mashup using Yahoo! Pipes and Google Maps that would allow me to do just what I wanted.

How to use it:

  1. Install the search-route bookmarklet.
  2. Go to Google Maps and create route.
  3. Click the search-route bookmarklet you installed in step #1.
  4. Search!

If you don’t want to bother installing the bookmarklet and want to try out the searching, you can test a local driving route or a long distance driving route.

How it Works:

After the user creates the route on Google Maps, clicking the bookmarklet sends the URL of their Google Maps page to a script on my site. This script will download the URL from Google Maps and parse out the encoded route in that page. Once we have this, we can give the user a search page with their route and map using Google Maps’ API. When the user searches, we call a Yahoo! Pipe which is passed the search parameters and a special id referencing this user’s route. The Yahoo! Pipe will download a specially crafted Atom feed for this route from my server. This Atom feed contains a list of some of the latitude and longitude points of the route. The Yahoo! Pipe then does a Yahoo! Local search on each point using the search parameters the user specified. Searches on particularly long routes can take several seconds to complete.

Comments (7)

Source Code Management

I’ve never used a source code management system for any personal projects. However, I just started using subversion after (1) hearing a lot of good stuff about it at OSCON2005 and (2) reading the first few chapters of Pragmatic Programmer, The: From Journeyman to Master, which strongly encourages using a SCMS for every single line of code you write.

I’ve immediately found reassurance in having my project in subversion. I don’t have to worry that a change I make might be hard to reverse. I can always revert to a previous revision. I’d definitely recommend using a SCMS for all your code. I’m still trying to figure out how to organize all my code to be kept in subversion, including any “throw away” scripts.

By the way, I’d highly encourage anyone who does any coding or application design to read Pragmatic Programmer, The: From Journeyman to Master. I’m about halfway through, and it’s quite good. It feels like the sort of book that you’d want to keep around and occasionally go back to, just to refresh your mind and get a new perspective on whatever project you’re working on.

Comments (1)

Gmail Greasemonkey Update

Wow, go me! I managed to dork up my site for awhile. :-/ Well I updated my Gmail greasemonky script to work properly even when changing between multiple Gmail accounts. Gmail changed something awhile ago, and I was slow to update the version on the site. It’s there now.

Comments (3)

Gmail Changes Breaking Stuff

Google decided to change the domain and URL syntax of Gmail:

  1. gmail.google.com redirects to mail.google.com
  2. instead of URLs like /gmail?param they look like /mail/?param

My persistent searches script has been updated to work with these changes. I would recommend uninstalling the original script and then installing the updated version.

Comments (5)

Gmail Bug Part 2

It appears that the issue is that behind the scenes (or at least relating to search and filters), labels apply to individual messages. Apparently when a filter is set to add a label, it will add that label to the message, and not to the conversation that the message is a part of. This is the only way that different messages in the same conversation may be labeled differently. Every other interface that Gmail provides to the label functionality relates to conversations, not messages. This turns out to be annoying. :-/

Comments (1)

Gmail Bug

I’m using Gmail a lot more recently (more later), however I’ve found an annoying bug. I’m now forwarding all my messages to a non-Gmail account to Gmail. All of these are given a label to indicate that they came to that non-Gmail account. They are also optionally given additional labels depending on if they have certain subjects, recipients, or content. I want to be able to do a search for any messages that only have the initial label that indicates that this email came through my non-Gmail account. For instance, if I label all my bills as “bills” and all emails from my gas company as “gascompany”, then some emails may be labeled both “bills” and “gascompany”. However, when I do a search like [label:bills -label:gascompany], I sometimes will get messages that are labeled both “bills” and “gascompany”. For those that are showing up in my results (but shouldn’t be), I can manually give them the “gascompany” label (again) and they won’t show up in the results if I do the same search again. Here’s proof: Example of Gmail Bug

Comments (2)

Nutch and Bittorrent

Cool. The new bittorrent search engine uses Nutch.

Comments

Cookies and Contacts

As everybody and their mom has been talking about Greasemonkey and AJAX, I decided I had better get a piece of the action. I also had a growing annoyance with the state of MUAs. I was contemplating writing my own, however I’ve since realized that perhaps I can get what I want by using Greasemonkey to add features to Gmail. Persistent Persistent Searches is that first step. The bit of code that I wrote allows people to write Greasemonkey scripts that store data in a Gmail contact. I wanted it to be relatively secure, “nice” to Gmail’s servers, and easy to use. What I ended up with is something that stores data in the note field of a particular contact. The data resembles cookie data and can be used in a very similar fashion. In fact the note data is cached in a cookie. This is my attempt to be nice to Gmail’s servers. On initial login, the note data is downloaded from the contact and stored in a cookie. Any read attempts for note data actually just read the local cookie. Any write attempts change the data in the local cookie and on Gmail’s servers. Since this data is cached in a cookie, I was a little concerned with the expiration time of this cookie (so that other users on the same computer couldn’t see the cookie data). The pseudo-solution was that this cache cookie expires after 3 minutes. However, Gmail checks for new mail every 2 minutes. Each time this happens (and the same user is logged in), the cache cookie will be given another 3 minutes to live. In other words, this cache cookie will be around after the user logs out of Gmail for at most 3 minutes.

Comments (5)

« Previous entries