Pro XML Development with Java Technology

I was throwing out a number of old computer books (throwing books into the bin is tough mentally) … one of which was an Apress book – Pro. XML Development with Java Technology published in 2006. Although a 7 year old computing book is ancient in computing terms most of the chapters are still very relevent apart from the chapter (8) concerning Native XML Databases.

The chapter focuses on the apache Xindice native database which is now defunct. Instead I use BaseX for my XML document database solutions. BaseXData has full support for XQuery 3.0 Processor and the W3C Update and Full Text extensions. It is relatively simple to setup and get running and has very good client support for a number of programming language.

Besides that one chapter much of book is still quiet relevent today as a general reference book … so it was saved from the bin for a while.

Written while listening to Radio Margherita Napoli (um … I säccio/sacciu I) … now I can listen to more of this The Raveonettes – Here Comes the End

TRAC – Arch Linux Apache/WSGI Installation Guide

The tutorial ia about installing and configuring the TRAC issue tracking web-based application using an Apache and MySQL Arch Linux server. installing TRAC is not a simple process of installing the trac package via pacman and pointing your browser to the appropriate host url.

Because TRAC can be installed in a variety of ways depending on the server and libraries installed this tutorial takes a single path for installing the current the TRAC application (version 1.0.1 at the time of publication) over Apache using WSGI bridge and MySQL (MariaDb in Arch Linux) database backend.

What is Trac

Trac is an open source web-based project management application for issue tracking. Its wiki enhanced. Trac can be integrated with various source control systems (subversion and git being the prime source control system for linux) although this tutorial does not cover source control integration.

Base Arch Linux Server:

