All this stuff is filed under "tips"

Run a Python script in Mac OS X Terminal

Terminal.appI’m sure this is self-evident for anyone with halfway decent knowledge of the Unix command-line, but it took me some searching through multiple sources to figure it out. (Kept getting env: python\r: No such file or directory errors whenever I tried to run the script on its own.)

If you need to run a Python script in the Mac OS X Terminal, save the script somewhere on your hard drive and run the following command:

python path/to/script [options]

Obviously, replace [options] with any options or arguments that the script accepts (or leave it off entirely). Remember that if you’re using bash for your shell, you can hit tab to autocomplete paths (which speeds things up a lot) and you’ll need to escape any spaces in paths with a backslash:

python ~/Documents/My\ Python\ Scripts/script.sh

Please note: I’m using OS 10.5; I believe the above will work with 10.2+ (since I think that’s when Python was bundled with the OS), but your mileage will vary. If you’re having issues, the Python documentation was one of the best resources I found, and of course the help file for the python command was useful once I figured out I needed to use a command other than running the script (type man python to access it).

Using a custom favicon with FeedBurner

This is a pretty simple tip, but when I was looking around online I couldn’t find any information about it.

If you’re using FeedBurner (or some other feed that you don’t have direct control over) and you want your site’s favorite icon (often called a favicon, typically favicon.ico) to show up in association with the feed, stick it in the directory that the feed directs visitors to (this is usually your root directory).

I’d been wondering why my Tagamac and Beckism.com favorite icons weren’t showing up for anything except my browser; copying the favicon.ico file to the root directy of my website solved the problem.

If you control your RSS feed, of course, you can directly reference an image to be included with it instead of relying on auto-detection.

Use a linebreak in Excel on Mac

Sometimes you need a linebreak in an Excel spreadsheet cell, but when you hit return or enter it always jumps you to a new cell. On Windows, you can just hit alt-return (or maybe alt-enter; if one doesn’t work, try the other). On Mac, you’ll need to hit control-option-return.

Took me a while to figure this out, and I figured it could be useful for others. Enjoy!

Using your Wii remote with a friend’s Wii

Every once in a while my girlfriend and I will take her Wii remotes over to my Dad’s house for some Wii bowling, and having to synch the remotes every time was getting really annoying. I couldn’t find any information about using your Wii remote at a friend’s house in the manual, but after digging through the Nintendo support pages I finally found how to use your Wii remote with a friend’s Wii without synching it. It’s called One Time Mode Synchronization.

One tip: in my limited experience you need to add the remotes after you’ve loaded the game (instead of doing it in the Wii menu) or you’ll have to do the process twice. Definitely nice not to need to resynch your Wii remote when you get home, though.

How to install Chyrp

Chyrp’s installation instructions are worthless, and the installation script’s errors even worse. If you’re trying to install Chyrp and getting “Could not modify database settings file” errors, make sure that you’ve followed all of these steps:

  • If you don’t already have a database ready for Chyrp, set one up and make sure you have the details on hand (host/database/user/password).
  • Unzip the package and upload the files to the desired location on your server.
  • In your FTP program, open up the includes folder and change the files named config.yaml.stock and database.yaml.stock to config.yaml.php and database.yaml.php respectively. Set both files’ access permissions to 777 (read/write/execute for everyone).
  • You may also need to rename chyrp.htaccess to .htaccess and give it 777 permissions, as well. There were conflicting reports online, and I did it just in case.
  • Navigate to Chyrp’s install.php script in your browser, and follow the instructions. This will probably be somewhere like http://yourserver.com/chyrp/install.php.
  • Delete the install.php file with your FTP client once you’ve finished.

That should get Chyrp up and running! Hopefully one of these days there will be some useful installation instructions included with the download. For such an easy process, it sure was difficult to figure out.

Update: I had an opportunity to install Chyrp again, and you do indeed need to rename .htaccess and make it writable or you’ll get an error about Chyrp not being able to write to the .htaccess file. Please note that these instructions are for Chyrp 1.1.3.2. They may or may not apply to future versions of Chyrp.

The mysterious whining MacBook Pro

I love my MacBook Pro. When they came out, I knew the fifteen inch, top-of-the-line MacBook Pro with an Intel Core Duo was my dream machine, and even though it took me a while to get one, I’ve never looked back. I’d suffered with a 700 pound eMac for so long that I’d forgotten how beautiful a Macintosh can be.

