Floating Spam

Thursday, October 23rd, 2014

I am bored, and therefore I intend to transfer my boredom to the internet.

Whilst looking from my spam folder (I really was that bored), I noticed that there were a bunch of messages at the top which had been there since I last looked (a long while ago)

At first, I dismissed it as my spam filter not working, but upon closer inspection, it appears that they were sent in October…

October 2018, that is. 4 years from now.

I therefore conclude that a type of spam designed to bug you to open it is what I have dubbed ‘floating spam’. That is, spam which was sent to you from the future. It will appear in your inbox if you perhaps run a small business, and are using a cheap mailserver to server you mail without a built in spam-filter and you only access your mail through webmail. If it’s all poorly put together, you will theoretically end up with these spam messages stuck at the top, hiding your other mail.

Of course, for me, the fact it was sent 4 years from now indicates to my spam filter that I am either involved in some Doctor Who plotline involving complicated timey-wimey stuff and email, or I have been sent some spam. It’s pretty obvious which one it is.

BE WARNED! FLOATING SPAM IS AMONG US!

Oh! Ye who hast been scrapped!

Thursday, October 2nd, 2014

Today’s going to be an interesting article for those of you who take an interest in cars.

The Governmental People released a list of all the cars they’ve scrapped through the Vehicle Scrappage Scheme. Today I intend to go through the top 5 cars scrapped, to celebrate the hunks of junk we all stuck it to.

  1. Ford Fiesta – 13,622 Scrapped
    So, Britain’s officially best-selling car is hitting the scrapheaps in their tens of thousands.
    Something leads me to suspect that they are either Mk4 or Mk5 Fiestas, because let’s face it. Nobody really wants one anymore.
  2. Nissan Micra – 11,808 Scrapped
    This car deserves nothing more. Most likely scrapped was the Mk2
  3. Vauxhall Corsa – 10,453 Scrapped
    If I had the choice, I’d take the Corsa C over the Corsa B any day, which is why I suspect that the Corsa B was worse off in those figures
  4. Volkswagen Polo – 8,432 Scrapped
    I’m sorry, but the Polo has nothing going for it. I bet you most of those were either Typ 6Ns or Typ 9Ns.
  5. Vauxhall Astra – 8,066 Scrapped
    I suspect 3rd or 4th Gen. These cars were simply terrible

That’s it. I’m going back to work, and I suggest you do the same before someone catches you.
I’ll do a proper post sometime soon

How to look good in your Prius

Saturday, July 12th, 2014

Now. This IS unusual. I haven’t talked about the one thing I talk about all of the time normally on my blog. No, it’s not looking good, it’s cars. Here we go…

It is a common stereotype: Prius drivers are boring people who ought to be locked up in old people homes for making the horrendous mistake of buying themselves a prius in the first place. Not so anymore, as I have some simple tips to help you look good whilst prancing around in your prius (Note: these tips may or may not affect your oh-so-sought-for gas mileage – YOU HAVE BEEN WARNED! Oh, and these tips are not guaranteed to work…):

  1. Wear an awesome hat and pair of glasses like you stole it. If you look like a normal person in a Prius, you’re doing it wrong. Ramp up the macho and wear a friggin’ awesome cowboy hat and an awesome pair of shades! When you get out, people will imagine you’re leaving a really awesome muscle car. They will (or they might).
  2. Drive it like you stole it. If you drive your Prius by the book, coasting wherever possible to save fuel and recharge the batteries, people will loathe you (Because they want to get past you and look better than you). The Prius has the advantage over similar vehicles in its class because pedal to the metal equals both the petrol and electric engine give you all they’ve got. MORE POWER!
  3. Paint it like you stole it. What good is it wearing you silly hat and your silly glasses and driving it like a silly little kid who ought to be on public transport when nobody notices your silent blur (silent unless you’ve got your foot planted) whizzing past them? Give yourself an epic white/blue two tone and rock that motherf*cker!
  4. Park it like you stole it. You have your clothes, your speed and your two tone. Now what? Go find an executive’s parking space and park in it of course! People will eventually catch on that the rich kids are spending their money on new Prii (Yes, that is the official plural for Prius) and will view you as a cool pioneer in Prius awesomeness.

There you go. You now know how to look good in your Prius, so don your hat, your glasses, give it a frikkin’ awesome paint-do and race it down to the exec’s space and walk away like a badass.

Be a proud Priuser.

I’m ill as unexpected, please leave a message

Thursday, July 10th, 2014

I don’t like being ill, nor do many other people I know of.

