Failing “find” when parsing GPX XML with jQuery

When using jQuery for parsing GPX data (which is an XML format) you may experience a weird problem of being unable to access extra elements (nodes) added by software used to process the data, such as QGIS.

A typical example would be having such data in the file and being able to read “extensions” as an abject, being able to access its contents as text, but mysteriously failing when attempting to read “ogr:id”, which was added by QGIS:


The good news is that it is not your fault. Actually the culprit is jQuery itself, which fails to operate correctly with the node identifiers from different namespace due to a bug.

The easiest solution is to escape the colon with two backslashes, like this:

var mytest = $(this).find(‘extensions’).find(“ogr\\:id”).text();

Read more about it here.



OSRM: Profile profiles/car.lua not found

So you build OSRM map routing server and attempt to run it following the instructions on how to do it, only to see a message:

[error] Profile profiles/car.lua not found!

Well… You shouldn’t leave the “osrm-backend” directory. As the message says, OSRM was looking for a certain file in the “profiles” subdirectory of the location where you are now and it couldn’t find one. The chances are that after building and installing OSRM you went to another directory where your OSM map files are stored to test it.

The quickest solution is to simply create a symbolic link to the map file in the “osrm-backend” directory.


Pydio – file sharing and teamwork program

A rather convenient PHP-based system for sharing your files and collaborating with your colleagues and clients.

Formerly known as AjaXplorer, now called Pydio. Community version available for free here.



Which deb package owns the file?

To find out which package the file belongs to in a Debian based system (Ubuntu, Mint, BunsenLabs etc.), you may use apt-file.

Normally this utility is not installed by default, so it goes like this.

Install it:

  • sudo apt-get install apt-file

Make it update its database:

  • apt-file update

Use it on any file, for example:

  • apt-file find /usr/bin/blender

Choosing disk size in VirtualBox

When creating a new virtual machine in VirtualBox, always go for a large size dynamically allocated disk.

Don’t use the defaults, as it is a dynamically expanded storage, it will use only the space it needs. If you set the limit too low, you risk running into storage capacity shortage soon enough and will have to waste your time thinking about expanding or adding disks.

Use something safe, like 100GB or 200GB – it will not use that much anyway unless actually needed.

Resize hard disk in VirtualBox

You may run out of space at your virtual hard drive of your virtual computer running inside Oracle VirtualBox.

You may easily expand the disk with one command. This example shows expanding a (dynamically allocated) disk to 20GB in size:

  • VBoxManage modifyhd "/home/john/VirtualBox VMs/bunsenlabs/bunsenlabs.vdi" --resize 20480

Please note, that you may have to supply the full path to your virtual disk file.

You can read more about it at Oracle’s site.

Also, you must afterwards extend the file system to use all the space that became available. Use a disk magament tool, typically gparted, to do it.

Please be aware, that the extra space on the virtual disk may not show up if you are using snapshots. In such a case you can clone the original virtual machine, merging all the changes  (“Full clone”), into a new one. Then, while it is switched off, run the modifyhd command on its .vdi file.

Please be aware that the purpose of the disk and the way of partitions are organized may prevent you from effectively resizing a particular partition. Consider creating a new partition in the new space and mount it at the necessary place in your file system (for example, mount the whole new partition as /home/john).

If there is an existing swap partition getting in the way, you can delete it and recreate at the end of the available space.

Find and replace text in all files in subdirectories

To search for and replace a text in all files in all subdirectories of the current directory:

  • find ./ -type f -exec sed -i -e 's/old-text/new-text/g' {} \;