Tuesday, 15 June 2010

What the fuck am I supposed to do?

I shocked myself at the weekend.

At Ken Chu's birthday drinking and football watching session at a pub in Finsbury, at some point in the afternoon I found myself sat at a table in the middle of a busy drinking hall, strangers bustling all around. The table housed some of Ken's received gifts, pool cues and cards. There was only me and another friend of Ken's left at the table, other folk had wandered off to the beer garden or headed home.

The other chap mentioned that he wished to leave, so it wold just be up to me to guard the table, to save it for the return of the party, but before he headed home he would seek out the folk in the beer garden.

For a few minutes I was alone, guarding treasure, fending off advances. "Is there anyone sitting here?", "sorry... folk in the beer garden... Cigarettes... Will be back soon..." Sympathetic nods followed by suspicious glares.

The other chap returned and said he was leaving, just as another mob of people looking for seats appeared.

"What the fuck am I supposed to do?" I asked, standing and leaning across at him.

One of the crowd saw me and said it was okay, they were friends of Ken, we'd met an hour or so ago.

I seated myself and looked sheeping.

I felt a little sick, the bubbling bile of rage that prompted me to ask "What the fuck am I supposed to do?" it wasn't a pretty thing, I am a dispicable and cowardly person.

There rest of the afternoon and evening passed without incident.

Anyhoo, today I had another "what the fuck am I supposed to do?" Incident. At my temp job a few people are on holiday, others work in several different offices. There were only two of us in this morning, the guy who knows the job and me. He was called up to go out to the other office, leaving just me.

After a few moments of twiddling my thumbs checking there was no paperwork or filing to do, I got up for a wander and discovered to my terror, that not only was I the only person in the office, I was the only person on site.

"What the fuck am I supposed to do?"

I suppressed the bile and the outrage of being left in such a position this time.

And what I did was this:-
*Planned out a strategy game in perl on paper
*Used my digital camera to shoot a short post-apocalyptic horror movie set in a construction depot and portacabin office complex
*Wrote the narative intro for the aforementioned perl game
*Made a stop-motion animation of the stuff on my desk coming alive and taking over

Not quite what I was supposed to do I guess, but kind of productive.
Sent using BlackBerry® from Orange

Monday, 14 June 2010

Taxpayer hours 2010

Yes, I know the government are soon to announce the emergency budget with its inherent tax rises and spending cuts. But to help you rationalise the figures, the millions and billions of pounds, I've done some sums.
  • Median weekly income these days is about £497
  • Tax freedom day was 30th May
  • That's about 41% through the year
Therefore:-
  • One taxpayer hour is £5.10
  • One taxpayer week is £204
  • One taxpayer year is £10,600

So when the government spends £1,000,000, it takes about 94 people working for a year.

Thrilling stuff, I'm sure you agree.

Sunday, 13 June 2010

Personal Finance in Perl: part 2

As mentioned last week, I've decided to exercise my mad leet perl skillz by writing my own personal finance software, and in the absence of feeling free to blog about anything else, I thought I'd share it with you.

It works by carrying out various neat filtery things on a a ledger which you enter all you financial transactions into. This is the bit of code for entering transactions into the ledger.

sub enteringTransactions {
$transaction_date = "01/01/2000";
$transaction_account = "dummy";
$transaction_value = "9999";
$transaction_payee = "dummy";
$transaction_category = "dummy";
$notes = "dummy dummy";
&bar;
print " Entering transactions\n";
&bar;
print "Please enter the date of the transaction dd/mm/yyyy:- ";
chomp($trans_date = );
@transaction_date = split /\//, $trans_date;
$trans_day = $transaction_date[0]*1;
$trans_month = $transaction_date[1]*1;
$trans_year = $transaction_date[2]*1;
$ninday = $trans_day+($trans_month*31)+($trans_year*12*31);
print "Please enter account name (cash, hsbc or credit):- ";
chomp($transaction_account = );
print "Please enter value (xx.xx):- ";
chomp($transaction_value = );
print "Please enter payee:- ";
chomp($transaction_payee = );
print "Please enter category:- ";
chomp($transaction_category = );
print "$trans_day/$trans_month/$trans_year\t$transaction_account\t$transaction_value\t$transaction_payee\t$transaction_category\n";
$entry_time = time;
my $filename = "chriscounts.poo";
open LOG, ">>", $filename or die "Can't open '$filename': $!";
print LOG "$entry_time, $trans_day, $trans_month, $trans_year, $ninday, $transaction_account, $transaction_value, $transaction_category, $transaction_payee, $notes\n";
close LOG;
print "Transaction logged\n"};

