twitter

@amandapalmer I thought you knew how to spell "theatre" :-)

twitter

Not that I'm predictable or anything, but every @swarmapp check-in here in Edinburgh is "you were last here in May 2014" :-/

twitter

Damn fine idea bringing my Chromecast on holiday with me :-)

twitter

Software updates in my future :-) "Fedora 22 released and available now" http://t.co/1dSBLcwbav via @fedora

twitter

RT @JCMitchinson: Does anyone know this girl? We found her camera with photos back to 2012, precious memories of a world tour she did. http…

last.fm

Tunng – Bullets

http://www.last.fm/music/Tunng
last.fm

Tunng – Take

http://www.last.fm/music/Tunng
last.fm

Tunng – Jenny Again

http://www.last.fm/music/Tunng
last.fm

Tunng – The wind up bird

http://www.last.fm/music/Tunng
last.fm

Tunng – Out the Window With the Window

http://www.last.fm/music/Tunng
perl hacks

Building TwittElection

I was asked to write a guest post for the Built In Perl blog. I wrote something about how I built my site, TwittElection, for the recent UK general election.

In the UK we have just had a general election. Over the last few weeks many web sites have sprung up to share information about the campaign and to help people decide how to vote. I have set up my own site called TwittElection and in this article I’d like to explain a little about how it works.

But why not go over to Built In Perl and read the whole thing there.

Incidentally, on 13th June, I’ll be giving a talk about TwittElection at this year’s OpenTech conference. If you’re interested in the positive impact that technology can have on society then you’ll, no doubt, find OpenTech very interesting.

The post Building TwittElection appeared first on Perl Hacks.

perl hacks

DBIC Training in Granada

It’s been a while since I’ve run a training course alongside a YAPC. By my calculations, the last time was Riga in 2011. But I’ve been talking to the organisers of this year’s conference and we have plan.

I’m going to be running a one-day introductory course on DBIx::Class before the conference (I think it’ll be on 1st September, but that’s not 100% certain yet). Full details are on the conference web site. There’s an early-bird price of 150 Euro and the full price is 200 Euro. The web site says that the early-bird price finishes today, but I wouldn’t be at all surprised if that gets extended for a few days at least.

Of course, readers of this blog will all already be experts in DBIC and won’t need this course. But I’m sure that most of you will have a colleague who would benefit from… well… a refresher on who DBIC works. Why not see if your company will pay for them to attend the course :-)

The course size is limited. So you might want to think about booking soon.

Hope to see some of you in Granada.

Two updates:

  1. The date has now been confirmed as 1st September.
  2. The early-bird pricing has been extended until 1st June.

The post DBIC Training in Granada appeared first on Perl Hacks.

books read

A History of Modern Britain

A History of Modern Britain
author: Andrew Marr
name: David
average rating: 3.90
book published: 2007
rating: 0
read at:
date added: 2015/04/28
shelves: currently-reading
review:

perl hacks

Subroutines and Ampersands

I’ve had this discussion several times recently, so I thought it was worth writing a blog post so that I have somewhere to point people the next time it comes up.

Using ampersands on subroutine calls (&my_sub or &my_sub(...)) is never necessary and can have potentially surprising side-effects. It should, therefore, never be used and should particularly be avoided in examples aimed at beginners.

Using an ampersand when calling a subroutine has three effects.

  1. It disambiguates the code so the the Perl compiler knows for sure that it has come across a subroutine call.
  2. It turns off prototype checking.
  3. If you use the &my_sub form (i.e. without parentheses) then the current value of @_ is passed on to the called subroutine.

Let’s look at these three effects in a little more detail.

Disambiguating the code is obviously a good idea. But adding the ampersand is not the only way to do it. Adding a pair of parentheses to the end of the call (my_sub()) has exactly the same effect. And, as a bonus, it looks the same as subroutine calls do in pretty much every other programming language ever invented. I can’t think of a single reason why anyone would pick &my_sub over my_sub().

I hope we’re agreed that prototypes are unnecessary in most Perl code (perhaps that needs to be another blog post at some point). Of course there are a few good reasons to use them, but most of us won’t be using them most of the time. If you’re using them, then turning off prototype checking seems to be a bad idea. And if you’re not using them, then it doesn’t matter whether they’re checked or not. There’s no good argument here for  using ampersands.

Then we come to the invisible passing of @_ to the called subroutine. I have no idea why anyone ever thought this was a good idea. The perlsub documentation calls it “an efficiency mechanism” but admits that is it one “that new users may wish to avoid”. If you want @_ to be available to the called subroutine then just pass it in explicitly. Your maintenance programmer (and remember, that could be you in six months time) will be grateful and won’t waste hours trying to work out what is going on.

So, no, there is no good reason to use ampersands when calling subroutines. Please don’t use them.

