Chris Worfolk's Blog


Worfo.lk

July 5th, 2012 | Limited, Tech

Inspired by Kieran’s recent registration of kjo.sh to use as his own short URL code, I decided to go on a bit of a search for any names which could be similarly useful.

Wouldn’t you know it, Sri Lanka happens to have a top level domain made up of the last two letters of my name – .lk. Seeing that the domain worfo was available, I’ve now snapped it up to form worfo.lk. Boasting an extra three letters on top of the minimum length of domain names, it isn’t the shortest short URLs in the world, but I’m more than happy to make the trade off.

Of course, please remember that clicking a worfo.lk link doesn’t guarantee you won’t end up on a web page containing hardcore pornography.

Logic-less templates with Mustache

July 4th, 2012 | Limited, Programming

The first thing you probably think about when I mention Mustache is, “you’ve spelt moustache wrong.”

You would be right. But although the creators of such a project clearly do struggle with proper spelling even more than I do, they have never the less created something really interesting – logic-less templates.

Mustache is a templating system, similar to Smarty or Twig, that was originally written for Ruby and has since been ported to almost every other popular language under the sun (it has not been ported to any languages that exist outside our solar system, to my best knowledge).

The idea is that you separate out your logic from your template. So you would have a view class which handles the logic, and then the actual template file which has your presentation in. Why this extra layer of complexity though?

Well the problem with templating systems such as Twig is that they actually aren’t as separate as we like to think they are. You have control statements like looks and if statements, and then people started adding helpers to templating systems where you could call functions and even pass parameters! This made it a lot easier for us to write the view, but by the time you’ve added all that in, why not just place the PHP directly inside the template – it would be just as simple.