Fast-forward to late 2007 when I’ve graduated from college and somehow managed to acquire an income, an apartment, and a widescreen TV. My TV is also a thing of beauty. Thirty-two inches (which is the perfect size for my living space), 1080p high definition, and a gorgeous shining black surface. It’s a Sharp Aquos 32″ HDTV, and if you’re in the market for a television at that size, I highly recommend it. Beautiful picture, perfect for gaming (which is why I bought it), and the built-in speakers are quite good, as well, which is a major plus because I hate the neighbors thanks to their sound system, and wouldn’t wish to become what I despise.

With two such wonderful gadgets in my house, naturally I wanted them to get together, so I went out and bought an HDMI cable and an audio audio cable to connect the MacBook Pro to the TV. As best I can remember, it worked great the first few times I watched movies.

But the last couple times, as soon as I plugged in the audio cable, the TV started outputting a high-pitched whine through the speakers, which was extremely annoying.

I figured it might be the audio cable, but that didn’t make much sense; it was new and worked fine a few times. Magnetic interference seemed like a long shot, since there was nothing electronic nearby except the TV and the computer itself. Before I rushed off to buy a second audio cable, I decided to consult the internets.

After a little research online, I found there was some info about whining MacBook Pros, but it all had to do with the computer itself whining. Fortunately, Daniel Jalkut had quite a lot to say about CPU whining in MacBook Pros. I tried his QuietMBP program, and surprisingly, it fixed the whine through the television speakers.

Here’s where it gets fun: the QuietMBP program basically uses up idle time in the CPU by running pointless data through it. You can control how often the program runs stuff through the CPU with a slider, and you’re supposed to set the slider as high as you can to alleviate the noise (lower numbers = smaller gaps between CPU usage = more power consumption). I started dragging the slider, and the whine started changing pitch in real time.

Seriously, I could have played music with the damn thing. It was bizarre. Why the heck does a piece of software that’s supposed to help with CPU-related whining change a whine going through external speakers? Why have I never heard a whine through either my computer’s speakers or my trusty JBL Creatures? What god of electronics did I offend, anyway?

It’s baffling to me.

Now that I’m sensitized to the whine, though, I’m realizing that I do sometimes get a strange high-pitched whine when my MacBook Pro is running off battery. Why it took almost two years and a TV to bring this to my attention, I don’t know. Possibly because the eMac was basically a jet engine with a screen on it (think noise, not speed) and my ears have been ringing all this time.

In any case, if you’re experiencing problematic whining when you hook your MacBook Pro up to a pair of external speakers that otherwise behave well, it might not be your cable, your speakers, or really anything involved with getting audio from your Mac to the outside world. It might be your CPU.

Go figure.

Creating quick, short Amazon.com Affiliate links

Ever since my recent redesign (and subsequent drastic increase in activity), I’ve started using Amazon.com Affiliate links when linking to good books, games, and so forth that I am currently experiencing. I hate the idea of advertisements on Beckism.com, and since I was planning on sharing opinions on books/etc. anyway, this seems like a pretty unobtrusive way to create a small possibility of revenue. My pie-in-the-sky dream is that someday Beckism.com will pay for its own hosting costs. That will be a good day.

In any case, I’ve only recently started using Amazon.com affiliate links, and may I just say that Amazon.com has a terrible system. You have to visit their Affiliate Central. Then log in. Then view all their widgets and so forth. Then choose the Product Links option. Then search for your product. Find the product in the search results. Die of boredom.

And the URL’s hideously long. Some monstrosity like this:

http://www.amazon.com/gp/product/0525457585/104-5843009-5065550?ie=UTF8&tag=beckism-20&linkCode=xm2&camp=1789&creativeASIN=0525457585

It makes me cringe. I’ve been searching for a way to quickly build my own Amazon.com Affiliate links; since I’m just using simple text links, I see no reason to jump through Amazon’s hoops. My goal was something that doesn’t require me to sign into Amazon and that gives me drastically shorter URLs (because long URLs make it difficult for me to read my post’s code):

These do not seem to me impossible demands. I searched for a Mac OS X Dashboard widget that would let me find products on Amazon and automatically generate an affiliate link: no love. Searched for blog posts about how to do this: Dave Taylor had some interesting advice, but it seemed outdated (given that I’ve never seen the types of URLs that he uses as examples before), and Noah Coad’s regex, while definitely good to know for non-affiliate links, doesn’t mention how to append an affiliate ID. Chris Thomson posted Using Amazon Associates Easily in MarsEdit recently, but his solution churns out hideously long URLs (and his MarsEdit macro forces you to input text; I don’t like doing that).

