Posts By: Nael Shiab

Tutorial: How to remotely control your Raspberry Pi


So you just received a Raspberry Pi and you put everything together to start playing with it: keyboard, mouse, wifi dongle, USB hub, HDMI wire and power supply.

Wires went all over the place and you wondered: if I need so much stuff to make this small computer work, what’s the point?

“Would it be possible to make things simpler?” you asked yourself, before typing a few keywords in Google and finally landing here.

Well, fellow geek, you are at the right place! We are going to make your Raspberry Pi headless. You will be able to control it directly from your Mac! (Or from your PC) 🙂

I translated this tutorial directly from French. Therefore, it’s possible that a few French words appear from time to time in the pictures.

Continue reading

Tutorial: how to code a robot reporter

This tutorial is a simplified version of a workshop I gave in french to the Fédération professionnelle des journalistes du Québec.

It’s not a surprise for anyone anymore: robots are invading every industry, and newsrooms are not spared.

On March 2014, an algorithm coded by Los Angeles Times reporter Ken Schwenke wrote an article by itself on an earthquake that struck the area. Nowadays, sports news, business news and even political news are written by bots.

Inspired by my American colleague and his initiative, I’ll show you how to create your own robot reporter, with the programming language Python! Our bot will extract data on earthquakes in Canada and will write a short article by itself about the most recent one in the seismic area of Charlevoix, in Quebec!

If you’ve never wrote code before, I suggest you start with another tutorial of mine: Your first steps in programming. 🙂

Continue reading

How to make an interactive map of the vote results with CartoDB and Excel

carte finale

This tutorial is based on a presentation I made for a Hacks/Hackers Montreal meetup. Become a member if you live in the area!

In this post, I’ll show you how to use the raw data from the 2011 Canadian General Election to make an interactive map with CartoDB.

CartoDB is an awesome tool that allows you to create beautiful maps. Moreover, it also has a JavaScript library CartoDB.js and an API. But I will talk about that in another tutorial!

For the moment, let’s play with the vote results and some Excel formulas!

PS1: I made the map in french and I simply translated the french version of this tutorial. If you want a map in english,  just replace (CMD + F and choose replace in Excel) the names of the political parties by their english translation at the end of this tutorial.

PS2: You will be using the results per ridings. But if you want something more precise, you could use the results per poll and the geographic files for them.

PS3: If you get stuck, write me!

Continue reading

The web scraping golden rules
Part II

This article was published on J-Source’s website.

Web scraping is a way to extract information presented on websites. As I explained it in the first part of this article, web scraping is used by many companies.

It’s also a great tool for reporters that know how to code since more and more public institutions publish their data on their websites.

With web scrapers, which are also called “bots”, it’s possible to gather data for journalistic stories. For example, I created one to compare the alcohol prices between Quebec and Ontario.

My colleague Florent Daudens, who works for Radio-Canada, also used a web scraper to compare the rent prices in several neighbourhoods in Montreal with ads from Kijiji.

But what are the ethical rules that reporters have to follow while web scraping? Continue reading

Tutorial: How to automatically run your scripts on your computer


To know how to code can save you a crazy amount of time when you are a reporter, especially for repetitive tasks.

Some scripts are meant to be used once (to sort a database or to extract data from a pdf file for example). But others are made to run every week, every day or even every hour (like a script that monitors a specific webpage).

Online services, like ScraperWiki, can host and run your scripts on a regular basis.

However, it’s also possible to automatically run your script directly from your computer, with a chmod command and Automator!

Note: This tutorial is for Mac users.

Continue reading

From Ontario to Quebec

Ouch… My last article published here dates from over three months ago… My goal was to publish an article or tutorial about data journalism each week. Oh well… Many things happened lately.
Continue reading

Members of Parliament
and web scraping

I was looking for small personal project on the Members of the House of Commons. Nothing serious. Just something to code and have fun with.

The result: an interactive timeline of the occupation of the Members of Parliament throughout History!

Surprising how involved farmers were in politics prior the 70’s, isn’t it? You may also notice how being a politician has become a full time occupation around 2000. Click on the chart below for all the details!

How did I create this interesting timeline? I coded my own program to extract data from the Parliament of Canada website!

Continue reading