Will Warren

The blog of an engineer from Canada who specializes in SaaS, HA, Cloud and Product Development. I work in the Internet.


Reverting a git commit after pushing to remote


Imagine a scenario where you have a git repo with 2 branches; master, the production-ready branch and dev, the branch where all the development occurs.

Now imagine that you accidentally made a commit on master, when really it should have been on dev. If you have not yet pushed to a remote repository (like Github), you can undo that commit using git reset like so:

Read the rest →

Length: 325 words or 2 min Tags: git, coding

The craft of code


Came across this great quote from the book The Pragmatic Programmer (which I whole heartedly intend to read after seeing this quote)

Read the rest →

Length: 170 words or 1 min Tags: discoveries

Awesome Database Design Tool: wwwsqldesigner


I stumbled across this software while trawling the internet looking for good design tools. It’s super simple to use and looks great. Because it’s web based (written almost entirely in Javascript), you can design without having to have any gigantic software packages installed. Also it’s free and open-source which I’m always a fan of!

Screenshot of WWW SQL Designer

Example of WWW SQL Designer

Read the rest →

Length: 141 words or 1 min Tags: database, discoveries

SQL Script for Provinces and Territories of Canada


I made this simple SQL script to insert all the provinces of Canada. I’m posting it on here in case I need it in the future, and so anyone else that might find it useful can download it.

CREATE TABLE IF NOT EXISTS provinces (
	`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	`name` VARCHAR(100),
	`abbrev` CHAR(2)
);

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Alberta', 'AB');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'British Columbia', 'BC');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Manitoba', 'MB');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'New Brunswick', 'NB');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Newfoundland and Labrador', 'NL');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Northwest Territories', 'NT');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Nova Scotia', 'NS');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Nunavut', 'NU');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Ontario', 'ON');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Prince Edward Island', 'PE');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Quebec', 'QC');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Saskatchewan', 'SK');

INSERT INTO provinces(`id`, `name`, `abbrev`)
VALUES(NULL, 'Yukon', 'YT');

Or download it as a SQL script here: canada_provinces.sql

Read the rest →

Length: 193 words or 1 min Tags: database, projects

Creating a public API with Apache Thrift


I recently came across a new client-server technology that really fascinated me. Through my meddlings with CirrusNote, I know that 49% of the effort of writing a good API is coming up with standards (XML formats, rules, schemas etc.), 49% is writing boilerplate code (XML parsing, schema validation etc. etc.) and the other 2% is spent actually writing interesting code like database interaction and cool client-side stuff.

What is Apache Thrift?

Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml. - From the Apache Thrift website.

That sounds great. Reading the documentation (if you can find it) and browsing through the tutorials made me even more excited about Thrift. Some of the testimonials were also pretty inspiring (Evernote, Last.fm, Facebook (who actually invented Thrift) to name a few).

Read the rest →

Length: 1306 words or 7 min Tags: coding, projects, php, python

Password protecting folders with .htaccess


I always forget how to do this, so I’m posting it on here for posterity. Sometimes it’s useful to password protect a folder or files on your web server. If the web server is Apache, then you can use a couple of files - .htaccess and .htpasswd - to achieve this.

Read the rest →

Length: 206 words or 1 min Tags: sysadmin

Read on...