Keath Milligan

On software development, quality, security and broken racecars

Create reusable chart components with Angular 2 and D3.js version 4

angular2-d3v4

Integrate D3.js (version 4) with the Angular 2 component life cycle to create reusable charts and other visualizations that support animation and dynamic data.… Read More...

Using Auth0 with Angular 2 and angular-cli

angular2Auth0‘s standard Angular 2 quick-start uses SystemJS and loads the Auth0 Javascript files globally from index.html. That’s fine for demo purposes, but not ideal for production. I’ve created a github repo (and some additional notes in this gist) that demonstrates using Auth0 with an Angular 2 app generated with angular-cli. This example loads Auth0 as modules and lets Webpack bundle it with the rest of your Javascript.… Read More...

A “shrink-wrap” Python project template and development pattern

Javascript development certainly has its ups and downs, but one of the good things about its ecosystem is the ability to easily share projects and quickly get other developers up and running. With most projects, it is simply a matter of cloning the repo and running “npm install” and you are ready to go without needing anything else pre-installed on your system besides NodeJS/NPM. With python, it’s usually not quite that simple.… Read More...

Python, LDAP and macOS

The Python LDAP packages (python-ldap and pyldap) mostly work on macOS, but if you try to use some options and APIs, you will run into trouble. For example:… Read More...

JWT authentication with Flask and Angular 2: a simple end-to-end example

flask-angular2-jwt

JSON Web Tokens are a standard method of securing exchanges between two parties (such as web server app and client) that has a number of advantages over other methods of securing exchanges such as cookie-based sessions – enhanced security, less overhead and statelessness to name a few.

In this post, well take a look at using JWT with Flask and Angular 2 and build a simple end-to-end example.… Read More...

RESTful Flask application quick-start

flask-quickstart

 

With the rise of the single-page application (SPA) web front-ends and mobile apps, the backend of many web applications is a collection of RESTful interfaces that provide JSON data rather than generating HTML. The rendering is up to the client side. While there are some drawbacks to this approach (heavier client, slower initial page loads, etc.), there are also a number of advantages, not the least of which is better separation of concerns since the front-end and back-end code are completely independent of one another.… Read More...

Cmder tip: enable forward slash completion

Cmder includes better command-line tab completion – normally, paths will be completed using the default Windows path separator, the backslash (“\”). But Windows has recognized the forward slash (“/”) as an optional path separator for a while now and there are instances where this might be desirable, especially if you switch between Windows and Unix-like environments (macOS, Linux) often as I do.

 … Read More...

Debugging pytest in VSCode (without adding files to your project)

For debugging pytest executions, the official VSCode Python extension documentation recommends creating an additional file in your project, e.g.:

and setting up a launcher to start the debugger against it. While this is simple, I really don’t like having to modify my project’s code or add source files just to satisfy my editor/IDE.

So, to debug pytest without having to create an additional source file, setup a launcher configuration with the “program” option pointing to the “pytest” script itself, for instance:

In my case, I have a virtual environment setup in the root of the project (.virtualenv).… Read More...

Debugging a Flask 0.11 app in Visual Studio Code

Visual Studio Code with the the Python extension makes for a great Python development environment – especially if you work on blended Python/Javascript web apps. The Python extension includes a built-in template launch definition for debugging a Flask app, but it assumes you have an old-style “run.py” script in your project. If you are using Flask 0.11.x, chances are you use the new “flask” command to launch your app.

First, be sure you have your virtual environment configured in VSCode (you are using a virtual environment, right?).… Read More...

What’s new in Flask 0.11.x?

It had been a while since I last started a Flask-based project, so I decided to have a look at what’s. new in the current release. Earlier this year, Flask and several other Python web development projects were organized under the Pallets Projects open source community and governance model. Along with the move, Flask 0.11 was released with several improvements and new features.

So what’s new? Flask 0.11.x brings several JSON-related fixes and improvements, making it easier to build apps that primarily provide RESTful JSON APIs.  … Read More...

« Older posts

© 2016 Keath Milligan

Theme by Anders NorenUp ↑