So here’s what I’ve come up with, which is hardly revolutionary. First step is to search for something via Amazon’s normal webpage (forget that convoluted affiliate link generating crap). You’ll get something hideous like this:

http://www.amazon.com/Neverending-Story-Michael-Ende/dp/0525457585/ref=pd_bbs_sr_3?ie=UTF8&s=books&qid=1203784616&sr=8-3

Yuck. The part that you want is the string of letters and numbers immediately after /dp/. This is the product ID. Copy it out of your address bar.

Now you just need to construct your shortened version. Insert the product ID into a URL that looks like this:

http://www.amazon.com/dp/0525457585/?tag=beckism-20

Of course, use your own Amazon.com affiliate ID instead of “beckism-20″, and stick the product ID after /dp/.

This link is the smallest format that I can find that is recommended by multiple people on the Amazon Affiliate discussion boards. I’m curious, however, if Dave Taylor is still correct about just slapping the tracking ID onto the end. If you’d like to help me test this, click here (I don’t expect you to buy Neverending Story, although it’s a classic and well worth reading, but in a day or so the affiliate reports will show that someone clicked a link, and then I’ll know for sure; currently the affiliate ID in the link hasn’t been published anywhere else).

I’m sure this is a common problem, so let me know in the comments if you’ve heard of a better way. Also, be aware that there’s the possibility that shortening your links down like this may disable some of Amazon’s fancy reporting stuff. I have no idea (or any way to test it).

Lastly, if you’re using MarsEdit, you can make the link creation process incredibly easy. Open up a post (or new post) and choose the “Markup” dropdown in the toolbar (or select Post→Text Markup→Edit). Click the + button to add a markup macro, name it whatever you like, and stick this in the opening tag:

<a href=”http://www.amazon.com/dp/#pastetext#/?tag=beckism-20″>

(Again, replace “beckism-20″ with your Amazon Affiliate tag.) The closing tag is obviously just </a>. If you like, assign a keyboard shortcut for easy access. All you need to do to use the macro is to copy the product’s ID (which follows /dp/ in the standard Amazon URL) before selecting the MarsEdit macro. The macro will deal intelligently with selected text (or lack thereof) without your needing to do a thing.

Update April 13, 2008: After a couple of other people have tested the linking in the comments (and having myself tried both the shortest method and the method I recommend in the article above), it turns out that the format http://www.amazon.com/dp/0525457585/beckism-20 does not work. The shortest format you can use is http://www.amazon.com/dp/0525457585/?tag=beckism-20 (a similar format is additionally cited on Amazon’s own blog, so presumably it will be valid for the foreseeable future).

Making Sapiens useful

I’ve shared my exploration into the world of tablet-friendly software, and there I recommended Sapiens, an application launcher that uses a mouse gesture to pop up a circular menu that provides you with quick-click access to the programs that you most often need in that context (Sapiens watches your habits and learns what programs you need/want the most over time). It’s a clever piece of software that’s beautifully designed.

But I’ve got a little secret for you: Sapiens actually totally sucks when you use it with a tablet. I don’t know about you, but when I’m drawing I tend to use a lot of circular motions. Sometimes I use motions that aren’t actually circles, but that are close enough for Sapiens. After about the third time I see Sapiens’ expanding dotted lines, I’m usually swearing like a sailor.

Sapiens does provide a list of excluded applications, so I could, for instance, disable it in my various drawing apps where I use circles the most. However, this totally defeats the point of using it for me since I’m mostly needed it when I’m using my tablet, and I’m mostly using my tablet when engaged in an artistic endeavor.

Fortunately, there is a simple solution: xGestures. xGestures has the happy benefit of requiring you to hold down a button while you make the gesture (right mouse button by default, which translates into the bottom button on a Wacom pen), so unlike Sapiens it rarely activates accidentally unless you make a habit of holding down the right mouse button while you move your mouse around.

To rid Sapiens of its annoying mouse gesture, circle your mouse for the last time, click the preferences icon and set things up in the “Activation” tab as shown (just follow the orange arrows):

Setting up Sapiens' activation prefs