As a minimum you will require the base Arch Linux installation and should have installed and configured MySQL and Apache. I recommend you install the complete LAMP stack (a requirement if you want to install MyPhpAdmin to manage your MySQL server. The tutorial was tested on a VirtualBox ArchLinux appliance connecting to a remote MySQL server appliance over the local network (there is no requirement to use a remote MySQL installation to follow this tutorial).

Basic Conventions

Any text enclosed in the square brackets i.e. […], represent variables that should be replaced along with the square brackets with appropriate entries for your installation.

Basic Install Workflow

  1. Install the required python2 packages
    • Create MySQL database and user
    • Configure the Apache wsgi module in httpd.conf
    • Create project directory
  2. Create TRAC environment
    • Deploy TRAC enviroment
    • Configure Apache httpd.conf
  3. configure Admin Authentication
    • Configure admin user in TRACS
    • Create authentication file
    • Configure Apache basic authentication

1. Install Required Python2 Packages

TRAC is implemented in Python 2.x and requires you to install a number of supporting packages. Issue the following pacman command from the commandline from an account with admin privileges (or use the su command).

$ pacman -S python2 python2-genshi python2-setuptools mysql-python trac

Create MySQL database and user

Log into MySQL using the admin account and issue the following SQL statements:

TRAC requires the database tables CHARACTER SET be utf-8

$ CREATE DATABASE [trac_db_name] DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

For a local MySQL installation

$ GRANT ALL ON [trac_db_name].* TO '[trac_user]'@'localhost' IDENTIFIED BY '[passwd]';

If you have a remote MySQL server replace localhost with the network IP address of the connecting MySqlClient. If the remote server is running on your local network you can replace localhost with 192.168.2.%. 192.168.2.% will permit any specified user to able to connect from any computer connected to the local network.

Configure Apache WSGI module

Add the following line to the LoadModule list in the /etc/httpd/conf/httpd.conf

LoadModule wsgi_module modules/

Restart your apache server.

$ systemctl restart httpd

Create the project directory and web directory

Create the trac projects directory in /var/opt. You can locate the TRAC projects directory in any suitable location in the Arch Linux file hierarchy. For this tutorial we will create the directory in the /var/opt directory.

$ mkdir -p /var/opt/trac/projects/[project]

The -p option creates parent directories if they do not exist.

Change the ownership of the trac, projects and [project] directories: enter the following command at the shell prompt.

$ chown -R http /var/opt/trac

Create a directory in the /srv/http directory which will be where trac-admin deploy command will create a number of files.

$ mkdir /srv/http/[site]

2. Create the TRAC Environment

We now issue the following trac_admin command to create the initial project environment

$ trac_admin /var/opt/trac/projects/[project] initenv

You will be asked for the project name and then have to supply the database connection string which has the form.

$ mysql://[trac_user]:[passwd]@[server]:[port]/[trac_database_name]

The [trac_user] and [passwd] should match those you set in the GRANT sql statement above. If you are running SQL locally you can replace [server]:[port] with localhost. For a remote MySQl server you replace [server] with the servers name or ip address and replace [port] with the port number the remote server is listening on. MySQL standard port number is 3306.

Replace the [trac_database_name] with name of the database you specified in the CREATE DATABASE sql statement above.

A number of directories will created in the [project_name] folder.

Deploying the TRAC environment

$ trac-admin /var/opt/trac/projects/[project] deploy /srv/http/[site]

set the ownership of /srv/http/[site] to the account of the httpd server (this will be httpd in archlinux) and make the files is /srv/http/[site]/cgi-bin/ executable.

$ chown -R httpd /srv/http/[site]
$ chmod +x -R /srv/http/[site]/cgi-bin

Configure Apache httpd.conf

Add the following to your /etc/httpd/conf/httpd.conf

WSGIScriptAlias /[alias] /srv/http/[site]/cgi-bin/trac.wsgi
    WSGIApplicationGroup %{GLOBAL}
    <Version < 2.3>
      Order allow, deny
      Allow from all
    <Version >= 2.3>
     Require all granted

Restart your httpd server

$ systemctl restart httpd

Test your installation is functioning with your browsers with the following url. I use links text browser on my server to quickly test whether a site is working locally.

$ links http://localhost/[alias]

And you should see something similar to the image below


In firefox you will get the following


You notice their is no ‘admin’ tab and if you attempt to login you get the following page


in order for you to login as the TRAC site admistrator you are required to setup authentication which we shall do via apache in order for TRAC to allow you to log into the site as admin and access the administration functions.

Configure TRAC Admin Authentification

A TRAC installation can use a variety of authentication methods – for this tutorial will use Apache’s built in basic authentication mechanism to allow you to login as the site administrator and configure various aspects of your TRAC installation.

Create the htpasswd file using the htpasswd command with the -c (create) option.

$ htpasswd -c [location]/[name].passwd [username]
 New Password: 
 Re-type new password: <type password>
 Adding password for user

Insure that the [location]/[name].passwd file is accessible to your apache server. When creating additional users you do not need to ¡nclude the -c option.

Now you need to grant administration rights to the named users above, [username], permissions in TARC by issuing the following command

$ trac-admin /var/opt/trac/projects/[project] permission add [username] TRAC_ADMIN

Now you need to enable apache to to authenticate against the password file by adding the following to the /etc/httpd/conf/httpd.conf file.

<Location /[alias]/login>
    AuthType Basic
    AuthName "TRAC"
    AuthUserFile [location]/[name].passwd
    Require valid-user

Restart your apache server to reload the http.conf file and navigate to your trac installation url. you will be presented with the login screen.


Once you are authenticated you will see the Admin table displayed.


You now have access to the administration features of TRAC.

In the next installment we will add a couple of modules: one for user administration and one for having TRAC hosting multiple project.

As a treat for finishing this post I’ll be listening to “shar-lar-lar

Project Fork n’ Knives

As I’m  now acquiring deeper knowledge of a couple of project management tools, in this instance Team Foundation Server 2012 Express/ALM, Project 2013 and Web2Project (an open source web-based project management tool) I need to define a project for myself in a couple of hours (although I come up with ideas fairly simply)

A quick overview of Project Proposal Fork n’ Knives:

I have come up with a better name – but that is for me to know and the cyber squatting chumps to guess. Oh, and can if you wish  repeat the name ten times in quick succession for a wee laugh. Actually, it is not a bad name thinking about it again.

The project (more a business proposal) is a C2B application that provides restaurants with the facility to handle group-booking by assisting the costumers in selection of their meals. Often it is the case with large groups that a restaurant would like to know the individuals members menu selection some time in advance of the date and time of the event.

Presently, there no single application (I have not done any research so the statement might not be factual … ) that provides this facility to restaurants and their potential costumer base. There are some general applications that can be configured to provide some of the facilities of the proposed application but these applications require a high degree of application knowledge to function beyond their intended domain.


Target Sector:

Family, small and medium-sized restaurants who currently have difficulties in providing for large groups and do not have the facilities to for management and planning for catering of group bookings. The system offers the business the ability to reduce the required time span for accepting group bookings, better planning in relation to staffing levels and associated costs.

For the customer, or group organiser, assists in menu choice associated with individuals as well as providing some control of costs (future development). A record of individuals meal choice and associated cost as well as an automatic reminder service for individuals to make their selection.

Potential Advantages to Business (restaurant):

  1. assists in reduction of waste reducing costs
  2. facilitates just in time cooking
  3. improves the meal pre-preparation task … (how many chocolate mousse …)
  4. enables better staff planning reducing costs
  5. assists the business in financial planning (a stretch … )
  6. facilitate improvement in uses of floor space
  7. Reduction in required time for accepting group bookings
  8. lots of other stuff but there is only 2 hours …. and I don’t want to divulge too much

Potential Advantages to the customer

  1. assists the group manager in managing the group meals requirements
  2. facilitates improved cost control
  3. reduces the pre-booking time
  4. reminder service who in the group has not made their menu selection
  5. other stuff that can not be divulged

Financial Strategy (how the service pays)

  1. Subscription based approach: our potential customers (restaurants) pay either by subscription (48 euros a year)
  2. Per usage based: each group booking has a set price (8 euro per booking).
  3. advertisement revenue (could be extra to keep costs reasonable)

The two hours are up but I have a project … During the time of writing this rather spare project/business proposal I have mainly been listening to …  Radio Margherita Napoli … now for some more of this … You Want the Candy

Evil Web Site Design – a satirical Web Site proposal

As promised as while back … and its a friday, funday, and as the book Evil by Design suggests creating a web site/strategy applying some of the pattens I thought it would fun to create my take on using some of the evil designs in a fictious web site/strategy.

Three hours later here it is – unpolished but the kernal is there. Enjoy the result of an unfettered amoral thought process.

General Description of Proposal

Ice Creams By Post is heavily Angel backed new business. The investers (mugs to me and you) have backed the opportunity to the tune of thousands of euro cents. The founders of the business require a innovative web e-comernce site and strategy because they only have business degrees/MBA’s and we know what that means – techno illiterates with a complex who think having tens of thousands of facebook friends is the rasion d’etre of e-comerce and will interfere at every step just to prove their ignorance.

We at AmoralDesignsCorp have been asked to provide a proposal  – but nothing is free so we asking for a percentage of the company plus some readies (money to our non english and non english-english speaking friends) up front.


  • sell ice creams by post (pretty ovious)
  • ice cream acquisitiion should be a social event (collect the set, invent your own flovours, leader boards … etc)
  • quick customer base growth (SOE and all that shit)
  • high customer return/retension (um … not really our business what’s it doing here)


A basic e-comerce site based on a PHP framework (Drupal/Joomla) with the e-comerce component and additional social modules interacting with the free phone app game..

Gamification Components

The game

Working title: Gelat – Icecream Delivery Warrior(ess)

A 2D game with top-down viewing angle with stearing control by phones/tablets accellorator.


The goal of the game is to deliver ice cream from the shop to an address thorugh a crowded city hoping the ice cream dosn’t melt before the delivery is made. On the way the player will have to avoid various obsticals and fines.

Initial game Configuration

Players begin with a battered Paggio APE van – they can spend reward points gained through purchasing ice cream, completing senerios, or simply purchasing reward points with real money on various customisations.


  • rival ice cream delivers (race to address, micheal schumaker road tatics etc.)
  • traffic lights, zebra crossings, lolly-pop ladies, road works, traffic jams, oil spills, pot holes etc.
  • the police, health inspectors, Google streetview vans, SOPRA enforcers, FBI, CIA, NKVD, MI5 agents and IP lawyers (if delivering a patened flavoured ice cream).
  • car jackers, bandits, mariachi bands, aliens, squirrels, and terrorists

Reward System

The reward system should be time limited and based on two configurations: rewards that can be applied to purchasing and those that are applied to in-game reward.

  • Order Ice cream from sites
  • Write review on icecreambypost website (extra for providing nice review)
  • Write good review on secondary sites
  • Anwering popup questions
  • Introducing new customers

Buyable Customisations

  • paint, lights, glowing signs, internet advertising panels (um .. IP that ASAP)
  • turbo charges, suspensions, engines, superchargers etc.
  • Icecream catapult launchers, ice lolly guns. cone hand granade luanchers etc.

Other verticals are available at various reward points cost

  • FIAT 500 van (60’s version)
  • Citreon CV2 van
  • Bedford Ice Cream Van
  • Ford Transit Ice Cream Van
  • Range Rover Ice Cream Van
  • WWII King Tiger Tank

Web Site Badges and Leader Boards

etc ..

Oh nearly forgot I was listening to Corsica Radio while designing the propasal – now listerning to Hasta Siempre

Google Search Settings: Why can I not exclude URL’s/IP address

With Google you can have personalised search settings most of which are pretty useless … the one I would like is an exclude URL´s with wild cards … such as *.com – to exclude search results from the com top level domain. Some sites proprio mi annoia (trans. piss me off) and this feature would be great as then when I do a search they would automatically be excluded. For Google this is extra data mining data and good for businesses as it would inform them their web strategy just pisses people off.

Get with it Google … and added it to the personlised search settings as its a benefit to you as well as the users !!!

Idea with IP pending … nah just joking … 🙂

Ah, with bit of coding … have to proxy via my virtaul archlinux server … and filter the results (removing the sites entry … um sometimes I get a blank page of results but still better than wasting my time having to check the urlS before clicking). Problem is only works locally.

Drupal 7 Superuser Password Reset

As just coming back from two weeks in the Catalan Pyrenees (Pirineu Catala) and Barcelona, and having finished reading Evil By Design I decided to I would implement my evil by design e-commerce site (as a test and more later). I have three virtual LAMP servers (alpha, beta and omega … dev, test and live). As I attempted to login into the Drupal 7 alpaha installation none of the passwords I tried were accepted, once more with dread I turn to the internet to find a solution.

I found some instructions here or here … but were is the fun in that, where is the challenge … so here it is … first the blag … the health warning … the well you know …

This script is free … no money back is guarenteed
It contains no classified material whatsoever …
It has been rigoriously tested to the point of destruction ….
100% satififaction that it does what it says in the code …
Now in full technicolor …
More effecient and effective than some advertised remedies … (see here above)
Fast acting (if correctly used)
Verbose … so no hidden extras and understandable to non perl witchies/wizzies …

Hopefully WordPress won’t mangal the code … when it mistakes perl pipe definitions.

use DBI;
my $base =  $ARGV[0];

if(-e $base) {
	if(-d $base) { $site = "$base"."sites/default/settings.php"};
	  my %conf_args = {};
	  if((-f $site) && open (DATA, "< $site")) {
      my %conf_args = {};

      while( <DATA>) {
        chomp $_;
        # jump comment rows
        next if(m/^(( |\/)\*+|#|$|\>)/);
        $m2=m/^ *\'(database|username|password|prefix)\'\ *\=> *\'([\w]*)\',$/;
        if ($1 && $2) {
          print "captured: $1 $2\n";
          $conf_args{$1} = $2;
      close (DATA);
      print "\nEnter new password: ";
      my $passwd = <STDIN>;
      chomp $passwd;
      my $cmd="php ./scripts/ $passwd";
      chdir "$base";
      my $has=qx/$cmd/;

      if($has =~  /hash: (.+)/) {
        my $hash=$1;
        chomp $hash;
        print "$hash\n";

        my $dbh = DBI->connect("DBI:mysql:$conf_args{'database'}", $conf_args{'username'}, $conf_args{'password'}, {RaiseError=>1})
          or die "Couldn't connect to database: " . DBI->errstr;
        my $user_tbl = "$conf_args{'prefix'}users";
        my $sql="UPDATE $user_tbl SET pass=\'$hash\' WHERE uid = 1";

        my $qu = $dbh->prepare($sql)
          or die "Prepared failed: " . $dbh->errstr;

        $affected = $qu->execute or die 'Execute failed: ' . $dbh->errstr;
          die "$dbh->errstr" if (!affected); # trap errors
          die "No rows updated" if ($affected eq '0E0');

        print "Drupal superuser account password reset!\n";

        $qu -> finish();
    else {
      print "File $site not found.\n";
else {
	print "Directory $base not found.\n";

Simple cut’n’paste into your favourite linux directory, giving the file an appropraiate name and pl extension and with cli. Run the script from the commandline.

perl the_base_dir_of_your_drupal_7_installation

press return

You should consult a qualified Perl consultant before use … failure to do so is at your risk

It is recommended that you read the instructions from the first to last letter and translate them into Finnish (as I have spent the time scritping this listerning to RadioPookie). Why, it makes me more effecient … now I can listern to some Mary Chain

Latest Book Read – Evil By Design

Having spent a consdierable amount of time in the book shop drinking a cappucinnu and being entertained by this book (as I’m a cheap skate and have to many weighty computer books hogging too much space) … I’d have to say it great read and very enlightening becuase as you read the various chapters you can see straight away the various strategies used by certain rather questionalable internet base companies.

Even if you have no intention of ever creating an e-commerce business one should still read this book just to protect yourself, your family and friends. Knowlede is power, your ignorance is dangerous to yourself and others will take advantage of it knowing you dom’t know they are doing so.  The book describes how some internet base commerce businesses treat you like a game idiot (I know some the tricks metioned in the book others I just could not believe people could fall for but they do).

Loved the entry about the facebook cow game …

The book will amaze, sometimes astonish and befounded you that some tatics actually work. The whys and hows they work from the psycological perpective are described. It will change your view of some people … and certaintly from the psychological perpective I now understand why people who think becaue they have a passing knowledge of something think they know it all …

I recommend others to buy or borrow this tome., whether you intend to start an e-commerce business or not, just so you know how you are being played by certain e companies.