Inane Coding Go on, slap that wayward code


First general release – Piwik OpenCart Ecommerce VQmod v0.3

Version 0.3 of my Piwik OpenCart Ecommerce VQmod has just been finished, hurrah!!

This is the first general release and is now available to download. The mod also now has its own github page.

v0.3 - 2013/05/28
First release of admin backend feature.
Arranged source files in an opencart folder structure for easy uploading.
PiwikTracker.php file now included for easier install.


Piwik OpenCart Ecommerce VQmod v0.2

Version 0.2 of my Piwik OpenCart Ecommerce VQmod has just been finished. As before this is a pre-release version with limited functionality and still requires testing. If you would like to trial it and give me feedback then please get in touch!

v0.2 - 2012/11/04
Fixed bug where the ecommerce action would sometimes not get attributed to the correct visitorID.
Improved Installation Instructions.

Announcing Piwik OpenCart Ecommerce VQmod!

I am in the process of writing a full Piwik Ecommerce mod for OpenCart.... this is very much a work in progress and a holding page!

Implements Piwik Ecommerce tracking for Opencart;
> Tracks regular page views
> Tracks Ecommerce product views (category views not yet implemented)
> Tracks Ecommerce cart add/update/delete
> Tracks Ecommerce orders

I have just finished the first draft pre-release version (v0.1) with limited functionality. If you would like to trial it and give me feedback then please get in touch!

v0.1 - 2012/10/20
First pre-release version.
Basic Ecommerce functionality.
No category reporting.
No admin back-end

Converting Excel date to Julian day-of-year number

I recently came across a mini-puzzler while helping a friend with Excel. I needed to convert an Excel 'Date' data type (see below for a recap) to the equivalent day-of-year number. This is sometimes called the 'Julian date', or more strictly correctly, 'ordinal date', as the famous Wikipedia informs me.

Now, this seemed simple - I thought - and I suppose it still is, relatively. But there is no single function where you can just plug in an Excel date and get out the day of the year, as I was expecting there would be. For example, to plug in 2011/08/25 or 25th August 2011 and get out '237' as the day number of that year. (By the way; if you just want to calculate the day of the year for a one-off I found this calculator was good).


Simple user input in batch files

I was recently playing around with batch scripts (*.bat files) - but what I wanted to do with the script snowballed and I found I needed more functionality, the main one being to be able to execute commands based on user input.

Below is an example of the code I used to do this. This is for Windows NT based batch execution (i.e. any recent computer).

SET /P _inputname= Please enter an input:
IF "%_inputname%"=="OMG" GOTO :they_said_omg

ECHO No 'OMG'... frowny face :(
GOTO :end

ECHO You said OMG!



Go on, slap that wayward code

Huzzah, it's alive!

Welcome to this here blog, courtesy of me. I will be bringing you regular articles with examples, snippets of code, and other programming related oddities which I come across during my day-to-day coding.

The articles will be covering a whole range of topics; off the top of my head here are a few areas that I've dealt with very recently which I may cover:

  • C programming
  • PHP, python
  • javascript
  • .htaccess files
  • SQL and interfacing with databases
  • batch scripting
  • VBA and excel
  • CSS and HTML
  • Programming AVR microcontrollers
  • and a whole host of others thrown in for bad measure - essentially whatever I come across.

I aim to make the articles informative and unique, to help you find that useful code example to do that thing you've always wanted to do. You know that thing? Yes that one.

Hopefully a few of the tricks I come across while searching for ways to accomplish things myself will be useful to others, and save you that little bit of time. And... if they do you can always donate!

Take it sleazy,