Proudly Presenting
Eidetic Opacity

Being The Singular Personal Blog and Virtual Soapbox of Alex Leonard

WordPress Tip: Get the date of your first post

Published on Tuesday, 27th July 2010 at 1:21pm

and featured in:
Functions

with feedback of:
Have your say!

Presented by: Alex Leonard

I’m just working on setting up a custom WordPress archive for a client at the moment (displaying posts by academic year).

In order to do things absolutely right (and in case they decide to post-publish older items), I need to be able to check when the first post was published on their WordPress installation.

I figured I’d share the code out here in case someone else finds it useful (and in case anyone can suggest improvements to the code). I’ve wrapped it up as a function so you can throw it your functions.php if it’s something you’ll re-use.

/**
 * Get First Post Date Function
 *
 * @param  $format Type of date format to return, using PHP date standard, default Y-m-d
 * @return Date of first post
 */
function ax_first_post_date($format = "Y-m-d") {
 // Setup get_posts arguments
 $ax_args = array(
 'numberposts' => -1,
 'post_status' => 'publish',
 'order' => 'ASC'
 );

 // Get all posts in order of first to last
 $ax_get_all = get_posts($ax_args);

 // Extract first post from array
 $ax_first_post = $ax_get_all[0];

 // Assign first post date to var
 $ax_first_post_date = $ax_first_post->post_date;

 // return date in required format
 $output = date($format, strtotime($ax_first_post_date));

 return $output;
}

To echo it anywhere on your site just run:

echo ax_first_post_date();

I’m hoping to be a little better at keeping track of useful WordPress functions that could be reused, so have created a sub-category of my WordPress category called “Functions”. If nothing else it will be a useful reference point for me.

Update

As soon as I hit publish I knew I should have held off until I added in a date format parameter. I’ve updated the code now so that you can tell the function what format the date should be returned in (using standard PHP date format).

I love getting email from Ban Ki Moon

Published on Monday, 26th July 2010 at 12:04pm

and featured in:
Life on the Web

with feedback of:
Have your say!

Presented by: Alex Leonard

Ban Ki Moon

Got a great spam email today, direct from Ban Ki Moon, the secretary-general of the UN. Apparently I am being compensated for being scammed..

How are you today? Hope all is well with you and family? You may not understand why this email came to you. We have been having a meeting for the passed 7 months which ended 2 days ago with the then secretary to the UNITED NATIONS.

This email is to all the people that have been scammed in any part of the world, the UNITED NATIONS have agreed to compensate them with the sum of USD $850,000…

It’s so nice of ol’ Banny to think of me and ask about my family. He’s a good head for sure. Also looks like all of this economic trouble must be a thing of the past if they can afford to compensate me so royally for some scam I don’t remember.

Oh, if you want to drop him an email, apparently his personal email address is info@javaparagon.com

Photo by worldeconomicforum on Flickr

Is 500 million a lot?

Published on Monday, 19th July 2010 at 12:30am

and featured in:
Life on the Web

with feedback of:
Have your say!

Presented by: Alex Leonard

I’ve read a few reports talking about how Facebook is about to hit 500 million users. It certainly seems like a substantially large number, but I thought I’d have a look for some statistics on how many people are using the internet in order to put this figure in perspective.

According to Internet World Stats of the (approximately) 6.7 billion people in the world, 1.8 billion of these have access to the net.

If that’s true then, scarily, Facebook hitting 500 million users would mean that approximately 28% of all internet users have a  Facebook account (or 7% of all people in the world).

And don’t forget, you too might have to poke your grandma one day..

YouTube Preview Image

Image by Carlo Nicora on Flickr

Viva España!

Published on Tuesday, 13th July 2010 at 1:34pm

and featured in:
cambodia

with feedback of:
2 Comments

Presented by: Alex Leonard

On Sunday night I had the pleasure of joining a crowd of Spanish and Dutch nationals and watching the World Cup final, wearing my finest red and yellow top in support of Spain. With the time difference the game didn’t kick off until 1.30am, but there was so much excitement in the air that tiredness never even came into the equation.

There followed two incredibly nerve wracking hours with much chanting and singing (with it consistently amusing me that the strongest Dutch chant was always “Olé Olé Olé”).

Anyway, I’m sure everyone knows now that Spain have won the World Cup for the first time, thanks to an excellent goal from Andrés Iniesta at the very end of the second half of extra time. The Spanish contingent went loco and I attempted to capture some of that excitement on my new camera. So I present a short picture diary of the most Spanish night in Phnom Penh imaginable, viva España!

Feliz pueblo español en Phnom Penh!

Click on photos to enlarge

And in case you missed the goal that ended nearly two hours of heart-stopping anticipation, you can check it out in the video below. I can only imagine the scenes in Spain – the country must have gone proper mental!

