Archive for ‘General’


Creating Word documents programmatically

I have spent much of this week creating software to generate electrical certification documents in word based on data filled in on a mobile application in the field.

I must say that the Novacode DocX library has made the whole thing quick and painless, and what’s more, the whole thing is free to use.

Great stuff.


Marketing yourself as a developer

I was listening to this podcast last night on Software Engineering radio, and there were a couple of points that really hit home – particularly at this time of year where traditionally resolutions are made:

  • Developers typically do not like to market themselves or their ideas.
    • A developer can write the best code in the world, but if nobody knows about it then it is all a bit pointless – no users will ever benefit.
    • Demonstrating the communication skills and commitment to document projects you are working on is highly attractive to prospective clients and/or employers, and could also earn you a following with among your peers.
  • Developers engage in traditional ‘Networking’ only in short and sustained bursts, usually at the time they are looking for a new job.
    • This needs to be an ongoing process, such that a strong network of connections is built and maintained.

The key to both of these is consistent commitment.

It only takes 10 minutes to write a blog post about something interesting done over the past week.

It is easy to take a few minutes to chat with member of your professional network.

I for one will try my best to put these principles into practice throughout 2016.




Force a favicon onto a webpage – 2016 update

Back in 2011 I wrote this article about supporting multiple sites on shared hosting, and forcing each site to have it’s own favicon.

Modern browsers require image files, and it is just older browsers (and IE) that require the .ico files:

<link rel="icon" type="image/png" href="">
<!--[if IE]><link rel="shortcut icon"href=""/><![endif]-->

Making the jump to Linux

Switching from Windows to Linux for my main home computer (laptop) has been a real possibility for me for some time now, and I have finally made the jump – and I’m so glad I did!

All that my main computer gets used for is internet browsing based stuff, light word processing tasks, some web development and managing my (extensive) audiobook collection.

The only things left to tie me to Windows were a familiarity built up over my entire adult life, a natural apprehension towards change, and the fact that I use Windows day-in-day-out at work.

The final push I needed was the Microsoft announcement that .NET web applications (what I develop at work) are going open source, and are to be released officially for Linux.

I have been very surprised as to how easy the transition has been.

I chose the Lubuntu 64 bit OS, because my laptop is old. It had become really slow under the reign of Windows 7, even after Windows reinstall. It is

Here are the apps I have installed:

I have rewritten into Python some bespoke apps I had written in C# to auto-id3-tag and add to a database the radio content I record using get_iplayer tool. I may do a future article on this.

I have also followed the outstanding instructions here to get the basic Microsoft MVC5 ‘Hello World’ web app deployed.

The bottom line, Linux is great – and I won’t be going back Microsoft in my home setting.


Set date and time of a Linux device from a Windows batchfile

I had a client with Linux device that whose clock is not as reliable as it should be, running a time-critical application.

As a workaround fix I wrote a Windows batchfile to update the Linux date and time, and  he has set up a windows scheduled task to run it every morning:

set Day=%date:~0,2%
set Month=%date:~3,2%
set Year=%date:~6,4%

set Hour=%time:~0,2%
set Minute=%time:~3,2%
set Second=%time:~6,2%

@C:\path_to_plink\plink.exe -ssh -pw linux_password linux_user@ date %Month%%Day%%Hour%%Minute%%Year%.%Second%

Once again I have utilised one of the free PuTTY tools (plink.exe):


Force a favicon onto a webpage

<link rel="shortcut icon" href="" type="image/x-icon" />

This will force a favicon onto your webpage – useful if you house different websites in subfolders – each subfolder site (or page for that matter) can have a different favicon.

Tags: ,

More mobile browser detection testing

My standard method of mobile browser detection as detailed in my previous post here involves the PHP function preg_match(). Unfortunately for me, having compiled a stripped down version PHP to run on ARM linux, the preg_match() function was not included (probably because I used the disable-all switch during compilation).

Anyhow I was quite quickly able to come up with a workaround using strpos():

//Read the user agent string, and convert to lowercase

//Array of mobile browsers
$mobile_browser=array('android','avantgo','blackberry','blazer','compal','elaine','fennec','hiptop','iemobile','iphone','ipod','iris','kindle','lge ','maemo','midp','mmp','opera mobi','opera mini','palm os','phone','pixi','pre','plucker','pocket','psp','symbian','treo','vodafone','wap','windows ce','windows phone','xda','xiino/i');

//initialise counter

//iterate thorough array
foreach($mobile_browser as $val) {
$pos = strpos($useragent, $val);
//if the array element is not in the user agent string, do nothing
if($pos === false) {
//else increment the counter
else {
if ($i == 0) {
echo "Load normal site";
else {
echo "Load mobile site";

I also found a great way to test all mobile browsers, using the user agent switcher for Firefox.


Relative batchfile paths

In a previous post “Batch file to perform SSH commands and transfer files from Windows to Linux” I used a batchfile to call on plink.exe as follows:


This is all well and good, but if this path changes for whatever reason (i.e. you save it to another directory or machine) then it won’t work.

There is an easy fix that gives the relative path, as long as the .bat and .exe are in the same directory:


Hope this proves useful.


Random Name Generator

Over the holiday period I was working on a bespoke CRM management system.

I found myself in need of a list of random names. Once again a generic search engine came to my aid. The pick of the generators I found was: