Archive for February, 2009

There are some chain emails you just can’t ignore

Tuesday, February 24th, 2009

album-cover

John Casimir, Prince of Anhalt-Dessau: Speech is more than eloquence. In stores soon.

We’ve all seen them. Forward this mail or die.  Forward to 50 friends and fall in love tomorrow.  Fill out these 7,000 questions and forward to all your friends.

Well I stumbled across this one on Facebook, and couldn’t stop myself as soon as I hit the Wikipedia entry.

CREATE YOUR FIRST ALBUM COVER

Here are the rules:

1 – Go to Wikipedia. Hit “random”
or click http://en.wikipedia.org/wiki/Special:Random
The first random Wikipedia article you get is the name of your band.

2 – Go to Quotations Page and select “random quotations”
or click http://www.quotationspage.com/random.php3
The last four or five words of the very last quote on the page is the title of your first album.

3 – Go to Flickr and click on “explore the last seven days”
or click http://www.flickr.com/explore/interesting/7days
Third picture, no matter what it is, will be your album cover.

4 – Use Photoshop or similar to put it all together.

Ladies and gentleman, I give you the latest album from John Casimir, Prince of Anhalt-Dessau. Speech is more than eloquence.

Code highlighting, and the magic of LINQ

Sunday, February 22nd, 2009

I’ve had a small block of code in my drafts folder for quite some time now, just looking for an excuse to publish it.  I’ve been using LINQ a lot in the past 6 months, and it’s one of the recent additions to the language that’s made me think twice before using PHP or Perl for my own projects (despite the existence of PHPLinq).

HIM: LINQ’s like pringles
ME: only makes sense after drugs?
HIM: once you pop you can’t stop

But I didn’t really want to write a full post on LINQ.  It seemed dull.  It’d been done before.  It’s old news.

So I picked up the WP-SynHighlight extension for WordPress.  Which gives some rather cool code-highlighting through GeSHi.

So here’s some highlighted stylised C# LINQ demonstrating how simple it is to combine LINQ to SQL with LINQ to XML data sources.

var answers = (from a in poll.Descendants("AnswerSet").Descendants("Answer")
join aCount in dbVotes
on a.Attribute("id").Value  equals aCount.AnswerId.ToString() into aJoined
from o in aJoined.DefaultIfEmpty()
select new {
id = a.Attribute("id").Value,
percentage = ((o == null ? 0 : o.VotesCount) / dbVotes.Sum(b => b.VotesCount.GetValueOrDefault())  * 100),
count = o == null ? 0 : o.VotesCount, text = a.Value
});

Now if only Microsoft would release LINQ to XSD out of preview.

Twitter your Gallery 2

Sunday, February 15th, 2009

Seems everyone is talking about Twitter nowadays.  The Hudson River picture launched it into the media world as the best news source on the planet, and Obama‘s adoption of the tool has given America the same pleasure that Britain experienced when our Prime Minister, Stephen Fry starting getting ‘back in touch with the people’, in October 2008.

The Hudson River picture wouldn’t have been possible without the non-affiliated TwitPic – which never truly got the recognition it deserved.  Without it, the infamous picture would have only been a 140 character description, and nobody will have noticed or cared.  Still, that’s the nature of buzzwords I guess.  If they don’t cause a buzz, they’re just words.

Anyway, TwitPic is yet another disparate service like Flickr, Panoramio or Facebook that’s had me tempted away from uploading some of my photos to Gallery2 / Blakepics.  With Facebook, I’ve integrated my own application there; Panoramio and Flickr, stolen the best parts of each.

And now with a hack to the tagging module in Gallery 2 I can emulate all I want from TwitPic as well, and tuck another service onto the shelf at the back at the cupboard.  So as usual, I thought I’d share.

What it is…

  • Tweet any photos on Gallery just by adding the tag ‘twitter’ to your photo.
  • Automatically takes the photos title as your Tweet text.
  • Processes all URLs through TinyURL, giving you a warm and fuzzy Tiny URL

What it isn’t…

  • A seamless Gallery2 module.  There’s some hacking to do.
  • Multi-user.  If you share your Gallery, there’s some more work to do.

If you make improvements in these areas or any others – please let me know :)

Requirements

Things you need to do

  1. Download my Twitter Tags class
  2. Unzip to the root of your Gallery installation
  3. Edit /modules/tags/classes/TwitterTag.class with your twitter username/pass, and Gallery URL.
  4. Edit /modules/tags/classes/TagsHelper.class
    1. Add this just above the line ‘class TagsHelper’
      GalleryCoreApi::requireOnce('modules/tags/classes/TwitterTag.class');
    2. Then just above
      return TagsHelper::assignTagById($itemId, $tagId);
      Add
      TwitterTag::Tweet($itemId, $tagId);
  5. Tag any photos you want to appear on Twitter with ‘twitter’.

The Devil’s Footprints in the Snow

Tuesday, February 3rd, 2009

You may have heard about the total devastation that hit Britain on February 2nd, 2009.  I already feel behind the curve as I write this on a wind-up battery-powered laptop, dividing the last tin of baked beans out between myself and the family upstairs.

Transport ground to a halt because we weren’t as prepared as Canada.  Businesses across the country, even in The Great Capital lost billions as a fifth of the workforce abandoned brave attempts to struggle into the office, shovelling coal into the engines attempting to push their way through snow drifts up and down the country.  Some even had to revert to working from home, costing the economy further millions as I.T. support staff were pulled from vacations all over the world to keep VPNs and email systems up and running.

Bendy buses were left abandoned across London as people struggled to climb atop double deckers after a growing number of reports of minor avalanches around Hampstead Heath. Ferry services from Greenwich were suspended after hundreds of commuters were lodged firmly in ice for over 6 hours without food or water, and even the time-honoured horse and carriage struggled to get all 27 of the City of London’s remaining employees into work on time.

Boris Johnson was on hand to help anyone local school children “from the borough” build snowmen in any way he could.  “The Snowman was invented in England, you know”, he quipped in an earlier statement today.  Meanwhile, the Canadian army is said to have been put on high alert to help Britain in any way they could, whilst President Obama was quoted as saying “why can’t you be more like Chicago?”

Three of the major supermarkets have closed 80% of their stores nationwide, and do not expect supplies to return to the cities any time soon.  With more snow expected before Saturday, they are said to be preparing armed forces from Sweden to prevent the tragic events in Shropshire happening elsewhere.

Then again, it’s just a bit of snow.  Lighten up :)