Recent Posts (all)

Make jupyter notebook work in WSL

In case you are playing around with the Windows Subsystem for Linux and jupyter, you might have notice this error:

Invalid argument (bundled/zeromq/src/tcp_address.cpp:171)

The issue, which arises because Bash on Windows does not currently expose any network interfaces, has been fixed by Adam Seering in its WSL PPA.

The fix he proposed, though, only works on when you install jupyter using Ubuntu repositories. In case you want to have it working with pip, I found the following to be helpful:

pip uninstall pyzmq
sudo add-apt-repository ppa:aseering/wsl
sudo apt-get update
sudo apt-get install libzmq3 libzmq3-dev
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
pip install --no-use-wheel -v pyzmq
pip install jupyter 

Hugola

Approximately a month ago I fell for the new Dell XPS 15. It had the right price/spec combination (I went for the high-end model with 512GB SSD) so I went for it. This had of course some drawbacks, the main one leaving a *NIX like system.

Of course I am not the first guy making the switch, so there are lots of helpful resources around (although I might write one for the data scientists using Python).

One thing struck me though: Jekyll has no official Windows version. There is on unofficial guide but I wasn’t too eager to follow that. So I started playing around with Pelican, as I know some Python and as this is the tool that I already use with the GoDataDriven blog and website.

Around the same time, I saw the announcement, on Hacker News, of Hugo 0.15, that introduces a Jekyll import tool. And, more importantly maybe, it offers a simple .exe binary that you can just drop anywhere and call with hugo (or hugo.exe).

So in between things (mostly in the train) I gave it a go and issued:

hugo import jekyll jekyll_blog_folder hugo_blog_folder

Magically, all of my posts were converted. The code highlighting and the front matter were adjusted accordingly to hugo syntax (although I had to adjust the url). What was left out was the theme.

So the longish part of the transition began: rewriting my old theme for Hugo. Albeit the process was not difficult, some extra docs could have helped. Moreover the way to two theming engines works is different. But in the end I’ve finished and now my blog (and website) too is running with the hugola them (from hugo + Lanzani, but it nicely resembles ugola, which is the Italian for uvula).

In the process I removed some cruft: I removed JQuery and therefore Bigfoot and rewrote the other only thing that was using JQuery: the activation of the blue above the current page in the side bar. The old code was the typical exaample of JQuery usage:

$( ".blog-active" ).addClass( "menu-item-divided pure-menu-selected" );
$( ".blog-active" ).removeClass( "blog-active" );

The above snippet searches for the blog-active element and add the classes needed for the highlighting. It turns out that you can do the same in pure (modern) javascript if you make blog-active or whatever other class you’re using, into an id. Then you’re off with the following:

window.onload = function() {
document.getElementById("blog-active").className = "menu-item-divided pure-menu-selected pure-menu-item";
};

While these changes do not make it easier to blog, they are a symptom that I should have a bit more time to do so. So hopefully I can begin crunching posts again!

A functional count in Python

Today I was sifting through the documentation for itertools.count

Return a count object whose .next() method returns consecutive values. Equivalent to:

def count(firstval=0, step=1):
    x = firstval
    while 1:
        yield x
        x += step