There is, of course, one case where ampersands are still useful when dealing with subroutines – when you are taking a reference to an existing, named subroutine. But that’s the only case that I can think of.

What do you think? Have I missed something?

It’s unfortunate that a lot of the older documentation on CPAN (and, indeed, some popular beginners’ books) still perpetuate this outdated style. It would be great if we could remove it from all example code.

The post Subroutines and Ampersands appeared first on Perl Hacks.

davblog

Quoted By The Daily Mail

This morning Tweetdeck pinged and alerted me to this tweet from a friend of mine.

He was right too. The article was about Reddit’s Button and about half-way though it, they quoted my tweet.

My reaction was predictable.

I was terribly embarrassed. Being quoted in the Daily Mail isn’t exactly great for your reputation. So I started wondering if there was anything I could do to to recover the situation.

Then it came to me. The Mail were following Twitter’s display guidelines and were embedding the tweets in the web page (to be honest, that surprised me slightly – I was sure they would just take a screenshot). This meant that every time someone looked at the Mail’s article, the Mail’s site would refresh its view of the tweet from Twitter’s servers.

You can’t edit the content of tweets once they had been published. But you can change some of the material that is displayed – specifically your profile picture and your display name.

So, over lunch I took a few minutes to create a new profile picture and I changed my display name to “The Mail Lies”. And now my tweet looks how you see it above. It looks the same on the Mail article.

As I see it, this can go one of two ways. Either I the Mail notice what I’ve done and remove my tweet from the article (in which case I win because I’m no longer being quoted by the Daily Mail). Or they don’t notice and my tweet is displayed on the article in its current form – well at least until I get bored and change my profile picture and display name back again.

This afternoon has been quite fun. The caper has been pretty widely shared on Twitter and Facebook and couple of people have told me that I’ve “won the internet”.

So remember boys and girls, publishing unfiltered user-generated content on your web site is always a dangerous prospect.

The post Quoted By The Daily Mail appeared first on Davblog.

davblog

Public Service Announcement: Aegon Pensions

Do you have a person pension with Aegon? If so, I suggest you ask them to double-check the statements they have been sending you, as they might well be incorrect. I’ve recently discovered that mine have been wrong to the tune of several thousand pounds for seven years.

This year I’ve been transferring all of my personal pensions to a SIPP at Hargreaves Lansdown. It has generally been a painless process. You fill in a form and sent it to HL, they contact your current pension provider and a week later the money is sitting in your HL account.

Of course, you’ll want to know how much is in your pension fund, so you know how much money to expect to be transferred. But your current provider will be sending you annual statements. As the stock market has been rising for a lot of the last twelve months, the amount you’ll get will almost certainly be a little more than the amount on your last statement.

But there will be two values on your statement. – the fund value (FV) and the transfer value (TV). FV is the amount your fund is worth if you leave it with the current provider. TV is the amount they’ll send to your new provider. Looking at all of my statements, FV and TV were the same amount. So all was well with the world.

I found that I had six personal pensions (I really have no idea why I had so many – it seems rather more than you’d need) and, over a period of a few weeks, I set the transfers going on all of them. Five of them worked fine – I got a little more money than I expected. The sixth was with Aegon.

One Friday afternoon I got a phone call from an adviser at HL. Aegon wouldn’t make the transfer unless I confirmed that I was aware of the current valuations. He read out the valuations that Aegon had given him. TV was about 20% smaller than FV. This meant that I’d lose about a fifth of my money if I transferred the fund. I asked him to put the transfer on hold until I could confirm this with Aegon.

Aegon’s customer support line is closed over the weekend, so I couldn’t speak to them until Monday. But I double-checked my statements. There was a different between FV and TV in 2007, but since 2008 every statement had shown the two values to be the same. And, naively, I assumed that my statements were accurate.

On Monday I called Aegon. Their customer support people tried to help but really all they could do was to pass my questions on and tell me to wait for ten days or so.

A couple of weeks later I got a reply which basically just said that my statements were wrong and that, yes, there was a 20% early exit fee on my plan. I wasn’t happy with that so I wrote back to them asking how their system could issue incorrect statements for seven years without anyone noticing.

Today I got a reply to that letter. Here’s what they say:

Statements are system generated reports which are issued annually. These are usually issued directly to Policyholders or Financial Advisers without being checked. It was only when you brought the error regarding values to our attention the the matter has been investigated and future automated statements have been inhibited.

So there you go. There was apparently a bug in Aegon’s system which went undetected for seven years, until I tried to transfer my pension fund away from them.

I’m going to continue to try and find out how I can get my money out of Aegon without losing a large chunk of it. Given that most of the industry doesn’t work the same way that they do, I suspect my best approach is to accuse them of mis-selling the policy in the first place.

