Categories
Computers Linux

Unix epoch counter plugin for WordPress

On Friday the Unix time used by many of the computers throughout the world will tick up to 1234567890. As I have learned, most non-techies don’t understand the beauty of this. Strange.

Anyway, I thought I should have a Unix epoch time counter on the web page but was surprised that I couldn’t find a widget to do it. Not to be let down, I realised that this was the perfect opportunity to learn how to write a WordPress plugin.

The result is in the sidebar and the code can be downloaded below. Now all I have to do is wait up on Friday night (0.30 am here in Sweden) and watch the counter step up towards the magic number.

Download epoch-counter.php

Categories
Gadgets Photography

Patiently waiting for EOS 5D Mk II

Canon announced the update to the EOS 5D on September 18th, more than three months ago. Now the holiday season is all over us and there are still no EOS 5D Mk II to be found – at least not here in Sweden.

Canon recently announced some demonstration films showing off the video capability that this camera – together with some good optics – can deliver. The result is absolutely astonishing. I will have to reevaluate my assumption that I wouldn’t use the video feature.

Now I only wish that Canon could learn something from Apple. If they announce something they should have it ready for delivery. I’m getting tired of the waiting and if they don’t start shipping these babies in volumes my allocated budget may be put into use for some other gadget.

Categories
Uncategorized

Web classic: How real men start their grill

This is a partial quote from early WWW sources. I would gladly give credit to someone but I don’t know who wrote the original text. I remember reading it around 1995 while I was still at University, looking at the video on the Sun computers in the lab. Nowadays just about anyone posts videos on YouTube but Goble and his colleagues were among the pioneers.



A guy named George Goble (really!!), a computer person in the Purdue University engineering department. Each year, Goble and a bunch of other engineers hold a picnic in West Lafayette, Indiana, at which they cook hamburgers on a big grill. Being engineers, they began looking for practical ways to speed up the charcoal-lighting process.

“We started by blowing the charcoal with a hair dryer,” Goble told me in a telephone interview. “Then we figured out that it would light faster if we used a vacuum cleaner.”

If you know anything about (1) engineers and (2) guys in general, you know what happened: The purpose of the charcoal-lighting shifted from cooking hamburgers to seeing how fast they could light the charcoal. From the vacuum cleaner, they escalated to using a propane torch, then an acetylene torch. Then Goble started using compressed pure oxygen, which caused the charcoal to burn much faster, because as you recall from chemistry class, fire is essentially the rapid combination of oxygen with a reducing agent (the charcoal).

By this point, Goble was getting pretty good times. But in the world of competitive charcoal-lighting, “pretty good” does not cut the mustard. Thus, Goble hit upon the idea of using – get ready – liquid oxygen.

This is the form of oxygen used in rocket engines; it’s 295 degrees below zero and 600 times as dense as regular oxygen. In terms of releasing energy, pouring liquid oxygen on charcoal is the equivalent of throwing a live squirrel into a room containing 50 million Labrador retrievers.

You can see actual photographs and a video of Goble using a bucket attached to a 10-foot-long wooden handle to dump 3 gallons of liquid oxygen (not sold in stores) onto a grill containing 60 pounds of charcoal and a lit cigarette for ignition. What follows is the most impressive charcoal-lighting I have ever seen, featuring a large fireball that according to Goble, reached 10,000 degrees Fahrenheit.

The charcoal was ready for cooking in – this has to be a world record – 3 seconds. There’s also a photo of what happened when Goble used the same technique on a flimsy A2.88 discount-store grill. All that’s left is a circle of charcoal with a few shreds of metal in it.

“Basically, the grill vaporized,” said Goble. “We were thinking of returning it to the store for a refund.”

Categories
Computers Linux Mac Windows

Extract image metadata

Over the years I have used many small applications to extract metadata from images but none of them were as versatile as Image-ExifTool by Phil Harvey. It support just about any image or video file format your can imaging. And a nice thing is that it is implemented in Perl so that one can easily use it to build a script. And it works cross-platform which is important for me who move between three operating systems on a daily basis.

This is all it takes to extract all metadata from a file:

Categories
Computers Mac

Cyberduck crash report question

Cyberduck is a great application for FTP/SFTP/WebDAV use on the Mac which I use daily to manage files on various Linux and Windows servers. It also works rather well together with TextMate, my favourite text editor on Mac (or elsewhere for that matter!) although I lack the ability to open a set of files and get them in one TextMate window.

With the latest version of Cyberduck (3.0.3) I received the message “do you want to report the last crash” every time I started the application. There was no option to remove the alert on future application launches.

To remove the warning when the application is started, just remove the files ~Library/Logs/CrashReporter/Cyberduck*.

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

Ubuntu 8.10 – libpolkit error

On a newly installed system with Ubuntu 8.10 you will see these kind of lines in /var/log/syslog:

Nov 24 01:12:31 sirius console-kit-daemon[9837]: CRITICAL: cannot initialize libpolkit

The error will repeat every ten minute or so and the fix to this issue is to install policy-kit, i.e.:

sudo apt-get install policykit

This is described in more detail on Launchpad: https://bugs.launchpad.net/ubuntu/+source/policykit/+bug/275432

Categories
Computers Linux

VirtualBox and Ubuntu 8.04.1

When installing a Ubuntu 8.04.1 virtual guest under VirtualBox 2.06 running on a Mac you will probably be faced with the following error:

Starting up ...
This kernel requires the following features not present on the CPU:
0:6
Unable to boot - please use a kernel appropriate for your CPU.

This problem is due to the fact that the last couple of versions of Ubuntu have been compiled with PAE enabled – but the default guest setting of VirtualBox is that PAE is disabled. So to solve the issue, just stop the virtual guest and enable support in the CPU for PAE/NX, it’s under the advanced general settings. Another solution would be to reinstall the guest using the alternate CD image of Ubuntu (which, last time I checked, didn’t require PAE).

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 Linux

Create images on the fly from Perl

The image in the previous post was made through a small Perl script and using GD. I had saved a list of files on one of the disks in my DNS-323 NAS and wanted to visualise it. The Perl code for this was this:

css.php