However, to be ill is to be relieved of normal duties for a period of time, which can be used to recuperate and recharge. This recuperation and recharging is very important for a person akin to myself as you need all the energy you can get.

What else is very important is to know that you are not the only one that’s ill.

The crisis of the storage space – part two.

Monday, February 10th, 2014

If your windows machine has run for twenty days straight without crashing or otherwise needing a restart, then congratulations!

It also means I should share with you a little secret. Windows uptime = disk space used for the page file, etc. A restart will significantly cut hard disk usage (4GB in my case :)) and allow you to continue working.

I would write more but I simply couldn’t be bothered. Believe it or not I have a life.

Using MySQL with PHP

Sunday, February 9th, 2014

Today I shall discuss a subject that took me ages to get my head around. It took me an incredibly long time to understand how to access SQL data within PHP.

Hence why I wish to make it easier for anyone else who is struggling to understand it.

To begin with you need a MySQL database (and a table to help speed things up). This post assumes you know how to do this for brevity’s sake. Now you need to access the database from within PHP:

This example is written in the procedural style. The object oriented style is written differently!

<?php
$db = new mysqli('server','user','password','database');

$people = $db->query("SELECT * FROM people WHERE gender='female'");
while($person = $people->fetch_assoc()) {
echo $person['name'].'<br />';
}

This code fetches all the names of people in the table 'people' who are female. Let me explain:

$db is how the script accesses the server. You can have more than one server instance. For example, I may have one accessing a database on an old server, to be moved to a database on a new server, or another database on the same server. new mysqli creates a new instance of server access. 'server' is the server address, which in most cases is either localhost or 127.0.0.1. 'user' is the username of a user who has permission to view the tables on the server. 'password' is obvious. It is the password of the aforementioned user. 'database' is the name of the database that this script uses.

I, for example may use
$db = new mysqli('localhost','ben','12345','friends');

Next is $people. This contains the query to be sent to the server to get all the records in the table 'people'. $db->query tells the server to query the database instance $db with the query to be mentioned next.

"SELECT * FROM people WHERE gender='female'" is the sql query. It is sent to the server to make it ‘do’ stuff. SELECT tells the database to fetch records from the server. ‘*’ tells the database to fetch all the columns, for example name, address, date of birth, gender, etc. FROM people tells the server to fetch all columns of information from the table called 'people'. WHERE gender='female' tells the server to fetch all columns of all records that match the WHERE clause, which in this case is records where the specified gender is female.

'while($person = $people->fetch_assoc())' Is the start of what PHP does with the data. $people is only a query, and it doesn’t contain any information. $person = $people->fetch_assoc() creates a new ‘person’ object which contains the data of the first record associated with the query contained in $people. You may have noticed that only the first record is selected, but the next records are selected when the while statement loops back, and so on until there are no more records left to process. Simple, right? ;)

After the while statement, there is then echo $person['name'].'<br />'; inside two curly braces. The curly braces define what code the while statement runs each time it loops. echo tells the script to print some stuff to the browser. Remember that the browser does not get to see any of this code, and so this line will be the first line sent to the browser. $person['name'] contains the content in the ‘name’ column of the record being currently processed. It can be changed to other names, such as $person['address'], $person['date_of_birth'], $person['gender'], etc. and it will echo different things. the dot in between the variable and <br /> tells the script to join something on. <br /> tells the browser to create a new line. Without this line, all the names would be printed in one long line.

The output of this could be:

Janet
Michelle
Emily
Susan

Changing the $person['name'] variable to $person['gender'] would be guaranteed to display:

female
female
female
female

This is because of the WHERE clause I wrote about earlier.

Of course, questions are welcome in the comments, which will be answered and included in this post!

The crisis of the storage space

Saturday, February 8th, 2014

I have run out of hard disk space on my computer.

I have run out of hard disk space on my other computer

I have run out of space on all of my external storage devices, including the SD and CF cards for my camera

I have run out of space on my current phone, my old phone and my school-tied iPad

I have even run out on my Raspberry Pis.

In case you haven’t noticed, I’m running a little short on storage space.

This isn’t the first time it has happened, and I doubt it will be the last, but I’m damn well sure that it is a problem.

So how does one go about solving it then? Well, I started by uninstalling everything I didn’t use, regardless of whether I needed it or not. I went on to remove old documents I didn’t need any more (which I really, really hate doing), before clearing out system temp files and removing update backups.

It is about this time I deem it ripe to rebuild a computer. This requires a backup of my documents, which, well, I can’t exactly do.

Oh dear sweet mother of all things holy in and out of the computer world.

In case you hadn’t noticed, I’m not feeling too good about this.

I will keep you updated.

With faithful regards,

Me.

