Using Jquery Formbuilder

2 Jul 2020

, ,


jQuery formBuilder is a lovely stylish formbuilding tool, with all the front-end features a developer could desire. But the documentation is a little short of examples for integration with a backend system + database, and the gitter chat is completely full of people struggling with the basics.

I’m writing down some integration notes to keep it clear for myself in my head.

I’ve tried to keep this code as simple and as framework agnostic as I can.

Example code = dirty code. Do not use in real-life.

Read More

Finite State Machines

4 Jun 2020

, ,


What is a finite state machine?

A finite-state machine (FSM) is a mathematical model of computation. It can change from one state to another in response to some inputs; the change from one state to another is called a transition. An FSM is defined by a list of its states, its initial state, and the inputs that trigger each transition.

Thank-you Wikipedia. That’s helpful.

Read More

Carbon Dating

16 May 2020

, ,


Over the years, I’ve built a whole library of helper functions for working with dates in php, but I think they’re all a thing of the past now. Because I’ve been playing with Carbon Date library by Brian Nesbitt. It’s best described as Php’s DateTime for humans.

Here follows a quick summary, but I’m just looking at the very tip of the iceberg. Lots more!

Read More

Using Bootstrap Modals with Laravel

9 May 2020

, ,


I use modal popups all over the place in my web applications. The most frequent use is to make the user confirm deletion, either by typing DELETE into a form or by giving a reason for deleting the item in question. And I want to make this work in Laravel.

Note: this is klunky.  I’ve been playing with Laravel for a few weeks and if I end up using it as an ongoing development platform, then yes, things will be rewritten.

Read More

Project Management as a treeswing

22 Nov 2012

, , ,


Talking to a customer t’other day and I mentioned the (infamous) tree swing cartoon. He had no idea what I was talking about.

Read More

Mac OS: Can’t move .svn/tmp/entries to .svn/entries: Operation not permitted

5 Aug 2012

, , ,


I’ve recently had a completely new (to me) SVN problem. I’ve been trying to update my SVN working copy from the reposisty and I get this error:

Can’t move ‘.svn/tmp/entries’ to ‘.svn/entries’: Operation not permitted

I’ve tried running the svn cleanup, but no joy. Google is my friend… the fix is to run this command in terminal

cd workingdir
chflags -Rv nouchg .

chflags – Change File Flags command
-R recursive, -v Verbose (tells you which files changed)
nouchg means the file can be changed (immutable bit cleared)

The immutable bit was a new one to me, so I had to go and look that one up as well. When you can’t take the chance of a file getting accidentally munged, you can set the immutable bit. Not even root can delete a file with the immutable bit set, unless they clears the bit first (making accidental removal highly unlikely). Very sensible, and since I’m exactly the kind of person who might accidentally delete whole swaths of files while in root mode, I can really see the point of an immutable bit.

However, I couldn’t work out how or where the immutable bit was being set. More googling … this seems to be a common problem where some developers are using windows & others are using mac os x. Still not sure of the WHY but the context makes sense.

Names Changed to Protect the Guilty

3 Jul 2012

, ,


This came to me via one of my clients – they were talking about problems they’d had with another web developer.

The site in question is a standard ecommerce site where users have to register as part of the checkout process, and login to get downloads, and special discounts. Problem started when the site owner got this email from one of their customers.

I want to report that your site is NOT secure.
I had forgotten my password. So I did a Google search to see if I can find the webpage on how to re-set it.
Guess what? Someone has hacked your site and obtained all the passwords and email addresses and posted them online.
Sure enough, I found my email … and my forgotten password.

Basically, some script kiddies had hacked the site and posted all email addresses and passwords online with lots of (in)appropriate “ha ha, we got you good!” messages

Read More

The Life of a Software Engineer

22 Jun 2012

, ,


Life of a software engineer

Every time. This happens every time.

I’ve been trying to find the source of this wonderful cartoon, but have just ended up with loads and loads of blogs where people go “me too!”

RIP Dennis Ritchie

26 Oct 2011

,


Hello World

printf("Goodbye world");

Trailing Comma or Leading Comma

7 Dec 2008

,


We all know that Internet Explorer is a pain in the backside. But the particular pain I wanted to write about is its pickiness about commas in Javascript. For example:

var cars = new Array(
   'Saab' ,
   'Volvo',
   'BMW',
);

If you’re used to programming in Php or Perl, that trailing comma is perfectly okay, and could even be considered good practice because it makes really easy to extend the array – just add a new line and leave another trailing comma. The only problem is – this trailing comma is not strictly legal in Javascript. However, just about every implementation out there will allow it except for (cue drum roll) Internet Explorer.

So I’ve taken to coding lists like this:

var cars = new Array(
   'Saab' ,
  ,'Volvo'
  ,'BMW'
);

I’ve taken to using the same style pretty much everywhere I have a comma-separated list of things – it’s particularly helpful in SQL server stored procedures.

insert into t_users (
   store_id
   , user_accesslevel
   , user_status
   , user_number
   , user_title
   , user_firstname
   , user_lastname
) values (
   @store_id
   , @user_accesslevel
   , @user_status
   , @user_number
   , @user_title
   , @user_firstname
   , @user_lastname
)