andriod-cpu

Installing CyanogenMod onto a Samsung Galaxy S3 (International) – SIII / i9300 using Linux Mint 16 Petra (Ubuntu Saucy 13.10)

DISCLAIMER: Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. I am not responsible for your actions. Good luck.

The new CyanogenMod installer requires Windows. Most of the manual tutorials assume you’re running Windows. Hopefully my summarised experience below will help other Linux users.

Continue reading

PostgreSQL functions and triggers

It is desirable to avoid using database functions. They are black boxes which gift only night horrors to unwary developers. A system is difficult to understand, maintain and debug when chunks of it lurk unseen in the DB.

Despite this – for certain features – using them does make sense. Provided the database function’s code is source controlled and huge lumps of comments referring to both the location and function of said code is spread evenly throughout the associated application code.

For example, in order to bill Ekaya agents accurately we needed a log of show house status changes, from upcoming to active to past or cancelled. Most of these changes were implemented in sweeping SQL statements that, while efficient at their own task, made it difficult to track individual changes.

Continue reading

classic date

Postgresql date formatting

Preamble

Formatting of data should only occur in the final steps of output. Until that point, and as a rule, internally data should remain in a base format that can easily be converted into many others – without being converted into another more basic format first.

For example Unix timestamp for dates or a floating point number for money. Both can readily be converted into more expressive formats without writing code to first parse or disassemble the initial format.

However in a situation where the flow is very specific and unlikely to ever be used to generate a different output it is permissible, even desirable, to generate data in the format it will be finally outputted.

Continue reading

whocharted

Bash script to download SXSW podcasts

For the last few years I have listened to the podcasts from SXSW while travelling to work or more recently while at gym.

Each year the number of podcasts has increased to the point where this year I am now too lazy to click through to every page and DownThemAll!. Besides it’s more fun to write a bash script to do the heavy lifting.

Continue reading

broken_dvds

Inside every DVD is a small movie trying to get out. Part 1: A quick guide to K9Copy

The problem with backing up a regular store bought movie DVD is that it simply won’t fit into a normal blank DVD. The movie DVD is a 9GB monster, and the blank a svelte 4.4GB. There are two solutions to this: re-encoding and transcoding. This article is a quick guide to performing a transcode using K9Copy (similar to DVDShrink) on GNU/Linux.

Simplifying terribly, re-encoding takes the better part of a day or longer and the result is an .avi or similar file. These are so much smaller than the original that you can fit four or more reencoded movies onto a single 4.4GB DVD, but they won’t play in a regular DVD player. On the other hand a transcode takes about an hour and results in a single movie on 4.4GB DVD, which will play on a regular DVD player.

Transcoding works by lowering the quality of the movie to make it smaller. The smaller the desired end result, the worse it is going to look, but with a normal sized movie you shouldn’t be able to tell the difference.

Continue reading

Bull-elephant-drinking-WEB_296731-590x393

PHP cURL over SSL

WARNING: Using this method will open you to Man-In-Middle_Attacks. As suggested by Filip Procházka in the comments below, you should get an up to date CA root certificate bundle and use CURLOPT_CAINFO. This article suggests a secure method for dealing with self-signed certificates.

If you’re getting stuck trying to use cURL over https in PHP, try setting both the verify peer and verify host options to false:

$url = 'https://myverysecret.domain/secrets/';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_exec($curl);