Point Clouds on the Liquid Galaxy

Image by Stoermerjp, unmodified (CC BY-SA 3.0)
The Liquid Galaxy began as a system to display geographic data through Google Earth, but it has expanded quickly as a display platform for other types of information. We’ve used Liquid Galaxies for panoramic images and video, three dimensional models of all sorts, as well as time-lapse renderings of weather, infrastructure, and economic data. Now we’ve added support for a new type of data, the point cloud.
“Point cloud” is simply the common term for a data set consisting of individual points, often in three-dimensional space, and frequently very large, containing thousands or millions of entries. Points in a cloud can include not just coordinate data, but other information as well, and because this sort of data can come from many different fields, the possible variations are endless. For instance, the terrain features visible in Google Earth began life as point clouds, the output of an aerial scanning device such as a LIDAR scanner. These scanners sweep their field of view rapidly, scanning millions of points to determine their location and any other interesting measurements—color, for instance, or temperature—and with that data …
graphics visionport
PyOhio 2014: Python FTW!

Just got back from PyOhio a couple of days ago. Columbus used to be my old stomping grounds so it’s often nice to get back there. And PyOhio had been on my TODO for a number of years now, but every time it seemed like something else just got in the way. This year I figured it was finally time, and I’m quite glad it worked out.
While of course everything centered around usage with Python, much of the talks surrounded other tools or projects. I return with a much better view of good technologies likes Redis, Ansible, Docker, ØMQ, Kafka, Celery, asyncio in Python 3.4, Graphite, and much more that isn’t coming to mind at the moment. I have lots to dig into now.
It also pleased me to see so much Postgres love! I mean, clearly, once you start to use it you’ll fall in love, that’s without question. But the hall track was full of conversations about how various people were using Postgres, what it tied in to in their applications, and various tips and tricks they’d discovered in its functionality. Just goes to prove that Postgres == ♥.
Naturally PostgreSQL is what I spoke on; PL/Python, specifically. It actually directly followed a talk on PostgreSQL’s LISTEN/NOTIFY feature. I was a touch …
conference postgres python
Customizing the Nestable jQuery Plugin
A while back, we started using the Nestable jQuery Plugin for H2O. It provides interactive hierarchical list functionality – or the ability to sort and nest items.