Hardening WordPress plugins

Thursday, February 6th, 2014

I write code.

Yes, most of you know this, but what most of you don’t know is:

I didn’t write secure code, until now.

Let me explain: It is no good building a website for a client and going “Hey! Here’s a new site I’ve built you. It’s super secure!”, when you haven’t given one thought the people on the dark side (of the planet and of the force), and allowed for SQL injection attacks.

SQL injection attacks are where people ‘inject’ code into your site. Imagine this scenario:

A good person goes onto the website and enters ‘Josh’ into a box called ‘username’.

The PHP for this database query looks as so:

$age= $_POST['username'];
$db->query("SELECT name FROM people WHERE username='".$username."'");

This code inserts $username into the mysql query. The query that is sent to the database looks as follows:

SELECT name FROM people WHERE username='Josh';

So what happens if someone injects SQL into this query?

Say Mr Baddie comes along and enters Josh'; DELETE FROM people into the ‘username’ box, the query sent to the database will be:

SELECT name FROM people WHERE age='Josh'; DELETE FROM people;' Note the apostrophe at the end!

Or

SELECT name FROM people WHERE age='Josh';
DELETE FROM people;'

A lovely list of people with the username Josh will be returned. Before promptly deleting everything from the table ‘people’.

Oh Dear. I hope someone remembered to take a backup of that database.

Once people have been observed throwing insult-ridden shouts across the office at each other, blaming each other for the incident; and the boss has been to throw his own insults; and the site has been down for a week; and the head office has held a conference call to throw their own insults, it is finally time to sit down and work out what went wrong and how it can be prevented in the future.

Option 1: Delete the site and pretend none of this ever happened.

Option 2: Use different users for fetching and writing data to the database.

Option 3: ‘Sanitise’ the code to prevent SQL injection attacks.

I suggest Option 1 if you want a 100% guarantee that this will never happen again, but a compromise is required for those who don’t want to/can’t take it that far.

I suggest Option 2 & 3 for the near best you can get. I will explain Option 3 only.

The process of sanitisation not only protects against code injection, it also protects against the good guys potentially accidentally breaking your server.

There are different ways of sanitising user input for each language. I will demonstrate how to sanitise input for a mysql database through php.

It’s a function called mysqli_real_escape_string

So, instead of putting the given input straight into the sensitive belly of the database, I need to sanitise it.

Here’s the code instead.

$age = $db->real_escape_string($_POST['username']);
$db->query('SELECT name FROM people WHERE age=".$username');

So when Mr Baddie inputs Josh'; DELETE FROM people into the ‘username’ box, the content is sanitised and the day is saved.

The End.

Winter

Wednesday, February 5th, 2014

It’s cold and dreary outside – and since I’ve been home for an hour, and there is a cold cup of tea I made waiting downstairs because of it – It’s also dark.

It’s that miserable time of the year again.

Now, I won’t lie: I like rain. There’s something really nice about just walking on your own down a quiet street where it’s just you and the rain. Oh, and the umbrella. I always have my umbrella with me.

This is the time of year where everybody (myself included) gets a bit snuffly, and we go around as a staggered group of warriors, passing it on to anyone who hasn’t got it, because that’s just what we do.

I’d love to sit and continue writing, but I have some other work to attend to.

Please come back soon, and one hopes I will have written something good.

I’m sorry I haven’t posted for so long. A lot has happened since then. Happy Colorado day, Tisha B’av, Victory Day, Hawaii Statehood Day, Labor Day, Carl Garner Federal Lands Cleanup Day, National Grandparents Day, California Admission Day, Patriot Day, Constitution and Citizenship Day, Emancipation Day, September Equinox, Rosh Hashana, Native Americans’ Day, Gold Star Mothers Day, Feast of St Francis of Assisi, Yom Kippur, Eid al-Adha, Child Health Day, Sukkot, Leif Erikson Day, Columbus Day, White Can Safety Day, Shmini Atzeret, Boss’s Day, Alaska Day, Diwali, Muharram, Halloween, Nevada Day, All Saints’ Day, All Souls’ Day, End of Daylight Saving Time, Election Day, Return Day, Veterans Day, Thanksgiving, Presidents’ Day, Black Friday, American Indian Heritage Day, First Day of Advent, Cyber Monday (whoop, whoop!), St Nicholas’ Day, Pearl Harbour Remembrance Day, Feast of the Immaculate Conception, Feast of Our Lady of Guadalupe, Hanukkah, Pan Am Aviation Day, Wright Brothers Day, Christmas Eve, Christmas Day, Boxing Day, Kwanzaa, New Year’s Eve, New Year’s Day, Epiphany, Orthodox Christmas Day, Stephen Foster Memorial Day, Prophet’s Birthday, Orthodox New Year, Tu B’Shevat, Lee Jackson Day, Confederate Memorial Day, Martin Luther King Day, Idaho Human Rights Day, Civil Rights Day, Kansas Day, Chinese New Tear, National Freedom Day, Groundhog Day and Rosa Parks Day