But if you have been receiving statements from Aegon over the last seven years, I’d ask them to check the values if I was you. Let me know what you find out.

The post Public Service Announcement: Aegon Pensions appeared first on Davblog.

perl hacks

Modern Perl Articles

Back in 2011 I wrote a series of three articles about “Modern Perl” for Linux Format. Although I mentioned all three articles here as they were published, I didn’t post the actual contents of the articles as I wasn’t sure about the copyright situation.

But now I suspect that enough time has passed that copyright is no longer going to be an issue, so I’ve added the full text of the articles to this site. The articles are all about writing a simple web application to track your reading. They use DBIx::Class and Dancer.

Let me know if you find them interesting or useful.

The post Modern Perl Articles appeared first on Perl Hacks.

flickr

Antsiranana

Dave Cross posted a photo:

Antsiranana

flickr

Antisiranana

Dave Cross posted a photo:

Antisiranana

flickr

Stray Dog in Antisiranana

Dave Cross posted a photo:

Stray Dog in Antisiranana

flickr

Antisiranana

Dave Cross posted a photo:

Antisiranana

flickr

Antisiranana

Dave Cross posted a photo:

Antisiranana

books read

Perl by Example

Perl by Example
author: Ellie Quigley
name: David
average rating: 0.0
book published: 1994
rating: 0
read at:
date added: 2015/03/01
shelves: currently-reading
review:

perl hacks

Penetration Testing with Perl

I was sent a review copy of Penetration Testing with Perl by Douglas Berdeaux. I really didn’t like it. Here’s the review I’ve been sharing on Amazon and Goodreads.

I’ve been wanting to learn a bit about Penetration Testing for a while and as Perl is my programming language of choice this seemed like a great book to choose. Unfortunately, it wasn’t.

I have no doubt that the author knows what he is talking about when it comes to Penetration Testing, but there were several things that prevented this book from transferring much of that knowledge to me.

Firstly, the typesetting in the book is terrible. I was reading the Amazon eBook edition – it’s possible that the printed version is better. For example, there’s a lot of code in this book and it’s in a proportional font. In order for code to be readable, it needs to be in a fixed-width font. Also, there are two or three places where an equation appears in the text, but it appears in an unreadably small font. I have just checked in the PDF version of the book and neither of these problems appear there. It would seem that this is down to a problem in Packt’s eBook creation process.

Secondly, it’s obvious that English is not the author’s first language. At times this really prevents him from getting his point across clearly. I’m very happy to see non-native speakers publishing books in English. But the publishers need to provide high quality proof-readers to ensure that the language is good enough.

Thirdly, the organisation of the book is a little haphazard. The first couple of chapters are introductions to Perl and Linux, but after that we are dropped immediately into a discussion of network sniffing. Later in the book there are chapters on intelligence gathering, social engineering and password cracking. These are all far simpler topics which could have served as a gentle introduction to the book, getting people up to speed on Perl before delving into the complex internals of network packets. Once again, I think this should be the responsibility of the publisher. There should be a good editor working on the book alongside the author and shaping the manuscript so that the story it tells guides the user through the subject as easily as possible.

Finally, the book falls short in its technical content. I can’t comment on the author’s explanations of Penetration Testing (I was, after all, reading the book to learn about that topic), but the Perl code that he uses throughout the book is really bad. He is obviously someone who only ever learned enough Perl to get his job done and never bothered to learn how Perl really works or to keep his knowledge up to date. As a result, the book is full of the kind of code that gives Perl its reputation as a write-only language. The idioms that he uses are often out of date (using ‘-w’ instead of ‘use warnings’, for example), confusing (predeclaring subroutines unnecessarily, using ampersands on function calls) or just plain wrong (‘my ($x, $y, $z) = 0 x 3′ just doesn’t do what he thinks it does). Actually, it’s worse than that. It’s not just Perl he doesn’t understand, it’s the fundamentals of good software engineering. His code is a confusing mess of global variables and bad design. This is another failure by the publisher. There should have been a competent technical editor checking this stuff.

I’ve read four or five Packt books now. They’re all of this standard. None of them should have been published. But Packt seem to have hit on a good business model. They find unknown authors and produce books as cheaply as possible. Their publishing process omits all of the editing and checking that more reputable publishers use. The books that come out of this process are, of course, terrible. But, for reasons I can’t understand, people still buy them.

Packt books – just say no.

The post Penetration Testing with Perl appeared first on Perl Hacks.

davblog

TwittElection

I was convinced that the general election in 2010 was going to be the “Twitter election”. I built a web site (now sadly lost somewhere in cyberspace) that monitored what PPCs were saying on Twitter in my local constituency. But, all in all, it wasn’t very impressive. I gave a talk about how disappointing it had all been but then I forgot about it all.

