Friday, August 28, 2009

Download, back up, and upload Google Docs files

You can download, back up, and upload documents from your Google Docs account using a little Terminal magic. Prerequisites:
  1. gdata-python-client 2.0.1 - download page
  2. gdatacopier 1.0.2 - download page
Installation:
  1. Download the prerequisites. Decompress each of the downloads.
  2. Install gdata-python-client:
    $ cd gdata-2.0.1

    $ sudo python setup.py install
Patch:

The current gdatacopier download has a small bug in it, and it needs to be patched to work properly. Open the file gdatacopier.py in the app's folder, and locate line 555. On that line, change this...
item_list.append({'title': entry.title.text.encode('UTF-8'),
...to this...
item_list.append({'title': entry.title.text,
Save the file and quit the editor.

Usage:

By default, gdatacopier will download your spreadsheets and text documents in the OpenOffice format (.ods and .odt, respectively). TextEdit does a pretty good job of opening the text (.odt) documents, but I was unable to find anything free that could open the spreadsheet (.ods) documents, so you may want to specify a specific format when downloading your documents.

Variables
  • $DIR = local download location
  • $USERNAME = Google email (e.g. someone@gmail.com)
  • $GOOGLEID = Google docs id number. You can find the document's Google ID by using the list- commands below. Make sure to copy only the Google ID from the listing -- not the date or other data. Also make sure to enclose the Google ID in quotes in your command.
Examples:
  • Display gdatacopier help: ./gdoc-cp.py --help
  • Back up all Google Docs in OpenOffice format: ./gdoc-cp.py --username someone@gmail.com --export default --google-id all --local $DIR
  • Back up all Google Docs spreadsheets in Excel format: ./gdoc-cp.py --username $USERNAME --export xls --google-id spreadsheets --local $DIR
  • Back up all Google Docs Text in Rich Text format (retains most formatting): ./gdoc-cp.py --username $USERNAME --export rtf --google-id documents --local $DIR
  • Back up all Google Docs in PDF Format: ./gdoc-cp.py --username $USERNAME --export pdf --google-id all --local $DIR
  • List all Google Docs: ./gdoc-cp.py --username $USERNAME --list-all
  • List all Google Docs spreadsheets: ./gdoc-cp.py --username $USERNAME --list-sheets
  • List all Google Docs text documents: ./gdoc-cp.py --username $USERNAME --list-docs
  • Find a specific Google Doc by title: ./gdoc-cp.py --username $USERNAME -p $PASSWORD --list-all | grep Casserole
  • Download a specific text document in TextEdit (rtf) format: ./gdoc-cp.py --username $USERNAME --export rtf --google-id "$GOOGLEID" --local "OUTPUT_FILENAME.rtf"
  • Download a specific spreadsheet document in Excel (xls) format: ./gdoc-cp.py --username $USERNAME --export xls --google-id "$GOOGLEID" --local "OUTPUT_FILENAME.xls"
  • Download a specific document in PDF format: ./gdoc-cp.py --username $USERNAME --export pdf --google-id "$GOOGLEID" --local "OUTPUT_FILENAME.pdf"
  • Upload a document to Google Docs (rtf, txt, xls, doc): ./gdoc-cp.py --username $USERNAME --import --local "INPUT_FILENAME" --title "OPTIONAL_TITLE"
Notes:
  • A password can be hardcoded into the command if desired.
  • The current version of gdatacopier (1.0.2) is unable to upload all the file types supported by Google Docs (including PDF, html, docx, and possibly others -- that's all I tested).
  • gdatacopier-1.0.3 in the repository appears to offer support for presentations and some other options including folders (aka tags). If you want to play around with it you can get it here. (The code must be patched as above, plus also patch line 289: download_document(document_id, file_format, local_path, write_metadata) -- change that to download_item(document_id, file_format, local_path, write_metadata).)
  • A future v2.0 is in the works, hopefully soon.
  • Maybe a crafty AppleScript Studio programmer could write a GUI for all this.

Apple to release Mac OS X Snow Leopard on August 28



Mac OS X Snow Leopard


The world's most advanced operating system. Finely Tuned.
Available on August 28, 2009.



Apple announced Monday that Mac OS X 10.6 Snow Leopard will go on sale Friday, August 28 at Apple's retail stores and Apple authorized resellers, and that Apple's online store is now accepting pre-orders.

Wednesday, July 15, 2009

Firefox 3.5's Three-Finger Swipes

In addition to the previous "twist" gestures which are disabled by default, Firefox 3.5 also ships with default enabled multi-touch swipe inputs:
  • Three-finger swipe up: Home key (top of the page)
  • Three-finger swipe down: End key (bottom of the page)
  • Three-finger swipe left: Browse back
  • Three-finger swipe right: Browse forward
These can be edited by entering about:config in the address bar. Enter swipe in the filter box.

Use web proxy auto-discovery in Safari

Unlike most browsers, Safari doesn't have a setting to use WPAD (web proxy auto-discovery) in OS X. However, there is a way to ask Safari to automatically detect the network's proxy settings, but only if your network administrator has configured WPAD on your network.

This auto-detect feature works through DNS. The browser looks for a host named "wpad" and if it exists, loads its settings by accessing a file named "wpad.dat" via HTTP. To use DNS-based WPAD with Safari on OS X, follow these steps:
  • In Safari, choose Safari » Preferences
  • Click on the Advanced icon
  • Click on the Proxies » Change Settings button
  • In the Configure Proxies dropdown menu, select Using A PAC File
  • In the PAC File URL field, enter http://wpad/wpad.dat
  • Click on OK
  • Click on Apply
Again, this is only helpful if your network administrator has set up a proxy to be auto-configured. If you're on a network that doesn't have such a setup, Safari will still work but much, much slower. To find out if your network supports proxy auto-detection, visit http://wpad/wpad.dat in your web browser. If your network supports WPAD, then your browser will download the file "wpad.dat" (which you can just delete). If it's not supported, you'll get an error message.

Tuesday, July 7, 2009

Remove Safari history files on logout via shell script

If you'd like to remove your Safari history files when you log out, first create the following shell script:
#!/bin/bash

# Point this at your user folder.
useroot=/Users/your_user

# Clear Safari History (except for bookmarks).
rm -f $useroot/Library/Safari/Downloads.plist $useroot/Library/Safari/History.plist
rm -f $useroot/Library/Safari/HistoryIndex.sk $useroot/Library/Safari/TopSites.plist
rm -f $useroot/Library/Safari/WebpageIcons.db $useroot/Library/Safari/LastSession.plist

# Add any additional clean-up here.
Save the script somewhere, make it executable, and because it runs as root, make sure it is protected from modification. Then copy and paste this command into Terminal, modifying it to point to wherever you put the above script:

sudo defaults write com.apple.loginwindow LogoutHook "/Users/your_user/scripts/privacy.sh"

To be complete, you should also visit Safari's Preferences, open the AutoFill tab, and clear all of the checkmarks (Safari then won't remember passwords and forms).

Make SMB shares appear in Devices section of Finder sidebar

It was driving me nuts that SMB shares from my Windows server would not reappear under DEVICES in the sidebar. However, I then figured out that I can do this:
  1. Open System Preferences » Network
  2. Click the network interface you use for the shares
  3. Click on the Advanced button at lower right
  4. Click on WINS tab, and manually enter the workgroup name of the server
  5. Click the '+' under the WINS Servers list
  6. Enter the IP of the server (you are using static IP on your server, right?)
  7. Click OK, Apply, etc. until you're done
The next time I dragged a mounted share to Devices, it then showed up there automatically after the next unmount/mount. My shares seem to mount much faster now, as well. Now if only I could find a way to increase the transfer speed...sigh.

Mac OS X 10.5: Wake a sleeping Mac with via Automator

I have a Mac mini in my living room hooked up to my TV. I wanted to be able to control the mini from my iMac in my office. Using Screen Sharing built into Leopard, it's a simple click of the mouse to do this. With a little Automator love, I created a simple workflow that turns the Screen Sharing step into a click of an icon in the dock.

However, even with the power efficiency of the 2009 Mac mini, I don't want to leave it on 24/7. After searching through several solutions that used Python and shell scripting (neither of which I know or could make work), I found this nifty this nifty Applescript from Mark Muir that I adapted to solve my problem. Here's my modified code:
(*
Script adapted from Wake on WAN - by Mark Muir (2008-04-01)
http://forums.dealmac.com/read.php?4,2751523
*)

property MAC_address : "00:25:4b:9f:63:c8"
property WAN_IP_address : "255.255.255.255"

on run
set command to "/usr/bin/php -r " & quoted form of ("$mac = " & quoted form of MAC_address & "; $ip = " & quoted form of WAN_IP_address & "; " & "
$mac_bytes = explode(\":\", $mac);
$mac_addr = \"\";
for ($i=0; $i<6; $i++)
$mac_addr .= chr(hexdec($mac_bytes[$i]));
$packet = \"\";
for ($i=0; $i<6; $i++) /*6x 0xFF*/
$packet .= chr(255);
for ($i=0; $i<16; $i++) /*16x MAC address*/
$packet .= $mac_addr;

$port = 9;
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, TRUE);
socket_sendto($sock, $packet, strlen($packet), 0, $ip, $port);
socket_close($sock);
")
do shell script command
end run
You'll need to replace the MAC_address property with the MAC address (found in the Networking System Preferences panel) of the machine you'd like to wake. I then wrapped this script in a simple Automator application to make it a true one-click operation. You can read all the details, and download a copy of the Automator application, in this entry in my blog.

I've mirrored the Automator application here on Mac OS X Hints, in case the original post ever goes away. While I haven't tested this one, I'm pretty sure you could replace the full script shown above with a call to the free Wakeonlan perl script, which was described in this older hint.

Wednesday, July 1, 2009

SSH’ing Into Your Mac

I use SSH a lot, it stands for Secure Shell and its main purpose is to connect to other computers, or servers, over a secure connection which you can use to manage the remote computer. For a general overview I recommend reading this Wikipedia article. For this article you do need to be a little tech savvy with Terminal, but if you are way from your computer, or you want to manage another computer this is a very useful technique.

The first step, which you must do, is enable this process in your Firewall. Took me ages to work out while I couldn’t do this on my own Mac. Go to System Preferences > Sharing and check Remote Login. This will open port 22 on your computer and allow SSH to be active.


This should be done on the computer you want to log into. For the purpose of this tutorial you can do it on your own computer, remember to switch it off when you have finished for security purposes. Under the Green icon there will be an address. This combines your ISP Internet address, which is given to you by your ISP, in my case it is part of my Uni address, this will be unique to you. For example it will be a unique identifier, such as a MAC address or account name, on your ISP network, it will then be preceded by your ISP web address. For the most part you don’t need to understand how this address is built. You just need to know what it is. The first part of the address is the user name, for the purpose of most maintenance a normal account will suffice, if you want to do some really high level stuff an administrators account can be used.

You can now log into the remote (or your Mac). Open terminal and type:

ssh user@ISP.address.com

This will start the connection process. If it immediately says connection refused make sure you have enabled SSH as mentioned above. If it says couldn’t connect on port XXX, add the following.

shh -p22 user@ISP.address.com

This will force your SSH connection to run on port 22, instead of a different port. If you, or someone else, has used SSH before it may have been bound to a different port. This will correct this problem.

The first login will ask you to accept and RSA key. This is a method to make sure the two computer are who they say they are. Since you know this accept the key by typing yes and hitting return. This is a security method to keep the connection secure, more information about this process can be found here.

The very final step is to type the password which belongs to the user name. This is the remote Mac’s login password, not your own, my friend who I tried to teach this concept too, didn’t grasp this step for a long while and confusion ensured. Once you have done this, the connection will be secured and you can happily run commands on their computer.

At this point you can run any Terminal command, which is useful to sort out problems with file and folder errors and problems relating to settings. You can also use it to monitor the health of the remote computer by running a process such as ‘top’. The Terminal window, at this point, is exactly the same as one you would use on your own computer. It just happens that the result run on a different computer and are forwarded to you.

When you have finished your session, type exit and the SSH session will finish.

Although this is a tech savvy process and solutions such as screen sharing are more useful to people who do not know how to use Terminal, it is a great technique to learn. You can use it on any Mac, Linux or Unix computer, this method is exactly the same. It is also very low bandwidth, with screen sharing your are sending a lot of data, this technique sends text. Text has a very low data rate, as a result can run on a dial up connection. This sort of process can be used to administer a server over a home network, or to make sure a remote Mac (such as your Grandparents) is still operating fine.

There is a lot more topics on how to use SSH on your Mac. I recommend search the internet for how to find out more, if you are interested on using this technique more.


Friday, June 19, 2009

MacBook Pro 13-inch teardown reveals "unimaginative" SD Card slot

A dissection of Apple's first 13-inch MacBook Pro shows the company may have run out of real estate to create a slot that would completely conceal SD cards but also points to certain do-it-yourself upgrades being near-trivial jobs for prospective owners.

The undisputed teardown experts at iFixit have just completed their step-by-step illustrated disassembly of the latest member of the MacBook Pro family, in which they note that the system's new SD card slot "is rather unimaginative" given that "half the card hangs out of the side of the computer."

"Apple couldn't free up enough space for a slot that would make the card completely captive," representatives for upgrade solutions provider told AppleInsider.

As with the MacBook Air and 17-inch MacBook Pro, removing the battery is simple enough that it can be done quickly, likely to allowing technicians to swap out batteries at Apple retail stores in a matter of minutes. All that's needed is a small Phillips screwdriver to open the case and a tri-wing screwdriver to remove the battery.

It's also noted that the mid wall dividing the MacBook Pro is now attached to the top case, unlike in previous models where it was was held in by four Phillips screws. iFixit believes this may be a move on Apple's part to help out its do-it-yourself customers.

"Aside from a couple of visual cues found outside, a casual user would not be able to discern if this was a [unibody] MacBook or MacBook Pro," the firm added. "Most screw layouts and brackets are identical to the old [unibody] MacBook."

Also discovered was a slightly heavier battery at 360 grams (compared to 302 g for the old one). However, it offers 60 Watt-hours of power, compared to the lighter battery's 45 W-h. And given that its connectors, size, and shape are different from the battery in the 13-inch unibody MacBook, the new battery isn't interchangeable with last year's models.




Apple's Mac OS X 10.5.8 to fine tune service technologies

The next, and potentially final, upgrade to Apple's Mac OS X 10.5 Leopard operating system will address loose ends in the software's underlying service technologies with a particular focus on networking and syncing.

Just two betas of the Mac OS X 10.5.8 Update have made their way into developers' hands thus far, the first of which was labeled build 9L12 and arrived for an extremely limited group of testers early last week. That distribution was quickly followed by the release of build 9L14 to all registered Mac OS X developers this past weekend.

Unlike Mac OS X 10.5.7, which addressed roughly two dozen system components and applications, Mac OS X 10.5.8's focus appears more narrow from the onset. People familiar with the update say Apple has asked developers to concentrate their evaluation efforts on just a dozen key technologies, only two of which represent forward-facing applications: Automator and iCal.

The remainder of the update addresses underlying service technologies that include 802.1x wireless protocols, Apple Filing Protocol, AirPort, Bluetooth, graphics drivers, iDisk syncing, networking, Spotlight indexing, Sync Services, and USB.

Similarly, many of the roughly two-dozen code corrections already baked into the first two pre-release builds also target underlying networking and syncing technologies. For example, Apple has reportedly made note of fixes to AFP and TimeMachine syncing, iCal time and calendar syncing, execution of startup items on Network home folders, and problems with DHCP client and 802.1x integration.



New Mac owners wrestling issues with their DisplayPort to DVI/VGA adapters should also see improvements with the release of Mac OS X 10.5.8, though Apple has reportedly failed to provide any color on the specific issues being addressed. Those users experiencing issues where their Mac inexplicably fails to go to sleep a second time around will also reportedly see relief to their problems.

Mac OS X Snow Leopard gives heads-up for near-death MacBook batteries

While the immediate charge on a Mac notebook's battery has been available for years, Mac OS X Snow Leopard now tells owners when their batteries are nearing the end of their useful lifespans.

Those familiar with the WWDC build of the operating system upgrade note that clicking the battery icon in the menu bar now shows a new, one-word "battery condition" summary in addition to the energy for the current charge and the power source.

When the battery has been used often enough that it 's losing capacity, the icon is overlaid with an exclamation mark warning and the battery condition changes to "poor" -- both signs that the pack is due to be replaced. While not every condition is known, Snow Leopard presumably reports varying degrees of battery status when the pack has only been moderately used or is like new.

The addition partly replaces third-party utilities that sometimes provide a more detailed estimate. Apple hasn't documented the reasons behind the change, but the most logical explanation is simply that the company's decision to seal in most notebook batteries makes it more important to have an early notice that a battery is near failing. A replacement of the sort is easy for technicians but, without the option of swapping batteries in the field, not trivial for end users.



Apple has lately been paying closer attention to battery life on all its devices and with iPhone OS 3.0 will add a numerical percentage to the iPhone's previously icon-only battery indicator.

Wednesday, June 17, 2009

Save non-savable PDF files

Occasionally one has to use an annoying PDF that one can't re-save, but can only print. My sister had this situation dealing with some obnoxious state-run Microsoft system that didn't allow the user to save a completed form, only to print it from a browser. The individual administering the system apparently flipped the wrong bit, as last year, the form could be saved.

Here's a workaround, various versions of which can allow you to save the PDF:

1. Turn off the print queue for the printer by going to Printer Setup Utility.
2. Print the file, but don't reactivate the printer -- choose the Add to Queue option.
3. Go into the terminal and su to root. (If you haven't enabled root, use sudo -s to start a root shell.)
4. Type cd /var/spool/cups, then identify the file you just printed. Do this by matching the queued file's time stamp to the time you printed the file (ls -l; the file of interest should be at the bottom).
5. Copy (don't move) that file out of the spool folder: cp filename ~/Desktop. I don't know what a move (mv) will do to the print system.
6. Type cd ~/Desktop to move to your user's Desktop folder.
7. Type chown myaccount:myaccount filename to make sure the Finder in your user space will play nicely with the file.
8. Peek inside the file and determine whether it's a postscript or PDF file -- you can drop it on TextEdit to see its contents. If it's a postscript file, rename the file to filename.ps. If it's a PDF file, rename it to filename.pdf.
9. Confirm the above by dropping the file on Preview. If the file is a postscript file, you can then save it as a PDF file from Preview.

Mac OS X 10.5: Take and upload screenshots via Automator

I often take screenshots and upload them for my friends to see -- especially while working on web projects etc. So I created an Automator workflow that does this automagically!

First the workflow snaps the whole screen and saves it to the desktop. Then a bash script is run wich uses ftp to upload the image to the webserver. It then takes the URL of the image and copies it to the clipboard. Lastly it notifies you of the upload via Growl. It has no error handling or anything. This is my first workflow and bash script ever, but it works for me. In Automator, create the following steps in a new blank workflow:
  1. Utilities » Take Screenshot. Use these settings:
    • Type: Full Screen, or whatever you prefer.
    • Select Main Monitor Only and/or Timed as you desire.
    • Set the Save To pop-up menu so that it saves to a file named tmpScreen.png on your Desktop.
  2. Utilities » Run Shell Script. Set Shell to /bin/bash and Pass Input to to stdin. Enter the following code, noting the lines you need to edit:
    #!/bin/sh
    # Author: Simon Ljungberg @ www.nimnim.se

    # Edit the 5 lines below to fit your configuration
    # URL will be copied to your clipboard!
    HOST='yourftphost'
    USER='yourusername'
    PASSWD='yourpassword'
    REMOTEFILE='pathtoremotefile(including filename)'
    URL='http://yourdomain.com/screens/screenshot.png'

    # If you change this you need to change the rm-line too.
    # For some reason (I'm new at this) I couldn't get the file
    # to disappear when using the variable...
    LOCALFILE='~/Desktop/tmpScreen.png'

    ftp -n $HOST <
  3. If you have Growl installed, add Utilities » Show Growl Notification. Give it a Title ("Done!") and Description ("Your screenshot has been uploaded") so you'll see a message after the upload is completed.
Alternatively, you could download the script from my server, and then just change the variables in the shell script section of the workflow.

To make this work, you need a web server with FTP access, and note that your username and password are stored in the script. Works for me in 10.5.7; I hope someone can make use of it!

Bulk convert Safari's Web Archives to PDFs

I've been archiving web pages using Safari's one-file web archive format for a while. I was trying to figure out a bulk conversion method if I want to send these archives to Windows users, or switch to a different browser. It turns out that Scott Garner's Download URL as PDF Automator action can take web archive files from the Finder and will convert them to PDFs (in addition to its intended function of downloading pages off the web.)

Just download the Automator action, then create a workflow with Find Finder Items hunting through your home directory for files that have the extension webarchive. That action should feed into Scott's action, and you're all set. The action has some options, including whether or not the PDF should be split into pages.

Create a Numbers document listing all Safari bookmarks

ou might find this AppleScript interesting and/or useful -- it opens a spreadsheet in Numbers of all of your Safari bookmarks.
set the bookmarks_folderpath to the POSIX path of (path to "cach" from user domain) & "Metadata/Safari/Bookmarks/"

tell application "System Events"
set these_bookmark_filepaths to the POSIX path of every disk item of folder bookmarks_folderpath whose name extension is "webbookmark"
-- generate book mark AppleScript list: {{bookmark 1 name, bookmark 1 URL}, {bookmark 1 name, bookmark 1 URL}, etc.}
set the bookmarks_list to {}
repeat with i from 1 to the count of these_bookmark_filepaths
set this_bookmark_path to item i of these_bookmark_filepaths
tell property list file this_bookmark_path
set the end of the bookmarks_list to {value of property list item "Name", value of property list item "URL"}
end tell
end repeat
end tell

-- convert AppleScript list to text
repeat with i from 1 to the count of the bookmarks_list
set this_bookmark to item i of the bookmarks_list
if i is 1 then
set the bookmark_text to (item 1 of this_bookmark) & tab & (item 2 of this_bookmark)
else
set the bookmark_text to the bookmark_text & return & (item 1 of this_bookmark) & tab & (item 2 of this_bookmark)
end if
end repeat

-- write to file
set the target_file to (path to documents folder as string) & "Safari Bookmarks.cvs"
write_to_file(bookmark_text, target_file, false)

-- open in Numbers
tell application "Numbers"
activate
open file target_file
end tell

on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
For the AppleScript wizards out there, I didn't send the data directly to Numbers because the Numbers scripting dictionary does not support making a document with the make verb.

Mac OS X 10.5: Find which items weren't modified by Time Machine

Getting ready for work this morning, I walked into my office to find my 2.5 year old daughter mashing on my keyboard with the monitors off. Time out! After a quick check, it looked like no damage had been done. Later though, I tried to launch iCal with Quicksilver, and Quicksilver could not find it.

I looked at my apps folder (which was open apparently when she was mashing the keyboard) and saw that there were three folders with a bunch of jibberish for names. They were apps, but I wasn't sure which ones were which. Enter Time machine!

I tried to restore the whole apps folder, which I knew would take a while, but it told me Applications cannot be restored as it is used by the system. I selected all apps, hit copy, pasted the names into a text file and printed the file, meaning to open Time Machine and go down the list marking things off until I figured out what was missing.

With all of those items selected, I opened Time Machine and selected a backup from early this morning. All of the apps that were the same remained selected, but the ones that were missing -- the renamed ones -- were de-selected. I simply chose the de-selected apps and restored them.

This saved me a bunch of time going down the list and manually comparing the folder in Time Machine to my printed list. Now, off to Home Depot to get a lock for the office door!

Add URLs to Address Book contacts for use in Safari

A somewhat-hidden feature of Address Book is its ability to add a URL to a contact. This feature used in Safari 4, which has a special Bookmarks section for Address Book entries, where it will use URLs from Address Book contact records. (For instance, if you take a look a the Address Book entries in Safari 4's Bookmarks area, you will find that the Apple Inc. card has a home page associated with it.)

It's not obvious how to accomplish this, as a Home Page field does not appear by default on a new blank card, nor when editing an old one or when adding fields using the green (+) button. The solution is in the Card » Add Field menu. From that menu, select the URL entry to add the field to any card. After entering a URL, it will then appear in Safari's Address Book bookmarks.

Fix an issue with Dreameaver and networked previews

When using Dreamweaver's Browser Preview feature when editing a file on a network drive, you will receive a path name which is incorrect in your browser window:
file:///NetworkDrive/Folder/Folder/file.html
Where the path name should be:
file:///Volumes/NetworkDrive/Folder/Folder/file.html
To resolve this instead of making a 'site' for each website with the text Volumes: added to the front of the path name for the site it is much easier to use a symbolic link. Open Terminal and type
$ cd /
$ ln -s /Volumes/NetworkDrive NetworkDrive
Please note that NetworkDrive should be replaced with your drive's name. You will now see what looks like an alias on the root of your hard drive, but this is a symbolic link and you should have no problems previewing your sites.

Mix Safari 4 Beta and Final to get tabs on top

Just a quick note to those who, like me, greatly miss the 'tabs in the title bar' feature of Safari 4 Beta in the final release of Safari:

After installing Safari 4.0 Final, I was quite disappointed to no longer have the 'tabs in title bar,' but I still had both the app and the installer from the last Safari 4 Public Beta (remember there were two main versions; the last one was published on May 12) on another disk, and I noticed that it launches just fine using all the underpinnings of the final version.

I'm sure it's not 100% compatible, but we all know that most of the meaningful components of Safari are *not* in the app itself. In fact, I'm using it right now to write this.

In short, you can install the final Safari 4.0, then use Pacifist to extract just the app from the Public Beta disk image. Better yet, if you still have the beta, rename it to something like Safari_beta.app, and you'll be able to use the tabs in the title bar again, as well as any of the customization tricks found here and elsewhere.

Friday, June 12, 2009

Change the default length of new iCal events

The default new event time in iCal is set to 60 minutes. There is not a interface preference to change the default. Seeing a request the other week on the Apple Forums asking for a way to change this setting, I had then assumed that this behaviour was 'hard wired' into iCal. After reading 'How to find hidden preference settings' just now (thanks Rob) and playing around with the result of the strings command on iCal, I came across the string Default duration in minutes for new event'.

It turns out this sets the default duration of new events in iCal. The defaults command below sets it to 15 minutes. You should quit iCal before running this to see the result. Open Terminal, enter the following and press return:

defaults write com.apple.iCal 'Default duration in minutes for new event' 15

Then open iCal. New events entered by double clicking or pressing Command-N will have the default time of 15 minutes. Obviously, you can set different values. To remove this setting altogether, enter the following in the Terminal and re-start iCal:

defaults delete com.apple.iCal 'Default duration in minutes for new event'

I've not noticed this hidden iCal default mentioned anywhere else.