The ledger is a file called, rather amusingly, "chriscounts.poo" and the data is stored in as a comma space separated line with the following information:-
  • timestamp of when the data was entered, in milliseconds
  • day of month of transaction
  • month of transaction
  • year of transaction in four digits
  • data in my own proprietary format for the purpose of sorting and doing neat things with
  • transaction account
  • value of transaction
  • category
  • payee
  • notes, although this bit isn't used.
In an ideal world where I knew what I was doing, there would be some kind of encryption routine here as well so if evil miscreants got the ledger file, it would all look like gobbledigook. But that's going to have to come later.

Right, this next subroutine is what I use to load the ledger file into memory as an array of arrays
sub getLedger {
@ledger = ();
my $filename = "chriscounts.poo";
open LEDGER, "<", $filename or die "Can't open '$filename': $!";
while () {
@tmp = split/, /;
push @ledger,[ @tmp ];
}
close LEDGER;
}

Friday, 11 June 2010

Voluntary cuts

I was engaged in a discussion last night night about whether there'll be a double dip recession due to the cuts in the public sector.
As someone who's been cut by the private sector twice in the last five years, I'm a little ambivalent.

However, understand that, via Raedwald, Glasgow City Council needed to make 4,000 people redundant, so they asked for volunteers and got 3,000 folk taking up the offer.

Is this a symptom of a workforce who hates their job, or people confident they can find work elsewhere, or who have enough in savings to take time out from paid employment?

If its highly skilled folk, then surely this takes skills away from the council, leaving only the incompetant people left to provide council services, so you get a lower quality of service. On the other hand, in the great scheme of the enconomy, the highly skilled folk will find new jobs quickly so them and the incompetent folk still get paid, still spend their wages and keep the economy ticking over. Whilst if it was the incompetents who got redundancy and were unable to find new employment, then they'd just be a drain on the economy.

This is still too general, you don't want to lose an average number of people from across your entire council sector, you just want to lose people from the services that the council are crap at or shouldn't be providing. Like parking inspectors or diversity co-ordinators, whilst keeping social workers and garbage collectors. But offered the chance of voluntary redundancy, its going to be the folk in non-jobs who grasp most tightly at job security, and the folk with the most valuable skills who jump ship.

Its a difficult one, how you prioritise lowering the cost of local councils and maintaining the quality of service.

It would be interesting to see, in Glasgow, the spread of redundancy volunteers by department, just as a sign self-confidence and skills.

Anyhoo, back to double-dip recessions, if everyone, in any sector was offered voluntary redundancy, would this inherently lead to a recession, or by making the labour market more liquid, would it speed up the recovery?
Sent using BlackBerry® from Orange

Wednesday, 9 June 2010

Personal Finance in perl

In the absense of a teach yersel Ruby or Javascript book, my mission to learn many languages has stalled on perl. So I've got myself a new crazy madcap scheme, I'm going to write myself a Personal Finance Suite.

Sure, it'll be a mammoth task, but I can easily break it down into bitesize chunks. Thusly:-

  • Chunk to enter transactions into a log file
  • Chunk to calculate current net worth
  • Chunk to calculate weekly/month spend in each expenditure category
  • Chunk to handle planned/future transactions

And then a neat menu thing.

I shalled call it NinAcounts or maybe NinAccounts.

Anyhoo, I started ploughing through last night, aned have gotten the log file business sorted. I'm just working on some data sanitising routines.

