HexColorPicker + Pixelmator

2009:05:12

I’ve been going without Photoshop for about a month now and I have to say, I don’t miss it.

I did have the issue of getting hex color codes from a color picker in Pixelmator. A quick google revealed that the OS X community had a solution. It’s called HexColorPicker and it upgrades the standard color picker in OS X with hex color code support.

Once installed, all applications that use the standard color picker get this nice feature.

hexcolorpicker


OS X Leopard – command line fun with voices!

2009:05:04

Open up terminal and type

say -v "Bad News" Your mother in-law is moving in with you

See a list of available voices here.


Eclipse 3.5M7 – SWeeT Sheet!

2009:05:04

I have long awaited for sheet dialog support on OS X in SWT and 3.5M7 delivers!

Read more about what is New and Noteworthy in Eclipse 3.5M7.


Eclipse 3.5M6 – No issues after 2 weeks of usage

2009:04:02

about-eclipse-35m6

I have been using Eclipse 3.5 M6 as my main IDE since it came out a couple of weeks ago. I am happy to say that I have not ran into any issues or crashes for that matter.

The latest updates in 3.5 M6 are described here -

http://update.eclipse.org/downloads/drops/S-3.5M6-200903130100/eclipse-news-M6.html


Disable SWT Browser Drop Handling

2009:03:24

I like using the SWT Browser component for embedded web application functionality in a desktop app. Unfortunately, users can drop whatever they want on the Browser and it will load the dropped item.

Let’s take a look at what I’m talking about

SWT Browser is sweet for displaying various content types like PDF

Not looking so sweet after dropping a URL on it!

Coming up with a fix

My first line of thought was to disable drop handling using a DropTarget and DropTargetListener. Short story – that doesn’t work as of SWT 3.5M6.

Well, you can’t disable drop handling in the Browser component, as the title suggests. It *is possible* to capture location change events and cancel them before they actually change the browser’s location. Since location change events fire when a user drops an item on the Browser component, canceling them achieves the desire effect of disabling drop handling.

Disable Browser Location Change Event

See the code snippet below for a simple solution for preventing the Browser from loading user dropped items.

// Prevent browser from changing to unwanted location
// Assumes you have a Browser reference named 'browser'
browser.addLocationListener(new LocationListener() {

    public void changed(LocationEvent event) {
        System.out.println("Changed location to " + event.location);
    }

    public void changing(LocationEvent event) {
        System.out.println("Changing location to " + event.location);
        event.doit = false; // this cancels the browser location change
    }
});

Further Customization

The above example can be tailored to suit your needs. You can put conditions in the ‘changing()’ method to only allow your valid location URLs. To really polish this off, we can add a ‘disabled’ cursor action when the user tries to drop an item on the Browser.

new DropTarget(browser, DND.DROP_NONE);

There! Now the user knows that the drop is invalid and the actual drop will not result in the Browser loading the dropped item.


Dangers of Relying on Online Backup

2009:03:23

TechCrunch.com – Carbonite Loses Customer Data

According to this article, Carbonite lost 7,500 customers’ data. Losing customer data is not a fun spot to be in and I seriously feel for the folks at Carbonite, especially since it was a hardware failure and not related to Carbonite software.

Note – CEO of Carbonite, David Friend points out in a comment below that only 54 customers actually lost data that was unrecoverable.

Before I begin, please be aware of the following -

  • I am a partner in a company that makes the backup software CrashPlan
  • Carbonite is a competitor to the CrashPlan consumer backup product
  • I am going to tout a feature about CrashPlan that prevents this from affecting CrashPlan users

This brings me to the point of this article and a point we’ve been trying to make with CrashPlan since its inception -

Online backup by itself is not enough

Online backup solutions are for the most part very simple to use and get going with. However many of them lack a crucial component to a complete backup solution – multiple backup locations. The premise is that because the solution is online and in the cloud, it is reliable and safe. This couldn’t be farther from the truth. Cloud reliability relies on a number variables -

  1. Network connectivity – You have to be online to talk to the cloud! In other words, if you are not online, you are not backed up.
  2. Bandwidth – Bandwidth is the killer for transferring data too and from the cloud. Backup data is often measured in GB if not TB these days. At 10 Mb/s, you are looking at 10 days to download a 1 TB of data.
  3. Hardware – Ultimately your data is going to be on some storage system, somewhere. Believe it or not, its most likely sitting on the same type of storage that is in your computer – a SATA drive of some sort. Various RAID setups can help make failure of this drive less drastic but the bottom line is that all drives fail at some point.

As of today, online/cloud solutions are facing some serious practical challenges. Will these challenges be overcome in the future? Possibly, but to be safe, one should treat online backup as just a part of a complete backup solution.

