Code Maven

Search for '{{search_term}}'

Welcome to the Code Maven!

Programming Exercises for any language.

For now, just read the articles...

If you want to make sure you don't miss any new articles, you can subscribe to the Code Maven newsletter, follow via atom feed, Twitter, or even my Google+ account.

CSV - Comma Separated Files

CSV stands for Comma Separated Values, though in reality, the character that separates the values can be anything. , is probably the most popular one, but there are plenty of files where the separator is semi-colon ;. In other places it is |, and yet in other places it is a \t TAB. The latter is usually also called TSV - Tab Separated Values.

We'll just use the name CSV and mean any of these cases.


CSV - Comma Separated Files


Error 718: Missing files cannot be found.

Once upon a time I worked at a company on an automated testing system. It had lots of "interesting" things in their code-base, but one that stood out was one of the error messages:

Error 718: Missing files cannot be found

Of course. If the file is missing, it cannot be found. What's the story?


Error 718: Missing files cannot be found.


Almost infinite recursive template in AngularJS for representing tree structures

Representing a tree-like structure can be a tricky thing, but as plenty of other examples found on the Internet show, people need to do it. Recently I also needed to do that and it worked quite well till the people who built the data have added another level to the tree. Then it blew up with a horrible error message. It was so big that the link leading to the Angular Error report site was also broken.

After some additional research I found the solution. Let's see it.


Almost infinite recursive template in AngularJS for representing tree structures


Why Git is better than Subversion for Open Source Projects

For a long time while I was still using Subversion I was bombarded by people wanting me to switch to Git. It took me quite some time to understand the value in it. Let me tell you my story.


Why Git is better than Subversion for Open Source Projects



Record editor in Angular for fixed list of values

Earlier we have started to build an editor in Angular to edit a record. In the first article we have prepared and editor for a simple input box for free text.

This time we'll add an editor for a record where the user must choose from a fixed list of values.


Record editor in Angular for fixed list of values



Switch to interactive mode from a Python script

Instead of stepping through your code with a debugger, you can add some code to your Python script or application that will instruct it to stop excuting and enter the interactive mode for you to examine what's going on.

This can be especially useful when trying out objects that require complex setup you don't want to type in the console.


Switch to interactive mode from a Python script


Deploying Python Flask using uWSGI and Nginx on Ubuntu 14.04

The following is a tutorial on how to set up uWSGI with an Nginx front end to serve a Flask based application.

In this tutorial we will only use the packages that are supplied by Ubuntu and we will deal with a very simple Hello World application.


Deploying Python Flask using uWSGI and Nginx on Ubuntu 14.04


Create and download data in CSV format using plain JavaScript

There can be cases, especially in Single Page Applications, when you have some data in the browser already that you have probably received via an Ajax call that you'd like to let your users download.

CSV is a nice and simple format to keep tabular information.

In this simple example you'll see how to let your users save data from the browser.

This solution only works in the simple case, but it could be improved to handle some of the stranger cases as well.


Create and download data in CSV format using plain JavaScript