What I'm a little stuck on is where I get user input for the transaction date. I can easily chop up dd/mm/yy, dd-mm-yy or dd/mm/yyyy into the constituent $day, $month and $year scalars or a neat @date array, but to then convert this into a single unixtime number its not working proper.

I want to be able to convert from human dates into unixtime and back again dead easily, but it no working...

Any ideas?
Sent using BlackBerry® from Orange

Monday, 7 June 2010

High end audio at Best Buy

As promised earlier, this weekend I made the epic journey to the new Best Buy store at the Lakeside retail park in Thurrock.

We made up a rhyme, "so much that I want to buy, that I cannot justify". Right now, at my stage in life I am skint and the only thing I can justify spending money is a mains lead for my old WD 500gb external hard drive. Alas modern drives of that capacity just run off usb, and have no additional power requirements. Best Buy had no spare mains lead department.

At home I currently have no broadband internet, I can only survive by going to a nearby friend's flat and using their wifi. If only there were a way to boost my friend's wifi, so I could use it from the other end of the corridor. At Best Buy I put this problem to their Geek Squad and as I'd previously predicted they sucked their teeth and said no.

With these issued addressed, I thought I'd have a look at their hi-fi and home cinema set ups as suggested at last week's bloggers meetup.

The first thing that struck me was their Loewe tv set up. It set my teeth on edge and made me sick a little in my mouth.

I've had dealings Loewe tvs before, in one of the setup menus there's some kind of image enhance setting that sounds great, but it fucks the picture. Its hard to describe how, but it does something to the lighting and motion that makes anything you watch look like it was done in a cheap American sit-com studio blue screen.

It doesn't matter what you're watch, James Bond or Avatar, it just looks crap, un-movie-like.

What pains me more is that people don't notice or object.

Its like when widescreen tellys and movies first came on the market, and in shops and home people would watch stuff with the wrong aspect ratio, so it was stretched or squashed - distorted, and folk would shrug, "its widescreen, its supposed to be like that"

No, its wrong. Its like you've broken the movie. Would you play a 33rpm record at 45rpm?

It amazes me that any shop anywhere manages to sell Loewe tvs.

At Best Buy they had several demonstration rooms for hi-fi, high end audio and home cinema.

A few times when I was young my pa took me to hi-fi shops, they were quiet, dusty places, lots of wood panelled speakers and turntables decked in smoked perspex. People studying specifications and quietly asking attendants if they could listen to certain systems.

When I worked at Linn Products and Roksan Audio, again, listening to things was a quiet and patient experience, setting up the system, listening to a piece of music, adjusting or changing the system, then listening again, comparing contrasting, adjusting and deciding.

Not so at Best Buy, demonstration rooms blasting out blockbuster movies, endless arrays of speakers blaring out whatever kids listen to these days.

My ears aren't delicate flowered but I couldn't bear to stand in the demoroom for more than a few seconds before retiring. It was just too stressful and unrelaxing.

Is a fight scene from Transformers 2 really the best thing for demonstration surround sound, or is it just designed to bewilder and confuse customers so they buy any old crap and escape as quickly as possible?

One of the demonstration room was kitted out with the walls decked with every single speaker they sold. Do you know how speakers work? They have a cone that moves in and out, to reproduce sound, how the cone moves is precisely controlled by the amplifier/ preamp playing whatever mp3/CD/record you're listening to. The waves of sound pressure come from the speaker, bouncing off walls and the floor and ceiling to varying degrees until they reach your ears. This is something people rarely need to consider, except if you work testing high end audio or if you are about to spend a lot of money on speakers. By a lot of money, I mean anything more than what you earn in a week.

Anyhoo, these waves of sound pressure will bounce off smooth surfaces and get absorbed by soft or furry surfaces, like carpets, curtains and sofas. Try listening to music with they curtains in your room open or closed, the music will sound different. Try standing in the corner and speaking and then moving into the middle of the room and doing the same, you'll sound very different. Imagine if the walls moved freely, this is essentially what happens if you have loads of speakers in one room and only listen to two at a time.