Mustache does a way with all that. In Mustache there are two main types of tags you can have – variables and sections. A variable is a straight replacement in double brackets {{like this}}. Sections contain one extra character so you might have a {{#section}} that wraps this text{{/section}}. A section can then be repeated zero or more times depending on whether you pass it a false value, a true value or an array.

There are a few other tags but this for the most part is everything! You don’t have the complicated control statements, the helper functions or other such syntax to deal with – inside a section which repeats from an array for example, you just call the key name, without having to specify the array variable every time. See the example below.

In Twig, you would do this...

{% for item in list %}
{{item.name}}
{% endfor %}

In Mustache, you just do this...

{{#list}}
{{name}}
{{/list}}

You can argue that there is added complexity in having to create an accompanying view class – and you would be right. But this is optional, and only required if you need to do view-time processing – passing an associative array, just like you would with Twig, works fine too!

I highly recommend giving Mustache a go, I was skeptical at first but once you dive in it really produces some beautifully clean code.

Don’t cover it up

July 4th, 2012 | Video

This is a great PSA by Lauren Luke.

YouTube link is here if you’re having problems with the embedded code.

Slim

July 3rd, 2012 | Limited, Programming

Slim is a PHP micro framework, similar to Flight, Silex and Limonade, not to be confused by the Ruby templating system of the same name. It claims to contain “everything you need and nothing you don’t.”

If functions like you would expect a micro framework to work. Here is the standard example.

<?php
require 'Slim/Slim.php';
$app = new Slim();
$app->get('/hello/:name', function ($name) {
    echo "Hello, $name!";
});
$app->run();
?>

My favourite part of Slim, however, is actually the Slim Extras bundle which doesn’t ship with it, but can easily be downloaded and dropped in. This adds easy integration for lots of different templating languages – notably Smarty, Twig and Mustache.

So, for example, if you wanted to integrate Twig, just grab the Extras bundle, the Twig bundle, include the relevant file and change your initialisation statement to the following.

$app = new Slim(array("view" => "TwigView"));

That’s all – now you’re away and can call the render method with a filename and data array to render a template using Twig.

Alpha Security Ltd

July 2nd, 2012 | Distractions

Having recently been contacted by a Libyan solider who had $50 million to split between us, I was currently engaged in sorting out the details with the UK based security company, Alpha Security Ltd. I had just sent them over my details but with my phone unfortunately broken, said we would have to continue planning by email.

Dear Bernard,

Not to worry, I can’t imagine it will be an issue either way. We should, as you suggest then, proceed with full steam ahead. The tourism season is approaching after all and I’m sure the restaurant will be placing many orders with my brother’s farm soon!

Actually, my brother was recently doing some market research as he is trying to gauge the expectations of his target audience. As a well to do business man that I am sure you am, perhaps you could lend your opinion. On a traditional hog roast you normally stuff an apple in the pig’s mouth. Obviously, with these being miniature pigs, we would need miniature apples, and he can’t do that. So he is wondering if the effect would be spoilt?

On the matter of proceeding, you would normally be able to reach me on 0113 350 7662, however we’ve been having some problems with our service recently, so I fear we may need to proceed via email.

Yours faithfully,
Rev Chris Worfolk

Unhelpfully, Bernard ingored my brother’s market research question and continued to discuss the arrangements.

Dear Rev. Chris Worfolk,

In line with our last email correspondence regarding the delivery of the consignment deposited with us in which you are the beneficiary, we wish to inform you that the consignment is ready to be delivered to your door step by our assignment Diplomat upon receipt of the following mandatory and non negotiation obligations.

1. Your mailing address which also include the nearest Airport to your home.
2. Payment of KYC and profile definition of USD550

Please treat this as a matter of urgency to enable complete our assignment and on time.

The fee should be sent in the of our Secretary as follows:

NAME: Victoria Ashley
ADDRESS: London UK

Please endeavour to send us the scan copy of the payment slip.

Yours faithfully,

Bernard David
Manager, Treasury Department

The address looked a bit suspect, so I asked for clarification.

Dear Bernard,

Good to hear from you. When I didn’t hear anything for a few days, I feared something might have gone wrong! So it’s very comforting to know that everything is ready.

My mailing address is:

3 Brockley Close
Church Fenton
Tadcaster
LS24 9RB

The nearest airport would be Leeds & Bradford International.

As for payment, I have this ready to send, but I don’t think I can send it to “Victoria Ashley, London, UK.” Normally you would also include a number, street name and postcode, as I fear that there may be many Victoria Ashleys in London, and how would the Royal Mail know which one to deliver it to?

Best wishes,
Rev Chris Worfolk

Bernard got back to me with a clarification on the address.

Dear Rev Chris Worfolk,

Thanks for your response and your observation. Yours mailing address and nearest airport is noted.

You are therefore requested to send the USD550 through western union money transfer with our secretary name and address below:

Victoria Ashley
62b, Clarendon Road, London E17 9AZ UK

Please ensure to send us the payment details via email to enable the Diplomat deliver to you address as follows:

3 Brockley Close
Church Fenton
Tadcaster
LS24 9RB

Yours faithfully,

Bernard David
Manager, Treasury Department

Unfortunately, I didn’t know what Western Union was.

Dear Bernard,

I must say that I am most confused. What is Western Union? It sounds like some kind of railway network. Are you suggesting that I put the money on a train?

Best wishes,
Rev Chris Worfolk

Bernard seemed quite surprised I hadn’t heard of it.

Dear Rev. Chris Worfolk,

I am amazed that you are hearing about the western union money transfer for the first time. It is the fastest way to send or receive money across the globe.

I want you to understand that you are the one delaying the delivery of your consignment. All you have to do is walk into any Western Union Money transfer agent or Money gram and tell them that you want to send money to the detail given to you.

They will give a form which you will complete after which they will collect the money from you and immediately dispatch it. Please you must understand that time is of essence in this transaction.

Waiting for your response with the payment details.

Yours faithfully,

Bernard David

Unfortunately, we simply don’t have any of that in the small village where I live.

Dear Bernard,

The fastest way to send or receive money across the globe? That is quite something. However, I’m afraid we wouldn’t have anything like that in the sleepy village of Church Fenton. Surely I can just send the money via back transfer?

Best wishes,
Rev Chris Worfolk

Apparently, I could.

Dear Rev. Chris Wolfork,

As per your request, please send the wire transfer to this account to our agent in USA.

William w. Miller Jr,
Regions Bank , 620 veterans memorial drive, Kosciusko, Mississippi 39090 USA

Routing # 065305436

Acct # 0169815690

Please ensure to send us the payment via email attachment.

Yours faithfully,

Bernard David

At this point, I got bored. Shame, I could have really done with the money.

Installing GCC 4.4 on CentOS 5

July 1st, 2012 | Life, Tech

If you’re running CentOS, you may find yourself frustrated that you have GCC 4.2 or older, when you need to be running at least 4.3 for some features – for example, if you want to compile HipHop for PHP.

Never fear, you don’t need to compile a compiler from source!

As well as the gcc RPMs in the repository, there are also a set for GCC 4.4, appropriately enough named gcc44 and you can install them in the usual way.

yum install gcc44 g++44

Captain David Kelly

July 1st, 2012 | Distractions

I’m a bit strapped for cash at the moment, so you can imagine how excited I was when I received the following email.

Attn:

My name is Captain David Kelly, a Liberian soldier who served in the NATO force, that brought an end to era of late Libyan leader Muammar Gaddafi.

In one of the raids I found the sum of USD13.5M stolen and hidden in a cave and I am writing to you to assist me in receiving the fund so that after my service I will come to your country for investment of the fund in any lucrative business of your choice.

Please, if this offer appeals to you do let me know, so that full information will be communicated to you More importantly, I suggest you keep this transaction with utmost confidentiality.

Sincerely,
Captain David Kelly

The question is though, how did I know he was legitimate? I thought it best to ask him.

Dear Captain Kelly,

That sounds too good to be true. How do I know you are legitimate?

Yours faithfully,
Rev Chris Worfolk

He emailed me back a week later to reassure me.

Dear Rev Chris Worfolk,

Thanks for taking time to understudy my email and for your response; in answer to the question about my legitimacy, I assure you that this is real and risk free.

I thought about leaving the money behind but changed my mind when I remembered that this was stolen money which probably was meant to sponsor terrorism. You will agree with me that the best option was to take the money and invest it into something positive.

Therefore, I solicit for your assistance so that you receive this fund and invest it on any profitable business of your choice and on our behalf.

If really you are interested please furnish me with the following details to enable me link you up with the security company where the fund was deposited by my personal aid.

FULL NAME:
MAILING ADDRESS:
TELEPHONE NUMBER:

Waiting for your response.

Yours faithfully,
Captain David Kelly

Well, what a relief. He has assured me that he was real, and risk free! I emailed him back.

Dear Captain David Kelly,

Thank you for your response. I must confess I am most excited by the prospect. In a stroke of good fortune I received an email from my brother last week. He moved to America some years ago and is currently looking for investment to start a farm. What an ideal opportunity I thought to myself!

However, I am curious as to how the transfer would be made? And on what terms?

Look forward to hearing from you.

Yours faithfully,
Rev Chris Worfolk

He got back to me with full details.

Rev Chris Worfolk,

Again thanks for your email. It is a great opportunity for your brother if he can accept and invest this money in his proposed farm firm.

To effectively carry out this fund transfer, I have made a concrete arrangement for the security company where the fund was deposited as family treasure to effectively get the consignment to you or your brother without hitches.

The fund was concealed and deposited as family treasures to avoid attracting heavy taxes associated with such huge fund transaction. Upon successful movement of the fund to you, we will share it to the ration of 50-50% and have it jointly invested in your brother proposed farm firm, or what do you think?

Please write the security company with the following email address and inform them that you are the beneficiary of the deposited treasure and keep me updated with your communications with them.

Yours faithfully,

Captain David Kelly

I decided it was best to explain about my brother’s farm in full.

Dear Captain David Kelly,

Yes, I am most excited about the prospect. I don’t fully understand what he does, as I am a man of God rather than a man of science, but he believes he has found a way to breed miniature pigs so that they could be sold to restaurants who could serve the phone pig, dressed with head and all, to their customers.

Such an arrangement sounds more than fair. Very good thinking in depositing it as a family treasure. Do I need to supply the security company with any kind of reference or account number when I contact them?

Yours faithfully,
Rev Chris Worfolk

As it would happen, I didn’t need to give them a reference number or proof or identity, because they would just know who I am. Brilliant.

Dear Rev Chris Worfolk,

Thanks for your response, thought it took you quite some time to reply. Just write the security company and inform them that you were referred by me in respect of the consignment deposited with them in your name.

From there, they will furnish you with all the delivery details. I have hereby handed over the business of receiving the consignment to you on trust as I am not disposed to constant communication due to my work schedule.

I trust that you will handle this transaction effectively. Once again here is the Security Company’s detail:
ALPHA SECURITY SERVICES LTD UK
Email: alphasec.ukltd@yahoo.co.uk

Yours sincerely,

Captain David Kelly

All going well so far. So I sent the security company an email, explaining the situation.

To whom it may concern:

I was recently contacted by Captain David Kelly who has referred me to you, in order to help him move his family fortune out of Libya. He instructed me to write to you, and that you would furnish me with further details.

Yours faithfully,
Rev Chris Worfolk

They emailed me back a form to complete.

Attention: Rev Chris Worfolk

Please view our letter with regards to the consignment with us by Captain David Kelly of which you are the beneficiary.

We await your response with regards to our demands.

Yours faithfully,

Bernard David
Manager, Treasury Department
Alpha Security Services (UK) Ltd

I had a few questions though, which I responded with.

Dear Bernard,

First of all, let me thank you for all your hard work in assisting Captain David Kelly and myself so far.

Having recently spoke to Captain David Kelly, he informs me that he may be away for some time due to his hectic work schedule. I trust that this will not interfere with the process of transferring the consignment?

Now, the consignment is eventually destined to be invested in my brother’s farm. He runs a pig farm you see, and has managed to breed miniature pigs so that the whole animal may be presented to the customer, dressed of course, at a local restaurant he supplies.

To better illustrate, I have attached a picture I have drawn. Please do not laugh at its crudeness – I am the first one to admit that I am no artist, but I thought it would better help illustrate his business model.

Therefore, I wonder whether it would be best to have the consignment transferred straight to his address, or whether it is necessary for it to pass through my hands first? I will leave this to your advice, as you are after all the expert on such matters.

Yours faithfully,
Rev Chris Worfolk

Below is the picture I attached.

Miniature pig

I presume they liked the picture, and emailed me back straight away.

Dear Rev Chris Worfolk,

This is to acknowledge receipt of your detailed email, however, I am sorry to inform you that all documentation on Captain David’s instructions have been registered in your name and it will take quite some time to reverse this documentations.

Please let us continue dealing directly with you to avoid deviating from our agreement with Captain David. Thank you.

Kindly furnish us with your direct telephone number for easier communication since we find out that it takes you more time to respond through email.

Find here attached the consignment’s certificate of deposit in your name.

All things being equal by Monday the delivery arrangements would have been concluded and delivery will commence.

Yours faithfully,

Bernard David
Manager, Treasury Department.

Part two is coming tomorrow.

EDIT: Part two is now available here.

Gay Men 365

June 30th, 2012 | Limited, News

Gay Men 355

Worfolk 18 is pleased to announce we’re expanding our existing range of adult entertainment websites with our first gay offering – Gay Men 365. Updated with a new photo every single day!

West Yorkshire Humanists AGM

June 29th, 2012 | Humanism

This month saw the AGM of the Humanist Society of West Yorkshire. It was a rather well attended affair, at least for an AGM, which normally sees people stay away. This year, I had volunteered to give a short talk as well, so hopefully that proved to be a bit more of a draw.

While it’s pretty much business as usual, I will be changing my role from a general committee member to treasurer of the society. We’re also going to gauge interest in bringing over bigger speakers over the next year, so we will see how that goes.

Twilight of the Porn Stars

June 28th, 2012 | Distractions, Thoughts

Louis Theroux’s latest documentary sees him revisit a documentary he did 15 years ago, about the adult industry.

It’s makes me feel very old that the documentary is now fifteen years ago, though with that recently having been screened alongside it brought back some interesting memories – for example in the original, Louis actually appeared in one of the films. He was just an extra, and kept his clothes on, but I’m sure it provides him with a great dinner party anecdote none the less.

I actually felt his blog post about it was more enlightening than the documentary itself was, mostly with him just re-visiting people he had previously seen. A lot of what I saw made sense, but only because of the added commentary I had already read from Louis’s writing (to which I would link to but I can’t remember where I read it; it wasn’t on his official blog).

The industry is described as being one in crisis as YouTube still porn sites overtake the DVD market.

This seems somewhat obviously (as if anyone buys DVDs these days, the new MacBook Pro doesn’t even come with a DVD drive) and rather than it putting them hard times, it seems more that, as with most markets, changes happen and the industry needs to adapt.

The traditional film and music industries are good example of this. Internet piracy is apparently destroying the music industry, but it’s been destroying it since people started making recordings on casette tapes and yet somehow it has survived all these decades.

But to suggest that the internet has prevented the music industry from making any money is simply nonsense. Apple, with its iTunes music store, is now the most valuable company on the planet, ahead of oil giants and banks. Spotify is looking like it will soon be posting profits and as for the film industry, last year LoveFilm sold for £200,000,000. There is clearly money to be made for this willing to adapt to the changing conditions.

The adult industry is the same. People aren’t throwing money at mail order DVDs anymore, but to say that nobody pays for porn anymore is simply untrue. Just like at the rapid expansion of Kink.com who in 2006 were so profitable that they could afford to spend $14,000,000 on the historic San Francisco Armory to use as a film studio. Plenty of new opportunities have arisen too – cam sites for example is a huge opportunity to take a massive cut out of the strip club market, in the same way that live dealers on gambling sites have taken a cut out of the casino market.

When I first entered the adult market in 2004, it was all about pushing paid content sites. Now the landscape has changed – it’s now about pushing dating sites (I use the term dating sites loosely, casual sex sites would probably be a more appropriate name) because that is where consumers are spending their money these days. They’re not spending less, just as I don’t spend any less on digital music than I did on CDs, they’re just spending it in different ways and you have to change your business model to adapt to this.

If the industry wants to survive and thrive, it needs to be willing to role with the times.