Since itertools is supposed to provide you with better tools to write functional Python code, I thought it was odd that they have an example with x += step, redefining the x variable with every new invocation (although, to their defense, they only say that it is equivalent to the provided definition.

I sat therefore down wanting to create a “functional” version of it. Here’s what I came up with (Python 3.4 required)

def _count(first, step):
    while 1:
        yield first
        yield from count(first + step, step)

Normal mode in Vim

I consider myself an advanced Vim user. But I always found annoying the multiple cursors support that Vim has (through vim-multiple-cursors) and below the Atom and Sublime standards.

For example, say I have this piece of SQL and I want to convert all the field names to lowercase:

1 CREATE TABLE test (
2 MYFIELD1 STRING,
3 MYFIELD2 STRING,
4 ...
5 MYFIELDN STRING
6 )

Doing it with macros it tedious, and with multiple cursor, at least in Vim, it can be annoying, especially if you have lots of tables create like that, spanning multiple lines.

Enter normal mode

Normal mode comes to the rescue here: you just need to know which commands you would execute on one line to get the desired result (in this case _g~w) and the range of lines where the commands should be executed (in this case 2,5). Then it’s just a matter of typing :2,5norm _g~w and, almost magically, the code will be transformed in what we wanted!

1 CREATE TABLE test (
2 myfield1 STRING,
3 myfield2 STRING,
4 ...
5 myfieldn STRING
6 )
This is one of the features that keeps me in Vim and not in one of the emulated Vim mode out there (like Atom Vim mode)

Bij Brons in Almere

When searching for a good restaurant, I found Bij Brons in Almere. As it was the highest rated restaurant in Almere, I decided to reserve a table for two on a (lovely) Friday evening.

On the phone I chose the “5 gangen menù” which is the most expensive option the restaurant offers (for a mere €43.50 per person I have to say). By peeking their website, I read somewhere that their mission statement (or strategy statement, depending on how you call it) is to offer great food for reasonable prices (take notes, Twitter!). This, together with their high rating, convinced me that there were no tricks hidden behind the price, nor any up selling.

Starting from our phone call, Ivonne (the lady that owns the place, together with her husband, John) impressed me by spelling out my name right (“Giovanni” is, for Dutch-speaking, not the easiest word to pronounce correctly). Later at the restaurant I understood the reason: she speaks fluent Italian although she’s as Dutch as it gets!

But the good things do not end up here. Upon arrival (the local was full, luckily we called in advance) we found a modern restaurant with classic touches that was intimate and warm. Ivonne asked immediately if there was anything we didn’t wanted on our menu, to which my wife promptly answered “Onions!”. Afterwards, as my wife was pregnant, Ivonne said that the salmon we were going to have was safe for the baby. She then offered to look up whether the paté was safe as well, but I said that I’d Google that. It turns out fresh paté properly conserved is also safe for the baby.

Let me say that I’ve never experienced such a level of care for the guests: we’re often asked these questions, but Ivonne did so because she cared, not because she had to.

Afterwards, the various courses began appearing. I asked suggestion for the wine. Ivonne chose wisely: first a red wine (I don’t remember the name), then a white Almaral Gewurz to accompany the salmon. Food and wine were nothing short of delicious.

As we approached the fourth course, I took the wine choice in my hands and ordered a red Valpolicella. When John (cook and owner) heard me, he made a big smile, as if I already knew, even if I didn’t, what was coming next.

The remaining courses were flawless. Contrary to what I thought by reading the menu, we received 5 courses + dessert. The dessert probably doesn’t count as it is served in a glass rather than on a plate.

It really was a magical evening at Bij Brons. You should check it out if you ever pass by Almere.

Thanks John and Ivonne.

My @NoSQLmatters Barcelona talk

It seems like, right now, I only write in this blog when a get a new child or when I speak at some public event. Not breaking the tradition is this post, with the link to the slides accompanying the talk.

As John Gruber aptly put it (although for another conference):

Great crowd, great venue, and an amazing array of fellow speakers. It was a real honor and a thrill to speak [there].

I completely share John’s take if I had to describe my experience at NoSQL matters Barcelona.

Without further ado, here’s the link to the slides.

Elia

It took more than 9 months (9 months and four days to be precise), but Elia Lanzani is now here. He’s a healthy boy. He weights 3.8 kg and he seems like he could be a sleeper (I certainly hope so!).

The real hero is of course my wife that almost didn’t blink while delivering. If before this I was writing little here, rest assured I’ll write even less now :)

My NoSQL matters Dublin talk

I was honored to have been invited at NoSQL matters Dublin 2014 as a speaker. The title of the talk was Real time data driven applications (and SQL vs NoSQL databases) and being there was a great pleasure. Dublin is lovely, they have really good beer, the typical Irish breakfast charmed me and beef had me yearning so good was it.

As a cherry on top of that, my wife flew with me, as we got married six years ago.

You can find the slides for the talk here in pdf and on Speakerdeck. I’ve even uploaded some pictures to Flickr.

My PyData Berlin talk, now with video.

As announced (you heard it here first!) I talked at PyData Berlin 2014. You can find the slides at Speakerdeck and a video of the presentation on Youtube. The video seems to be rather popular on the PyData Youtube channel, but we’ll see if it’ll stand the test of time.

Kudos to Numfocus and Pydata for promoting the conference and kudos to the organisation for putting the video’s online in record time (faster than WWDC’s video’s).

Web Excursions for July 26, 2014

Lot of bookmarks this time:

postman
A command-line utility written in Go for batch-sending email.
Ma (negative space))
I’m always fascinated by the Japanese culture.
Find out what’s keeping your Mac awake
Sometimes selecting Sleep from the Apple menu doesn’t do anything. In that case, there’s a Terminal command that’ll tell you which processes are keeping your Mac awake. This is SO useful!
What I Wish I Knew When Learning Haskell ( Stephen Diehl )
A skimmable reference for intermediate level Haskell topics and an aggregate of the best external resources for diving into those subjects with more depth.
BestPig/cv
A command line tool for showing the progress of long-running coreutil functions like mv and cp.
You’re probably using the wrong dictionary « the jsomers.net blog
Add the best English dictionary to your Mac.
Online syntax highlighting for “MySQL”
Online syntax highlighting for more than 100 languages, including C#, Java, PHP, Basic, Perl, Python, Pascal, SQL, JavaScript and others.
Vim Awesome
Awesome Vim plugins from across the universe.
Cloudmarks - Canisbos
Cloudmarks (formerly Moofmarks) is a Safari extension that works with cloud bookmarking services Pinboard, Delicious, Kippt, and Google Bookmarks, letting you access your cloud bookmarks in a convenient popover.
launched
A web-based launchd.plist generator.
100+ Interesting Data Sets for Statistics
Looking for interesting data sets? Here’s a list of more than 100 of the best stuff, from dolphin relationships to political campaign donations to death row prisoners.
contacts
The utility contacts gives you access from the terminal to view and search all your records in the Address Book database.
Shaping up with Angular.js
Learn to build an application using Angular.js
Syncthing
Syncthing replaces Dropbox and BitTorrent Sync by being open and decentralised. Runs on OS X, Windows, Linux, FreeBSD and Solaris.
vincent
Vincent takes Python data structures and translates them into Vega visualization grammar. It allows for quick iteration of visualization designs via getters and setters on grammar elements, and outputs the final visualization to JSON. Perhaps most importantly, Vincent groks Pandas DataFrames and Series in an intuitive way.