You can set the hotkey to anything you like (just make is obscure so that it won’t be likely to conflict with another application). Then in xGestures, set up the gesture. I used a circle (after all, why not?). If you do use a circle and are using a tablet, I recommend drawing circles with xGestures a few times before you actually define the gesture. I found that my typical circle can register in a number of different ways, but by drawing it a few times I found the one that I use the most often, and then stuck with that.

And now that Sapiens is actually on-demand instead of constantly interfering, life is much, much better.

Getting your tags into MarsEdit 2.1

I’ll make this short and sweet:

Although MarsEdit 2.1 added tagging, it didn’t include an easy way to migrate in your old tags (it only remembers tags that you’ve added to a post using MarsEdit). There are two workarounds for this:

1) Edit a MarsEdit plist (not too painful, but still not fun)
2) Open up your old posts and select the tags

Seriously, all you have to do to get MarsEdit to remember a tag is to select it. If you have a fairly short list of posts (or quick fingers), this is simple. Make sure that the tag field is turned on for your blog and that it’s the last field before the content in the post window. Then:

  • Hit Enter (to open the selected post)
  • Shift-Tab (to select the tag field, which incidentally selects all of the tags, adding them to MarsEdit’s memory)
  • Command-W (to close the window)
  • Arrow down, Enter (to open the next post)

Rinse and repeat. Repetitive, but if you don’t want to touch a plist it’s probably an acceptable substitute, and once you get the pattern down you can very quickly drill down through a number of posts (one hand for arrows/enter, one hand for shift-tab and command-W). If you’re not impatient, it looks like Daniel Jalkut will be implementing some sort of friendly tag management interface down the road.

Because I’m a drummer and possibly crazy, I put on some music and did it in rhythm. This is more fun than it sounds; kind of like a poor man’s Guitar Hero. Without a guitar. Or any heroics.

Migrating old images into MarsEdit 2

MarsEdit is a brilliant product, and one that I’ve been trying to use for my blogging ever since version 2.0 was released by Red Sweater Software (aka Daniel Jalkut). Initially, though, I didn’t have much luck and kept finding myself returning to the WordPress web interface. However, version 2.1 finally added decent tagging, which provided the impetus to at last move all of my blogging activities into MarsEdit.

For Beckism.com this was easy, but for Tagamac I had a big problem: MarsEdit didn’t give me access to the many images that I’ve uploaded using the WordPress web interface. This is a major issue for Tagamac, because I reuse images a lot (when writing about software updates).

Although Daniel Jalkut has stated that he’s going to implement some form of image migration, I got impatient this weekend and hacked my way through the MarsEdit uploaded files plist. It took me about an hour and a half to get the 40 images I wanted in, but after I hammered out a few details the process was pretty straight-forward. For anyone else who is frustrated by the lack of their old images in MarsEdit, read on for some tips and advice on how to hack your own plist and lead a happier, more fulfilling life.

Before you get started, a few disclaimers: this process is completely unsupported by the developer, and if you don’t know what a “plist” is, you should probably stop right now or else proceed very slowly and cautiously. Mucking around in preference files is an excellent way to screw up your app.

With that out of the way, let’s get started.

First off, go invest in PlistEdit Pro (or at least download the demo). You’re going to be doing a lot of copying and pasting, and trust me: you don’t want to edit plists in plain text form. PlistEdit Pro also lets you duplicate and drag and drop XML nodes, which makes it about a trillion times more useful than the default Property List Editor included with Mac OS X.

Assuming you’ve got PlistEdit Pro, open MarsEdit, make sure that you’ve uploaded at least one image using its Media Manager to the target blog, and then quit the program. It’s possible to do everything from scratch, but this will make your life a lot easier.

Navigate to ~/Library/Application Support/MarsEdit/ (if you’re not familiar with that notation, “~” means your user account folder, which is the folder that contains the folders Documents, Desktop, Music, Pictures, etc.). Duplicate the file UploadedFiles.plist so that if you totally screw up you can get MarsEdit working again. Open UploadedFiles.plist in PlistEdit Pro.

Next, open the ~/Library/Application Support/MarsEdit/UploadedFiles/ folder and go through its sub-folders until you find the image you uploaded using MarsEdit to the target blog. This is where you’ll be copying all your old images into.

The UploadedFiles.plist file is organized into a root level which contains a bunch of numbered entries (starting at 0). If the image you uploaded to your blog was the most recent image you uploaded, it should be the highest numbered row. Find it and toggle the row open using the little arrow. You should see something like this:

MarsEdit plist example

This is where you realize just how much work you’re in for and give up. If you’re lucky (like me) and all of the images you need to migrate into MarsEdit are the same size and type of image, you’ll be editing four of those entries for each image, copying the image into the folder you found above, and creating a thumbnail version of it for MarsEdit to display. If your images differ in size or type, then you’ll be editing all but three of the fields for each image.

You have to want this.

If you’ve decided that yes, you do want it that bad and absolutely can’t wait for Daniel Jalkut to implement some sort of migration assistant, here’s the process:

Select the row you toggled open (”3″ in the example above) and click the “Duplicate” button in the PlistEdit Pro toolbar. The duplicate will be inserted immediately below and everything will be automatically renumbered (so your duplicate entry would be “4″ in the example above). To make your life easier, drag the duplicate to the very bottom of the list. This will reduce confusion when you begin duplicating over and over.

The general workflow that I followed and recommend:

  • Duplicate the last row (which I just described) so that you get all the weblogName, weblogUUID, and so forth for free.
  • Used your blog’s admin interface to get the URL of the image (I had an empty post open so I could insert the images as I went).
  • Because the image name and month were about all that ever changed in this path, I’d just switch back to PlistEdit Pro and change those in the url entry by hand. If yours differ a lot, you may want to use copy and paste.
  • Edit the copyFilepath, imageThumbnailPath, and originalFilepath fields with the image’s name and appropriate path. For the first one I used PathFinder’s Copy Path→Unix command (available in the right-click contextual menu). All of my images were in the same directory, so after that I just edited the filename at the end. If yours are located in different places, you’ll need to edit the entire path for each image.
  • If your image is a different width/height from what’s shown in the imageHeight and imageWidth fields, then you’ll need to edit these. Mine were all the same, making the whole process that much easier.
  • Set originalFilename to the text that you wanted to be used as the image’s alt text (MarsEdit by default uses the actual image name, e.g. “example.jpg”, but as long as you have the chance to set some intelligent alt text, I say why not? As far as I know, this field isn’t used for anything else).
  • If your image is a different type than the image you duplicated this row from, you’ll need to change the mimeType entry accordingly (some common mime types: “image/png” for PNGs, “image/jpeg” for JPEGs, “image/gif” for GIFs). Odds are, the world will not end if a few mimeType entries are incorrect; I don’t know if it’s actually used by MarsEdit after the image has been uploaded.
  • In the Finder, copy your image into the appropriate folder (you located it inside the ~/Library/Application Support/MarsEdit/UploadedFiles/ folder already). If you don’t have the image backed up on your local machine, download it from your server.
  • Duplicate the image for the thumbnail. If either height or width of the image exceed 128 pixels, you need to resize the thumbnail (in whatever editor you prefer; I recommend Acorn) so that both dimensions are 128 or less.
  • Edit the name of the thumbnail version so that it’s the same as the image with “.com.red-sweater.thumbnail” appended to the end (e.g. “example.jpg.com.red-sweater.thumbnail”).

And that’s it! The image should be added to MarsEdit now, and accessible from the Media Manager catalog tab. After you add the first one, you should probably save the plist and open MarsEdit to make sure that it shows up the way you expect. If it does, then feel free to add as many other images as you need using the same basic process. As long as you take it slow and make sure that you get all the names right, you shouldn’t have any problems.

Some notes:

The type of image of the thumbnail doesn’t appear to matter. Theoretically, the name of it shouldn’t matter, either, as long as you have the correct name in the plist file. The naming convention described above is the way MarsEdit does it automatically, though, so it’s probably a good idea to stick with it.

The copyFilepath and originalFilepath entries may well be optional. In fact, you might well be able to get away with only copying a thumbnail version of the image into MarsEdit’s Application Support area since when it comes to viewing the image in the Media Manager and adding it to your blog posts, the only things that matter are the thumbnail and the URL. I didn’t experiment with this, but if you do let me know in the comments if it works or not!

Overall, this is a major pain (it took me a good hour and a half to two hours to migrate the 40 images that I need into MarsEdit), but if you use your images a lot like I do, it can really help you move into MarsEdit and out of the web interface once and for all. Particularly compared to WordPress’s terrible image manager, MarsEdit’s Media Manager is a breath of fresh air for me. Good luck!

Track me like a stalker:
  • Tagamac
  • Twitter