Today I was in an experimental mood and found yet another small trick that felt worth writing about.
At this point my hosting is fairly crappy (but also damn cheap), a virtual host with 128MB of RAM (and up to 512Mb burst). Even with just a few visitors, the server is very slow. Until now I was using WP-SuperCache plugin that converts dynamic WordPress PHP pages into static HTML and serves them. Unfortunately it cannot figure out on the fly that the cached page is out of date and keeps serving the static one until it expires (static lifetime I setup). This is especially annoying while I edit a post as I do not see the changes immediately.
A much more elegant solution is using a PHP caching extension. The one that felt easiest to use and was free was Alternative PHP Cache.
On Ubuntu the installation took a whole 5 minutes to complete (the longest time was wasted trying to figure out some obscure message about apxs). You need to install the following bunch of packages
sudo apt-get install php-pear php5-dev apache2-threaded-dev make
After that install APC from the Php-Pear repository:
sudo pecl install apc
After it finished building, unless it found out your php.ini by itself, you will have to load the extension manually by adding extension=apc.so. For my system this was done with:
Inspired by this tutorial, I decided to try a similar thing, to speed up the TimeMachine backups of my VirtualBox virtual machines.
The results are quite nice, rather than backing up 20GB every time I boot the VM, it does only about 500MB. While this not spectacular – changing almost no data in the VM generates some traffic, at least is fast enough to let TM backup it up.
Same way as the tutorial, you create a sparse bundle image, mount it and you move inside it all your VM data. You can either tell VirtualBox that the new machines are located in a new location (the place where your image mounts), or create a symbolic link between your previous VM location and the mounted disk location. Notice that I said symbolic links and not an Alias from Finder. The VBox is not able to navigate through Aliases. To create a symbolic link you fire up a Terminal and type:
cd ~/Library
ln -s /Volumes/VirtualBox/VirtualMachines .
In the previous example my virtual machines were located under ~/Library/VirtualMachines and the name VirtualBox.
There are however a few annoying things about this whole setup. The disk has to be mounted before you start VirtualBox and it does not get unmounted automatically. I am sure that there is magical scripting solution for this, but I am yet to find it.
The advantage of Sparse bundle images over the regular dmg images is that they can expand dynamically up to the maximum size allocated (they can resized however if you decide you want more space). They are also allocated in 8MB stripes, thus allowing you to perform incremental backups.
Unfortunately they do not shrink automatically after you deleted some data. This can be achieved with the following terminal command:
hdiutil compact Your_sparse_image.sparsebundle
A similar bloating phenomenon happens with your VBox disk files if you made the expand.
The first step is to zero out the free space. If your VM is Windows boot it, download sdelete and run it from a command prompt:
sdelete.exe -c
After that is done shutdown the VM and run:
BoxManage modifyvdi your_VM_disk_file.vdi compact
It is rather annoying having to deal with 2 layers of self adjusting container images.
I have been annoyed for some time now that my favourite cloud storage project – Wuala – could never integrate with Windows. A few days back during an usual Wuala upgrade I noticed that it wanted to install a new proggie to “enhance” OS integration. The library in question is called Dokan.
This is a library that implements user land filesystem drivers. The library itself takes care of handling all the nasty windows kernel calls needed for the usual filesystem driver, providing a simpler interface to the programmer. The actual functionality is provided through plugins which do not need Administrator privileges.
Besides the nice development implications of this, I was happy to finally be able to attach a network disk to a remote SSH location, something that SSHFS+FUSE was doing for ages now under Linux. The FUSE project started pretty much to support SSH and FTP filesystem mounting.
This is absolutely awesome news for all those forced to constantly peddle data between Windows/Linux with WinSCP or likes. This gets old really fast since running local apps on remote data, you are forced to copy data locally and re-upload it by hand. The SSHFS module gives you a comfy GooWee for mounting.
Unfortunately I never got the SSHFS module for Dokan to work under Windows7 64-bit, but worked like charmed under WinXP.
As soon as somebody writes an NFS module, Windoze and Linux will play together much nicer (at this point the only way to mount NFS is through Microsoft Windows Services for Unix suite, which is an absolute pain to use).
Today I am uploading a bunch of digital Infrared shots I took over time.
Stay tuned as I will also write my first tutorial on how to take such photos.
Kudos to the guy that wrote FancyZoom. Best thing since bread came sliced.
Today I wanted to attract your attention to a funky contraption which dates from the 80′s, and no, it has no connection to Homer’s favourite brand of beer.
I am talking about a nice exploit of the C programming language, related to the case-label fall-through invented by Tom Duff. This function performs the simple task of copying data from one place to another in memory.
In the dawn of C and compiler optimization, this function performed almost twice as fast as the naive looping approach due to the loop unrolling (unwinding).
Nowadays it is probably nothing more than a curiosity as memcopy is doing a better job on almost all platforms. Actually at some point the performance of XFree86 got a serious boost from replacing all Duffs. At least one good thing came from the awkward behaviour of C’s switch-case…
If you are like me, and have tens and tens of gigs of music, you understand the pain of keep everything sorted and with the right album art, especially when you use all sorts “smart” media players like Windows Media Player, that screw up your hand written ID tags.
This new free tool I found not only fills in missing info by matching preexisting tags, but also can compute a unique hash of your mp3 based on some proprietary algorithm. So you should be able in theory to tag mp3′s that are called “file1.mp3″
Well, today during of one of my usual weekend random internet wanderings, I stumbled across an awesome project that does just that and does it semi automatically. To top things, all files including the database is released under GNU (to be read free, costs nothing, zilch, nada).
I am talking about the guys at MusicBrainz. This is just a database containing lots of music meta-information uploaded by lots of people, pretty much they way FreeDB is for audio CDs. There are quite a few taggers that are able to get their information from this site, but I personally tried just two of them: EasyTag available for *nix and Picard available for Win/Mac/*nix (available on the MusicBrainz site). While EasyTag is “easier” to use, as all operations are automatic and the program makes all the decisions for you. From now on I will make an in depth presentation of Picard.
For some strange reason the default version of Picard can view Album Cover, but you cannot download any missing covers for your files. The downloading capability is enabled through an extra plugin available on the same site, Cover Art Downloader Plugin. Follow the instructions on how to install plugins and make sure you enable it.
For an quick intro on how to use Picard check out these two links: How to tag files with Picard and the screencast made by one of the authors:
The docs are quite decent but there are certain GUI elements which are not self explanatory. Every so often you will notice that a song has a musical note icon. This basically means that the file is missing from the album (file missing or assigned to another album). Other times there is a musical note but there are two items in the subtree. This means that it found two duplicate files that match same position in the album. This can be resolved by scanning the file to get it’s fingerprint since there certain albums which contain multiple tracks with the same Name (like different studio takes).
Picard has more or less two working modes: a very fast, but inaccurate mode that matches just ID tags which is triggered by clicking Lookup, and a slow and accurate mode that matches ID tags but also MP3 fingerprint (a unique ID that does not depend on tag codec used to encode, etc) that is somewhat slower but dead accurate.
I’ve been meaning to start off a web project for some time now, but I just never found an idea that felt good enough. Till the little light bulb lights up above my head, I will be flexing that web muscle maintaining this blog.
Now some might run in tears: “OHHH NOES, yet another blah blah blog by a guy that has nothing to say telling us about the great omelette they had for breakfast”. I am planning to keep this blog as informative as possible. The blog will include howtos related to IPhones, Linux, Mac, Photography, etc, call it my way of giving back to the community.