O2′s Data Scandal

If you are running on O2 or another network that uses O2′s infrastructure (namely Tesco Mobile and giffgaff), it is likely that your mobile phone number has been transmitted to every website you have visited over the past 15 days. The Information Commissioner’s Office said it is considering whether to investigate further, although a spokesman said there was no immediate breach of the Data Protection Act. This is because the DPA does not class mobile phone numbers as personally identifiable information.

However, if you have received telemarketing text messages or calls over the last 15 days that you believe may have been caused by your mobile phone number being released, there may be grounds on which you can either cancel your contract or claim compensation.

NB: Please do not take this advice as a legal footing, I am not a lawyer. Please check with your solicitor to see if you have valid legal grounds before entering a dispute with O2.

There is an European Union directive, 2002/58/EC, that instructs under Article 13 “Member States shall take appropriate measures to ensure that, free of charge, unsolicited communications for purposes of direct marketing… are not allowed either without the consent of the subscribers concerned or in respect of subscribers who do not wish to receive these communications…”

By “communications,” this implies emails, text (SMS) messages and telephone calls. This directive means that there should be some form of legal context within the Data Protection Act on which you can claim compensation, based on what the UK government did to implement this directive. If you manage to find the clause in the DPA which covers this, please let me know.

 

Google Weather + Character Encodings

I’m building an application for my “Data, Schemas & Applications” module at university, which manipulates data from Google to display the weather for given locations. Google’s weather API is fairly simple to understand, and is run through a REST base service and does not require the use of an API key.

You can use PHP to download a copy of the weather data for your chosen city, and subsequently process it to output the weather in whatever way you choose. Prakash has provided a function which can be used on the University campus for loading files through the proxy. It looks like the following:

function get_file($uri) {

/*********************************************************
* @function: get_file
* @author: Chris Wallace
* @created: 30 November 2009
* @updated: 20 January 2012
* @source: http://www.cems.uwe.ac.uk/~pchatter/php/dsa/dsa_utility.phps
*
* This function will get any file through the UWE proxy.
*
* It has been adapted so that if we
* are running on our local testing server, we do not
* need to use this function, as Ben's private server
* does not have proxy requirements.
*********************************************************/


// Conditional: Do we need to use the proxy?
if(substr($_SERVER['HTTP_HOST'], 4) == 'cems.uwe.ac.uk') { // Conditional @value: Yes

// Create a context for the PHP file_get_contents function
$context = stream_context_create(array('http'=> array('proxy'=>'proxysg.uwe.ac.uk:8080', 'header'=>'Cache-Control: no-cache')));

// Get the contents of the requested URI
$contents = file_get_contents($uri, false, $context);

} else { // Conditional @value: No

// Get the contents of the requres URI without use of the proxy
$contents = file_get_contents($uri, false);

} // End Conditional

// And return the contents of the file
return $contents;

}

We later use that function to get a SimpleXML instance of the Google Weather XML file. However, there’s an issue with using Google’s API and PHP’s SimpleXML class, and that is one of character encodings. Every text file generated by computers uses some kind of character encoding, and it’s used by computers to interpret what certain bytes should be rendered as. Common character sets used in everyday situations include:

  • ASCII – American Standard Code for Information Interchange
  • UTF-8 – UCS Transformation Format, the most common format used on the World Wide Web.
  • ISO/IEC 8859-1 – more commonly known as Latin1, a common choice for storing data in MySQL databases.

As it turns out, Google API returns XML documents encoded in an encoding called “GB_18030,” which is a Chinese government standard, and includes a lot of Latin characters (commonly used in English, French, Italian and other European languages), as well as Chinese, Japanese and other east-Asian characters, thereby allowing the API to work in those countries.

However, PHP’s SimpleXML class expects us to load a file in UTF-8. Because of that, we need to convert our returned XML file into UTF-8; which, as it turns out, is fairly simple.

PHP has a module called “iconv.” This module is able to convert an object or a string’s character encoding. Through the following code we can easily switch the character encoding of Google’s XML file to UTF-8.

// We created the get_file function earlier, so we'll use that here.
$file = get_file($this->weather);

// The following line converts the XML file, $file, from "GB18030" to "utf-8".
// Bear in mind that the information portrayed below is case-sensitive.
$xml = iconv("GB18030", "utf-8", $file);

// Finally we return an SimpleXML object of the re-encoded XML file.
// The @ symbol before the function simplexml_load_string makes sure that
//   if we were given an invalid XML file, it will now throw an error.
$xml = @simplexml_load_string($xml, NULL, LIBXML_NOCDATA);