Update: every time I find this video it gets taken down by FIFA a little while later. So I’ve taken a copy of it and uploaded it to Vimeo, but made it private on Vimeo. Hopefully they don’t find my lowly blog and send me a DMCA take-down notice…

http://www.vimeo.com/13323086

Mass CC vs Reply All

Published on Friday, 9th July 2010 at 12:43pm

and featured in:
Life on the Web

with feedback of:
4 Comments

Presented by: Alex Leonard

I’m not entirely sure which offender is worse – the person who sends an email out to fifty friends and thinks it’s a good idea to put all their names in plain view in the “to:” or “cc:” fields; or the person who, upon receiving this mass email, decides it’s a fantastic idea to click “reply all” as though those fifty people really want to receive another email with a banal one-line reply.

Obviously this is an old rant, but one that clearly still hasn’t penetrated the consciousnesses of those with an exiguous knowledge of technology and its pertinent etiquette.

Which is worse? It’s not quite a chicken and egg situation here – quite simply if no one mass cc’d like this, then no one could be tempted to click ‘reply all’ in the first place. Still, I don’t think that lessens the crime that is clicking ‘reply all’. Seriously, think about it before you send that unimaginative and pointless reply to fifty people you’ve never met.

Perhaps we should blame the persistence of such things upon the modern fascination with sharing all amongst extended social groups, which ‘connect’ wholly unconnected people in an overly familiar way. Perhaps before the meteoric rise of these social entities, the message was being slowly received and such mass mailings, or their equally evil reply-all siblings, were fading out. Or, well, perhaps not.

I tend to write a short reply (single) to the sender, saying that it’s generally best to avoid such displays of all your extended friend’s email addresses, not knowing which nefarious member of this group will decide the time is ripe for a wonderful harvest of new fodder for their mailing list, their desperate need to further the expansion of their social networks, or whatever opprobrious plans they may have. Although I simplify my message a little.

I hope I do not directly offend anyone by writing this. It is, I assure you, all said in good humour ;)

Paint it red?

Published on Thursday, 8th July 2010 at 12:02pm

and featured in:
cambodia

with feedback of:
Have your say!

Presented by: Alex Leonard

Spain celebrates

Congratulations to Spain on their 1-0 win against Germany last night. I was too tired to stay up and watch it but it’s great to see Spain knock out Germany and know that whoever wins the final it will be their first time lifting the world cup. I will admit that I had pegged the Germans for the win (no bets placed though ;) ) but was rooting for Spain.

Of course, I’m biased in favour of Spain due to the large Spanish contingent in existence in Phnom Penh. I anticipate a late night on Sunday surrounded by loco pueblo español.

Olé, viva España, córcholis!

Photo by penguinstorm on Flickr

Music: don’t make it difficult to buy

Published on Monday, 5th July 2010 at 4:00pm

and featured in:
Music

with feedback of:
2 Comments

Presented by: Alex Leonard

Sketches of Spain

A number of years ago I bought a CD – Miles Davis: Sketches of Spain, released by Columbia Records. It’s a wonderful recording which starts out with a fantastic interpretation of Concierto de Aranjuez by Joaquín Rodrigo.  I probably first listened to it back in the 90′s when I first discovered, and fell in love with, the music of Miles Davis.

Fast forward a number of years to somewhere around 2004: my love of CD’s as the format of choice had completely died, supplanted by storing my music on hard drives. Around then I decided to rip my entire collection of CD’s – in and around 600 albums. However the CD case for Sketches of Spain contained no CD! I looked everywhere for it but deemed it to be lost. Every once in a while I’d remember the album and check my digital collection to find it wasn’t there, and I’d move on.

Yesterday after listening to a couple of Miles Davis albums (it had been a while), I decided to rectify the missing Sketches of Spain issue.

The “you can’t have it” approach to commerce

My first stop was Emusic, with whom I have a subscription which provides 100 track downloads a month for €30. As far as I can tell all Columbia Records releases are absent from Emusic, no doubt due to lack of DRM or some such. I then searched on Amazon’s music store. There was indeed a digital version available, however apparently due to licensing restrictions I can’t buy mp3′s from Amazon UK unless I’m in the UK. The thought occurred to me that I could run my net connection through a variety of proxy connections but it’s such a pain that I couldn’t be bothered.

Buying a physical CD release really wasn’t an option in my mind – I’m fully digital now from purchase to speaker – and the fact that I’m living in Cambodia makes purchase of a CD even less likely!

The “I’ll get it some other way, thanks” approach to buying

So I turned to Google and searched for “buy miles davis sketches of spain flac download“, figuring if I’m going to buy it online it may as well be in a high quality lossless format.

  • First result: The Pirate Bay 1.
  • Next 9 results: All torrent or similar illegal download links.
  • What did I do: I downloaded it illegally of course.

