Monday, November 16, 2009

My favorite Regular Expression for deleting a line at a time

Ok, so you probably know the power of regular expressions or regex. One of the great things about regex is that with most modern text editors (and even some old classic ones) you can use them to do quick editing over a large file.

My favorite (and this will work in Visual Studio) is for removing lines at a time based on some match.

Let's say we want to select (most likely for removal) any line from a file that has the word Bart in it. Our regex would look like this:


The \n indicates new line. If you left off the \n the line would be selected without the new line character. If you are doing a replacement (such as with nothing to delete the line) and leave off the \n the line is selected but not the return character so for removing the text, a blank line would still exist in the file, whereas including the \n will delete the entire line from the file.

Monday, November 09, 2009

Snow Leopard Doesn't Support Some Epson Printers

UPDATED: See update below...

Well I wish I had known this before I upgraded to Mac OS X Snow Leopard.

Apparently Epson hasn't released drivers for some of its more expensive "pro" printers such as my Epson Stylus Photo 2200. It appears the same is true for the 1280 and 2100 and probably others as well.

Epson has stated they will release a new printer driver by the end of January 2010 that will be distributed by Apple as a software update.

The current version of Mac OS X Snow Leopard (10.6.2) includes the open source Gutenprint driver for these printers, however, most people report that either they don't work, or the colors are so off that they are useless.

For a list of Epson (and other) printers supported with native drivers in Snow Leopard you can go here. If the driver lists Gutenprint next to the printer name (i.e. Epson Stylus Photo 2200 - Gutenprint v5.2.3) you know that the manufacturer hasn't developed a native Snow Leopard printer driver yet and your printing results may vary.

BTW you may find the printer driver on Epson's website here that claims it is compatible with Mac OS X Snow Leopard 10.6. That file is identical to the older printer driver that worked under 10.5 and is not a new one that fixes color issues in 10.6. Epson has stated multiple times that the new version will be available through Apple's software update and not a download from their website.

UPDATED: January 3rd 2010

Well it appears they've released the update. Oddly it doesn't appear during the Apple Software Updates but through the new printer driver update facility that Apple added to Snow Leopard. Now you might be wondering how to get the update to appear? Well, mine showed up automatically when I plugged in the USB cable of the printer to the computer. Immediately I got a dialog saying updated drivers existed and asked if I wanted to download them. Note that I had already uninstalled the non-working Gutenprint drivers, so if you were using those, I have no idea if you would get the update notification. I hope you would.

After downloading it automatically added the printer, and I was able to print. I haven't done any detailed photo printing but printed a few color pages on plain paper the colors looked good. So good luck to you and thank you Epson for living up to your word. It would've been better if you had these drivers available when Snow Leopard shipped but better late then never. You can see several printers have been added here to the list here with a + which indicates the Vendor software was recently added via software update.

Friday, November 06, 2009

Clicking HTTP URL Links in Outlook 2003 on Windows opens two browser windows in Safari

I've seen this happen in both Safari and Firefox. This fix is specific to Safari although the Firefox fix is probably similar.
If you open explorer.exe (the Windows file manager, you can just double click "My Computer" or "My Documents" to get an explorer window) then go into
1) Tools->Folder Options...
2) Then click the File Types tab.
3) I scrolled down and found two entries for:
(NONE) Safari URL
As you can see from the picture, the Delete button was grayed out so I couldn't delete one of them.
4) I selected one of them and clicked Advanced.
In the Actions list was a single entry named "open"

5) I selected that action and clicked Remove.
After that I only get one window in Safari when I click links in Outlook 2003.
I've gotten some feedback from other users (including Firefox) that this isn't always the problem/solution so I'm adding another step here.
You may have to remove the DDE entry. Follow the steps above 1-4. Select "open" and click Edit...

If you see anything in the DDE Message area, just clear it out and click OK.

Wednesday, September 09, 2009

iTunes 9 Released, new version of Fetch Art coming soon

