Beginning With D3

Lately I’ve been studying Data-Driven Documents (d3). It’s a JavaScript library built around the use and visualization of datasets through the web. I’ve been reading Scott Murray’s introduction book on the topic called ‘Interactive Data Visualization for the Web’, and would recommend it to anyone who is looking for a basic overview of d3.

Simple charts produced using the d3.js library

Simple charts produced using the d3.js library

The above screenshot shows two charts, which I’ve created using the d3 library. All data was provided by the World Bank, and then massaged into a .csv file format, that was imported with the d3 library. Although the charts are simple, it does provide a clear example of how effective the library can be in visualizing datasets. I’m now studying more interactive examples of d3 with an increased focus on using spatial datasets. I look forward to sharing more examples in the future.

If you’re wondering what d3 can do for you, check out the homepage at www.d3js.org, and if you’re interested in reading Scott Murray’s book, he has generously provided a free online version through his website.

Quick-Tip – Netstat: Processes and Port Numbers

Earlier today I needed to kill a process that was occupying a specific port of a network. After a quick search online I learned from a website that Netstat can list listening sockets and provide the program PID’s which are using a specific port. The command to do this is as follows;

netstat -lp

This approach can be further refined if you know which port to look for, by piping a grep command afterwards with a specified port number;

netstat -lp | grep <port #>

Javascript – Object.create vs. New: Perfomance Comparison

Recently I’ve been studying object oriented programming with JavaScript and trying to learn the differences between Object.create vs new, when creating child objects that inherit from parent objects.

Although I’m not an expert on the topic, I did come across an interesting site which compares the performance of both approaches in multiple browsers. I thought I’d share the site since it provides some interesting information of the topic of performance which may be of interest to other developers. Enjoy.

For those like myself who are new to OOP with JavaScript, I’d recommend the following website as an introduction to the topic. It’s provides both a concise and straightforward description of how to implement OOP with JavaScript.

Quick Tip – Multiple Authors in BibTeX

Recently I was storing some bibliographic data in JabRef and came across an issue in which bibliographic entries which have multiple authors were not being displayed as expected.

Example of Incorrect BibTeX:

The BibTeX Entry of “Author = {John Doe, Jane Doe, Jack Doe, and Jill Doe}” would display as “John Doe and Doe” in JabRef. To correct this issue, mutliple authors need to be delineated with an ‘and’, in order to display correctly.

Example of Correct BibTeX:

“Author = {John Doe and Jane Doe and Jack Doe and Jill Doe}” will display as expected as “Doe et al.”

Quick Tip – Starting a Local Web Server with Python

I’ve been doing some web development lately, and came across a great little tip about how to quickly run a local web server. This is especially useful if you’ve ever run into problems with restrictions in executing local javascript files in a browser.

If you have Python installed on your computer, type the following command in your website project directory, to initialize a local web server.

  • python -m SimpleHTTPServer 8888 & (Python v. 2.x) or python -m http.server 8888 & (Python v. 3.x)
  • Then open up a browser and go to the URL http://localhost:8888 and view the website.