All posts by David Davidson

Taking Screenshots in Mac OS X

MacRumors has pretty much everything you need to know.  You can also take screenshots remotely, over SSH.  (Just remember that with great power, comes great responsibility.) The only thing the built in functionality can’t do is take full screenshots of windows that scroll beyond the screen.  There’s tons of commercial apps to do that, but Papparazzi! will do the job for free.

Change file associations in OS X

Do you want to open a particular file with another program in OS X?  If you want to open it just once, you can right/control-click and select “Open With.”  (Since I have VMware Fusion installed, I can open files in Windows directly from the Finder!)

To open a single file with a particular program every time, right/control-click, and Get Info.  Then you can select to program to use under “Open with.”

This change only applies to current document.  To change the default program for all documents, click “Change All…” and confirm.

Tutorial #2: Organizing your music library

My music library began sometime in the late 90’s with hours spent waiting for MP3’s to download from the Internet or be ripped with my 4X CD-ROM and AMD K6-2 processor. Today, I mostly get my music from the Amazon MP3 store and the bargain shelf at Half-Price Books. When I was preparing to transfer my music to my new Mac, I wanted a way to clean up my music library and add correct meta data (song info and album art) to all my songs.

Tagging and organizing files:

Thanks to audio fingerprinting technology, it is now possible to quickly identify a song based on a short sample of its audio. There are a number of free and commercial tools for doing this. The one I used is MusicBrainz Picard – a free program for Mac and Windows. Picard comes with a graphical online tutorial, so I’ll just provide some additional tricks:

Be sure to go through Picard’s options as well as the list of plugins available online. I got the cover art downloader to get album art from some additional source. If you are willing to do additional work, you can get plugins that automatically search Amazon.com or Google Images for album art for Picard and iTunes.

Unfortunately, Picard does not support AAC4 files, so any files purchased from the iTunes music store will not be updated -but that’s OK, since iTunes music is already tagged. I enabled the rename file option and set the Various Artists custom field to nothing. This moves songs from compilation CD’s into the folders of their respective artists. I checked the Move Files option and picked a folder on my desktop so I could see just how much music was tagged. This also allowed me to delete all the empty folders.

Ultimately, Picard was able to look up about 90% of my music and tag 96%. (You can use existing tags to find album art even if the audio fingerprint is not recognized.) About the only tracks it did not recognize were AAC-encoded files and bootlegs recorded from radio and live events.

Fixing corrupt MP3’s:

After tagging all my music, I had to fix all my corrupt files. iTunes is very picky about only playing files that conform to the Mp3 standard, and will silently skip any that don’t. This is a tricky problem to identify, as iTunes will silently skip over bad Mp3 files in Windows and silently refuses to import them at all in OS X. I only noticed that it was doing so because of the different song count in iTunes. Ultimately, over 20% of my music was corrupt – but if your MP3’s are from the Internet, or a number of years old, your count may be much higher.

The best tool I found to fix corrupt files was MP3 Validator. It’s a Windows application, but I was able to run it in Crossover for Mac, and I assume it will work in other Wine distributions as well. Just follow the instructions to run it on all of your files before importing it into iTunes.

iTunes AppleScripts and helper apps:

Once your music is in iTunes, I found a few helper applications and scripts to keep it organized. Doug’s AppleScripts for iTunes has hundreds of scripts you can run to perform various operations in iTunes. My favorites are Super Remove Dead Tracks, and embed album art in files. I also use GimeSomeTune to automatically look up lyrics for songs and control iTunes with my Apple Remote. In Windows, I also used TuneUp, a commercial music labeling and cover art application that is “coming this fall” to the Mac.

Using the new ClearType fonts on your Mac

One of the nice touches of OS X is the use of the Helvetica typeface for rich-text editing in TextEdit and other programs. Microsoft’s version of Helvetica is Arial, which is basically a lower-quality rip-off of the original. (To understand my attraction to Helvetica, I recommend watching Helvetica, the documentary.)