But there’s another general election coming. And, surely, this one must be the Twitter election? A lot has changed in the last five years. Everyone is using Twitter. Surely this time some useful and interesting political discussion will take place on Twitter.

I set the bar a lot higher this time. Instead of just monitoring my local constituency, I’ve created a site that monitors all 650 constituencies in the country. Each constituency has a page, and on that page you’ll find a Twitter widget which displays a list I’m curating which contains all of the PPCs I can find for that constituency.

Well, when I say “I can find”, that’s a bit of a simplification. Obviously, finding details of all of the PPCs for 650 constituencies would be a bit of a mammoth task. But I’ve had help. There is a wonderful site called YourNextMP which is crowdsourcing details of all of the PPCs. And they have an API which allows me to grab their data periodically and update my information. If you have any information about PPCs in a constituency that they don’t already have, please consider adding it to their database.

After I found YourNextMP, it was just a simple matter of programming. I made heavy use of the Twitter API (via the Net::Twitter Perl module) and I’ve hosted the site on Github Pages (so I don’t need to worry if it suddenly gets massively popular). All of my code is available on Github – so feel free to send pull requests if there are features you’d like to add.

Oh, and obviously there’s a Twitter account – @TwittElection. Follow that if you want updates about the site or general chatter about the election campaign.

Today marks 100 days until the general election. I thought that was an appropriate day on which to officially launch the site.

Please let me know if you find the site useful.

The post TwittElection appeared first on Davblog.

davblog

Taxing Affairs

People complain about the Inland Revenue. Of course they complain about the taxes they have to pay. But they also complain about the level of service they get from the people in the tax office. Sometimes they might question the level of intelligence of people in the tax office.

Here’s an example of why they might do that. It concerns my company’s VAT return.

At the end of November I needed to fill in a VAT return. My accountants have a great online system where it does all that calculation for me. I can even submit the return online. The only thing it doesn’t do is to transfer the money to HMRC.

So on the 29th November I logged in to my account and saw that I needed to pay HMRC £X. I logged into my company bank account and transferred £X to HMRC’s account.

In December I went off on holiday.

In early January I returned from holiday and found a letter from HMRC saying that I hadn’t submitted a VAT return and that they had therefore estimated my payment as £Y. £Y was less than £X.

I emailed my accountant, she looked into it and soon realised what the problem was. Although I had made the payment for the VAT owed, I hadn’t actually submitted the return. I logged on and did that immediately. This should have been the end of the matter.

This morning I received another letter from HMRC. One written on 9th January. Today is 17th January. I don’t know what mechanism HMRC use to send letters, but it’s not particularly fast.

This morning’s letter said that my company had an outstanding VAT debt of £377.30.

£377.30 is £X – £Y. That is, it is exactly the amount by which the the payment I made was greater than their estimate of my liability.

This is very confusing. I have paid more than their estimated that I owed and they still think that I owe them money. I have no idea how they could have reached that conclusion.

But I hope my accountant can find out when she gets back to her office on Monday.

The post Taxing Affairs appeared first on Davblog.

davblog

2014 in Gigs

Slightly later than usual, here’s my overview of the gigs I saw in 2014.

I saw 45 gigs in 2014. That’s 25% down on 2013’s 60 (which is my current record). Letting it drop below an average of one a week is disappointing. I’ll have to try harder this year.

I saw both Martin Carthy and Chvrches three times in 2014 and Annie Eve twice. Martin Carthy is definitely the artist I’ve seem most since I’ve been keeping track of such things. And it’s the first time for many years that I haven’t seen Amanda Palmer. But that’s only because she didn’t play London in 2014 (well, she played one small gig at the British Library, but I didn’t hear about it until it was far too late to get tickets).

What was less than impressive. Well, my review of Yes at the Albert Hall upset a couple of Yes fans. And Eddi Reader wasn’t as good as the previous time I saw her. But, in general, the quality of things I saw was pretty high. Perhaps I was being more picky and that’s why I saw fewer shows.

Anyway, here (in chronological order) are my ten favourite gigs of the year:

As always, there were shows that were unlucky to fall just outside the top ten list. Special mentions should go to Paper Aeroplanes, Neutral Milk Hotel, Lisa Knapp and Banks.

Right, so what’s happening this year?

The post 2014 in Gigs appeared first on Davblog.

cpan

Tie-Hash-Cannabinol-1.11

=êå{^žÈ¨ú+r·š¶)à…«!zËaj×è®­¶§‚
slideshare

Perl in the Internet of Things


My training course from the 2014 London Perl Workshop
slideshare

Return to the Kingdom of the Blind


A talk from the London Perl Workshop 2014

sources

Feed Subscribe
OPML OPML

Powered by Perlanet