Archive for the ‘Uncategorized’ Category

Bash bug

This is a short (local) test of the bash bug, announced in September 2014. Check out the reference [vox.com] to learn more about the story behind the bug and its impact.

The machine runs Ubuntu Server 14.04 LTS.

$ uname -a
Linux amgspc 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

The distribution bash package is on version 4.3.11(1).

$ bash --version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

The bug, showing an arbitrary execution during an environment variable definition.

$ env AMGS='() { :;}; echo hey' bash -c "echo foobar"
hey
foobar

After update, the version number does not change. However, behavior does:

$ env AMGS='() { :;}; echo hey' bash -c "echo foobar"
bash: warning: AMGS: ignoring function definition attempt
bash: error importing function definition for `AMGS'
foobar

References

http://www.vox.com/2014/9/25/6843949/the-bash-bug-explained

Fonts and Matplotlib

There are a few posts on StackOverflow about changing the font used by matplotlib, but I was not able to find a practical solution, particularly if the font is not part of the current set of system fonts.

To use a new font:

  1. (Optional) Install the font in the system;
$ apt-get install msttcorefonts
  1. Copy the font to matplotlib font directory. In this case, it’s in a virtualenv (server);
$ cp usr/share/fonts/truetype/msttcorefonts/Times_New_Roman* ~/.virtualenvs/server/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf
  1. Clear the font cache;
$ rm ~/.cache/matplotlib/fontList.cache

The font should be available for plotting. Testing with the scatter example from matplotlib’s documentation:

import numpy as np
import matplotlib.pyplot as plt

plt.rc('font',family='Times New Roman')

N = 50
area = np.pi * (15 * np.random.rand(N))**2 
plt.scatter(np.random.rand(N), 
            np.random.rand(N), 
            s=area, 
            c=np.random.rand(N), 
            alpha=0.5)
plt.title("Sample title")
plt.ylabel("Random Value")
plt.xlabel("Random Variable")
plt.show()

Changing the font of a matplotlib plot

Note: If the font is not rendered, it may be because matplotlib needs to refresh its font cache (see Kevin’s comment):

import matplotlib
matplotlib.font_manager._rebuild()

Codesign gdb on Mac OS X Yosemite (10.10.2)

Mac OS X 10.10.2 does not come with gdb pre installed. It is available on homebrew:

$ brew tap homebrew/dupes
$ brew install gdb

The binary is installed on /usr/local/bin

When initializing gdb on a program (a.out) it will produce the following error:

    Starting program: a.out
    Unable to find Mach task port for process-id XXXXX: (os/kern) failure (0x5).
     (please check gdb is codesigned - see taskgated(8))
Start Keychain Access application (/Applications/Utilities/Keychain Access.app)

This error occurs because OSX implements a pid access policy which requires a digital signature for binaries to access other processes pids. To enable gdb access to other processes, we must first code sign the binary. This signature depends on a particular certificate, which the user must create and register with the system.

To create a code signing certificate, open the Keychain Access application. Choose menu Keychain Access -> Certificate Assistant -> Create a Certificate…

Choose a name for the certificate (e.g., gdb-cert), set Identity Type to Self Signed Root, set Certificate Type to Code Signing and select the Let me override defaults. Click several times on Continue until you get to the Specify a Location For The Certificate screen, then set Keychain to System.

Double click on the certificate, open Trust section, and set Code Signing to Always Trust. Exit Keychain Access application.

Restart the taskagted service, and sign the binary.

$ sudo killall taskgated
$ codesign -fs gdb-cert /usr/local/bin/gdb

ACM SIGSPATIAL 2014 @ Dallas, Texas

ACM SIGSPATIAL aka GIS 2014 conference notes

GIR 2014 Workshop (4/11/2014)

[Presented] Indirect Location Recommendation, André Sabino and Armanda Rodrigues. The paper describes the Productive Network model with a spatial extension.

Using Minimaps to Enable Toponym Resolution with an Effective 100% Rate of Recall, Hanan Samet

Spatial and Data Processing and Querying

TAREEG: A MapReduce-Based Web System for Extracting Spatial Data from OpenStreetMap, Louai Alarabi (University of Minnesota, USA), Ahmed Eldawy (University of Minnesota, USA), Rami Alghamdi (University of Minnesota, USA), Mohamed F. Mokbel (University of Minnesota, USA)

Recommendation and LBS

Parameter-Free Discovery and Recommendation of Areas-of-Interest, Dmitry Laptev (ETH Zurich, Switzerland), Alexey Tikhonov (Yandex, Russia), Pavel Serdyukov (Yandex, Russia), Gleb Gusev (Yandex, Russia)

Spatial Data Mining

Hourly Pedestrian Population Trends Estimation using Location Data from Smartphones Dealing with Temporal and Spatial Sparsity, Kentaro Nishi (The University of Tokyo, Japan), Kota Tsubouchi (Yahoo Japan Research, Japan), Masamichi Shimosaka (The University of Tokyo, Japan)

Dallas, Texas

The conference venue was the Renaissance Dallas Hotel, at the Dallas Market Center.

Hotel: Holiday Inn Dallas Market Center, 4500 Harry Hines Boulevard

Run: Sat, 8 Nov 2014 7:44 Central Time (US & Canada)

Distance: 6,56 km
Time: 40:09
Avg Pace: 6:07 min/km
Elevation Gain: 36 m

Dallas Run