Recently I've been playing around with the last 15 years of patent publications as a 'big data' source. This includes over 4 million individual documents. Here I thought I'd highlight some problems I faced. I found that a lot of academic papers tend to ignore or otherwise bypass this stuff.
Artificial Morality (or How Do We Teach Robots to Love)
One Saturday morning I came upon the website 80000 Hours. The idea of the site is to direct our activity to maximise impact. They have a list of world problems here. One of the most pressing is explained as the artificial intelligence "control problem" : how do we control forces that can out think us? This … Continue reading Artificial Morality (or How Do We Teach Robots to Love)
Fixing Errors on Apache-Served Flask Apps
This is just a quick post to remind me of the steps to resolve errors on an Apache-served Flask app. I'm using Anaconda as I'm on Puppy Linux (old PC) and some compilations give me errors. Stuff in square brackets is for you to fill in. Log into remote server (I use ssh keys): ssh -p … Continue reading Fixing Errors on Apache-Served Flask Apps
Using Alembic to Migrate SQLAlchemy Databases
There are several advantages of using SQLAlchemy as a wrapper for an SQL database. These include stability with large numbers of data records, class/object-oriented approach, plug-and-play underlying databases. However, one under-documented disadvantage is poor change management. If you add a field or table you generally need to regenerate the entire database. This is a pain if … Continue reading Using Alembic to Migrate SQLAlchemy Databases
Quickpost: Adding a Custom Path to Conda Environment
I have a few Python applications in development in a custom 'projects' directory. I want to be able to run these using 'python -m [appname]'. The easiest way to do this is by adding a .pth file to the site-packages folder of my Python environment (for me '/[userdirpath]/anaconda3/envs/[projectname]/lib/python3.5/site-packages/'). For example, I added a file called 'custom.pth' that … Continue reading Quickpost: Adding a Custom Path to Conda Environment
Starting a Python Project with Anaconda
It just so happens that on a few systems I have been using Anaconda to allow painless Python coding. For example, on Windows or non-Debian Linux I have struggled to compile packages from source. Anaconda provides a useful wrapper for the main functionality that just works on these operating systems (on my Ubuntu machine or the … Continue reading Starting a Python Project with Anaconda
Quick Post: Structuring a Python Program
One thing I've found hard about programming in Python is the jump from small scripts or iPython (now Jupyter) notebooks to fully functional programs. Many examples and online tutorials only require a single ".py" file or a series of command line or notebook entries. However, as you get more advanced and start looking at complete Flash applications or … Continue reading Quick Post: Structuring a Python Program
Quick Post: Recursive Function to Search Multi-Level Dictionary
Many APIs return JSON that is converted into a multilevel dictionary (e.g. EPO OPS). The following code snippet helps find a key (e.g. "id") that is nested within the dictionary. The function is based on this answer. To find more than the first occurrence "return" may be converted to "yield".
Twitter Robots on a Raspberry Pi
Or how to get very quickly write-restricted by Twitter. This is a short guide to playing around with the Twitter API using Python on a Raspberry Pi (or any other Linux machine). Overview The process has four general steps: - Setup a new Twitter account and create a new Twitter app; Setup the Raspberry Pi … Continue reading Twitter Robots on a Raspberry Pi
(Near) Infinite Budget iPad Karaoke
It turns out my 3-year old daughter is a big karaoke fan. She does a marvellous version of Lionel Richie's "Hello". It just so happened that this beautiful Arbiter karaoke machine was in one of our local charity shops for the princely sum of £10. (Aside: turns out Ivor Arbiter was quite an interesting fellow.) Lightbulb: … Continue reading (Near) Infinite Budget iPad Karaoke