Diagram from Nestable jQuery Plugin representing interactive hierarchical sort and list functionality.
I touched on H2O’s data model in this post, but it essentially mimics the diagram above; A user can build sortable and nestable lists. Nesting is visible at up to 4 levels. Each list is accessible and editable as its own resource, owned by a single user. The plugin is ideal for working with the data model, however, I needed a bit of customization that I’ll describe in this post.
Limiting Nestability to Specific List Items
The feature I was requested to develop was to limit nesting to items owned by the current authorized (logged in) user. Users can add items to their list that are owned by other users, but they can not modify the list elements for that list item. In visual form, it might look something like the diagram below, where green represents the items owned by the user which allow modified nesting, and red represents items that are not owned by the user which can not be modified. In the diagram below, I would …
javascript
PostgreSQL conflict handling with Bucardo and multiple data sources
Bucardo’s much publicized ability to handle multiple data sources often raises questions about conflict resolution. People wonder, for example, what happens when a row in one source database gets updated one way, and the same row in another source database gets updated a different way? This article will explain some of the solutions Bucardo uses to solve conflicts. The recently released Bucardo 5.1.1 has some new features for conflict handling, so make sure you use at least that version.
Bucardo does multi-source replication, meaning that users can write to more than one source at the same time. (This is also called multi-master replication, but “source” is a much more accurate description than “master”). Bucardo deals in primary keys as a way to identify rows. If the same row has changed on one or more sources since the last Bucardo run, a conflict has arisen and Bucardo must be told how to handle it. In other words, Bucardo must decide which row is the “winner” and thus gets replicated to all the other databases.
For this demo, we will again use an Amazon AWS. See the earlier post about Bucardo 5 for directions on installing Bucardo itself. Once …
bucardo database postgres replication
Python Imports
For a Python project I’m working on, I wrote a parent class with multiple child classes, each of which made use of various modules that were imported in the parent class. A quick solution to making these modules available in the child classes would be to use wildcard imports in the child classes:
from package.parent import *
however, PEP8 warns against this stating “they make it unclear which names are present in the namespace, confusing both readers and many automated tools.”
For example, suppose we have three files:
# a.py
import module1
class A(object):
def __init__():
pass
# b.py
import module2
class B(A):
def __init__():
super(B, self).__init__()
# c.py
class C(B):
def __init__():
super(C, self).__init__()
To someone reading just b.py or c.py, it is unknown that module1 is present in the namespace of B and that both module1 and module2 are present in the namespace of C. So, following PEP8, I just explicitly imported any module needed in each child class. Because in my case there were many imports and because it seemed repetitive to have all those imports duplicated in each of the many child classes, I wanted to find out if there was a better …
python
Python Subprocess Wrapping with sh
When working with shell scripts written in bash/csh/etc. one of the primary tools you have to rely on is a simple method of piping output and input from subprocesses called by the script to create complex logic to accomplish the goal of the script. When working with python, this same method of calling subprocesses to redirect the input/output is available, but the overhead of using this method in python would be so cumbersome as to make python a less desirable scripting language. In effect you were implementing large parts of the I/O facilities, and potentially even writing replacements for the existing shell utilities that would perform the same work. Recently, python developers attempted to solve this problem, by updating an existing python subprocess wrapper library called pbs, into an easier to use library called sh.
Sh can be installed using pip, and the author has posted some documentation for the library here: http://amoffat.github.io/sh/
Using the sh library
After installing the library into your version of python, there will be two ways to call any existing shell command available to the system, firstly you can import the command as though it was itself a python library: …
shell python
Creating a Symbol Web Font
Creating a custom font that only includes a few characters can be very useful. I was looking for a good way to display left and right arrows for navigating between clients and also between team members on our site and after doing some research, creating a custom font seemed like a good way that would be small and that would support all kinds of screens and browsers. So, here I’ll show how to create a web font with a few custom characters in it that you can use on your website.
You’ll need to get the free, open source vector graphics editor Inkscape and familiarize yourself with its drawing tools.
To start, open Inkscape and open the SVG font editor by clicking Text -> SVG Font Editor. Under the font column, click “New” and then name your new font.
Now you can start adding characters. Begin by adding as many glyphs as you need and choosing letters for your character to be represented by. Only use characters that you can find on a standard QWERTY keyboard, as FontSquirrel (which we’ll use to convert this to a web font) won’t work with, for instance, Unicode special characters.
Now, for each symbol, draw it using Inkscape’s tools and make sure that its dimensions are …
graphics
Runaway Rewrite Rule
I am not an expert in Apache configuration. When I have to delve into a *.conf file for more than five minutes, I come out needing an aspirin, or at least a nerve-soothing cupcake. But necessity is the mother of contention, or something like that.
My application recently had added some new URLs, which were being parsed by your typical MVC route handler (although in Perl, because that’s how I roll, and not in Dancer, because … well, I don’t think it had been invented yet when this application first drew breath). 99.9% of the URLs worked just fine:
/browse/:brand/:category (the pattern)
/browse/acme/widget
/browse/ben-n-jerry/ice-cream
and so on. Suddenly a report reached me that one particular brand was failing:
/browse/unseen-images/stuff
(“unseen-images” has been changed to protect the innocent. The key here is the word “images”; put a pin in that and hang on.)
/browse/unseen-images
worked just fine. What’s worse, instrumenting the route handler code proved that it wasn’t even being called for /browse/unseen-images/foo or any of its siblings, whether :category was valid or not.
Making sure my bottle of aspirin was at hand, I dove into the Apache configuration. I added –
RewriteLog …
apache