For each speaker for any room there will be a sweet setup, the distance its positioned from the walls, the angle it's toed in at, the distance it is from its partners.

In Best Buy you can't listen to any speakers or any sound system and make an accurate judgement about which sound better than others. No matter how much money you throw at them when you get those speakers home they're going to sound completely different to how they did at the store.

They may very likely sound better than they did in the store, they couldn't sound much worse. Best Buy's setup seems design to get the worst performance out speakers on the home cinema side of the store.

I might have got the wrong end of the stick with the speaker, mind, that in the demonstration room with hundreds decked out on the walls, you're not supposed to listen to them, and its merely just to see what they looked like. If that's the case then I apologise for the ranting of the previous few paragraphs.

Oddly though, on the other side of the building they get it right. In the games console demonstration room, the speakers are set up perfectly, the screen is set up great. They're doing it right. Pick any game you want to play, and you can have a go in the best gaming, video and audio environment I've seen in a long while.

It only half makes sense. In the gaming room, they're doing it right, but not trying to sell speakers or tvs, and in the home cinema/audio room, where they are trying to sell hardware, they're doing it wrong.

I fear there's nothing I can do to help them.
Sent using BlackBerry® from Orange

Saturday, 5 June 2010

Perl text document stats script

Crikey, that was a little easy, in less than a fortnight I've done a cover version of my Python script from here, now in Perl, all this from not knowing any Perl at all.

I didn't do it on my own mind, I had a textbook, Learning Perl from O'Reilly, and tutoring from Robbie and Matt off of Facebook, without their help, I'd be floored.

The program in perl that analyzes the text file of my 2001 novel Shag Times and comes up with various statistics for it.

Its a bit messy compared to the Python version, and its clunky too, there's gotta be simpler and more leet ways of doing many of the sections.
#!/usr/bin/perl

# Program to
# open shagtimes
# provide a word count
# count unique words
# provide top ten most popular words
# provide all single occurance words
# calculate average word length
# find longest word

use Text::Wrap;

sub hashValueDescendingNum {
$occurance_list{$b} <=> $occurance_list{$a};
}

# Opening Shag Times and processing it a bit
$filename = "shagtimes.txt";
open BOOK, "<", $filename or die "Can't open '$filename': $!"; my @book = ;
close BOOK;
foreach $book (@book) {
$allbook .= $book;
$allbook .= " "};
$allbook = lc"$allbook";
# $allbook is a long string of Shag Times

