I made a note about these commands a while back while trying to find a solution to setting the default printer via ARD. They might come in handy some day…
lpstat -pwill show you the printers availablelpstat -dwill show you the current default printerlpoptions -d printernamewill set the default to whichever printer you specify
I am currently installing 10.2 on some old Blueberry iMacs. I came accross an error that said something to the effect of “The destination is not within the first 8 GB of the hard disk”. Ok then. After some searching, I find that the solution is to partition the drive, and install the OS on the first partition, which you have partitioned to a size smalled than 8 GB. Apparently, this monster 20 GB aftermarket drive is too much for 10.2 to handle as the OS drive. Now I realize I have seen this error before, many years ago.
After partitioning and installing the OS, I boot the machine and see the two hard drives. Personally, I have no problem with this. I often have 5 or more drives mounted on my desktop. But where this computer is going, this will be an issue for the user. Now I start looking for a solution to hide this second volume. I came accross this solution. But it requires that I install developer tools. I am not going to try and do that on a G3. So I just tried something simple, formatting the volume with a leading period. A leading period will hide a file in UNIX, OS X is built upon UNIX, why not. It works! So if you ever want to make a volume disappear in the finder (VM drive, backup drive, “don’t confuse the old people with two hard drive icons” drive), format with a leading period. You can of course still access the drive via command line.

.Awesome
When it comes to file manipulation in OS X, I find myself using these three commands often, and usually in combination. Almost every time I use them however, I have to reread the man pages, and review regular expressions. I end up googling the same things and ending up at the same pages, so I wanted to make a single post that will contain all the information and links necessary. Here we go…
GREP
“grep searches the named input FILEs (or standard input if no files are named, or the file name – is given) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.”
AWK
“Awk scans each input file for lines that match any of a set of patterns specified literally in prog or in one or more files specified as -f progfile. With each pattern there can be an associated action that will be performed when a line of a file matches the pattern. Each line is matched against the pattern portion of every pattern-action statement; the associated action is performed for each matched pattern.”
SED
“The sed utility is a stream editor that reads one or more text files, makes editing changes according to a script of editing commands, and writes the results to standard output.”
REGULAR EXPRESSIONS
Regular expressions allow you to use variables in your commands. Most of us are at least familiar with *, where *.db means “every file ending in .db”. There are however many useful regular expressions, and they are the key to executing the above commands efficiently. Brush up on regular expressions here.
PIPES AND REDIRECTS
In order to send the results from one command to another command you need to “pipe” them together. An example:
cat *.txt | grep "blatti.net"
cat *.txt will display the contents of every file that ends in “.txt” to the standard output. By piping those results, they become the input for the second command. grep "blatti.net" will take the standard input, and display each line that contains “blatti.net” on the standard output. So when these two commands are piped together, we will get every line that contains “blatti.net” in every file that ends in “.txt” in the working directory.
While most of your work can be done with standard input and output, you’ll probably want to write your results to a file. Enter redirection. Using the example above, lets say we wanted to take our results and write it to a file. This is done with the > redirector.
cat *.txt | grep "blatti.net" > results.txt
This command will take every line that contains “blatti.net” in every file that ends in “.txt” in the working director, and write them to the file “results.txt”. Note that this will overwrite any existing “results.txt” file that exists in the working directory. Which begs the question “What if I want to append instead of overwrite?” Well then use >> instead of >. The >> redirector is especially useful if you are creating logs.
Now you too can create obnoxious commands with limited knowledge! The command below is one I created using the resources listed in this article. It is part of a piece of software that pulls text out of a PDF and returns a specified section in a text file. (I’m sure it is inefficient – so someone chime in and tell me how to make it better so I’ll know for next time)
sed 's/^[0-9]$/Period &/' /tmp/skypdf.txt | sed 's/[A-Z]*$/&,/' | sed '/Period/G' | sed '$!N;s/\\n/ /' | sed '/Period/{x;p;x;}' | sed 's/^ //' > ~/Desktop/full.txt"
Now say that 10 times fast!
Now that I have comitted myself to OSX, I had to start using iSync to sync my Treo with my Address Book and iCal. For some reason this is still a goofy process.
- You open iSync
- You tell iSync to begin the sync process
- iSync asks you to start initiate a sync with the Palm software
- Conduit Manager syncs some things with iApps (iCal, Address Book) and others with Palm Desktop (Pictures, Phone call DB)
- Conduit manager completes the sync and quits itself
- You manually quit iSync
Again, there has to be a better way to do all of this. Unfortunately I have heither the ambition or know how to fix the entire problem, so I’ll tackle what I can fix. Everytime I open iSync, I want to sync my device. Everytime the sync is complete, I want to quit iSync. Enter iSyncandiQuit. Simply run this application and it will launch iSync, initiate a sync, and upon completion of the sync, quit iSync and itself.