Today Apple released iTunes 9. I am currently testing a new version of Fetch Art and should know about compatibility with iTunes 9 and have a new version with some bug fixes available in about a week.

Wednesday, August 26, 2009

Robocopy trumps RichCopy

Microsoft has released a new replacement for Robocopy. What's Robocopy you ask? Only about the best way to copy a lot of files across a network via the command line in Windows.

Robocopy will copy a directory with any amount of files and subdirectories. It will merge the contents of the directories if duplicates already exist in the destination depending on options you pass it. If a file cannot be read, it will pause and retry a certain number of times, and if you lose your network connection during the copy, when your connection is back, you can reissue the same command, and it will pick up where it left off, not recopying the files it already copied.

It's a really great command line tool and I wish drag and drop copying in both Windows and Mac OS X behaved like this instead of failing miserably if the network drops or wiping destination directories out even if they contain different files from the source.

Robocopy is great. It's one of the first things I install on a freshly formatted Windows box.

So what could be better then Robocopy? According to Microsoft TechNet, RichCopy. RichCopy is the next generation Robocopy adding an easy to use GUI and performance enhancing multithreaded copying (so it can move more then one file at a time which reduces network lag if you are moving a lot of small files.)

So today I installed RichCopy and put it to the test. I needed to move a directory that had 19.8GB in 69,510 files and 13,654 directories (or folders if you prefer.) I started RichCopy and used its GUI interface to start the copy. My network performance was only about 10Mbps (I'm on gigabit people) but it's an overworked corporate network, so I don't think that's any fault of RichCopy. Unfortunately about an hour and 45 minutes into the job, the server disappeared from the network for a second. No problem, right? That's the kind of thing RichCopy was made to handle. Unfortunately at that point RichCopy crashed with an exception, and the only option was to close the exception dialog which closed the RichCopy application.

So now I've got Robocopy doing the copy. It doesn't have a fancy GUI but it's working.

Oh BTW, there is also a GUI for Robocopy here. But I tried it and it had at least one bug (back when I tried it.) It may work for you, but, if you are looking for a robust copy tool, chances are you can handle the command line anyway.

Here's something to get you started on Robocopy:

robocopy source destination /S

By default robocopy won't copy files that appear the same so it always performs a merge and that's what this command line will to. The /S says to be recursive but don't copy empty directories.

The Wikipedia entry on Robocopy covers all the optional parameters.

Tuesday, August 25, 2009

Fixing Printer Sharing in Mac OS X

Ok, so an odd thing happened trying to print the other day. I share a USB printer from my Mac to other computers on the network. After unplugging the USB cable from my Mac at one point to move some stuff on my desk and then plugging it back into the same Mac, printer sharing for this printer no longer worked.

I could print fine from the computer connected directly to the printer via the USB port. I share it with three other computers and none of them could print to the printer, although they could see it on the network.

When I tried to print from a networked printer the document would simply never print. When I opened the printer queue on the computer I was trying to print from it said:

Unable to get printer status (Forbidden)!

Also if I tried to add the printer to a computer that wasn't using it previously, although the computer could see the printer, it could never choose the correct printer driver.

Here’s the fix:
On the computer sharing the printer (the one the printer is connected to) you have to reset the printing system. Just open Print & Fax in System Preferences and right click in the list of printers and chose “Reset printing system…”

It will ask you if you are sure, and you’ll have to supply an administrator password. That will remove all your printers.

Then you can click the + button and add them manually, however, I found it was easier to power cycle my printer and it was automatically added to the list. Make sure to check Share this printer and you may have to turn on Printer Sharing in the Sharing control panel too. The Print & Fax control panel should notify you if Printer Sharing is not enabled.

You may have to remove and re-add the shared printer on any of your networked computers you wish to print from. Two of my computers started printing to the printer with no problems, but one of them had selected the wrong driver (a generic postscript driver.) You could tell it was wrong because the printer icon didn’t match the one on the computer that the printer is connected to.

It could still print ok with the wrong driver but it couldn’t access any of the printer’s settings such as paper type or print quality.

Here’s things I tried that didn’t work:
  1. Turning off and on printer sharing.
  2. Deleting the printer from the computer I wanted to print from and re-adding it.
  3. Repairing permissions on the computer sharing the printer
  4. Printing from another computer that could see the shared printer. It behaved the same from three different computers.

Monday, June 22, 2009

iPhone 3GS, 3G, and original iPhone Comparison

A lot of people are talking about "new" features of the iPhone 3G S, however, many sites listing new features are listing items that exist for previous generation iPhones as well. Also, several sites are only comparing the new 3G S to last years 3G and not even including the original Edge only iPhone in their comparisons. So I felt the need to put together this table.

Hardware Differences



3G S

Metal back

plastic back, more curved shape

Recessed headphone jack

standard headphone jack

No stereo Bluetooth headphone support

Stereo Bluetooth headphone support


3G (3.6Mb/s HSDPA)*

3GS (faster 7.2Mb/s HSDPA)**

No GPS (simulates using triangulation=very inaccurate and often unavailable)


GPS + Compass (should allow turn by turn directions in future software)

No video

640x480 30fps video (fixed focus during recording)

2MP fixed focus Camera

3MP auto focus camera

Original CPU

Faster CPU

Original graphics

Faster 3D graphics

Powered by old iPod chargers****

Powered only by newer chargers****

Supports 1 button inline headphone remote

Supports 3 button inline headphone remote including volume control

No voice dialing

Voice Control

No tethering




No Nike + iPod

Nike + iPod built in

New features added with the free 3.0 software update to all iPhones



3G S

Cut, Copy and Paste



Global Search



Horizontal keyboard in most apps



Voice memos



Notes sync with Mail/Outlook



* Some reports state that AT&T artificially limits 3G access to 1.4 Mbps instead of allowing the full 3.6Mbps HSDPA speed.
** Not available in the US with AT&T yet.
**** The original iPhone supported the 12 volt charging (as did older iPods) and many car chargers only supplied that voltage. The 3G and 3G S require newer chargers that do not rely on the old specification.

Wednesday, April 29, 2009

How UPnP failed me and Bonjour for Windows saved me.

Today I am working in an entirely Windows XP environment. Not a Mac to be found. However, it was Apple software that saved me.

It might seem strange to be extolling the virtues of Apple software on Windows, and believe me, if the Windows UPnP software worked as it is supposed to, I probably wouldn't be doing this, but if you find yourself in the same situation this article might help you.

We just got a new Axis Q1755 network camera. It supports Universal Plug and Play or UPnP. It also supports Bonjour which it turns out is very lucky for me. I connected the camera to our network. At that point, as a UPnP device it is supposed to show up on my Windows XP computer inside My Network Places. I opened My Network Places, and it wasn't there.

I found an article that said Windows Firewall can interfere with UPnP devices. However, since I'm on an internal network, I have my Firewall turned off.

I found another article that mentioned that by default Windows XP might not have all the needed UPnP software installed. I went into Control Panels->Add or Remove Programs. I clicked the Add/Remove Windows Components button. I clicked Networking Services. Then I clicked Details… I saw that UPnP User Interface was not checked, so I checked it to install it. Clicked OK, then Next, then Finish which installed the UPnP components. Opened My Network Places again, but still nothing.

I found yet another article that said I might need to enable the UPnP discovery service. So I went into Control Panels->Administration Tools->Services and looked for the SSDP Discovery Service. Sure enough, it was disabled. I enabled it and started it. I verified its status changed to Started. Closed the Services control panel. Opened My Network Places again, and still nothing.

Now I've already wasted 10 minutes on something that was supposed to be Plug and Play. Then I noticed in the setup manual of the camera it also supports Bonjour for Mac OS X. Hmmm I know Apple released Bonjour for Windows too. It can't work any worse then this, and if it takes less then 10 minutes it's a more efficient use of my time. So I go to the Apple website and download Bonjour for Windows. It installs a new button on the Explorer Bar in Internet Explorer. I click that button and it immediately finds three devices on my network. Two printers, and my new Axis camera. I click on the camera and have full access to it.

So I gotta' say, I'm liking Bonjour for Windows.

Tuesday, March 17, 2009

iPhone OS 3.0 Adds a lot of features

In my previous post: iPhone 3G, still missing features I discussed the features introduced by the 2.0 version of the iPhone OS that shipped with the second generation 3G iPhone.

There were a lot of (what I considered obvious) omissions. Let's review those now that Apple released what they will be adding to the next generation of the iPhone OS in June:
  1. Stereo Bluetooth headset support (A2DP) (not on first generation iPhone as it lacks some hardware)
  2. Copy and Paste
  3. Global search (they let you search contacts now, but not notes or calendars, Palm OS has had this for years!)
  4. DUN tethering (so I can use the phone as a 3G modem on my laptop either over Bluetooth, or preferably, USB) (They claim they are adding this in 3.0, however, not all the carriers are ready to enable it...)
  5. Notes syncing (on Windows and Mac OS X)
  6. MMS (picture messaging, so far they still only support text messaging)
  7. Chat/IM support for popular chat apps (MSN Live Messenger, AIM, GTalk, etc.) (With push support finally arriving this appears to be solved.)
  8. API for turn by turn GPS (although Apple will not be supplying maps, so this will have to be 3rd party.)

The following items still won't be added:
  1. Video recording
  2. A ToDo app with syncing with Outlook (on Windows) or iCal (on Mac OS X)
  3. Voice activated dialing
  4. Syncing music/video/podcasts and calendar data over Bluetooth or WiFi. Why should I have to connect a USB cable just to sync?
  5. Forward camera and video chat support
  6. Undo in most apps (something PalmOS apps have had for over a decade)
  7. Bluetooth support for keyboards and standard devices other then headsets and headphones.
So all in all a pretty decent update. They've also added several features that were not in my wish list such as auto discovery of nearby iPhones for gaming etc. I'd say they addressed most of the items on my list I would classify as most important (Thank goodness for copy, cut and paste!)

Wednesday, February 18, 2009

Disk Utility Erase Failed on Mac OS X

Ok, I'm always running out of hard drive space. I just bought a $100 one terabyte external USB 2.0 and eSATA drive to add to my current pile of external hard drives.

Of course it ships formatted FAT32 which Mac OS X can read, but isn't a very good format (doesn't support journaling, limits file sizes to 4 gigs, etc.) So we need to erase and format the drive (or partition or reformat... whatever you want to call it.)

No problem. I launch Disk Utility, select the new drive, and click the Erase tab. Then I select Mac OS Extended (Journaled) as the Volume Format. Then I click Erase. It warns me I'll delete data, blah blah. It starts erasing, and then says the erase failed. Specifically it says:
Volume Erase Failed with error: The underlying task reported failure on exit

After a few more tries I found the solution and it requires changing a setting in the partition. We only want to create a single large partition but we still have to change a setting in the Partition tab.

If you don't see a Partition tab between Erase and RAID try selecting the drive in the list to the left. You may have selected the mount point (or sub volume/partition). To edit the partitions you have the have the higher level drive device media selected.

Ok, after that, click the Partition tab, then select 1 Partition from the Volume Scheme drop down menu. Then click the Options button. Chances are Master Boot Record is selected. You don't want that for a Mac OS Extended format drive. Instead select the GUID Partition Table and click OK (You only want to choose the Apple Partition Map if you are running on a PowerPC Mac with an OS below Mac OS X 10.4 or if you are running a PowerPC Mac and you need the disk to be a startup disk.)

Then click Apply. That should do it.

I haven't been able to reproduce this problem since the Mac OS X 10.6.3 update. If you have this issue and you are running 10.6.3 or newer could you please let me know with a comment below? Thanks!