# Code to remove full stops and commas and stuff
$regexp = '[\W]' ;
@book = split /\s+/, $allbook;
foreach $book (@book) {
$book =~ s/$regexp//g };
print "\n=======================================\n";

# Doing the word count
foreach $book (@book) {
$wordcount += 1 };
print "The document contains $wordcount words in total\n";
print "=======================================\n";

# Doing the unique count
foreach $book (@book) {
$was_this_in_uniques = "no";
foreach $uniques ( @uniques ) {
if ($book eq $uniques){
$was_this_in_uniques = "yes"}};
if ($was_this_in_uniques eq "no") {
push @uniques, $book}};
foreach $uniques (@uniques) {
$uniquecount += 1 };
print "The document contains $uniquecount unique words\n";
print "=======================================\n";

# Finding top ten popular words
print "The top ten most used words:-\n";
foreach $uniques ( @uniques ) {
$was_this_in_book = "no";
foreach $book ( @book ) {
if ($uniques eq $book) {
$occurances += 1}};
$occurance_list{$uniques} = $occurances;
$occurances = 0 };
foreach $key (sort hashValueDescendingNum (keys(%occurance_list))) {
push @ranked_occurances, "$key \($occurance_list{$key}\)"};
foreach (0..9) {
print "$ranked_occurances[$_]\n"};
print "=======================================\n";

# Finding single use words
print "Words that were used only once:-\n";
foreach $ranked_occurances ( @ranked_occurances ) {
$_ = $ranked_occurances;
if (/\(1\)/) {
s/\s\(1\)//;
push @singles, ("$_");
$single_use_count += 1}};
@singles = sort @singles;
foreach $singles ( @singles ) {
$single_paragraph .= "$singles, "};
print wrap("", "", "$single_paragraph\n");
print "=======================================\n";
print "A total of $single_use_count words were used only once\n";
print "=======================================\n";

# Finding average word length
foreach $book (@book) {
$chartotal += length($book) };
$avechar = $chartotal/$wordcount;
my $printy_avechar = sprintf "%.3f", $avechar;
print "The average word length was $printy_avechar letters long\n";
print "=======================================\n";

# Finding longest word
foreach $uniques ( @uniques ) {
if (length($uniques) > $longlength) {
$longlength = length($uniques)}};
print "The longest word was $longlength letters long\n";
print "These words were that long:-\n";
foreach $uniques ( @uniques ) {
if (length($uniques) == $longlength) {
print "$uniques\n"}};
print "=======================================\n";

Now I need to order that Ruby book, Ruby on the Rails for Dummies perhaps?

Friday, 4 June 2010

Blog Stat Pron - May

Good evening and welcome to my irregular start of the month look at the previous month's blog traffic stats review. According to google analytics, for May, this blog got:-
1,612 Absolute Unique Visitors
2,446 Pageviews
Lets compare that to the past couple of months
April
1,264 Absolute Unique Visitors
2,009 Pageviews

March
1,494 Absolute Unique Visitors
2,413 Pageviews
Well, Absolutes are up by loads since April which was a crap month and still better than March which was okay. I think I've set myself a new record for hits in a single day. Some chap on twitter got fined £1,000 for tweeting, I wrote a blogpost with the right keywords in the URL and got all the googlejuice, which sent a mammoth 517 visitors in one day which kind of raised up the average for the month.

Its all continuing the long term trend of alienating my regular readers and instead getting loads of unsuspecting traffic from google, Facebook and Twitter. Really, I haven't had any refery links from other blogs in months and months and months.

Statcounter reckons I had 2,542 Unique Visitors, and an average of 98 pageloads per day, the highest ever. Still not quite breaching the 100 ppd barrier, but getting better man. Maybe next month.

Here are the metrics of of my RSS feeds on various feed readers:
26 subscribers - GoogleReader (same as like forever)
4 subscribers - Bloglines (same as like forever)
10 followers - Blogger (two more than last time)
Small improvement, I'm glad.

These are my top seven referrers for May (not including google wanderers)
1. Facebook - 139 visitors (220 friends)
2. Twitter - 47 visitors (182 followers)
3. UK Bubble - 17 visitors
4. Rob Dyke - 16 visitors
5. Jack of Kent - 14 visitors
6. Mark Wadsworth - 12 visitors
7. Dick Puddlecote - 7 visitors
Lets take a brief moment to consider which were the most viewed posts during May.
1. Paul Chambers Guilty - 489 views
2. The Holly Greig Story - 184 views
3. iPod Daleks - 124 views
4. What Have I gotten myself into - the TFTA scam - 71 views
5. Budget 2010 Working Tax Credits - 59 views
6. Bookcase Dreams - 39 views
7. Origami flapping bird animation - 38 views
8. Indiepop Eyespy - 29 views
9. Tories have no mandate to rule Scotland - 29 views
10. Diane Abbott on Andrew Marr - 28 views
The top five most popular posts that I wrote in May were:-
1. Paul Chambers Guilty - 489 views
2. Tories have no mandate to rule Scotland - 29 views
3. Diane Abbott on Andrew Marr - 28 views
4. Diane Abbott for Labour Leader - 17 views
5. Python text stats script - 16 views
That's it belatedly for May's stat pron, until next time, take care space cadets.

Thursday, 3 June 2010

London Bloggers Meetup: Best Buy

Went to a London Bloggers Meetup for the first time in ages, this time at Doggett's Coat and Badge, near Blackfriars bridge, under blazing hot sunshine, with civilisation on the verge of collapse. MyBerry was playing up beforehand so I couldn't log on to FourSquare adequately, no one would have known where I was, my last checkin was hours ago on the other side of town.

On the second floor as usual, a warm and fuzzy cloud of recognition, some folk I knew, some I didn't, all friendly and chatting, all united in their enthusiasm for new media and free beer provided by the evening's sponsors BestBuy.

We chatted and introduced ourselves randomly, the phrase "Do you blog?" starting to sound like some 1970's swingers party fetish as we nibbled on canapés.

At some point I broached the subject of how there appears to be the cultural requirement for an artifact, a milestone, representing social networking, what Romeo&Juliet does for love, what Frankenstein does for science, what Heart of Darkness does for stuff, something that encapsulates online relationships, checking out on facebook people you used to know, without actually seeking them. Something like Billy Jones is Dead, but with added internet. How to deal with being unfriended, people who don't exist online, truly its a twenty-first century issue that needs to be resolved adequately.

Andy the organiser set forth on stage, thanked and introduced the evening's speakers:-
Tom Tired talked about political blogging, he works in politics, talked about political blogging, how we have no rules or conventions to abide, only bloggers can compare John Prescot's schlong to a cocktail sausage. The talk was about three minutes too long but rather entertaining.

Kind of reminded me that I need to register "DianeAbbottShouldHaveWon.com"

The second speaker was the CEO from BestBuy. There was a prize draw, where the prizes were Dr Dre headphones and Bon Jovi tickets, as I didn't win my coverage of his talk will revolve round how the chap is very nasel, but nice message. Gotta quote the word "Cushtomer".

I like the idea of Best Buy, an electronics store where they know what they're talking about. Against the backdrop of the shite service that Comet and PC World are reknown for, then some thing as inspirational as Best Buy can only be a good thing. And from talking to the BestBuy blueshirts at the meetup, they sure are an enthusiastic bunch.

I promised that I'd check out the Thurrock store at the weekend, and fire into the hi-fi demonstration room, but I fear, in the light of my self-actualisation and realisation of my nature, that although I like the idea, and I'm an open minded kind of chap, I'm going to come away with rattling off a list of everything they're doing wrong, and everything I'm sceptical about.

Like 3D cinema and 3D TVs, its just a gimmick, the next excuse to replace your existing media collection. As Lossless compression followed MP3 followed CD followed tape followed LP followed sheet music, as Bluray followed DVD followed VHS followed cinema followed theatre. Yes, but no.

During the CEO's talk the recycling message makes me weep blood, aw c'mon ceo, its bullshit compared to "drive slower" and "don't fly", the energy efficiency of your domestic modern conveniences is pish in the wind, do any customers really care about recycling when they buy the product? Doesn't that suggest that they're buying an inferior product which they're not going to enjoy using for many many years. Doesn't that suggest some kind of failure on the part of the designer and retailer? "You'll love our product, but not for very long"

And, oh ffs! Windfarms?

As is my norm for this sort of event, here's a list of the bloggery folk who I chatted to (18):-

Didn't speak to (8)

I think I may have set myself a new record there
but if we consult the graph we can clearly show that apart from February's plumbing the depths of solace, my London Blogger Meetup socialising has kind of plateaued.

Thrilling perl problems part #3

So I've got myself an array called @book which is a list of all the words in a text file, essentially my original text file split on whitespace. That was difficult enough to do satisfactorily, but now my next task is to create an array called @uniques, which is a list of all the unique words in @book.

In Python doing that was easy, but in perl, I'm running into problems as there is no 'in' qualifier, that is, I can't just say "foreach $word ( @book ); if $word not in @uniques; push @uniques, $word"

So instead I'm thinking I need to go through each $book in @book and compare it to each $uniques in @uniques, then have some kind of flag it waves if it doesn't match to tell it to add the word to the unique word list.

Christ, you'd think sort of this word be easy, but no no.
Sent using BlackBerry® from Orange