Columbia Records, or their parent company, have obviously decided that it’s most important to protect their music catalogue by making it difficult to purchase online. Perhaps they have an exclusive deal with iTunes for worldwide purchases, but I’m not an iTunes user and don’t plan to be.

Whatever their reasons, by confounding my attempts to make an official purchase they actually guided me into the temptation of downloading their music illegally. I don’t feel in any way bad about it, considering that I originally bought it and lost it – so I’ve paid my money to Columbia. However I was willing to pay for it again, but instead torrents offered me a simpler option and provided the music at a higher quality than I would have received from most online music stores.

There’s a couple of good articles by Warren Daly over at Invisible Agent that round up a lot of my thoughts on this subject:

Basically, music labels need cop on and get with the times. Stop condemning your customers as criminals while not providing an avenue for said customers to be legitimate.

  1. By the way, searching for the same search but replacing ‘flac’ with ‘mp3′ has a similar effect – initial results for Amazon, from whom I can’t purchase, followed by torrents

Ye ex-vegetarians, abandon your pescetarianism

Published on Saturday, 3rd July 2010 at 8:52pm

and featured in:
General

with feedback of:
Have your say!

Presented by: Alex Leonard

Fishing Trawler

I know quite a few vegetarians who have, for various reasons, changed to pescetarianism or pesco-vegetarianism, which is essentially a vegetarian that also eats fish, but avoids other forms of meat.

I have always felt that if it was necessary for me to abandon vegetarianism (for health reasons or similar) the last thing I would do is revert to eating fish.

More than 20 million people employed in the fishing industry may need to be taken out of service and retrained for other work over the next 40 years if the final collapse of fish stocks in oceans around the globe is to be avoided, the UN warned today.

Source: Guardian Newspaper

In my mind, when it comes to the question of sustainability, the concept of pescatarianism is seriously flawed – entirely due to the unsustainable nature of the fishing industry (in it’s current form).

Whilst I’m not suggesting that there aren’t issues in other food related industries don’t face their own issues with regard to environmental impact, those other industries are likely not endangering such a vital part of the earth’s eco-system to such an extent.

The Guardian article linked to above is well worth the read, and it refers to a UN report which is also worth reading.

Photo by adstream on flickr

Workload Insanity Past

Published on Thursday, 1st July 2010 at 7:00pm

and featured in:
General

with feedback of:
Have your say!

Presented by: Alex Leonard

Work was insane for me between the end of WordCamp Malaysia and the end of last week. I didn’t take a day off in that time. I feel a lot better now for a weekend off and normal working hours during this week.

Check out the computer usage below, taken from my Wakoopa account which tracks individual application usage.

Too many hours

It’s quite the bulge ;)

Legend

  • Blue: Internet
  • Green: Audio/Video
  • Red: Development
  • Orange: Utilities
  • Purple: Office
  • Grey/Olive: Design

And before anyone says that clearly I just spend all my time browsing the internet, well, in some ways that’s true – but it’s me either making CMS modifications on a customer website, browsing forums for solutions to Magento (that was a lot of time spent in the last month, I’ll have a wee rant about Magento in a future post), and of course some general net browsing and maybe the occasional writing of a post on this site!

The only thing it doesn’t include is time spent writing emails to clients on my phone, which should be a relatively small percentage – still it’s definitely visually describes the reasons for my current exhausted state!

No more 70 hour weeks for a while thanks.

Suggestions Wanted: PDF Reader software for Windows

Published on Wednesday, 30th June 2010 at 11:05am

and featured in:
SoftwareTech

with feedback of:
3 Comments

Presented by: Alex Leonard

A post on Download Squad, shared by Vlad (an old Jaiku contact), reminded me that I’ve been meaning to sort out a new alternative to the stupidly bloated Adobe Reader.

I’ve been a long time user of Foxit Reader, but over the last while this piece of software has increased in size, gotten much slower on load time, and worst of all, started to use dubious practices in tricking you to install crapware – the worst of all being as displayed in the screenshot below.

Foxit Crapware Trick (courtesy of Download Squad)

This nasty tactic makes you think you’re deselecting items you don’t want and then, if you aren’t paying attention, your default reaction is to click “I accept” assuming that you’re accepting the installation of Foxit Reader without the unwanted crapware. No no. This means you’re accepting the install of yet-another-useless-browser-toolbar but not using Ask as your homepage/default search.

This nearly caught me out, and I’m a seasoned computer user wary of such things.

As a result I will no longer be suggesting Foxit software as an alternative to Adobe.

Now I need recommendations on new alternatives. I’ve tried Sumatra, but it’s missing out on text selection. In fact, pretty much the only feature I need in a PDF reader is being able to read the document and text selection – I need no other features.

Anyone got a recommendation? If so I’d love to hear about it in the comments.