Archive for the ‘Code’ Category

Getting Data from CokeBikes

Friday, January 29th, 2016

Just a piece of PHP for getting data from it is in a JSON format at the top of the webpage in JavaScript, I get it out of the webpage using a Regex and then pass it through a JSON decoder in PHP to get the piece I want.



Pull out e-mail addresses only in Excel

Wednesday, December 16th, 2015

Just a shot snippet of code to pull out e-mail addresses only, it works as a function in excel so you can write it as a function in excel.


Table reating and text insertion

Tuesday, June 16th, 2015

Well there comes a time when you need to make a table in word and you need to insert data in to it, so here is my quick version, its not the greatest bit of code but it does the following job :

  • Creates a table
  • Inserts text

That’s all nothing more, nothing less.


Handy links for this

Raspberry Pi as a Digtial Signage

Tuesday, August 26th, 2014

Modify /etc/rc.local , the startx does exactly that starts X windows to give you the login page

setTerm prevents the monitor from going blank


if lightdm is controlling the screen then set it of



Set the Monitor and the pi not to power down or blank the screen


Set inittab to run the terminal and bypass the login



Install unclutter to get rid of the mouse


If your are using LXDE tell LXDE to not the blank the screen and not to turn on a screen saver, and to run midori in full screen kiosk mode and point it to the web service you want.

you also have to install x11-server-utils this allows you to control the screen saver functionality

modify or create




Database PDF Manafacture

Wednesday, December 11th, 2013

Database PDF Manafacture

Their comes a time when people want stuff printed, and no matter what you do, it will still have to be printed, and if your running big events, then that printing can get pretty troublsome, I was involved in building a little bit of a site, where we wanted to reduce people input in to generating printed documents. Essentially taking the copy and pasting out of the job, and as the posh people say “structering the data”.



So this meant HTML form to PHP to Databases and then to PDF’s

I used PDF’s as webpages don’t normally print very well and PDF’s are almost everywhere, they give a nice printed page, which you can print, and the most important thing is people understand them.

Tools used

  • jquery
  • PHP
  • MySQL
  • tcpdf
  • HTML

The jquery was use in form validation, as show in a earler post

PHP was used to process the forms, in the standard way and then insert the code in to the database, but using Prepared statements and stored procedures (

Then using the database and tcpdf (, you could generate pdfs on the fly from the data base, here is a sample of the code below.

An HTML option list for the coutnies of Ireland

Thursday, October 10th, 2013

This is a reminder for myself, but when your doing a site and your looking for a HTML option list for all the counties of ireland see below, for those that are wondering the hell I’m on about, see below:


List is below



Banks and people, and databases in the sky!

Thursday, July 5th, 2012

It seems we have another banking crisis, but this time it’s IT related, so what could be occurring at any of the said banks that are having these issues.

Well all these systems are interlinked, fail proofed and secured to the maximum……We hope! No bank will come out and tell you exactly what way they are doing this, or it will be hidden behind some PR brefing document.

So lets ponder what a typical bank set up might be:
well its going to be at the base level, storage, processing, and display

So lets have a look at storage:
We can presume that any bank would have a SAN or Storage Area network, this could be fiber or network, but these systems tend to be legacy based, so will probably be fiber. Their should be actually at least two sans, on as a mirror, so there would be fail-over. At a disk level there would be at least a RAID array (We would hope)and their would be a back up solution.

On the Processing side:
They could have a private cloud running vmware or Linux or M$ or some other cloud vendor, or they could be on plain hardware which hopefully would be on a cluster. These boxes would hopefully run Linux or M$.

Then we’re going to have some processing software, remember at all these systems core is a database that keeps your name, account number and the current balance in your account, that’s the main function of a bank. That would be fine if there was nothing else happening, and when you credited or withdrawn money form the bank, well then your current balance would be credited of debited, however the trouble is that when you have millions of these occurring, you then have a problem, or in some cases 20 million plus occurring, then if it goes wrong then you have a bigger problem.

The Display part, is simply putting the information on the screen, however if the information is wrong in the screen, well then you have a problem.

This seems to be whats happening at the moment, as shown in the regester:

But I just wonder about the people that may ask the questions at our enquires, what skill set will they have?, will they have the technical competency to know or understand even the basics of these systems?, I not aware of any member of the oireachtas, coming out and stating that they have a Degree in IT related discipline or having a Technical officer asking the questions that need to be asked.

Even looking at the committees list ( we don’t even have a mention of information technology, and I surpose I’m looking for it in the wrong place, but even so, I just wonder how tech competent the oireachtas members are?

Father Of C And UNIX, Dennis Ritchie, has passed away at age 70

Thursday, October 13th, 2011

We seem to be loosing a lot of good people in the computer business, and the Father Of C And UNIX, Dennis Ritchie, has passed away at age 70. I know Steve Jobs helped create the the consumer demand for I.T. products but Dennis Ritchie was one of the inventors or the modern operating system, or what we know as Windows, Mac OS, and Linux. Some how I don’t think the worlds news papers will fill the front pages lamenting this loss, Which is sad really, seeing with out Denis Ritchie we may not have had the C programming language. Why is that important, well with out the C programming language, we as software poeople may not be able to write programs, which alot of have formed operating systems.


Resizing images on the fly

Monday, July 4th, 2011

This is hand little script for resizing images on the fly, you need to have imagemagick installed on your linux box, but it puts out 5 folders of images of different sizes, so its perfect for thumbnails and quick corp’ing.

it uses convert out of the image magic liabary


echo "\n Running resize script \n";

echo "Making 460x images ";
mkdir scriptresizedx460;
for i in `ls | grep -v scriptresized | grep -v Cropped110x`;
do convert -resize 460 -quality 95 -compress JPEG -density 72 -strip $i resized_460$i;
mv resized_460$i scriptresizedx460/;

echo "Making 50x images ";
mkdir scriptresizedx50;
for i in `ls | grep -v scriptresized | grep -v Cropped110x`;
do convert -resize 50 -quality 95 -compress JPEG -density 72 -strip $i resized_50$i;
mv resized_50$i scriptresizedx50/;

echo "Making 70x images ";
mkdir scriptresizedx70;
for i in `ls | grep -v scriptresized | grep -v Cropped110x`;
do convert -resize 70 -quality 95 -compress JPEG -density 72 -strip $i resized_70$i;
mv resized_70$i scriptresizedx70/;

echo "Making 110x images ";
mkdir scriptresizedx110;
for i in `ls | grep -v scriptresized | grep -v Cropped110x`;
do convert -resize 110 -quality 95 -compress JPEG -density 72 -strip $i resized_110$i;
mv resized_110$i scriptresizedx110/;

echo "Making 220x images ";
mkdir scriptresizedx220;
for i in `ls | grep -v scriptresized | grep -v Cropped110x`;
do convert -resize 220 -quality 95 -compress JPEG -density 72 -strip $i resized_220$i;
mv resized_220$i scriptresizedx220/;

echo "Cropping 110x images ";
mkdir Cropped110x;
for i in `ls | grep -v scriptresized | grep -v Cropped110x`;
do convert scriptresizedx110/resized_110$i -crop 110x100-0-50 Cropped110x/croped$i;

Hopefully this helps some one.