Benchwarmer is a simple backup application designed for basic users. It allows the user to backup some critical elements of their home directory including:
- Mail (including prefs)
- Address Book (including prefs)
- iCal (including prefs)
- Desktop
- Documents
This data is backed up into a single ZIP archive on their desktop. Please leave any questions, comments, or requests as comments on this post. Thanks.
Download Benchwarmer HERE.
Well after suffering for a long time with my quality eMac, my employer sprung for a new MBPro for me. Everything seems fine so far, allthough I have noticed some display issues. Now that I have a processor that can handle it, I have been using a bunch of new applications. I’ll try to get some reviews and links up in the coming days. Now check out this quality pic! (The camera I used was so old it stored the files on a floppy)

I recently had a situation where I need a dialog box to pop up and a certain web page to load whenever something was printed. This was pretty simple to do by scraping the CUPS error log. The command sed '$!d' /var/log/cups/error_log will return the last line of the log. By monitoring this last line, one can determine when a print job has been executed. Here are the key elements of the Applescript I used.
-- when the application opens, store the last line of the log as the variable old_entry
on run
set old_entry to do shell script "sed '$!d' /var/log/cups/error_log" --intial value
end run
-- loop to compare the stored value old_entry with the current value
on idle
set new_entry to do shell script "sed '$!d' /var/log//cups/error_log"
-- Because the error log is written to more often than just when print jobs are executed, I had to add the "and" statement here. I found that the last line added to the log when a job is printed is "Started backend /usr/libexec/cups/backend/lpd"
if old_entry is not new_entry and (new_entry as text) contains "Started backend /usr/libexec/cups/backend/lpd" then
-- do stuff
end if
-- returning 1 waits one second until the loop re-executes
return 1
end idle
I made this a stay open application, and using Drop Script Backgrounder, kept it out of the sight of my users. A big thanks for Jacques for his help and Macscripter.net. Here is the discussion thread.
MacWorld San Fransisco was kind of a strange one this year. Not so much about the Mac, but more about Apple, Inc. (yeah, they dropped “Computer”). First they introduced Apple TV. It’s cool. You can download content from the iTunes store right to your TV. You can also stream content from your computer. Movies, music, TV shows all from one spot. Now I don’t mind paying a buck or two to get the shows I want to watch, sans commercials, when I want to watch them. That’s great. However, until iTunes carries every show I want to watch I still need my Media Center to record shows. I am reluctant to add more hardware when what I have can do what AppleTV can do, albeit a little more complicated and much uglier. I see the market, but I’ll need it to be more feature rich. I am excited to see the advances in the Apple TV product line.
Next was a quiet release of the new Airport Extreme. The new extreme supports 802.11 draft-n, with twice the data rate and range of standard 802.11g signals. Apple adopted the mac mini form factor for the new airport, which was a good choice. The 6.5″ square white box has become an Apple signature. There are 3 10/100 network ports (where’s the 1000 Apple?) for wired devices. There is also a USB port that can be used to share a printer or turn any USB hard drive into NAS. Hopefully we will see PoE and gigabit interfaces soon with the new form factor.
Finally the iPhone. There was so much speculation on this one. Most of us thought we would either not see it, or it would be the mark of true Apple snobbery. Luckily, it’s here (kind of) and it is for everyone. The interface is very cool, centered on a touchscreen. This touchscreen solves one of the biggest problems with cell phones, static UI. When the buttons are truly dynamic, new functionality can be added and interface flow can be customized. The music, web, mail (free push IMAP!) and chat interfaces are very much OS X in appearance and hopefully performance. It seems that the iPhone handles voicemail much more logically. It appears VM’s are pushed to the phone instead of held on a cell provider’s server, allowing you to access each voicemail independently instead of having to go through 10 messages to listen to the 11th. This phone seems to be truly innovative, but you’ll have to wait until at least June ‘07 to get one.
Now the bad news. Can you use the iTunes content you have as a ringtone? Nope. Well that blows. All this technology and I have to go back to standard ringers? Ouch. Open development of widgets? Nope. Apple isn’t going to allow us to make widgets for the iPhone. Again, that blows. And finally, no VOIP. So definitely no Skype widget on this thing. These downsides probably don’t mean much to most people, but for something that has all these abilities, I hate to see these handicaps. I’ll still buy one and it will still be cool, but the overwhelming excitement I had when the iPhone was announced is gone. Someone once told me, “If you think something is too good to be true, it probably is.” That man was Gary Coleman. Maybe Todd Bridges. The 80’s was pretty much a blur.
Every year communication seems to get easier. Well maybe not, but it should right? Being a tech geek, I am pretty well connected. I can be reached with: AIM, Yahoo IM, Jabber IM, Skype IM, home phone, cell phone, work phone, SkypeIn phone, and countless email addresses. While that sounds ridiculous to some of you, it’s not as unusual as you think. Applications like Trillian do a good job of combining chat services, but what do you do about phone numbers? Enter my new favorite startup, GrandCentral.
GrandCentral’s tag line is “One Number…For Life”. And that is exactly what you get. When you sign up for an account, you get to pick a traditional phone number. It seems they have expanding coverage based on their blog, and I had no problem getting a number in my local area code. You then record your voicemail message (this will also become your only voicemail btw) and even upload and MP3 for people to listen to as a ringtone when they call your phone. Next you will add entries for each of your current phones. For me, I have my home phone, my cell and SkypeIN which I use (primarily) via my Sony Mylo. That’s it for setup. It took me 10 minutes to do, most of which was searching for the proper ringtone.

