Categories
Computers Gadgets Mac

Completely remove U3 from Sandisk Cruzer on Mac

My collection of USB memory sticks is constantly growing. Some USB sticks I have bought, others were given to me as giveaways. The nicest ones from a physical perspective are a couple of Sandisk Mini Cruzer but unfortunately they came with U3 which I utterly dislike. U3 means that there is a small CD partition on the flash disk which is used to hold the U3 software. Since I am mainly using a Mac that is of no use to me and is just causing more clutter to my desktop. Even when I am running Windows it feels like a nuisance. The extra CD partition also meant that I couldn’t install a live USB OS on them. As a consequence they haven’t been used much.

For the longest time I thought it was impossible to fix this issue. But then I found an article on the Sandisk forums. So, if you want to remove the U3 partition to gain access to the full USB memory (or for whatever reason), just download and install this file.

Run the Launchpad Removal Utility for Mac application from within the SanDisk Cruzer folder in the Utilitites folder inside the Application folder.

Categories
Computers Linux Mac Photography Windows

Pruning Canon EOS image folders

I have had my Canon EOS 20D since early 2005. The first few weeks I set the camera to save images in JPEG only. After a while I switched over to saving images in both JPEG and RAW and have been doing so up until this year. Up until last year I had been using Windows XP and Windows Vista and having JPEGs around made it easier to look at the photos. However, about a year ago I switched over to Mac and am now using Aperture 2 for my photo cataloging needs. There, the presence of both JPEGs and raw images is nothing but annoying.

Photos with both RAW and JPG files

To avoid the problem with both formats in Aperture I want to import the raw images where available and JPEGs otherwise. But I can’t just remove the JPEG files on a folder level because some images are only available as JPEGs. And with literally tens of thousands of images I just didn’t want to do it manually.

The attached Perl script solves the issue. It takes a source and a target folder as arguments. It then goes through the source directory hierarchy and copies all the image files to the target – but skipping files that are available both as RAW and JPEG. In that case it will pick the RAW file. It uses embedded EXIF tags (the time the photo was taken plus the serial number of the image) to judge if two images are the same. Further, it retains the folder structure but removes certain folders to flatten the target folder structure – I had originally put the RAW files one folder down so that they wouldn’t interfere with the JPEGs when viewing them in Vista’s image viewer.

Please note that I can only vouch that this works on CR2 files and JPEG files from a Canon EOS 20D as that is the only thing I have tested it with. It should be simple to adapt it for other cameras. Also note that the script does not test whether the target folder is empty. You are advised to test the program on some files that you don’t mind losing before you apply it to your entire image library.

I called the script photo_prune, despite the fact that it doesn’t actually prune the source data. To avoid data loss it instead copies the data to a new location.

Download script

Categories
Computers Gadgets Mac

Dlink DNS-323, part 4 – Gotchas for Mac users

Here are some quick hints that made me lose a couple of hours when setting up the DNS-323 from an iMac:

  • Do not use Safari to access the web administration pages on DNS-323. Especially not when formatting the drives. It just stops at 94% and sits there. Use Firefox instead.
  • Do not use Cyberduck to transfer the fun_plug files to the DNS-323. For some reason, the NAS does not run the fun_plug file when it boots. Instead, use the console FTP client from a terminal to upload the files.
Categories
Computers Gadgets Linux Mac Windows

Filename encoding problems on Dlink DNS-323

I have had my Dlink NAS DNS-323 since early 2007. It has mostly served me well. Over the months I have put more and more files on it so that it now holds about 350GB of data. Out of fear of losing precious data I have not updated the firmware so I am still on 1.03 from May 2007.

I mounted a shared folder on the DNS-323 from a Ubuntu client and noticed that the Swedish characters were all messed up. First I thought the error was related to how I mounted the drive from Linux, but then I found out that the issue is with the DNS-323 itself and the fact that it uses a non-Unicode character set for the filenames. This should be solvable with the iocharset and the codepage parameters to the mount command in Linux but I couldn’t get it to work.

Later firmwares are said to fix the problem – but only if the drives are totally wiped. I got myself a USB drive sufficiently large to hold everything and copied all the data over using rsync so now I am just about ready to upgrade the firmware and reformat the drives and use some of the plugins on http://wiki.dns323.info. But more on that some other time.

Before I wipe the disks I wanted to make sure that I could rename all the files using Unicode but with some 50,000 files I didn’t want to do it manually. The Linux command iconv can convert between encodings but it works on a file level and I wanted something that only touches the filenames, not the contents of the files.