I don’t know about you, but I think we have too many holidays.

The end of the PC is nigh.

Monday, July 1st, 2013

Firstly, I do apologise about the hideous colour scheme on the last theme, the green made me see yellow.

As one who browses the internet for hours upon hours a day, it didn’t take long to realise how much buzz there was a couple of years ago about ‘cloud computing’, and after kicking my feet up for those past years saying to myself ‘That’ll never happen’ – and before I knew it the world overtook me and I was bombarded with adverts for cloud hosting and it was all quite frustrating.

But since then, a new threat has cropped up. The tablet. A lightweight, easy to use and very portable system, which got me scratching my head. It didn’t have a keyboard.

Now I know I’m meant to be a ‘computer boffin’ or what have you, but I really couldn’t get my head around the idea that a computer is now this touch screen with a battery, a pretty solid mobile processor, a long -ish life battery and a hard casing on the back. It was like someone had decided that the laptop was too easy to break, and so they broke off the lid, and went ‘Hey, I could make money out of this idea!’.

Windows for Pen Computing kicked off Microsoft's tablet efforts back in 1991.

Windows for Pen Computing kicked off Microsoft’s tablet efforts back in 1992.

If I’m honest. I should have seen this coming. Tablets have sort of been around since before I was born. Take Windows for Pen Computing. It was an application that could be bought for Windows 3.1 (I know, right? 3.1 was like April ’92). It allowed 3.1 to be used on these primitive plastic tablets, which at the time, could run an Intel processor, but not for a day’s work.

Since WfPC Microsoft made a whole load more mistakes, right up to the point of a ‘touch screen table‘ in 2008. With no hardware or software developers, virtually no buyer market and the fact that they were only available after filing a request with Microsoft, and going through a screening process and having a swarm of checks made on you/your company, it was clear this product was not to make money, it was simply to prove that Microsoft knew what they were doing when it came to tablets. and they do, with the exception of hardware.

Microsoft have always done an amazing job when it comes to writing software, but they’ve always been a bit, well, crap when it comes to their hardware. Remember the snapped off lid I mentioned earlier? They took that a step further by allowing you to attach the keyboard back on. And take it off again.

I really shouldn’t be giving Microsoft Surface all this hate. It follows on an idea which Apple have dropped altogether. I said I don’t understand tablets, and it’s true. But what I do understand is the idea of Tablet PC’s.

My First Tablet PC - A Toshiba Portégé M200

My First Tablet PC – A Toshiba Portégé M200

I used to have a tablet PC, if I remember rightly it was a Toshiba Portégé M200-16M. Lightweight and rugged, with a screen which twisted round and locked down, it was a brilliant first laptop and tablet PC.

SIDE NOTE: I spent so many hours on that thing, I could swear the screen got a few millimetres thinner!

It is thanks to Microsoft that the Tablet PC is being dug out of its grave, with the release of Windows 8, everyone has been scrambling to get their lines of portable computers stocked up with tablet PC’s once more. The Microsoft Surface is to be disliked in my opinion, however it it designed to keep Microsoft revenues rolling in, because Microsoft and Bill Gates made their fortune on the Software, and with Entry Level Windows 7 Home Premium rolling off the shelves at £80, and the OS line going up to their top end Windows 7 Ultimate at £150, it’s no suprise that Windows needed a financial solution now that their Windows 8 lineup is cheap as dirt, and so came up with the idea of a tablet / tablet PC hybrid. Yes that’s right, tablet AND tablet PC, that’s the removable keyboard that stirs that one up.

Quite frankly the iPad is a disaster, and Apple have messed up their pricing, so they get a minimal mention in this post. Does this mean I’m a Microsoft kinda guy? I’m writing this from Windows 7, installed on a Mac. Hmm.

It’s now just a wait until the guys in Cupertino (Yes, that means Apple) come up with a comeback for the tablet PC hybrid.

So, to sum this up, Microsoft have been toying with this tablet idea for far longer than Apple have been even thinking about it, I used to have a laptop with a French name, Mobile devices are going to take over the world, and Windows 8 is pretty rubbish. Thank you for reading!

Ben Wilkinson

Follow

Get every new post delivered to your Inbox.

Join 429 other followers