When photos are exported from iPhoto using the Export function, all the photos will get the current date/time stamp. But if you use any of these photos in an app that organizes them by date/time, then the organization will be lost. For example, I export a set of images from iPhoto to view in my Wii's photo tool, but those images are organized by date.

To fix this problem, I took advantage of the EXIF data in the JPEG images from my digital camera. To batch change a large set of images, I use the open source command-line tool jhead, which is available as a pre-compiled Intel binary (source code is also available from the website, or via Fink).

I copied the jhead binary into an Applications folder in my home directory, and made it executable with the following command:

Don't forget to make the shell script executable as well.To run the script, just change into the directory with all images and run the shell script.

[robg adds: This worked for me, though the script does more than just change the date -- it also changes the extension from .JPG to .jpg. In my case, my exports already had a lower-case name, and I didn't want the filename changed, so I simplified the script by just using the second (find . -type...) line.

Once I had it down to one line, I realized a script wasn't necessary. Instead, I created a new alias in my .profile file:

Sometimes I find the need to copy a file's timestamp to another file. For example, when I do batch conversion of video files (e.g. via VisualHub), the converted files' timestamps are all based on the current date. Subsequently when I import them in iMovie, I have to spend some effort to get them to show the correct date. It would be nicer if the converted files' timestamps were exactly the same as the original ones.

So I created this shell script, which allows you to copy the timestamp from one file to another.

I don't know if this is already common knowledge, but it's been an irritation to me for some time and I finally figured it out. Whenever I tried to use CPAN to install Perl modules in Mac OS X, I would always get a never ending series of long waits and error messages akin to:

When I searched for the error messages, all the top hits lead to the same question others had with no responses. Finally, I kept digging and tweaking my search parameters until I found a solution that worked. You need to set an environment variable to tell CPAN to use passive FTP mode. I have aliased this so that I never need to think about it again:

env FTP_PASSIVE=1 perl -MCPAN -e shell

If you type that into the command line, CPAN will finally work correctly. Don't forget that you may need to sudo the command.

Files with Japanese names that show up fine when I'm in the local terminal, all turn into ???? when I ssh in from my laptop. It's because the locale of the remote sessions is ignoring the default locale and encoding of my local terminal. My local terminal defaults to "en_US.UTF-8," while the ssh sessions are something called "C," which apparently doesn't support Unicode.

One solution I've discovered is to to edit the ssh_config and sshd_config files so that the client sends the language environment variables, and the server accepts them. I've created two commands you can run in Terminal to achieve this:
On the server, you should run:

These commands append lines to your config files. They tell your client and server to respectively send and receive only the environmental variables that control language. You do not have to restart the server after running this command because the new config will be applied to the next session.

If you have the problem that OS X doesn't recognize your FAT/NTFS partition because GNU parted changed the partition type to "Microsoft Reserved," this might help.

In GNU parted, it looks like 'msftres' was a flag, but this is not the case. It refers to the partition type 'Microsoft Reserved,' which can be used for NTFS and FAT. The partition type 'Basic data' can also be used for these file systems, which is then recognized by OS X.

Fortunately Linux also uses 'Basic data' for its main partitions, so the solution is to change the file system type to ext2 using GNU parted.

Many contributors have come up with ways to read man pages in a more usable format. However, using troff to produce PDFs takes time and I don't really like the output. There are also some excellent man page reading apps out there, but they require launching and browsing a list.

So I came up with a simple shell function to provide exceptionally fast lookups from the Apple Developer site's HTML man pages. That way, you get your nicely-formatted Darwin-specific man pages in a tab in your browser.

The function uses man -w to get the section number and then forms a URL which then gets launched. The web pages are organized by section, and so the URL is not straighforward. I'm new to sed, and my guess is that there are readers that can improve my regex. I've tested this with with a variety of commands, but certainly not exhaustively.

Drop this into your user's .bashrc file. You should also put it into .bash_profile if you maintain them separately -- my .bash_profile has a single line (source ~/.bashrc), so I only have to maintain one.

Thereafter, you can just type wman and the name of the command you want (e.g., wman rsync). If anyone knows how to automatically scroll the browser down to the horizontal rule, I'd love to know how. There are no named anchor points in the pages, so a # in the URL doesn't work.

While browsing commandlinefu.com (a very useful site, by the way), I found this gem that uses Python to quickly set up a webserver for the current directory in Terminal. First launch Terminal and cd to the directory you'd like to access via your web browser. Then just use this command to start a webserver serving just that folder (and folders within it):

python -m SimpleHTTPServer

The webserver runs on port 8000, so to access the pages in your browser, you'd use http://localhost:8000. If you'd rather run the webserver on another port, just include the port number on the python line: python -m SimpleHTTPServer 8080.

Depending on which browser you're using and the files you're browsing, you may be able to open the files in the browser, or via a helper application. Safari, unfortunately, wants to download file types it doesn't know about, which may not be all that useful.

To quit the server, press Control-C in Terminal (does anyone know a more graceful way to do this; Control-C throws a bunch of errors as it quits?).

Terminal is very useful in managing of rooms of Macs with Apple Remote Desktop. One thing I do often is change the screen resolution. To do that, I use a custom Terminal program that's based largely on Jeffrey Osterman's code posted in this Mac OS X Hints Forums thread.

It is easy to compile (you'll need Xcode to do so, however), and it supersedes the old and missing cscreen. First, here's the code:

If, for some reason (space in my case), you want your applications to reside somewhere other than /Applications, you will still want to have links to those relocated programs in /Applications. For Apple applications, updates are likely to fail if the applications aren't located there, and tools like AppFresh only search that location.

Creating a bunch of aliases is tedious, so here's a quick Terminal trick (that I didn't think would work, as it doesn't under Linux):

$ cd /Applications
$ ln -s /path/to/apps/* .

Change /path/to/apps to the path to your replacement Applications folder, and then run those two Terminal commands (don't overlook the very-important . at the end of the second one), and you're done.