Could not find libv8-3.16.14.9 in any of the sources

Problem

You are trying to upgrade one of your gems (ie uglifier) and at the same time you are using a new gemset (ie for rails 4.2.4), and you get the following error when you are trying to bundle:

Could not find libv8-3.16.14.9 in any of the sources

Solution

Upgrade to rails 4.2.4 first and bundle and afterwards change the other gem and do bundle again.

Terminate/Kill unused guest sessions in linux

Problem

You have started a couple of guest linux sessions on your pc, that you do not need anymore (ie giving access to your children while on holiday :-) ), and you want to close them from your own session.

Solution

Find out about the guest users by using who:

who
...
guest-kk9tnS :2           2015-08-09 17:39 (:2)
guest-kk9tnS pts/21       2015-08-09 17:40 (:2)

and then kill the sessions using pkill:

sudo pkill -9 -u guest-kk9tnS

Combine .img OpenStreetMap files to use in a Garming GPS

Problem

You would like to create your own map that includes different tiles and upload it into your Garmin’s SD card.

Solution

  • Make sure that your SD card is formatted with the FAT32 file system and not with the default exFAT that comes as standard in some > 32GB SD cards. There is no limit in the size that your Garmin can read provided is FAT32.
  • In your SD card create a directory called Garmin if it does not exist.
  • Download the latest version of the program mkgmap from here
  • Put all your .img tile files in a directory called my_tiles for example.
  • Go to the directory that you downloaded the mkgmap zip file and extract the files
  • Run the following to combine them all toghether:
    ./mkgmap.jar --gmapsupp  $( ls my_tiles/*.img )
  • Rename the resulting image file and upload it to your Garmin SD card inside the Garmin folder

Password protect a pdf file in linux using pdftk

Problem

You have a pdf file with sensitive information and you want to protect it with a password.

Solution

Install the pdftk if you haven’t already in your system:

sudo apt-get install pdftk

And then run the following to prompt for a password before opening the file:

pdftk original.pdf output pswd_protected.pdf user_pw PROMPT

make the unpermitted parameters errors in Ruby on Rails more obvious

Problem

When you are adding new attributes to your model after the initial creation, they are not by default included in the permitted parameters list. Sometimes the error is not so obvious to see when testing, unless you look at the test log files.

Solution

To make the error more obvious, there is the following configuration option that you can set up in config/environments/test.rb (tip taken from Rails 4 In Action):

config.action_controller.action_on_unpermitted_parameters = :raise

PostGIS in Action by Regina O. Obe & Leo S.Hsu (Manning)

This is another book from Manning publications in the excellent ‘.. in Action’ series, which guides the reader through some practical uses of the book’s subject. In this case the subject is PostGIS, which for people that come across the term for the first time, is a spatial database extender for the PostgreSQL database management system. As described in the introduction the audience of this book includes GIS Practitioners and Programmers, DB Practitioners as well as Scientists, Researchers, Educators and Engineers. That makes it obvious that the audience covers a wide spectrum of professionals that would have various degrees of experience with the subject matter.

The material is divided in three main parts, which are: Learning PostGIS, Putting PostGIS to work, and Using PostGIS with other tools as well as four additional appendices.

The first part about Learning PostGIS is an introduction to GIS database concepts and practices, that introduces the geometry, geography, raster and topology types and what problems can be solved by each one of them. There is a thorough explanation of what PostGIS is and what you can do with a spatially enabled database that is not possible with a relational database. There are also chapters describing the spatial types that PostGIS offers and their related functions, an introduction to spatial reference systems and their concepts, tools for loading spatial data as well as desktop tools for viewing and querying them, and the use of geometry, geography and raster functions, geocoding and finally an introduction to spatial relationships.

The second part Putting PostGIS to work, is where all the pieces are put together, using the theory foundation from the previous part, in order to solve real world problems to questions like: which places are within X distance and what are the N closest places?
These cover the traditional methods of finding closest neighbours as well as KNN indexes. Following that there is a section dedicated to geotagging. Geometry and geography processing has its own chapter to demonstrate techniques to manipulate geometries, and some of the most common problems and solutions related to them. Other chapters include raster processing, topology which includes creating a topology, and building and working with topogeometries as well as the simplification and validation of them. The final two chapters of this part offer the reader practical solutions in how to organise the spatial storage depending on the requirements, and some very useful tips about query performance tuning and optimisations. It should be also noted that throughout the book there are plenty of examples for the reader to follow, and especially in this part, that are of great practical use.

In the Using PostGIS with other tools part we are told how PostGIS can be extended by means of add-ons like the PostgreSQL procedural languages PL/R and PL/Python that allows us to use the wealth of statistical functions and plotting capabilities of R as well as the numerous Python packages. A variety of travelling-salesperson problems are displayed in this section, and the pgRouting used for building routing applications is also covered. The remaining chapters cover server-side mapping servers and client-side mapping frameworks to display PostGIS data on the web.

Finally the appendices have a very useful section with additional resources, instruction for installing PostGIS, an SQL primer and a separate section with the PostgreSQL features that includes table inheritance, roles, functions and performance tips.

To summarise, this is an extremely useful book for a variety of professional people interested in discovering PostGIS and at the same time PostgreSQL. It does not require any previous knowledge of geospatial databases as there is a great explanation and coverage of the theory, systems and tools needed. It would be helpful if the reader has some knowledge of SQL in order to follow the examples provided, even though there is very good appendix that covers SQL.
A highly recommended book for starting your exploration in the world of spatial databases.

Disclosure of Material Connection: I received this book free from the publisher. I was not required to write a positive review. The opinions I have expressed are my own. Regardless, I only recommend products or services I use personally and believe will add value to readers.

ERROR: could not open extension control file “/usr/share/postgresql/9.3/extension/plr.control”: No such file or directory

Problem

You are trying to install the PL/R extension to PostgreSQL, after install R in your linux ubuntu development environment, but when trying to install the extension inside your PostgresSQL with:

create extension plr;

you are getting the following error:

ERROR:  could not open extension control file "/usr/share/postgresql/9.3/extension/plr.control": No such file or directory

Solution

Install the necessary package for your PostgreSQL version with the following, and install the extension in your psql:

sudo apt-get install postgresql-9.x-plr