You need multiple backup locations

  • Your backup is only as good as your backup location.
  • Your best bet is to have at least three.

A complete backup solution should provide you a guaranteed restore experience and to have that, you need at least three (3) backup locations -

  1. Local backup – This hits the 80% sweet spot for your daily backup and restore needs. An external USB drive works beautifully in this capacity as it provides a fast, easy to use backup location.
  2. Near-line backup – In CrashPlan we call this backing up to your friends and family. Don’t just backup to a cloud, backup to a trusted location that you can access physically and quickly should disaster strike. If that USB drive fails after someone stole your laptop, you can still drive over to a friend’s house and get your data.
  3. Online backup – Yes, online backup is an important part of the overall solution. In a pinch, you can quickly restore key files, like a term paper or a sales presentation. However, it is less than ideal should you need to restore an entire filesystem.

<start-sales-pitch>
CrashPlan makes backing up to mutiple locations simple. Backup to local drives, your friends computers and/or our online backup service, CrashPlan Central. All of this done in a super efficient, secured manner.

If this sounds like a backup solution for you then try CrashPlan for yourself, its free!
</end-sales-pitch>


Recover lost iPhone/iPod photos

2009:03:17

I lost my iPhone on the flight back from SXSW with a bunch of photos that I thought were lost for good. I then remembered that iTunes keeps a backup of my iPhone and figured there had to be a way to recover the backup.

Sure enough – there is iPhone Backup Extractor!

  1. Download iPhone Backup Extractor
  2. Launch iPhone Backup Extractor.app
  3. Select ‘Other Files’ option
  4. Click ‘Extract’

All of my iPhone photos were extracted to the folder ‘Other Files/Media/DCIM/XXXAPPLE’ where XXX is a 3 digit number.

NOTE – This only works on Mac OS 10.5 (Leopard). Although the site says it doesn’t work with iTunes 8.1, it extracted my photos correctly from my iTunes 8.1 backup file. I have not tested extracting applications.


UCDetector – Detect unused code in Eclipse

2009:03:11

http://www.ucdetector.org/

UCDetector is an Eclipse plugin that lists unused classes/code in a project as warnings in the Problems panel.

I found this plugin to be easy to install and use, however its pretty slow when performing its scan. By default it scans text files (*.xml to be precise, which you can modify) for textual class references so I turned that off to see if it would speed things up. No such luck.

UCDetector also makes recommendations on visibility – i.e. ‘method A’ should be protected instead of public. After using it, I found that I didn’t like its visibility recommendations so I turned them off as well.

Overall, its a nice utility to have when you want to cut the fat out of your code base.


OS X Image Manipulation – Convert Multi-page PDF with sips and pdftk

2009:02:24

Awhile back I wrote the article ‘OS X Command line Image Manipulation‘ which shows how to use the ’sips’ command to rasterize a PDF document into a PNG, JPG or any other image format file.

A reader then asked how to do this with a multi-page PDF document. From what I can tell, its not possible with the ’sips’ command by itself. However, a little poking around on the internet revealed another very useful command-line tool when dealing with PDF documents – ‘pdftk’.

http://www.accesspdf.com/pdftk/index.html

‘pdftk’ is an open source command line tool for manipulating PDF documents. In particular, it can extract the pages of a single PDF document into their own PDF document files.

By using ‘pdftk’ to extract each page into a its own PDF document file, we can now use ’sips’ to convert the files into our desired rasterized image format.

Installing ‘pdftk’

Easiest method is to download it from the web -

http://www.pdfhacks.com/pdftk/OSX-10.3/pdftk1.12_OSX10.3.dmg.gz

Note – I have not tried this version as I found the next method more to my liking…

Mac Ports
If you’re running Mac ports, you can install it via command line

sudo port install pdftk

This can take a *long* time if gcc needs to be built. Just be patient, it’ll finish eventually!

Using ‘pdftk’

Once installed, simply issue the command

pdftk multi-page.pdf burst

where multi-page.pdf contains the pages you want extracted. This will result in each page being written as its own PDF document in your current working directory. The filenames will be ‘pg_000x.pdf’ where x is the page number.

Integrating with ’sips’ at this point is trivial, as you can customize the output file naming scheme of pdftk to whatever you need.


Safari 4 Beta + Webkit Nightly

2009:02:24

Here are a couple of pictures of the nightly webkit build after having installed Safari 4 Beta -
webkit-safari4

webkit-topsites-safari4

Notice the Safari 4 top tab browsing and debugging button. Also, the top-sites and ‘cover flow’ history navigation all appear intact as well. I guess Safari is the window dressing to Webkit’s browser engine.

It took a few moments to get used to the eye-candy features like top-sites but I am settling into it and definitely like the top tab positioning.