Wiki Items

Pagination for lists

Here's an awesome article which I am using for the basis of the pagination for lists.

http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/

Alternate Rows in PHP

I found a really nice way to do alternate row colours in PHP:

http://stackoverflow.com/questions/399137/easiest-way-to-alternate-row-colors-in-php-html

Translation

The system has various layers for translation. Unfortunately there is not one single technology.

The gateway server has translation lookup tables and the output is translated to the session language. This uses the i18n Node.js module. The translations are stored in the /locales/<language>.js

The desktop web client has two parts to the translation - PHP and Javascript.

The first is the PHP translation. This is achieved through the gettext() function. The translation files are stored in /locale/<language>/LC_MESSAGES/strings.po.

Database Query Cache Helpers

There are two placeholder tokens which are used to help with caching of database calls. If the parameter is a SessionUuid and you want the database call to be cached for all sessions then you prepend @i_SessionUuid= before the actual parameter. If the parameter is a TransactionUuid and you want the database call to be cached for all transactions in the given session then you prepend the @i_TransactionUuid before the actual parameter.

Database Logging

The auditing of database changes has been somewhat inspired by the following:

www.dbforums.com/microsoft-access/999215-audit-trail.html

www.matthidinger.com/archive/2008/05/08/linq-to-sql-audit-trail.aspx

The representation of the transition of values was taken from here:

MySQL Data Types

The database will use standard SQL types for various fields.

 

BIT will not be used as it is a BIT field rather than a single bit. TINYINT will be used instead. The following article is the inspiration of this choice: www.xaprb.com/blog/2006/04/11/bit-values-in-mysql/

Stored Procedure Coding Style

All stored procedures in MySQL will have the following basic structure:

DELIMITER$$

CREATE DEFINER=`user`@`host` PROCEDURE `p_module_StoredProcedureName` (IN i_ParameterOne,
IN i_ParameterTwo,
INOUT io_ParameterThree)
MODIFIES SQL DATA | READS SQL DATA
SQL SECURITY INVOKER
BEGIN
DECLARE v_InternalVariable BIGINT;
...
END$$

Javascript Coding Style

The style for the coding of Javascript for the node components will mostly follow Felix's node style guide.

Additionally at the start of each function the pragma 'use strict'; will be inserted. This helps pick up silly coding errors.

The node system will be run through jshint and jslint to make sure there are no other errors that are picked up.

The style that we are using does not fully match Douglas Crockford's style so jslint will complain about indenting. Everything else should be atteded to.

SQL Sanitising

Every query that is hitting the database will be run through the squel node.js module. Additionally any parameters that are passed need to be sanitised using the sanitiseSqlString function in the butrDatabase module.

The mysql_real_escape_string() javascript function came from:

http://stackoverflow.com/questions/7744912/making-a-javascript-string-sql-friendly

PHP Required Libraries

On Ubuntu 12.04 LTS the following php libraries are required for the PHP client.

  • php5-uuid
  • php-pear
  • php5-curl
  • php5-mysql
  • php5-common
  • php5-gd
  • php5-dev
  • pecl pecl_http
  • pecl uploadprogress
  • php-gettext

 

Pages