Monthly Archive for January, 2008

Atwood Strikes Again

Some of you probably follow Jeff Atwood’s Coding Horror. I used to look forward to reading his articles, but his content is increasingly starting to bore and annoy me. Many times it’s him quoting large pieces from some guy’s blog that does have original content, while trying to give some insightful comments. Except, they’re not insightful. They’re just plain wrong.

His latest entry, What’s your backup strategy, is another one of those monsters. Here’s a snippet:

The rsync command is more than a simple copy; it actually does a block-by-block comparison, only copying the differences. So instead of backing up the entire contents of your hard drive (again), you only back up the parts that changed since your last backup. This is commonly known as incremental backup.

Sorry Jeff — I can call you Jeff, right? — although your introduction to rsync is correct, rsync is definitely not “incremental backup” software. If he’d actually read the Wikipedia article he links to, he’d notice that the first line of it goes like this:

An incremental backup is a backup method where multiple backups are kept (not just the last one).

(Emphasis’ mine) rsync doens’t keep multiple backups. rsync will indeed only transmit the differinces between the last backup and the current original, but the result will be one backup: a complete mirror of the current original one.

The advantage of an incremental backup is not that it’s fast to do, like Jeff implies, it’s that you can pick a backup from before your last backup. This way you can restore the one you need, which is not necessarily the last one. Handy if you need a file you deleted 2 weeks ago, but your last backup was last week.

Even better, at the end of the article he throws up this God-awful piece of advice:

You don’t even technically need a second or third hard drive; if you have a large enough primary drive, Acronis will allow you to create a new, hidden partition to store a complete backup image.

If you store a backup on the same drive as the one you’re backing up, what the fuck — excuse my french — is the point in backing it up in the first place? If your drive dies, dear Jeff, your backup dies with it. Guess he didn’t got the message Jamie was trying to spread anyway.

It’s not that I hate Jeff. I guess I’m just disappointed that his articles have decreased in quality so much. There are some real gems on his blog, so you really should check it out. Just watch out for his Microsoft-centered ideas ;) .

Seen this before

Mmmh, where have I seen this photograph before?

Photograph by Tom De Nies

Of course, it’s from friend and classmate Tom De Nies!

Tom De Nies name

Nice, Tom!

(From CJP magazine/Gobots Zine Knokke-Heist Januari 2008)

How-To: Passwordless Sudo

This one is as much for you as it is for me. Every time I install a new system, I forget how to set the /etc/sudoers file so that I can execute certain applications as root using sudo without having to enter my password. This is very useful for scripts, or for harmless commands that you need te execute a lot — like vpnc — but still require root permissions.

Start by opening the editor of the sudoers-file:

$> sudo visudo

This will open the file in vim, which you might not be familiar with. No problem, just type i which puts it in insert-mode and it’ll work as any other editor.

Append a line in the following format at the end:

username ALL=NOPASSWD:command1, command2, ...

For example, mine:

david ALL=NOPASSWD:/usr/sbin/vpnc, /usr/sbin/vpnc-disconnect

As you can see, you need to use the full path for every binary. If you don’t know them by heart, find out using the whereis command:

$> whereis -b vpnc
vpnc: /usr/sbin/vpnc /etc/vpnc.conf /etc/vpnc /usr/share/vpnc

Usually the first result is the correct one.

Save the sudoers file by pressing ESC and typing :wq return. Now you can use sudo on the commands you entered without having to type your password. Have fun!

PS: There’s also a way to allow passwordless sudo for all commands, but I’m not telling how since that really isn’t safe. You’ve run away from Windows for a reason, remember? This is one of them ;) .

Religion and Programming Languages

One Michael Kimsal put up a survey to determine the correlation between what religion you believe in and what programming language is your favorite. Although of little real use, and probably not to be taken seriously, it’s going to be interesting to see the results.

At the time of writing, there are 1003 entries. Why not put in yours? It’ll make the world a better place… (not really ;) )

I bet Scientologists will love LOGO. Har Har.

How-To: Photoshop CS2 on Ubuntu Gutsy

