Category Archives: coding

Redirect URLs to hide Google Analytics query strings

One of the great things about Google Analytics, is how easy it is to track your incoming traffic. And if you’re running an email campaign, or pushing some other outside link source, you can use their link builder to create a query string that tracks the individual sources and campaigns. (See their tool here.)

However, the only problem with this is that if you’re encouraging social sharing at the destination URL, those query strings can cause problems. Facebook sees them as unique pages, and twitter sharing looks ugly. So, I found this solution that quickly and easily cleans up the URL for social sharing, while maintaining the tracking from the query string.

Basically, just add the following code below your _trackPageview call.

if (window.history && history.replaceState && {
history.replaceState({}, "", location.pathname); //assuming you want no query string

This was originally posted at Stack Overflow here.

Connecting Sequel Pro to Bluehost databases

I found the instructions to this in a thread over at bluehostforum, but thought I’d re-post them here and provide what worked for me.

I’m using Sequel Pro, formerly CocoaMySQL, to connect to databases on my Bluehost account. Here’s what I did.

To pull all the info together, I had to add my IP to:
Cpanel > Databases > RemoteMySql

When you launch that function in Bluehost’s Cpanel, it’ll list your IP address for you, so you just hit the Add button.

Then in Sequel Pro:
Host: your domain name w/o the http://www
Port: 3306

Add in the database name, username, and password and you’re good. Remember that your username is the first 8 letters of your primary domain, followed by an underscore and the actual username. Such as would be domainam_username.

Hope this helps.

WordPress for the iPhone

This is a test/ review of the new iPhone app from wordpress. It will be short since I am writing it from my iPhone, but so far, set up took less than a minute and I’m already composing. This is fantastic. It’s also COMPLETELY intuitive. Everything has been right where it should be, and the options are clear and concise.

At the moment I’m trying to add an image. Not completely obvious I guess, which is contrary to my last point. Oh well.


Update: It seems that when you’re typing in the body of the post, you only type. After you hit Done, you can then add an image (either from the camera or from the library), set a timestamp, edit the categories, etc. Then, you just hit publish.

The photo above was taken from my iPhone of the iTunes App Store showing the WordPress App. Special Note: The image was resized automatically, and automatically linked to the larger version of the image. This is also fantastic. I imagine someday you’ll be able to set preferences for the way this is handled, and what the thumbnail size is (for easier and more seamless integration into different themes), but for now, this is a fantastic 1.0 piece of software and I’m thrilled to have it in my arsenal.

Hardcore advanced renaming of files in Mac OS X and Windows

Renamer4Mac is an advanced file renaming tool for Mac OS.

Where was this app just a few weeks ago? I needed this desperately and ended up bugging my programmer for 30 minutes as we wrote a shell script (never done that before) to make some pretty sophisticated file-renames. However, I was pretty nervous to hit “go” in case I missed something… Now, here this is with live previewing, so you can see exactly how your files will be renamed before you hit Go.

Renamer4Mac supports Regular Expressions (yay! regex), search and replace, insert/overwrite of text, numbering files, and capitalization. Whew. It’s also donationware, so make sure you support these guys if you like their work.


Renamer4Mac, found via

Wufoo – Hosted Form Service


I’ll be the first to admit that this free script solution isn’t the most full-featured form builder I’ve ever seen, but it is very simple and handy for it’s intended purpose. Sometimes however, you need a little more muscle. Wufoo is just such a muscle. It’s a great, hosted service that lets you manage and control forms without any programming knowledge or time commitment. After you create an account, you can then create and manage as many unique forms as you want; contact forms, questionnaires, event sign-ups, etc). All of it is done via wysiwyg editors and simple wizards. It then gives you the code to put into your site and viola, instant database driven forms. You can then log back into Wufoo and view, sort, export the results of your form at any time. It has a very simple free plan, but for bigger needs, you’ll need to upgrade to a paid plan, but the price you pay is much cheaper than paying a programmer to build it by hand, especially if you need to administrate the results of the form. In the end though, the prices are very reasonable.


Available on All Plans

* Built in Validation and Error Checking
* Ability to Style the Look of your Forms
* Subscribe to Entries via email or RSS
* Custom Confirmation Messages
* Easy integration into Your Web Site or Blog

Available on Paid Plans

* Access to Customer Support
* Upload Files with your Form
* No Advertisements on Confirmation Page
* Redirect to a Custom Confirmation URL
* Password Protection on Forms and Reports

Creating Web Contact Forms Script

Aaron Wall recommended this site in a recent TechCrunch comments thread, and I absolutely fell in love. I’m not much of a programmer, so I’m always bugging my partner to make me little scripts or do simple things for me when I need something, but this is the kind of thing that will help me be much more efficient and self-sustained.

Contact Form Generator

This site has a quick little wizard that will write and preview everything you need for a customized contact form. You enter where you want the form to send it’s contents (an email address), the subject of the email, and then you design the form with whatever fields you want. It writes up some php and gives you some code to embed in your site, as well as a php file to place on your server. It’s all very simple, and very fast. I love it.

I whipped up a little one and embedded it below to test it out.

Continue reading

Check a site at a repointed domain before DNS catches up

So, my friend Matt taught me a nifty trick this afternoon. I had recently uploaded a new site to a server, then switched the DNS settings over to it. It was going to take a while before the DNS propogated itself, and I didn’t want to wait (actually, I wanted to double check it was working before my client saw it). So, if you have a Mac, here’s how you force your computer to check an IP before it looks to its DNS settings.

1. Open terminal and type sudo mate /etc/hosts. (this will open the file in textmate)
2. When the file opens, go to the bottom of the file and start a new line. Enter the IP address of your new server, hit TAB, then add in the exact URL you want to point to that new address. I added mine WITH a www., so I can still look up the non-www URL and see how the DNS settings are propogating.

I’m sure people out there no a ton more about this than I do, but this is enough info that it worked for me, and I thought I’d share (as well as document it so I don’t forget.)

Using Textile

I find Textile somewhat frustrating. I’m not really sure it’s better than HTML, because I have to learn so many random codes now. While it may be simpler than HTML, I’m not really sure it’s any easier to learn, especially since HTML actually uses tags that make sense semantically. For instance <strong> makes sense to me. I don’t have trouble remembering that. *strong* seems faster, but only once I’ve memorized it.

Anyway, I have to use it often, so here is my list of resources:

Textile Resources:
This site will take standard text, or textile input and output it as HTML. This lets you play with textile and dial in exactly how your site will look. This is great if you know HTML and are trying to learn textile for wikis or other CMS that requires textile input.
This is just a big list of tags ordered logically, with their HTML equivalent and a preview of how it would render.