Getting Data from CokeBikes

January 29th, 2016

Just a piece of PHP for getting data from www.bikeshare.ie. 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

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

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

https://msdn.microsoft.com/en-us/library/office/ff838470.aspx

ADSL telcos and exchange line length

October 22nd, 2014

ADSL telcos all require a phone line and if one ADSL telco is saying no, then you shouldn’t go with any of them as it all comes down the same pipe or copper from your local exchange…. My humble recommendation would be go wireless if any of the ADSL telcos say no. Some parts of towns have better copper and are connected closer to the phone exchange in your area, if you’re wondering why? Then you’re looking at power loss of frequencies down a copper line.

dslreports has done a break down of this here http://www.dslreports.com/faq/4676

but if your looking for actual Irish  data here is the best I could find.

http://www.eircom.net/efibreinfo/map/

here’s is Eircom talking about it below, you can’t really beat physics no matter how hard you try!

http://www.finfacts.ie/irishfinancenews/article_1016178.shtml

 

or if you want to help map what ADSL is in the area

ww.boards.ie/vbulletin/showthread.php?t=2055427255

https://www.google.com/fusiontables/DataSource?docid=1M_lYcvMkt7xIqqSa43TdS1s25oRqtA2JgpxAkYM#map:id=4

Raspberry Pi as a Digtial Signage

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

/etc/lightdm/lightdm.conf

 

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

/etc/kbd/config

Set inittab to run the terminal and bypass the login

/etc/inittab

 

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

/etc/xdg/lxsession/LXDE/autostart

 

 

Going to college and you need a computer, The class of 2014

August 14th, 2014

So your back in college and you need a computer. So what to buy well it’s always a tough choice, but you don’t need to go into the thousands for a PC these days. the lower end laptop will do the job for most things, and the way to go here is low end.

  • Keyboards: if your buying a laptop be sure to try it out and type on it, and type a paragraph on it, cause if it’s a bad keyboard your stuck with it for 3-4 years.
  • Memory, go for as much memory as you can, Memory is not hard disk space, we’re looking here at on-board memory, it will be quoted like 4096MB which is more than enough if your running windows 7 or Windows 8, also make sure you can expand it.
  • Hard drive space: Don’t worry about hard drive space 160GB will be enough for most people, if your into music and video, you can always get an external USB drive.
  • USB 3.0 is now fairly standard on systems, its the Blue USB port
  • Network port, at the extreme lower end and extreme higher end, Network ports are being removed, the sales rep will say “you can use wireless” and he/she is correct, but wired is going to be always their, and as anyone who has been at a conference with too few WiFi access points will WiFi is nice but can sometimes not be dependable.
  • Screen size, remember the bigger the screen the more its going to cost to replace it if some one sits on it, of if it falls off the bed/desk or what ever!, a 17inch screen is going around €200 for a replacement, and its not an easy job.
  • Processor, while window 7 was light work, windows 8 will be a bit harder on a machine, look for 4 cores or above, and stay away from 2 cores
  • Touch Screen, try and get one of these, windows 8 will be a lot easier with a touch screen.

The next thing is software:

  • Office software, well Microsoft office is the standard, but you can use open office or libre office, once you have made sure that you save everything as Microsoft file format and it will work fine.
  • Photo-shop is a standard but GIMP gives you all the functionality that most people need, it’s also open source.
  • The Zotero plug-in for Mozilla FireFox, is great for citations.
  • LYX is great for producing papers and Theseus, and is much better at handling documentation than word.
  • If your a publisher look at scribus, its open source desktop publishing system, you could always pay for quark.

Here is a few reviews and tables about CPU’s:

What proccessors are out their: https://kb.wisc.edu/showroom/page.php?id=4927

This is a comparasion of tests against cost of processor: http://www.cpubenchmark.net/cpu_value_available.html

Happy shopping, and don’t spend too much!

 

Having your cake and eating it – UserCake

July 21st, 2014

Setting up Usercake

The setting up of UserCake is pretty straight forward, and is very straight forward and is listed below:
http://usercake.com/docs.php#5

However the configueration docs can be a little less than clear.

So how do you protect your pages

There are three basic functions which are used to protect pages in UserCake


It is the function which ought to be used if you want the admin panel to dynamically control which permission levels have access to a page.

 

This function checks if a user has been granted a Permission Level. It’s useful if you have content on a page (such as admin features) which you only want specific users to see. You simply specify the Permission Levels who ought to have access as an array.

 

This function checks if the user is logged in. It’s useful if your permission levels change often, and you have a page you want everyone to have access to, or for public pages where you want some parts only to be visible to logged in users (such as the box to post comments on a blog).

The isUserLoggedIn(); function is probalbly the most used of these functions, where it allows people to see the content that only a logged in user will see, this means that if you want a logged in user to access the page, then he can do so, but you can still see the page, If you put this in a nice if statment.

 

 

 

 

Database PDF Manafacture

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 http://patrickrice.net/blog/2013/10/form-validation/

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 (http://php.net/manual/en/pdo.prepared-statements.php)

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

CryptoLocker virus/ransomeware

December 10th, 2013

Just to make people aware, there is a new virus (technically ransomware (http://www.microsoft.com/security/resources/ransomware-whatis.aspx) ) that is doing the rounds. It’s been in the wild for a while, but seems to be getting more media attention these days.

Basically once you click on a e-mailed link it will encrypt files it can access on your hard drive. The engineering beauty of this virus is that it encrypts your files, and then contacts you to demand a ransom in the form of bit coins (http://bitcoin.org/en/) to decrypt your drive. So it becomes a case of pay up or your data is gone, if you have backups on another drive you should be able to restore to that drive, however if your do not have backups your data is basically gone as the encryption is uncrackable at the moment.

The above has a less chance of happening if you are running non system administrative privileges, You can read more about how a US police force had to pay to get there data back on the link below, it’s a pity they didn’t have backups. http://www.theguardian.com/technology/2013/nov/21/us-police-force-pay-bitcoin-ransom-in-cryptolocker-malware-scam

You can read more on: http://www.f-secure.com/weblog/archives/00002640.html

Form Validation

October 11th, 2013

Form validaion is a bit like picking spuds, you know you want to eat the spuds, but you got to dig them and then pick them (spuds are potatoes for the non Irish reading this)  so how do we do this efficiently, well I’ve been starting to use the jQuery Validation Plugin it seems to work pertty good, and it’s plain and simple, so how does it work, well the doc’s are a bit sparce, and it’s javascript, which isint the easyest language in the world to program in.

 

so here goes:

Put below at the top of your html web page, this collects the jquery and the jquery validate library’s

 

Then you need add the scripting part, i do a standard debug check to see that jquery works first.

 

Now we have the script ended we can start the HTML and the form

 

 

Thats pretty much it,  yes you can do alot more fancy stuff, but this is a start to get you going.