What is a JSON feed? Learn more

JSON Feed Viewer

Browse through the showcased feeds, or enter a feed URL below.

Now supporting RSS and Atom feeds thanks to Andrew Chilton's feed2json.org service

CURRENT FEED

Tom Taylor's Blog

Tom Taylor's personal blog.

A feed by Tom Taylor

JSON


Blog engine III: Pages

Permalink - Posted on 2016-11-04 10:06

Welcome to the latest installment of my gripping Blog Engine series. This time, I'll be discussing the core page architecture.

Before I go any further, all source code for my engine/CLI tool is available on GitHub: see my taylortom-cli GitHub repository.


Blog Engine II: The Basics

Permalink - Posted on 2016-05-24 09:28

After another considerable hiatus (maybe I'm just not cut out for blogging), I thought I'd try and resuscitate this series of posts reflecting on my self-written blog engine. This post will cover the underlying tech, with some reasoning as to why it was chosen.

Language: JS/Node
Database: NONE
Styling: LESS
Templating: Handlebars
Blog posts: Markdown

First things first: I opted for Javascript and Node for the simple reason that this project was intended to be a bit of an experimentation into the possibilities of Node.js, especially in a desktop environment.

I originally intended to set up a MongoDB database to handle the storage of all my blog data, but after (not much) deliberation, I decided against this. My main driver for this project was simplicity, and I couldn't justify the need for a database here; the only real data I'm throwing around is a list of blog posts (with accompanying metadata) and some configuration data, so a database here seemed like overkill. The only 'problem' with this solution was that I wouldn't be able to send dynamic data to users, so all pages would have to be static. Although this adds some complexity to the engine itself, removing the middle-man meant that the end-user experience is much snappier.

Next up, structure. I chose Handlebars for the templating of my site, as it's a library I've used satisfactorily many times now, and had no reason for greener pastures. I created a very basic structure hierarchy for my site which consists of:

  • A top-level html page: contains the global elements such as the nav bar, footer, and all of the file includes.
  • Handlebars templates for individual pages: these would be loaded into the top-level page, and contain page-specific content.
  • Markdown files for the actual page content: this applies to the truly static pages (such as the homepage), and things like blog posts. Using markdown allows me to easily apply styles to the site text without the need for any complex CSS.

For the styling of my site, I originally used plain old CSS, but later added support for LESS, as it allowed me more flexibility and more importantly cut out a lot of clutter in my CSS files.


Blog engine I: An introduction

Permalink - Posted on 2015-09-10 22:33

I posted some time ago (1st November 2014 to be exact) about my intentions to write a Node.js blogging engine to replace the ramshackle Wordpress site I was using. I am pleased to report that it is finally (almost) done, and that it is this. After a month of stolen spare half hours, I've finally managed to get to the stage where I have something useful enough as to be usable. There's still quite a bit to do, but I'm pretty happy with where it's at so far, especially as it's my first real Node outing.

If you're interested, the code for the engine is hosted on GitHub (the website src is in another, undisclosed location).

In the next few weeks, I'll be writing about various aspects of this (hence the pt I in the name) with the hope that someone else may find this useful. For now though, I'd just like to present it in all its minimalistic glory.

Please have a look around, and keep your negative opinions to yourself


Opinions of open source: a retrospective

Permalink - Posted on 2015-01-18 00:00

Came across this article on Hacker News, which has some interesting reflections on the perception of open source software in 2015 (as well as some quotes that may leave some Microsoft employees slightly red in the face).

No longer is open source the alternative. It is the mainstream.

If, at the beginning of the 21st Century, we had recalled this quote from French author Gustave Flaubert, we would not have been surprised by this outcome for open software:

"You can calculate the worth of a man by the number of his enemies, and the importance of a work of art by the harm that is spoken of it."


Setting up an Adapt development environment in Mac OS X

Permalink - Posted on 2015-01-13 00:00

If you opt not to use the Adapt authoring tool, setting up your computer to work on the Adapt framework can be a less than trivial process; you'll need to have a number of tools installed and working before you can even view the vanilla course, and this will require you to get your hands dirty in the terminal. I've put together this guide to hopefully make this process a bit simpler, and get your shiny new courses up and running before you know it.

This guide assumes you are completely new to web development, and therefore will need to install everything from scratch. If this is not the case, some of the steps may be inapplicable.

Install Xcode using the App Store

Grab Xcode from the App Store, and fire it up when installed, agreeing to all terms and conditions. If this isn't done, building the node source may fail later.

You'll also need the command line tools to be able to pull down the Adapt repositories using git. To get these, type git in a terminal window, and follow the instructions.

Install node and node package manager

This is by far the trickiest part of the installation process, largely due to the issues surrounding file permissions you can easily run into. After several less than straightforward installs, the following instructions are my recommended method.

A note on node/npm installation paths
By default, these are stored in /usr/local/, which requires root access to write to. There are three routes around this:

  1. Run every npm install as root (definitely not a good idea, as it could result in something like: sudo npm install trojan-disguised-as-module).
  2. Change the owner of the contents of /usr/local/ to your user account (if you're using a shared computer, this is not advisable).
  3. Change the home of global modules to somewhere you do have permission. This is the option I use below.

Create (and change to) a directory in your home folder to store your globally accessible node modules, and add this to your system path variable:

mkdir ~/local/ && cd ~/local/ 'export PATH=$HOME/local/bin:$PATH' >> ~/.bash_profile

Download and extract the latest node release:

mkdir ~/node-latest-install && cd ~/node-latest-install curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1

Install node to your local folder:

./configure --prefix=~/local make install

When this has finished, close the terminal, reopen and try the node and npm commands to confirm everything installed as expected (after running the node shell, you'll need to exit pressing ctrl+c twice).

Install the required command line interfaces

Finally, you'll need to install both the adapt-cli and the grunt-cli globally. To do this:

npm install grunt-cli -g npm install adapt-cli -g

Test out your installation

Now let's try downloading and building the vanilla adapt build:

Clone the adapt_framework from github. (This assumes you have ssh set up, if not check out github for a nice guide):

git clone adapt_framework git@github.com:adaptlearning/adapt_framework.git && cd adapt_framework`

Install the relevant components:

adapt install

Install the required npm modules (if everything has gone to plan, you won't get any permissions errors here):

npm install

Build, and run the course using grunt:

grunt build grunt server

Provided the above steps went according to plan, you should now have the example Adapt course open in your default browser, ready for development!


Just when you thought it was safe to go back into the water

Permalink - Posted on 2014-11-01 00:00

After a considerable hiatus, I thought it about time I started to give this blog a bit of love again.

Over the next few weeks/months, I’m going to be diving head-first into learning Node.js, and thought that I’d attempt to build my own simple blogging engine as a nice training exercise. I’ve been meaning to replace the Wordpress site I currently use for a while (which is a bit bloated for my needs, and is always a massive headache to re-theme any time I decide to update my website), so what better way than to build my own?!

Wish me luck.


Python Challenge: Insertion Sort

Permalink - Posted on 2012-06-21 00:00

Insertion sort is a fairly simple and 'clean' (implementation-wise) sorting algorithm. It works in much the same way that we might sort an unordered list (a shuffled deck of cards, for example): each item in the list is taken in turn, and compared with the item that comes before it in the list. If the preceding item is larger, the items are swapped. The element (in it's new position) is then compared with the element before it, swapping the two if it's larger. This process is continued until the item is positioned in such a way that the preceding element is smaller in value, or until the element is the first item in the queue. This process is repeated for all elements in the list.

The benefit to this algorithm is that each element is placed in its final resting position. It's also very quick when sorting small lists (some good quicksort implementations actually use insertion sort to sort lists below a certain length).

You can read more about insertion sort on Wikipedia.

# sort the list def insertionsort(list): for index in range(1, len(list)): item = list[index] holeIndex = index-1 while holeIndex >= 0 and list[holeIndex] > item: list[holeIndex+1] = list[holeIndex] holeIndex -= 1 list[holeIndex+1] = item


Python Challenge: Bubblesort

Permalink - Posted on 2012-06-12 00:00

Bubblesort was the lucky algorithm chosen for the Python Challenge: Part III. Pretty much useless in terms of it's practicality (due to it being so slow - it's average-case complexity is O(n2)), bubblesort is mainly used for educational purposes to illustrate list sorting.

It's pretty simple in how it works: the algorithm iterates through the list to be sorted and compares pairs of adjacent elements. The larger of the pair is always moved to the right, which results in the list being sorted in ascending order.

# swaps the two elements in the passed list def swap(list, index1, index2): index1Val = list[index1] index2Val = list[index2] list[index1] = index2Val list[index2] = index1Val # sort the list def bubblesort(list): while True: swapped = False for index in range(len(list)): if index == 0: continue if list[index-1] > list[index]: swap(list, index-1, index) swapped = True if not swapped: break


Python Challenge: In-place Quicksort

Permalink - Posted on 2012-05-31 23:00

Continuing with the Python challenge, the next step was to implement the in-place version of quicksort. Slightly more complex than the simple quicksort, this version uses less space by sorting the list in place. It keeps the same time complexity (O(n log n) average case)

# swaps the two elements in the passed list def swap(list, index1, index2): index1Val = list[index1] index2Val = list[index2] list[index1] = index2Val list[index2] = index1Val # partitions and sorts the list at the specified points def partition(list, left, right, pivotIndex): pivotVal = list[pivotIndex] swap(list, pivotIndex, right) storeIndex = left for index in range(left, right): if list[index] < pivotVal: swap(list, index, storeIndex) storeIndex = storeIndex + 1 swap(list, storeIndex, right) return storeIndex # sort the list def quicksort(list, left, right): if left < right: # get a pivot index pivotIndex = Random.getRandomInt(len(listToSort)) while pivotIndex < left or pivotIndex > right: pivotIndex = Random.getRandomInt(len(listToSort)) pivotNewIndex = partition(list, left, right, pivotIndex) # Recursively sort elements on each side quicksort(list, left, pivotNewIndex - 1) quicksort(list, pivotNewIndex + 1, right)


Python Challenge: Simple Quicksort

Permalink - Posted on 2012-05-30 00:00

I've been meaning to do a bit of hacking in Python for a while now, but haven't really had the free time what with the mountain of uni work. Now I'm all done and nearly a graduate, I thought it'd be a good time to give Python a go.

In the attempt of killing two birds with one stone, I thought it'd be quite an interesting challenge to work through my big fat book of algorithms and implement them in Python, because hey, you can never implement too many algorithms right?

I thought I'd start of gently, so the first one I tackled was the simple version Quicksort:

def quicksort(toSort): if len(toSort) <= 1: return toSort pivotIndex = len(toSort)/2 pivot = toSort[pivotIndex] toSort.pop(pivotIndex) # partition the list lower = [] higher = [] for i in range(len(toSort)): item = toSort[i] if item <= pivot: lower.append(item) else: higher.append(item) return (quicksort(lower) + [pivot] + quicksort(higher)) sorted = quicksort(list)

I'm pretty impressed with Python so far, albeit only having played around for a short time. I like the fact that curly brackets are out; the whitespace-sensitivity makes for much cleaner and easier-to-read code than I'm used to. I also think that the syntax in general encourages much leaner code; I remember my implementation of the same algorithm in Java was many more lines.

Next stop: in-place quicksort.


Judgement is Earned

Permalink - Posted on 2012-05-30 00:00

With my graduation pretty imminent (all things going well), I've been reading up on job hunting/interviewing techniques etc. etc. and came across this interesting comment thread via Hacker News, discussing the value of experience. I think one poster in particular hit the nail on the head:

Judgement comes not from success, but from failures. Most companies want to hire people that have had their failures paid for by previous companies

It's an interesting point to make that in order to achieve success, one must first experience failure. I sometimes find myself choosing the 'easier path' so as not to fail, but it's this failure which causes us to constantly evolve and grow.

Even the most skilled don't achieve success without a proportional amount of failure. This is how good judgement is earned.


Dominoes

Permalink - Posted on 2012-05-20 00:00

Just finished a short animation testing out the PhysX engine in 3DS Max. Check it out.


Cogito

Permalink - Posted on 2012-05-17 00:00

After 6 months of hard work, I've finally finished my final year university project, which I'm pleased to say turned out pretty well.

The main aim of my project was to experiment with academic AI techniques in a game context. It's pretty surprising that games aren't more adventurous in terms of their AI, which still takes a 'smoke and mirrors' approach; providing an illusion of intelligence rather than actually creating intelligent systems. Many of the techniques and algorithms used today date back 30 years or more. With my project, I wanted to introduce some more modern techniques (in particular machine learning).

The main inspiration for my game was the old school platform-puzzler game Lemmings. My intention was to take the Lemmings concept, which requires the player to safely guide a number of Lemmings across a treacherous 2D level, and remove the human element. I wanted to allow the characters to explore for themselves and learn how best to cross the level, without any human interaction.

The main learning method used in the game is reinforcement learning, which uses a 'carrot and stick' method to reward the characters for 'good' behaviour, and punishing them 'bad' behaviour.

I developed my game for iOS (specifically the iPhone), and it turned out pretty well. The Lemmings actually work by using a number of 'episodes' or lives to actually learn the level. Movement is completely randomised during these episodes. When they finish the learning stage, they have one chance to try and reach the exit safely using their gained knowledge. You can see a couple of videos of my project in action:

The full source code is available on Github, and should be appearing on the App Store very soon.


Algorithmic

Permalink - Posted on 2012-04-15 00:00


The Crazy ones

Permalink - Posted on 2012-03-26 00:00

Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can’t do is ignore them. Because they change things. They push the human race forward. While some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.


Optimise

Permalink - Posted on 2012-03-10 00:00

Avoiding premature optimization doesn't only apply to writing code, it's a good way to approach life.


Success

Permalink - Posted on 2012-03-10 00:00

I came across an interesting article earlier about success, being successful, and how successful people are successful. It poses an interesting point: that successful people gain success by building on minor successes, rather than the slightly naive notion that you can be unsuccessful, struggling for many years for that big break, and suddenly achieve success overnight. This extract from the article sums it up pretty nicely:

Many people think it makes sense to sacrifice everything for some elusive success that's waiting a few years down the line when their startup makes it big. They'll sacrifice their health, their social life, their appearance, their savings, their house, they'll quit their jobs, break up relationships that couldn't stand the pressure cooker, stop learning new things because "now is the time to get things done", and "there'll be time to have fun later, after the startup is out of the way"

Thinking about success sensibly, it's much wiser to aim for 'compound' success; with each decision in our lives building upon what we already have, moving from lesser successes to greater successes. If we can try to maximise our personal growth with each decision that we make (be it by gaining new knowledge or skills, financial wealth, connections, experience, and so on), it's difficult to see how we could come out worse off.

That's not to say that we should be completely selfish, completely concerned with our own personal gain (in fact, many decisions can be beneficial for all involved), but it's useful to remember that self-sacrifice is often beneficial to someone else's success at the expense of being detrimental to our own. Besides, surely it's easier to help people when already in a position of success?

You can read the full article here


Prototypes and Demos Always Come Before Spreadsheets

Permalink - Posted on 2012-02-20 00:00

It's not too surprising that Steve Jobs and his methods have been discussed pretty extensively over the last few months. While reading one such article (viewable here), I came across a nice quote from a supposed exec who has previously worked for both Apple and Microsoft:

Microsoft tries to find pockets of unrealized revenue and then figures out what to make. Apple is just the opposite: It thinks of great products, then sells them. Prototypes and demos always come before spreadsheets.

The origin of the quote is really irrelevant; if more companies picked up this mantra, the world would surely be a much more awesome place.


Float Like a Butterfly

Permalink - Posted on 2012-02-15 00:00


Productivity

Permalink - Posted on 2012-02-02 00:00

A nice quote from a letter I came across on the Hacker News from id Software co-founder John Carmack:

Using your time effectively is very important, and there is often a non-linear relationship between the amount of time you can stay focused and the amount that you can learn or accomplish. It is often possible to get more done in a highly focused 12 hour stretch than in a normal 40 hour work week that is interspersed with email, chat, and other distractions. Someone that can be completely obsessive about something does have an advantage, but the same questions about focus apply for any amount of time you choose to devote to an undertaking. Most people work at only a fraction of their potential.


Source Tree

Permalink - Posted on 2011-10-17 00:00

As a self-confessed source control addict, I found it slightly irritating to say the least that there were no decent apps available which were capable of managing the projects I work on. While there are plenty available with the basic commit/push/pull/branch etc functionality, I couldn't find any decent programs which actually provided a way to track all of your repositories in one GUI, with most preferring to function on a repo-by-repo basis. While this isn't a huge problem, it just adds an extra unnecessary complication to what should be a simple task.

Enter Source Tree: my source control client of choice (works with git, Mercurial and SVN). In addition to being really pretty, it provides all of the functionality you'd expect to find from source control software: branch, tag, merge, rebase, resolve conflicts, stage/unstage files, create and apply patches, view 'blame' reports, view the history of a single file, stash - the list goes on.

Source Tree also integrates nicely with most of the popular diff/merge tools, and provides integration with GitHub, Bitbucket and Kiln hosting services.

Available for Mac OS X for free

http://www.sourcetreeapp.com/


Spider vs. Wasp

Permalink - Posted on 2011-10-17 00:00

I saw this epic battle taking place on my windowsill the other day. Who won? The spider. Though I haven't seen it since, perhaps it too was mortally wounded in the skirmish.


Carlsberg don't do Linux distributions, but if they did...

Permalink - Posted on 2011-04-22 00:00

For any Linux users, the elementary team will no doubt be familiar, but for anyone that hasn't heard of it, elementary is a free (and open-source) software project with its main focus on bringing elegance and simplicity to the Linux operating system. Originally started in 2007, the elementary project now has several applications in its repertoire, as well as themes and icon sets for the gnome desktop.

It isn’t much of a surprise then, that the elementary team has made the decision to release its own distribution of the Linux operating system. Elementary OS uses the latest long-term release of the ever-popular Ubuntu as a base, with the team having essentially stripped out all of the superfluous programs and packages (you won’t see any of the games for example, or even a music player), and left only the bare essentials. The result is an incredibly lean OS which runs even faster than Ubuntu, which is by no means sluggish. What I like about this approach is that you really get a blank canvas; no bloat-ware or unnecessary apps to clog up your hard drive, leaving you to install what you need. You still get the standard Ubuntu Software Centre, so finding the apps you need is still a breeze.

In addition to the improved performance, the elementary OS is truly beautiful to look at; kind of a given considering the elementary team’s reputation for elegant user-interface design. It comes with all of the pretty elementary themes/icon sets pre-installed, as well as the custom ‘nautilus elementary’ file browser (a tweaked and streamlined version of the standard nautilus browser). Theming and icons are obviously very Mac inspired; lots of greys, industrial silvers and high contrast black symbols. Elementary OS also comes with the Mac-dock clone ‘Docky’ pre-installed. The whole feel of the UI is very much in keeping with the 'less is more' ideology; minimalistic, clean and uncluttered. Even the desktop has been locked down, so there are no icons cluttering up the desktop. It’s a similar story with the top panel (although both can be re-enabled easily using the gconf-editor if you so wish).

Overall, I’m very impressed with the elementary team’s first attempt, although I wouldn't have expected anything less with their high pedigree. It’ll be interesting to see what’s in store for the future as more of their apps reach public release.

If you want to try out elementary OS before installing, you can download the OS and create a live CD or USB over at: http://elementaryos.org/

Note: Faenza icon theme shown in images


Key Frame Animation

Permalink - Posted on 2010-05-21 00:00

Here's a little key-frame animation I made using 3DS Max for a university project. I was going for a cartoon-y almost cell-shaded look, so chose soft lighting and went for matt, bump-mapped textures. I wanted to get a nice contrast between light and dark, so chose to use spotlights rather than any natural global illumination-type light sources (although the finished product looks a bit more gloomy than I'd intended). The robot was (quite obviously) inspired by Wall-E.