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.

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


Angular example: simple router

When creating Single Page Applications with AngularJS it is quite important to handle the back button properly. The ngRoute service provides a simple way to handle this.


Angular example: simple router


Ideas for TED

TED is full of great talks about Technology, Entertainment, Design, and actually a lot more. I also love the fact that they have plenty of local events sometimes in the local language and that many of the talks have subtitles in a lot of languages.

This makes it even more likely that their ideas will spread.

So I thought I'd like to help it with my little knowledge of programming, but first let's write down a few ideas.


Ideas for TED


Prevent leaving the page using plain JavaScript

In many case, but espeically in single-page applications when there is some unsaved data in the browser you might want to make sure the user does not accidently leave the page without first saving the data. This can be achived using the onbeforeunload (read "on before unload") event.


Prevent leaving the page using plain JavaScript


Wikipedia

Wikipedia is great, especially if you speak one of the major languages.

Unfortunately there are many people who cannot read these major languages, and even if they can, it is much easer to understand thing in their own mother tongue.

On the other hand I have encounterd many articles on Wikipedia that are available in one of the "smaller" languages, but not in English. I belive making these available in English as well would be important.


Wikipedia


Merge only one commit from a Pull-request on GitHub

Recently I got a pull-request for one of my projects. The pull request had two changes in it. One of them I wanted to accpet, but for the other one I had a much simpler solution and thus I wanted to only merge the change that was really good.


Merge only one commit from a Pull-request on GitHub


Skeletons

When you start writing a project it is much easier to start with a skeleton than to stare at a blank page. This is a collection of skeletons you might find useful.


Skeletons


SVG X

This is part of the SVG Tutorial and exercises drawing a line in SVG.


SVG X