Lumen Jwt Authentication

Programming  Tutorials 
This post will go over how to include JWT (Json Web Token) authentication into an existing Lumen API. JWT is a standard for API authentication that is URL safe, and can pass manage small amounts of state too. You may have to edit more files depending on what state your API is already in but if you have an existing API you should be able to manage this. It is assumed that the existing api is just the result of creating a basic Lumen project with the composer tool.
Read more →

Lumen Api Setup

Programming 
Lumen is a micro-framework written in PHP by the designers of Laravel. I needed to learn how to use an API that is written PHP. The reason for this is that unlike Python or Java frameworks, PHP can be dropped on almost any web hosting site there is, whereas other languages require more specialised hosting. API Setup Setting up Lumen is a fairly well documented process but I will go over some of the parts that tripped me up initially.
Read more →

Flask Connexion Template

Programming  Software 
What is this template? This template creates a basic API that uses a username and password for initial login and then a JSON Web Token for subsequent access of the API. THe API includes routes for user management such as creating, deleting and modifying users. Download it here What is connexion? Connexion is a framework that automagically handles HTTP requests based on OpenAPI Specification (formerly known as Swagger Spec) of your API described in YAML format.
Read more →

Django Notes – Part 3

Programming  Tutorials 
API Access to the Notes To give our web application an API we are going to be using the REST framework. For our API to work correctly we need to provide ways for the application to serialize data, that is, convert the database objects into JSON. We will need to create a serializer object for each of the data objects we want to be able to access. Firstly, we need to create the directory structure so go ahead and create the following directories/files inside our notes/ folder:
Read more →

Django Notes – Part 2

Programming  Tutorials 
Securing the Application Now that we can view our notes on the website, we are going to want a login system. Currently anyone can navigate to our website and see all of our notes. Not ideal. To secure our site we will be using a combination of Djangos built-in auth module and crispy forms. First off we will add the auth modules URLs to the project so open up the URLs file in the project directory and add the following.
Read more →

Django Notes – Part 1

Programming  Tutorials 
Creating the Application To start, we will create a virtual environment for our project and install the required libraries mkdir DjangoNotes cd DjangoNotes python3 -m venv venv source venv/bin/activate pip install -r requirements.txt Now that we have our environment setup we can create out Django application. django-admin startproject DjangoNotes python manage.py startapp notes Whilst we are still doing some admin setup, we need to initialise our database and create ourselves a superuser.
Read more →

Flask API Template

Programming 
Flask API Template I often use Flask when I am writing a small web interface for an application. Flask proved to be a very simple easy to use framework and so I decided I would write an API. The end goal is to have a database back-end and a simple interface for retrieving and storing notes. However, this post is just about setting up a template and authentication for the API.
Read more →

Basic Java Threads

Programming 
Basic Java Threads Java provides classes and methods to create multiple threads inside your Java process. This allows you to run multiple different pieces of code at the same time. In the code below each of the worker threads prints out that they have started, wait a random amount of time before printing their message, wait another random amount of time and print that they have stopped. Each time the program runs the output will be in a different order.
Read more →

Logging with Java

Programming 
Logging with Java When writing applications in Java it is incredibly useful to print out information as you go a long so that you can track what your application is doing and the state of various different variables. One method of doing this is to use print statements, however, when it comes time to package your code into an application, you have to track down and delete/comment out all of these print statements.
Read more →

Useful Commands

Programming 
This is my page of small scripts and little one liners that give a helping hand during my daily use of Linux machines.
Read more →