Recent Posts (all)
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)
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:
1CREATE TABLE test (
2MYFIELD1 STRING,
3MYFIELD2 STRING,
4...
5MYFIELDN 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!
1CREATE TABLE test (
2myfield1 STRING,
3myfield2 STRING,
4...
5myfieldn 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)
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.
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.
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 :)
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.
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).
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.
I need to be on vacation in a house without internet connectivity to catch up with what is
happening on the web. So two months after Maciej Cegłowski gave a talk at Beyond Tellerand in
Düsseldorf, here am I, linking to it.
The talk is about the consequences of the internet on our lives. Maciej worked at Yahoo and runs a
profitable business selling something (almost) all his competitors are giving away for free so he’s
no stupid and mostly knows what he’s saying. As a bonus, his sense of humour is
almost unmatched on the web (follow him if you don’t believe me).
If you’re short on time (like me), at least read it up to the second animal picture. But you’ll
miss gems like:
You can dress up a bug and call it a feature. You can also put dog crap in the freezer and call
it ice cream. But people can taste the difference.
I am thrilled to announce that I will speak this next July (25th and 26th, to be precise) at
Pydata Berlin 2014, about Python and pandas as back end to real-time data driven
applications. From the abstract of the talk:
For data, and data science, to be the fuel of the 21th century, data driven applications should
not be confined to dashboards and static analyses. Instead they should be the driver of the
organizations that own or generates the data. Most of these applications are web-based and
require real-time access to the data. However, many Big Data analyses and tools are inherently
batch-driven and not well suited for real-time and performance-critical connections with
applications. Trade-offs become often inevitable, especially when mixing multiple tools and data
sources. In this talk we will describe our journey to build a data driven application at a
large Dutch financial institution. We will dive into the issues we faced, why we chose Python and
pandas and what that meant for real-time data analysis (and agile development). Important
points in the talk will be, among others, the handling of geographical data, the access to
hundreds of millions of records as well as the real time analysis of millions of data points.
The full schedule is available and if you’re into Python and data I warmly suggest you go.
Registrations are still open.
←
6/11
→