However, in Vista/Office 2007, Microsoft released the ClearType Font Collection, a great new set of fonts, including several designed especially for viewing text on computer screens. The two I find particularly useful in this regard are Cambria, which is optimized for viewing small text, and Consolas, which is a monospaced font useful in programming and the like.

So how do you get these fonts in your Mac? Well, they come with Office 2008 for the Mac. After you install office, just go into your favorite editor’s preferences and select Cambria and/or Consolas as your default font.

If you don’t have Office 2008, things are a little trickier. This tutorial will guide you through installing the fonts in Windows and Linux – and OS X, if you install the required Linux utilities via something like MacPorts. Office 2004 users can get some of the fonts with the Open XML Converter. If you have a Vista computer, you can copy them from C:WINDOWSFonts to /Library/Fonts. If you have a pre-Vista OS, you can get them with the free Powerpoint 2007 viewer. If you are still out of luck, you can always purchase them directly from the foundry.

Google Mobile for the iPhone – now with voice search

The latest update for the Google Mobile iPhone app has a very cool feature:  voice search.  You just open Google Mobile, lift the phone to your head and say what you want to find.  That’s it.  When I said “What is the latest book by Neal Stephenson?” I got:

Your iPhone knows where you are, so you can ask about places and events nearby, and Google Mobile will hook you up.

P.S.: To take screenshots on the iPhone, press the sleep/wake + home button.  The screen will flash to let you know it worked.

Better remote desktop for OS X

If you want to access a Windows computer remotely, you can use the built-in Remote Desktop functionality – if you’re lucky enough to be running a professional edition of Windows XP or Vista.

OS X also comes with remote desktop support in the form of a built in VNC server, which is calls “screen sharing”. You can enable screen sharing in the Sharing preference pane. Unfortunately, the built in VNC server and viewer in OS X are very limited, especially if you’re used to the Remote Desktop functionality of Windows.

If you have a few hundred dollars to spare, you can purchase Remote Desktop for OS X. Otherwise, you can enhance the built in viewer and run your own VNC server for free. If you are connecting to OS X from Windows, there are many VNC viewers to choose from, such as Tight VNC, Ultra VNC, and Real VNC. The servers for Ultra and Real VNC are commercial, but the viewers are free.   My favorite is the Real VNC viewer from their Enterprise edition.  (You can download the viewer separately.)

My favorite option lacking from the build-in functionality is “Adapt to Network Speed”, which automatically adjusts the image quality to the speed of your network.

P.S.: If you want to access Windows from your Mac, get Microsoft’s Remote Desktop for OS X.  Another free option for both Mac and PC is LogMeIn.com

Tutorial #1: Using a Mac with a Windows pc

This post is about getting started: moving your files to the Mac (and back), sharing hardware, and running Windows applications on your Mac.

Sharing input devices between a Mac and Windows (or Linux) PC

I like working on my Mac, but I still have many things that I need my Windows pc for, so I dedicate a single monitor to each on my desk. I switch between OS X and Windows constantly, but I don’t want to keep two keyboards and two mice on my desk.

One solution is to use a KVM switch. A KVM switch is a gizmo that allows you to switch your Keyboard, Video and Mouse between two computers. But we already have two monitors, and so there is a free software option: Synergy. Synergy allows you to share input devices and clipboards between two computers, kind of like two monitors connected to a single computer.  Get it for for Mac, Windows, and Linux.

After you install Synergy on both computers, you need to set up one computer as a client and the other as a server. I use my Windows PC as the server, since it’s always connected. LifeHacker has some detailed instructions for setting it up.

Sharing and synchronizing files between a Mac and a Windows PC

If you’re like me, there are some files you want to have copies of on both Windows and Mac, and some files you want to keep on one PC and access from both. For example, I want to take my music with me but also want to be able to play at home. I have a huge photo collection that requires my Windows-licensed editing software, so I keep that on my PC. I also have my work files, which I keep on a portable hard drive, so I can access them on any computer.