I found the Perl command convmv which is available through the standard Ubuntu repositories. Just type “apt-get install convmv”. It does the same as iconv but on filename level. Precisely what I needed. I then typed:

#/mnt/wd640gb# convmv -f cp850 -t utf8 -r .

This command shows how files would be renamed, switching from codepage CP850 (the default or DNS-323) to UTF8. Once you are happy with the suggestions, just issue the command again but with the extra switch –notest to actually rename the files.

My only issue now is that convmv only works on filenames, not directories. But at least I have reduced by problem by a factor 30 or something. The directories I can do manually.

Categories
Computers Mac

Create ISO on Mac OS X 10.4

On Mac OS X 10.5 it is possible to create ISO files directly from the Disk Utility application but on Tiger, this is not supported. A quick solution is to use the terminal and realising that an ISO file is nothing more than a binary dump of the contents of the disk:

Start by opening a terminal window and insert the CD or DVD you wish to make an image out of. Then type “drutil status” to get information on the CD/DVD reader.

Unmount the disk by typing

$ diskutil unmountDisk /dev/disk1
Disk /dev/disk1 unmounted

Create the ISO file by using the dd command:

$ dd if=/dev/disk1s0 of=image.iso bs=2048

Note: It appears that the device should be stated as above for CDs but similar to /dev/disk1 for DVDs. YMMV

Categories
Computers Mac

Partition USB disk with FAT16 on Mac OS X

A previous article explained how to upgrade the BIOS on an Eee Box by using a USB memory formatted with FAT16.

As far as I have found, formatting with FAT16 can not be done through the GUI on Mac OS X. Instead one has to use the terminal.

First type “diskutil list” to see the devices on your system, making very sure that the following command is applied to the USB flash drive and not to a drive with important data. You have been warned!


diskutil partitiondisk /dev/disk1 1 MBRFormat "MS-DOS FAT16" "Data" 512M

The arguments have the following meanings:

  • /dev/disk1: The disk device to be partitioned and formatted
  • 1: The number of partitions
  • MBRFormat: The partition format
  • MS-DOS FAT16: The partition type
  • Data: The partition name
  • 512M: The size of the partition
Categories
Computers Mac

Install git on Mac OS X 10.4

The other day I wrote about how I compiled and installed support for git on Mac OS X 10.5. I also use a laptop with Mac OS X 10.4 and thought naïvely that the same would work on Tiger. I was sorely mistaken.

Apparently git has a few dependencies which must have been met on Leopard but caused errors on Tiger. The dependencies are to the packages expat and asciidoc. To compile support for those the following can be done prior to running the installation of git.


# Install expat
wget http://switch.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
tar -xvzf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure
make
sudo make install


# Install asciidoc
wget http://www.methods.co.nz/asciidoc/asciidoc-8.2.7.tar.gz2
tar -xvzf asciidoc-8.2.7.tar.gz2
cd asciidoc-8.2.7
sudo ./install.sh

Once this is done, the installation of git should go smoothly.

Categories
Computers Mac

Rails boilerplate project

After doing a couple of Rails projects I found myself doing the same setup for each project. On top of the template project I wanted user authentication support with mail activation. Whenever it was time to implement a new project I didn’t quite remember the exact process and ended up spending too much time searching for how-to-articles. This article is a summary of the steps required to create a project with support for user authentication based on restful_authentication.

To be able to implement this you will need to have a sufficiently new installation of Rails. I am using 2.1.1 but it may work on later or earlier versions. In addition, you will need to have support for git since the restful_authentication plugin has moved to a git repository.

The name “myproject” should be replaced with whatever project name you want to use.

Create project folder

$ rails myproject
$ cd myproject

Categories
Computers Mac

Install git on Mac OS X 10.5

Git is the version control system initially developed for the Linux kernel. Nowadays it is used in many other areas and recently the Rails community has migrated from svn to git. This means that a working git client is required to install many plugins when developing a Rails application.

Git install screenshot

The best way to install git on Mac OS X is to build it from sources. The script below makes this process effortless. This script has been verified on Mac OS X 10.5.4 (Leopard) but may work on other OS X versions as well. Your mileage may vary.

Download script

Categories
Computers Linux Mac Windows

Clearing the local DNS cache

On Mac OS X
Type “sudo nslookupd -flushcache”

On Linux
DNS records are not cached locally unless you have installed a local DNS server. Intead DNS records are cached in the upstream DNS servers.

On Windows
Type “ipconfig /flushdns”

css.php