PEAR – DreamHost
“Dreamhost includes only a bare set of PEAR modules on shared hosting accounts, and does not allow users to add more to the base install. To install your own set of PEAR modules on a Dreamhost shared hosting account, SSH into your account and issue the following command…” –via PEAR – DreamHost.
Installing Pear on OS X 10.7 Lion
Nothing big, just need to document this stuff or else I forget…
$ sudo cp /private/etc/php.ini.default /private/etc/php.ini $ sudo php /usr/lib/php/install-pear-nozlib.phar $ sudo pear config-set php_ini /private/etc/php.ini $ sudo pecl config-set php_ini /private/etc/php.ini $ sudo pear upgrade-all
One of My Old Favorites All Fresh and New

The postman just delivered my fresh copy of Build Your Own Database Driven Web Site Using PHP & MYSQL, 4th Edition. It’s not that there was anything wrong with my previous copy, but it was getting a little dated. Plus I am a little nostalgic for this particular publication.
With a quick glance I can already see that the book has been restructured quite a bit moving chapters around. I am really looking forward to reading this book again with renewed purpose and updated perspectives.
[tags]php, sitepoint, mysql,book[/tags]
LittleSnapper Touch Is Soon to Hit Realmac Lineup
This looks interesting, a companion iPhone application to LittleSnapper (desktop Mac app) and QuickSnapper (web based snapshot sharing). It’s yet to be released but the new app, dubbed LittleSnapper Touch promises to allow the user to snap photos and webpages (or parts of them) and then post them to QuickSnapper.
Anyone familiar with QuickSnapper will be aware that you will, in turn, be able to pull down those snaps into the desktop version of LittleSnapper with a simple click of the “Send to LittleSnapper” button. It’s not clear yet whether there will be any syncing option that will negate this step. I guess we’ll have to wait and see.
Control your processors in Mac OS X 10.5
Remarkably after nearly one month I am still trying to tweak my system just so. I think this is one of the last things though, my processor preference pane. By default, the CPU controls in Mac OS X 10.5 and not enabled and in fact, can’t be enabled unless you have the developer tools installed.
I like to be able to turn off some of my processors when I am just doing day to day web design and theme development. It’s a good way to save some energy (it’s good to be green) and to be totally honest, coding in HTML, CSS, PHP, Javascript and XML isn’t all that processor intensive. With the developer tool installed you can do this. There two things you can do, you can run the CPUPalette.app and/or you can install processor preference pane.
The CPUPalette.app can be found in /Library/Application Support/HWPrefs/. It’s a simple app that doesn’t allow much other than turning the processors on or off. If you click the little pill button in the top right-hand corner you can see a couple of basic preferences for window type, sampling rates and information display. It’s a quick and easy way to both monitor how your cores are being taxed and whether or not you can afford to shut a few of them down.
Your other option, if you you are already familiar with your processor usage, is to install the processor preference pane. Go to /Developer/Extras/PreferencePanes and find Processor.prefPane. Double click to install it. Once installed I highly suggest you click the “Show control in menu bar” for quick access. You’ll notice by installing the processor preference pane you get access to the CPUPalette.app without having to dig for it.
Let Them Know You're Open With PHP
I wanted a php script that would inform visitors to a web page that the office was either open or closed, depending on the day of the week and what time of day it was. I made a half hearted attempt to find one on the internet, but to be honest I knew I could write one faster. I thought of making it a proper extensible class but thought I’d better move on before I tie up too much time in it.
It’s pretty basic but I thought some of you might find it handy for your own purposes. The directions are in the script itself which you can download here.
Auto mount/unmount your Mac volumes when required
Earlier this month you might recall the solution I gave you for keeping unused volumes unmounted on your mac. The next part of the equation, automatically mounting those volumes when needed to run my backup scheme, took me a little longer to sort out. In fact I wasn’t able to write a solution on my own, try as I might, so I finally went searching for one.
I needed a script of some sort that would mount my unmounted volumes when it was time for ChronoSync to run and then unmount my volumes when ChronoSync was finished. After several IRC queries, forum posts here and there and countless Google searches I finally stumbled upon this post at Mac OS X Hints. This solution was the answer I needed and it works perfectly. I won’t recap the whole thing here, but I will give you the bits that were most important to me.
Copy the following script into Script Editor.app (/Applications/AppleScript/Script Editor.app), changing the diskname and appname to suite your needs:
property diskname : "MyDisk"
property appname : "ChronoSync"
on idle
tell application "System Events"
set x to the name of every process
if appname is not in x then
if (exists the disk diskname) then
do shell script "disktool -l | egrep -i "Mountpoint = '/Volumes/" & diskname & "" | cut -d\' -f2 | xargs -n1 disktool -p"
end if
else
do shell script "disktool -l | egrep -i "Mountpoint = '', fsType = 'hfs', volName = '" & diskname & "" | cut -d\' -f2 | xargs -n1 disktool -m"
end if
end tell
end idle
Next you need to save it as a bundled app and select “Stay Open“, give it a useful name and save it where you will be able to find it. In my case I chose /Library/Scripts/ChronoSync/:

Then you have to make it run in the background. To do this, find your newly created app, right click on it, “Show Package Contents“, find the Info.plist and open that in your favorite plain text editor. Above the key that says CFBundleAllowMixedLocalizations you want to add the following:
<key>LSBackgroundOnly</key>
<string>1</string>
Get out of the package and find your app again and double click on it. It should launch in the background but not show in the dock. You can see that it’s running by opening Activity Monitor.app (/Applications/Utilities/Activity Monitor.app):

Now to truly make this process automated, you need this app to be on when your computer is on, so it needs to launch when you login. So open your Accounts preference pane in System Preferences.app (/Applications/System Preferences.app), select the Login Items tab, select the
button and add your newly created app:

And that’s it! Next time your backup program fires up to do it’s regularly scheduled backups, your disk mounting app will mount your volume, wait for your backup app to finish and then quietly tuck your volume back up for the night.
Other references
YourHead launches Stacks 1.0
Fellow RapidWeaver developer, Isaiah of YourHead Software announced today that Stacks, a fluid layout plugin for RapidWeaver, is now official, hitting the big version 1.0. Those of you familiar with YourHead’s previous heavy hitting page layout tool, Blocks, will immediately recognize what this RapidWeaver plugin is all about, but the two are as different as night and day.
Don’t get me wrong, Blocks is a brilliant feat of plugin engineering and is the life blood of literally throngs of RapidWeaver users unable to do such layouts on their own. But it’s not a plugin that ever fit my web design sensibilities. The web is fluid, ever changing, growing, shrinking… for me, Blocks was too rigid.
Enter Stacks; a completely fluid, flexible, drag’n'drop all about layout tool for RapidWeaver that can generate oodles stacked up, blocked up, split up, embedded here and there kind of page layouts that only a pocket full of hand coded snippets could achieve perviously. Just like Blocks, Stacks allows to drop in text, HTML, images and whatnot, but then it allows to stacks onto stacks and those onto more stacks. You can make columns, columns in columns, columns where one column is an image, one is some code, one is some text, etc… drag that under some more columns… before you know it, you’ve got your very own 960 Grid System built into a RapidWeaver plugin.
If you are looking for the ultimate in flexible page layout with RapidWeaver, go check out Stacks. There are some great movies demonstrating the raw power of it and there is also and Stacks API if you’re interested in creating a custom Stacks library or two.
Keeping unused hard disks unmounted
The question
How do you prevent Mac OS X Leopard from auto mounting disks, drives and volumes when the computer boots up or a user logs in? (skip to the solution)
The preamble
I have spent days (literally) searching for the answer to this one; I have a Mac Pro running Leopard with (count them) 4 internal hard drives. One is my system disk and the other 3 are backup disks. Two are weekly mirrors of my system while the third is a daily snap shot of my user account. We won’t even get into the external disks I have. Yes I am THAT anal about my data.
So what is the trouble here? When you have this many disks containing duplicate data, Spotlight, QuickSilver, Launchbar, Google QSB, etc… they all want to serve up information found on each disk. That would include duplicate information that you most likely don’t want to inadvertently open and/or edit. But further to this, why spin up a disk, potential shortening it’s life span and wasting precious energy, when it only gets used on occasion?
One way around this is to diligently eject each volume every time you boot up your system. But that is both a pain in the butt and no where near as geeky as it should be. So do a quick search on Google for a solution to “unmount disk on login” or “prevent volumes from mounting at the boot up in Mac OS X Leopard” and you get a great deal of outdated info, inefficient Apple Scripts, overly complex bash commands, apps that wrap bash in an executable app that you launch at login when the moon is at… you get the idea.
So I set forth to put together the best of the best and simplest of the simple and post it here, for my own reference, exactly what I did to prevent my back up volumes from mounting on boot up.
My Solution (proceed at your own risk)
First off, what you are going to find with most solutions out there is the need for a file called fstab in the systems hidden “/etc” folder. The trouble is that later versions of OS X (10.4.x and later) don’t have this file. However, there IS a redundant file called fstab.hd. WE ARE NOT USING THIS FILE. Instead we will create our own fstab file. So with that out of the way, let’s get started:
The short of it
- Start by making a backup of your system. If you bugger up your system you’ll have something to recover from.
- Open terminal (/Applications/Utilities/Terminal.app)
- Do one on the following:
- In Terminal, type the following (with your volume name) and return
*:diskutil info /volumes/DiskName
- Or, you can use Apples Disk Utility app (/Applications/Utilities/Disk Utility.app), select the disk in question and choose “info” from the toolbar.