Since Wine 0.9.54 got released yesterday, I’m giving a step-by-step to get Photoshop CS2.0 to work on Ubuntu Gutsy, using Wine 0.9.54. Although Photoshop CS2.0 should work now, installing it still requires a tad of magic, as I discovered when trying to get it installed.

Photoshop CS2 On Ubuntu

There are probably multiple ways to install Photoshop CS2 but this is the path I took, after finding out it crashes while trying to install it the normal way. This How-To requires a Windows XP installation.

Step 1

Install and activate Adobe Photoshop CS2.0 on a Windows machine.

Step 2

Still in Windows, go to Start->Run and type in “regedit“. Now browse to HKEY_LOCAL_MACHINE/Software/Adobe, and export it to adobe.reg.

Next browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\
Uninstall\{236BB7C4-4419-42FD-0409-1E257A25E34D}
and export that to adobe_uninstall.reg. (Apparantly you only need the keys EPIC_ORG, EPIC_SERIAL, and EPIC_NAME, but I was already getting fed up with switching between OS’s that I just imported all the keys in that directory, just for good measure.)

Step 3

You can go back to Ubuntu now. Copy the directory C:\Program Files\Adobe to ~/.wine/drive_c/Program Files/. If you installed Photoshop CS2.0 in another directory, copy that one instead.

Meanwhile, install recode and recode the .reg-files you created in Step 2:

$> sudo apt-get install recode
$> recode utf16..utf8 adobe.reg
$> recode utf16..utf8 adobe_uninstall.reg

Install them using regedit in wine:

$> wine regedit adobe.reg
$> wine regedit adobe_uninstall.reg

You’ll also need to install the font Times32:

$> cd /tmp
$> wget http://heanet.dl.sourceforge.net/sourceforge/corefonts/\
times32.exe
$> wine times32.exe

Trying to get the normal way to work, I also did the following. I don’t know if this is required, but if these steps don’t work, you might want to try running it as well:

$> cd /tmp
$> wget kegel.com/wine/winetricks
$> sh winetricks vcrun6

Everything should be in place now. Try running it:

$> wine ~/.wine/drive_c/Program Files/Adobe/\
Adobe\ Photoshop\ CS2/Photoshop.exe

If it asks you to Activate, and then gives an error saying there’s not enough disk space to activate, then you need to temporarily allow read+write access for all to your primary drive device — that’s /dev/sda or /dev/hda or something like that. E.g. mine is /dev/sda (and I have partitions /dev/sda1, /dev/sda2, …), so I do the following:

$> sudo chmod a+wr /dev/sda

Now restart Photoshop, the activation process should work smoothly now. Don’t worry, it won’t actually write anything. After you’re done, change the permissions back:

$> sudo chmod a-wr /dev/sda

This last tidbit I got from here.

Enjoy Photoshop CS2 goodness on Ubuntu!

Scratching an itch: Cocaine

Cocaine Context Menu

Ever have a file you need to quickly upload to a remote location so that you can share it with others? I have. For example, some photo I want to show someone, real quick.

So I wrote a script to do just that. It uploads a file to a previously specified location, and then puts the URL to that file in the clipboard, for easy pasting in whatever esoteric communication device you’re using, like IRC, IM, or E-mail. In fact, it copies the URL first, and then uploads the file, so you can paste the URL even before the file has uploaded.

Get it here: Cocaine v1.0

It’s a python script with about 30 functional lines. It requires pyGTK to interact with the clipboard. Edit the file and insert your ftp-server, username, password, and HTTP-subpath. I recommend using Nautilus-actions for Gnome users to add Cocaine to your context-menu, so you can easily right-click->upload any file straight out of nautilus.

(Both pygtk and nautilus-actions are in Ubuntu repositories)

Photoshop on Linux, finally

The new release of wine, 0.9.54, finally has support for Photoshop CS and Photoshop CS2 (no word on CS3 yet). This was one of my only complaints about linux - it didn’t have a decent Image editor. Sure, Gimp can handle a lot. It’s also unintuitive and has many, many quirks I don’t like.

Now if only more games would be playable on Linux…