To share files:

First, get both computers online on the same network. Second, enable file sharing in OS X and Windows XP or Vista. When specifying the folder to share, I shared the home folder of my respective Windows and OS X user accounts, which gave me access to my music, docs, etc. Now, you can easily copy files and directory from one computer to another. I suggest you map the Mac share as a drive in Windows. In OS X, you can select Go -> “Connect to Server” and then type “smb://PCNAME”, where PCNAME is the Windows computer name (Computer->Properties) to mount any of your shares in Finder.

To keep files in sync:

There are many neat OS-X exclusive tools for editing music (more on that in a later tutorial) so I want to be able to edit my music and synchronize it back to Windows, including any moved and deleted files. Furthermore, I want to synchronize just the changes, without having to delete my Windows version and copy everything every time. The best tool I’ve found for doing this is Microsoft SyncToy. It’s Windows-only, but you can use it to synchronize folders either way. There’s an outdated tutorial on this at LifeHacker, but I suggest you try all three synchronization options, and use the “Preview” option before every sync to verify that it’s doing what you want.

Share a backup drive:

You have automatic backup enabled on all your computers, right?  Right? Backing up your Mac is very simple: just pick a destination for your backups and enable Time Machine. In my case, I have a shared external drive I use for several Windows computers as well as my Mac.  Time Machine requires a natively formatted partition, so I had to shrink the NTFS partition in Windows, create an empty volume for the Time Machine partition, and then format that partition with Disk Utility to be a native OS X volume.  Now I can use a single drive for all my Windows and Mac backups.

Accessing your files remotely from another computer:

A great free tool for accessing your files from your Mac/Windows remotely is another Microsoft product – Windows Live FolderShare. It works quite well with both Windows and OS X, even behind firewalls. You can set up synchronized folders, or just browse the entire file system on the web.

Running Windows (and Linux) apps on a Mac

There are three ways you can run Windows applications on a Mac:

· Use Boot Camp to install Windows on a dedicated partition and rebooting to switch operating system.

· Run Windows in a virtual machine application such as VMware or Parallels. You can use both with your BootCamp partitions, so you don’t need to keep two installations.

· Run Windows apps natively with Wine. Wine is a compatibility layers that allows you to run most Windows applications at full speed. I use the commercial product CrossOver for Mac, but you can also use the free Darwine. (Get the latest unofficial build of Darwine.) Using the unofficial TriX add-on that comes with Darwine, you can add native Windows components to Wine, increasing the range of the Windows applications you can run.

Viewing Windows files on OS X

OS X does not support Windows Media files by default, but there is an easy fix for that: Flip4Mac ads Windows Media support to QuickTime, and the VLC media player will play pretty much everything else you’ve got. While you’re on the Microsoft website, you may want to get Microsoft Remote Desktop for OS X, so you can connect remotely to Windows pc’s.

Using the Apple Keyboard in Windows and Logitech keyboards/mice with OS X

I have an Apple Keyboard which I occasionally use with Windows, so I got AutoHotKey and cobbled together an autohotkey .kbd script to remap some of the keys in Windows to their usual positions on a Windows keyboard.

I also got Logitech Control Center for my Logitech keyboard and mice – unfortunately it only recognizes one of my two mice.

Introduction: how I became a Mac evangelist

I’ll keep this short so you can get to the good stuff:

A dedicated Windows user and programmer, I got my first Mac a few weeks ago. I came for the shiny metallic and glass enclosure of the MacBook, but stayed for the highly usable, powerful, and shiny metallic and glass operating system.

I immersed myself with my MacBook for several weeks, withdrawing periodically only to eat, sleep, and lecture my friends on the superiority of everything Mac.  Having thoroughly annoyed my immediate acquaintances, I have decided to let my wisdom loose on the web.

Mises Tagging Overview