- In Terminal, type the following (with your volume name) and return
- Find the Volume UUID (Universal Unique Identifier). Copy the UUID to your clipboard
**. - In Terminal enter and return
***:sudo pico /etc/fstab - Enter your password and return.
- You’ll enter a window that looks like this:

- Enter the following (with your UUID) and return
****:UUID=87635CC4-B2EF-3114-B854-F64347A39630 none hfs rw,noauto 0 0 - Repeat step for each device you with to hide, each on a new line.

- Exit pico (⌃X) and save (Y).
- Press return when prompted with:
File Name to Write: /etc/fstab
- All that’s left to do is is cross your fingers and reboot your Mac.
The long of it
*substitute “DiskName” for the name of the volume you wish to hide. If your volume name contains a space, like “Macintosh HD” you need to escape the space with a backslash so it looks like “Macintosh\ HD”**We use the “Volume UUID” as the disk identifier since it is not prone to change like “Device Identifier” (i.e. “disk0s2″) which can change with each and every start up.***This will create/edit your “/etc/fstab” file with pico, a simple text editor.****The string you are entering is the device id followed by the mount point, the filesystem, the mount options, the dump and fsck booleans. In this case:- the device is my UUID (UUID=87635CC4-B2EF-3114-B854-F64347A39630)
- the mount point is “none” (because we won’t be mounting it)
- the file system is “hfs” (since it’s formatted for Mac)
- the mount options are “rw” (read-write) and “noauto” (volume will not auto mount)
- the dump option (backup utility) and fsck option (filesystem check utility) booleans are both set to 0 (false, off, nil, nada) since we don’t plan to mount the volume and therefor don’t need to backup or check them
For more on fstab column structures, visit tuxfiles fstab help.
The wrap-up
For whatever reason, Apple decided to nix fstab from it’s own Unix core. Perhaps for security or perhaps they just deemed it unnecessary. If you look in the other file I mentioned, “/etc/fstab.hd” (in terminal, enter and return: sudo pico /etc/fstab.hd), you’ll see the message:
IGNORE THIS FILE. This file does nothing, contains no useful data, and might go away in future releases. Do not depend on this file or its contents.
However, I see no harm in extending the life expectancy of my disks and saving energy at the same time. All while doing away with the annoyance of long indexing times and being inundated with duplicate search results. If you have anything to add, please feel free to leave a comment.
Other references
Working with PHP, PEAR and MAMP
So I am starting to play around with PEAR in my PHP development and since I use MAMP I thought I better brush up on getting these extensions to load via the command line like they show for each extension. Knowing that MAMP works things a little differently than what’s already on my Mac I knew that there would be some trick to getting this to work. A quick Google search brought me to this article which taught me just what I needed. Sweet!