Now have someone call your new GrandCentral number. Since this is the first time they are calling from that number, they will be asked to record their name. (And a contact in the address book is automatically created!) Then all of your specified phones will ring (preserving their caller ID). You can pick up any of your phones and will get a message stating: “You have a call from..”, and the person’s recorded name. You can press 1 to answer the call, or send the call to voicemail. One of the premium services available during the beta period allows to you to send them to voicemail, and listen as they leave their message. You can press a key to interrupt the message and jump into the conversation. Awesome – call screening has officially gone high tech.
So let’s say you decide to answer your home phone and 10 minutes into the call you need to leave the house. Normally you would have to call the person back from your cell. With GrandCentral, just tell the caller to hold, press *, and your other phones will ring. Pick up your cell and continue the conversation.
Your voicemail notification comes via email, and the web interface is awesome. After using the beta for 2 days I am sold. I will be a life long customer. When I am at work, I have no cell signal and have to go VoIP with SkypeIN. When I am in the car, no VoIP so cell is the communicator of choice. And when I am at home, incoming calls are free so I might as well pick that phone up. Until now, everyone would call my cell at all times. I can’t expect them to keep my 3 numbers and know when to call which. Thank you GrandCentral. You have really made my life easier.
A couple suggestions for GrandCentral to tackle: (UPDATED based on reading their FAQs)
- Scheduling Options – Right now, all I can find is a checkbox that stops my home phone from ringing from 8a to 6p. What if I don’t work those hours? What if I want my home phone to ring from 5-6a, then my cell and my SkypeIN from 6-7a, etc. I’d bet that a cool little GUI could be made for this.
- Voicemail Notification Options – There seems to be SMS and email notification options. Personally, I’d prefer IMs. I use IM constantly, and have multiple applications notify me of things via IM. I’d imagine others would appreciate IM notifications as well.
- SMS forwarding – I’d hate to have to give out “one phone number” that didn’t forward the SMSs to my IM, cell phone, and/or email. (UPDATE – “We’re not compatible with standard text message services (yet), but it’s definitely on our road map.”)
- Number of rings based on device – I have an answering machine at home and voicemail on my cell. I don’t want them picking up the “You have a call from” calls and recording them. I also don’t want to set them to pickup for 10 rings, as people will still call me on those numbers. If I could specify how many rings for each of my devices I could avoid this entirely. (UPDATE – While I wouldn’t consider this a solution but more of a workaround, GrandCentral says: “GrandCentral will disconnect a call from your forwarding numbers after it is answered if no action (pressing 1, 2, 3 or 4) has been taken within 15 seconds. Therefore, to prevent the GrandCentral message from being recorded by your cell (or other) voicemail systems, all you have to do is record a voicemail greeting that is at least 15 seconds in length, before the beep.”)
An Integrated service for anyone to tackle:
I don’t want another address book. I don’t want to export mine from outlook. I don’t want to import mine into Thunderbird. I don’t want Gmail to try and build one for me. I want one that is easy to use and compatible with multiple devices. Think del.icio.us style. Let my phone automatically pull my contacts down from the internet. Let my computer do that too. And let me provide account info so GrandCentral can do it. Let me right-click any email address and add it as a contact with a contextual menu. Same with a phone number. I now have one app for IM and one phone number. One address book please. I am willing to put work on this project if someone else is willing to be the primary. People will use this. Google do you hear me?