The framework used to tag pages on Mises.org is a tagging library I developed to tag any kind of content on Mises.org.  The tag library references GUID‘s assigned to all objects in the Mises.org databases.
It tracks users by username or IP address as well as the date that each tag was added.  It includes spam/bad word filtering and has some simple tag rewriting to automatically correct misspelled words and incomplete names.  For a simple tag example, see business cycle.

Update: Mises Tagging is now an open source project!  See the project page for details.

Architecture overview:

Database layer:

The database schema gives a good indication of the
data-access layer:

Tag Schema

Stored procedures:

UI Layer:

The interface is organized into self-contained user
controls.

  • TagCloud.ascx – a tag cloud for the given document
    Example: http://mises.org/resources/3250  (Sroll down)
  • EditTags.ascx – an editable list of tagged
    documents and a user-specific tag cloud.
    Example: http://mises.org/mymises/
    (You’ll have to register at Mises.com tag some documents first.)
  • TaggingStats.ascx – global tagging statistics
    Example: http://mises.org/clouds.aspx#stats

Management:

  • DocumentTags.ascx – an editable list of tags for a particular
    document
  • Tags.aspx: delete tags, delete all tags by a particular user
    and search/replace tags

The MisesBot:

You might have noticed that 99% of all tags are entered by
the MisesBot.  The bot is an application
that uses the meta tags collected by the MetaParser (detailed in a future post)
as well as other available metadata to add tags to document.

Thanks to:

  • Cloud Control for ASP.Net – displays a list of hyperlinks in
    varying styles depending on a weight.
  • Toxi – the inspiration for the tag schema
  • Freetag, an Open Source Tagging / Folksonomy module for
    PHP/MySQL applications – the inspiration for the business logic layer
  • Community Server –  Inspired the tag browser interface and provided the banned words list.

To do:

  • Did you notice the TagAuthority field in the tag
    schema?  A future version of the MisesBot
    will automatically determine the “authoritative” document for each tag.
  • Automatically mark up content.  If we know the authoritative document for a
    tag, we can automatically link to it when that tag appears in the document text.
  • Improving the “related tags” algorithm.  I could use some help with this:

Here is the query to get related tags.  The problem is that it currently ranks tags according to their total popularity, not their “related-ness.”

CREATE
PROCEDURE [dbo].[TagGetRelatedTags]
        @Tag VARCHAR(70)
AS
BEGIN
        DECLARE
                @TagId int
                SET @TagId =
                        (SELECT TagId FROM Tag WHERE Tag = @Tag)
                        SELECT  TOP 30 Tag.Tag,
                                COUNT(TagMap.TagId) AS 'Count'
                        FROM    TagMap
                        INNER JOIN Tag
                        ON      TagMap.TagId    = Tag.TagId
                        WHERE   [TagMap].TagId <> @TagId
                            AND (TagMap.TagId  IN
                                (SELECT DISTINCT TagId
                                FROM    TagMap
                                WHERE (ObjectId IN
                                        (SELECT ObjectId FROM TagMap WHERE (TagId = @TagId)))
                                )
                                )
                        GROUP BY TagMap.TagId,
                                Tag.Tag
                        ORDER BY 'Count' DESC
                END

ASP.Net: Adding feed auto-discovery & meta tags to the page header

Every now and then, I will post code snippets which others might find useful.  Here is one:

How to add an RSS auto-discovery meta tag to the page header:

 Private Sub AddRSSLink(ByVal title As String, ByVal URL As String)
        Dim link As New HtmlLink
        link.Attributes.Add("type", "application/rss+xml")
        link.Attributes.Add("rel", "alternate")
        link.Attributes.Add("title", title)
        link.Attributes.Add("href", URL)
        Page.Header.Controls.Add(link)
    End Sub

What about meta tags?

Dim hm As New HtmlMeta()
hm.Name = "Description" ' Or Keywords
hm.Content = "Description..."
Page.Header.Controls.Add(hm)

Why not just put this in the .aspx you ask? Check out the tags on this page for the answer.