I hope this explains the issue and the solution in as simple form as possible. However, if you have any questions on how this works, please post them in the comments section below.

Reverting Themes

Well, over recent months I’ve noticed that the WordPress theme I hastily made to fit the general style of my site hasn’t really worked. Therefore, since I really want to get back into blogging properly, and I haven’t the time (what with coursework assignments and the hunt for a placement) to build a new WordPress theme, I’ve reverted to the default one until the summer.

After all, surely the blog should be a method of communication more than a demonstration of my WordPress theme building skills (which is something I want to learn). The content I post is far more valuable than the PHP, HTML and CSS that forms the backbone of the design.

To conclude, please forgive me for allowing the blog to differ from the rest of my website, but I guarantee the increase in posts will be worth it.

Sam Boyd’s Custom-Made Surfboards

Website screenshot

This static website, created for my ‘Web Design Principles’ module, demonstrates the importance of working to client specifications. Based on a composite image that had been previously created, the task was to transform that image into a full-featured website.

See the full site…

Hello iOS 5!

iOS 5 FeaturesWell, I’ve been using iOS 5 on the iPhone and iPad for a few hours now. My first impressions are as follows:

Firstly, my iPhone seems more responsive, slightly faster, although I’m trying to work out whether thats due to me actually doing a fresh install and not restoring from a backup.

iMessage seems totally awesome, i feel it’s going to save me a fortune on international text messages (even if they’re only 6p on giffgaff).

I’m glad to see the return of the iTunes app for the iPhone. I was wondering where that went. I missed being able to purchase songs as they come into my head.

The reminders app looks interesting, I’m yet to play with it in detail, but it certainly looks like a better replacement for some of the shoddy to-do apps already out there. However, I think this may make some app developers quite unhappy.

I love the fact you can change the tones for just about anything now. I’ve gone a little bit nostalgic and changed my ringtone to the Nokia tune, my text message tone to 3 seconds of Peter Griffin laughing, and my email tone to the very 1990′s America Online “You’ve Got Mail” tone. I think I could have some fun for a while listening to those.

The basic twitter integration is an excellent idea, the idea of linking it within apps is perfect. If only Apple would embrace Dropbox with the same functionality. I don’t know if this is going to have an adverse effect on twitter app developers, since I’ve not been using any other app but the Atebits one, but it may do.

iCloud is definitely a good idea, and I’m glad its now provided as a free service. I’ve been using MobileMe for 2 years and I love it, and now that I don’t have to pay for it it makes it even better. Maybe iCloud could have Windows support for my friends still using Windows OS. However, for me with an iMac, a MacBook Pro, an iPhone and an iPad it’s brilliant.

To conclude, I think a lot of hard work has gone into iOS 5. If anything the release of this should have been the flagship of their recent keynote, not the new iPhone 4S. Well done Apple. I hope you can continue to impress me despite the loss of the late Steve Jobs. May he rest in peace and his spirit remain within Apple forever more.

Hello world!

Welcome to my blog. Yeah I’ve made blogs in the past, not managed to stick to them very well though. Hopefully this one will go better. Why did I make this one? Well…

Firstly I thought it would be a great place for me to improve my writing style, since conveying ideas clearly and concisely is not one of my strong points. Ergo this blog will be a place for me to improve said skills.

Also, I enjoy talking about my interests, experiences and findings. Being able to share stuff is great, and the World Wide Web has opened up so many new platforms for sharing things through. This will be my feed to the world. Follow it if you wish, I’m sure there will (eventually) be something that interests you.

Finally, I wanted to play around with WordPress, simple as. I hope you will join me in enjoying my experiences and and this blog doesn’t become a waste of a database and PHP scripts.

Les Lézards

Les Lézards is a bed and breakfast in the Creuse region of France. Les Lézards commissioned a website for their business, built on the content management system Drupal. Work included customising a chosen theme to fit specific needs; guidance on usability; search engine optimisation and a Google Maps API static map.

See the full site…

Web Air

A screenshot of the project

Web Air was a group web development project completed for the “Systems Development” module during my first year at university. Working as a team with Alex Jegtnes, Charlie Tizard, and Mark J. Smith, we created a fully-functional website utilizing PHP & MySQL technologies to book virtual flights around the UK.

My personal responsibilities laid with the database creation and the bulk of the PHP development.

View the source code or the full site…

Crimson Pink

As my first major freelance project, Crimson Pink is an e-commerce website built on the content management systems Joomla! and Virtuemart. work involved theme development, component customisation and database manipulation, including creating some standalone apps to allow mail merging using the CMS customer base.

See the full site.