Tuesday, December 31, 2013

Things that were true about me on 1st January 2013 that are not true on 31st December 2013

It's never been claimed that the Lord was speaking through me
I've never seen Bloc Party, Artic Monkey, FatBoy Slim or Vann Music live
I've never been to The George
I've never been to Wembley, or climbed The Monument
I've never tried to buy a house
I've never been to Electric Picnic
I've never done yoga
I've never been live on RTE television
I'm not certified as a MongoDB developer
I've never been to a rugby league game
I've never started a parody social media account
I've never been tackled by a security guard without a reason
I've never shared a taxi with a stranger

Sunday, November 10, 2013

My first rugby league game

I went to the Rugby League World Cup game in Thomond Park, Limerick last night, Ireland lost to Australia 50-0.
It's a professional game in Australia, so their players were bigger, faster, better trained than the Irish, but you'd still expect at least one score from the boys in white*
They did get close the Australia try line a few times, but poor decision making meant it never led to a score. I've only seen bits of games on Sky Sports, never a full match, so I'm unfamiliar with the rules but the way it seemed to go to me is this:
player in possession runs at opposition, up to three players are allowed to tackle him (at least I didn't see more than three players in a tackle) and this involves wrestling him to the ground until...something happens and the ref blows. The player who took the ball into the tackle is allowed to stand up, the tackling players stand off him, and he puts the ball on the ground, stops it with his foot, and rolls it back to a teammate, and play resumes as before.
There's no lineouts, if the ball goes out of play on the sidelines, an opposition player collects the ball, and passes it from the sideline to a teammate, who touches it to his boot (think tap-and-go in rugby union) and then play resumes.
Not sure why scrums are awarded (is it for knock ons?) but a scrum only has six players on each side and appears to be uncontested, although this may have been because of Ireland's amateur status.
A try is 4 points, and a conversion is another point on top of that.
Play is 40 minutes a side, and the team with the most points at the end wins.
Honestly, if it wasn't for the unique attraction of the "World Cup" element to the occasion, I more than likely would not have attended and it's unlikely I'll be at any games in future.

*Australia played in green because they are higher ranked than Ireland, Ireland played in white.

Wednesday, September 25, 2013

SteamOS

Valve's Steam has been the de facto standard for downloadable PC gaming for some time now, and it has long been reported that they intended to move into the console gaming arena, with the "SteamBox" rumoured to be announced at a trade show/convention (E3, PAX, GDC, etc) for the past few years.

The first tentative steps have been made over the last 12 months, with Valve first releasing "big screen mode" to make the transition from PC gaming with a keyboard and mouse to console gaming with a control pad simpler. Following this came the Linux Steam client, and its steadily increasing library of games, although still lagging behind the numbers available on the Windows and Mac clients. The next big announcement came just this past week with the announcement of SteamOS, an Ubuntu-based Steam operating system that will be made available for free to hardware manufacturers, similar to Google providing the Android OS to mobile device manufacturers. However, I don't think this is going to be as big a success as Android (now the dominant mobile OS) in the gaming market.

Firstly, PC gamers are unlikely to spend money on hardware to play the games they already play on their desktop/laptop. Modern laptops can easily be connected to modern TVs with HDMI cables, and I've used a PC to play DVDs on a TV using a graphics card with a TV out port for almost a decade. A similar setup could easily be used for gaming, if you really wanted to use steam on a TV.

Secondly, console gamers are unlikely to be interested in buying another console in the near future. Sony's PlayStation 4 and MicroSoft's XBOX One are launching in November, costing 400 and 500 respectively (according to gamestop.ie). After that initial outlay plus new games, gamers are unlikely to be willing to pay for another box to sit under their TV, no matter what it offers, unless of course it is ridiculously cheap.

 Finally, and what is most important on any console, games. Steam's main rival in the downloadable gaming market is EA's controversial Origin platform. EA are unlikely to make any of their big franchises available on any Steam platform - FIFA, Madden, Modern Warfare, etc - which are among the top selling games on consoles every year. If they are not available, then gamers will simply not buy the platform. There are two more announcements to be made by Valve, the first coming this evening at 6pm GMT, which may change my opinion, but as it is, there's little to be excited about.

Friday, September 13, 2013

How to get the historical FIFA rankings for a country

FIFA, the world's football association have issued a set of international rankings once a month since August 1993 but have not made them available to developers, either through an API or downloadable files (e.g. csv, excel spreadsheet, etc).
However, it is possible to access the rankings for a country in an xml file using Firefox and the Firebug plug in.
First, open fifa.com and click on the relevant association's page, e.g. Scotland: http://www.fifa.com/associations/association=sco/index.html
When the page opens, click the "Rankings" link: http://www.fifa.com/associations/association=sco/ranking/gender=m/index.html
Right click on "Rankings Evolution" and select "Inspect element with Firebug"
The parent element of the div containing the "Rankings Evolution" text box is a div with a class type of "box". Right click on this and select "Copy HTML".
Paste the HTML into a text editor (notepad, gEdit, Kate, etc).
Search for the text "new SWFObject(" (without the quotes) and copy the first parameter, e.g. /flash/maranking/marankbrowser.swf?t1=sco&g=m&a=1&v=2&lang=e&environment=PROD
Add this to http://www.fifa.com to create the URL for the flash object: http://www.fifa.com/flash/maranking/marankbrowser.swf?t1=sco&g=m&a=1&v=2&lang=e&environment=PROD
Open a new tab and activate firebug. Click the Net tab and ensure it is enabled. Note that two requests are sent to the server, flashranking.xml and association=sco.xml. Right click on association=sco.xml and select "Copy Repsonse Body".
Open a text editor and paste in the response body. Each entry is in the format

Wednesday, September 11, 2013

Door closed for Trap

If you had said after the 1-1 draw at home to Cyprus that we would be at a World Cup play off in two years, and qualify for a tournament two years later, you'd have been laughed off the internet. Yet, that's where Trapattoni brought us.
I'm genuinely sorry to see him go, and I fear for the future of the game here with GAA in the ascendancy again, and rugby still drawing massive viewing numbers, but I have to admit it was one qualification tournament too many.

I think in time, his majority of his tenure will be remembered well.

Thanks for the memories Trapattoni, Paris, Poznan, etc,

Thursday, September 05, 2013

A farewell to boots

Since camping at all but the first Witnness events, and attending the Sunday night of the first Oxegen in 2004, it's been the better part of a decade since my last music festival (Slane isn't a festival) and, much like buses, this year I've been to two! The Longitude festival was held in Marley Park, not far from where I live and work, and the Electric Picnic celebrated it's tenth anniversary in Stradbally, Co Laois.
I wore the same work boots I had with me at Punchestown many moons ago, they were given to me as a health and safety requirement in a temporary warehouse job I took a lifetime ago, during a three week break between semesters during my Grad Dip in UL and the only positive from that job. Regrettably I had to retire my musical companions as the sole of the right boot finally conceded defeat on Sunday afternoon when it cracked, and the metal plate between it and the in sole of the boot snapped back, rendering the boot useless. They've served me well these past years, and I hope to replace them with a similar pair as soon as possible.
Among other firsts at the EP was my first yoga class. Waking early on Sunday morning (well, earlier than I had planned) and unable to regain a state of slumber, I walked first around the campsite and then on to the main concert site. Wandering around in the ealry morning, with little of the guests for company and precious few stalls open, I did feel an odd sense of serenity. While passing a tent for some local businesses in Cloughjordan, Co Tipperary, I noticed an sign for a free yoga class starting at 11, seeing as it was 10:40 or so, I resolved to try it out. The instructor began by asking was it anyone's first time, and happily I wasn't alone in making my debut. Of the class of about 30, I'd estimate there were eight others attempting this for the first time. The instructor took us through some basic breathing exercises, and then into some simple movements, before some intermediate poses, including one developed at the EP by her and a partner. While I didn't really get the breathing correct during the class, I found the movements and poses relatively easy to complete. I've been attending the local gym regularly after work and my warmup includes some similar stretches.
While the art, comedy and spoken word attractions were the big differences from the Oxegen and Witnness festivals of old, it's the little changes that struck me the most. Whereas in festivals past, facilities were kept to a minimum, there's been a mass growth in the cottage industry of offerings to festival attendees, offering everything from massages to phone recharging to ATMs (incidentally the only queue longer than the ladies toilets was for the ATMs!). Londis had a pop-up shop at the campsite in Stradbally, and the Irish Time's Ticket supplement was given away for free on each day with reviews of the previous day's events.
Ep has a reputation for being more family-friendly and I did find this the case with many young children in attendance, which did give a more relaxed atmosphere to proceedings. There were many infants as well, with one girl passing us pushing a buggy carrying a child that had not yet seen his first Christmas! One downside of this was that many remained in attendance in the main arean after the sun had passed below the horizon and night had set in. While there's nothing wrong with this in theory, in practise this meant a child could disappear without notice and be left alone in the dark, in a field with more than 30,000 people, (many of whom in were in later stages of intoxication) and with mobile phone coverage at a premium. I can only imagine what this would do to a parent.
What I had noticed at Longitude and moreso at EP was the reappearance of symbols of 60's flower child idealism, girls wearing flowers in their hair, beaded hairbands and CND-branded clothing. What troubled me was the flowers and beads were plastic and mass-manufactured, instead of real and hand woven, and clothes bearing the symbols of peace and tolerance were made and sold by fashion houses with more eyes on the bottom line than anything the icons they stood for. I wondered did these children of children of the cultural decade ,and the pivot of change that followed it, believe in what they wore, or did they just want others to think they did?
I doubt this will be my last festival, or that another nine harvests will be reaped before I attend another, but I cannot imagine myself camping again. While not unable to function without the creature comforts of home, the simple fact is that, in my fourth decade, the recovery time is longer, the stiffness less bearable and the cold night air more penetrating. C'est la vie.

Tuesday, August 27, 2013

Spring Insight on Tomcat failing to start

Spring Insight is a powerful tool to record timing data for web applications deployed on a Spring server, but can also be used on Tomcat.
However, it does require a large amount of configuration before it will run correctly on a Tomcat deployment.
One exception that caused me a large amount of grief was the descriptive java.lang.NullPointerException at java.io.File.(File.java:222) at com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader.readInsightConfig(TomcatWeavingInsightClassLoader.java:67) at com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader.start(TomcatWeavingInsightClassLoader.java:50)
  Fortunately the source code for all Spring products is available to download at http://maven.springframework.org/release/com/springsource/ I am using Insight 1.5.1.SR2, and the source for the TomcatWeavingInsightClassLoader class is in the insight-collection project at http://maven.springframework.org/release/com/springsource/insight/insight-collection-tcserver/1.5.1.SR2/insight-collection-tcserver-1.5.1.SR2-sources.jar Examining the class, on line 67 we can see the following File insightDir = new File(System.getProperty("insight.base")); So Insight is looking for the insight root directory in your deployment, which can be set at run time. To resolve the problem, add the system parameter "insight.base" to your tomcat startup with the value of the insight directory in the deployment, e.g. "-Dinsight.base=C:\tomcat\insight"

Monday, August 12, 2013

Persist timing data from Spring Insight

Spring Insight is a powerful tool for tracing time spent in various methods during the progress of a web application call. While you can export traces from the Insight UI, the resultant file is in binary format, and can only be opened with the Insight UI itself. Fortunately, there is a workaround if you want to persist the data recorded during a call.
Insight adds extra headers to the repsonse object from a call - X-TraceId and X-TraceUrl. The traceId is (unsurprisingly) the id of the compelted trace and the trace url is a link to the trace on the Insight server that is in the form "/insight/services/traces/?type=[json|xml] with json as the default.
If you enter this url into your browser, the Insight server will return the data from the call in the selected format.
If you can access the response headers programattically (e.g. in a headerless browser, or using a proxy) you will be able to access the X-TraceId and X-TraceUrl values and from there can request and persist the Insight data.

Wednesday, July 24, 2013

SalesForce.com Authorised Application using Apache HttpComponents

This article describes how to create a basic authorised application that will query the SalesForce.com API without the need for logging in to your account
  1. Register a SalesForce.com remote application
    • Create a SalesForce.com Developer account - http://developer.force.com/
    • On connection to the salesforce.com api, you must provide your password and the security token combined as a string
    • Log into your account and click App Setup(in the menu on the left) -> Create -> Apps
    • Under "Connected Apps", click New
    • Enter the Connected App Name, Connected API Name and Contact Email (note - it's recommended to not use spaces in the App and API names)
    • Under OAuth Settings. select "Enable OAuth Settings"
    • Enter the Callback URL - in an OAuth application this is the URL the application will return to after authentication, which will not be needed here, but the value cannot be blank
    • Select "Access and manage your data (api)" in the "Available OAuth Scopes" and add it to the "Selected OAuth Scopes"
    • Click Save
    • In the application description page that opens, note the Consumer Key, and Consumer Key values (you will need to click "Click to reveal" to see it)
    • In the user dashboard, click Personal Setup -> My Personal Information in the menu on the left, then Reset My Security Token.
    • Your security token will be not be displayed on screen, and will be sent to the email address associated with the salesforce.com account
      • e.g. for password "myPassword" and security token "mySecurityToken" the connection is authorised with the string "myPasswordmySecurityToken"

  2. Develop application in Eclipse
    • Create a new Java project
    • Add the following jar files:
      • From the apache http components project  - http://hc.apache.org/ - you will need the following jar files
        • httpclient
        • httpcore
    • The following code snippet will open a connection to the SalesForce API and return a JSON document
      • Replace the values in angle brackets with the appropriate values from your setup
      • String accessToken = null;
        String instanceUrl = null;
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost("https://login.salesforce.com/services/oauth2/token");
        // prepare the parameters
        ArrayList postParameters = new ArrayList();
        postParameters.add(new BasicNameValuePair("grant_type", "password"));
        postParameters.add(new BasicNameValuePair("client_id", {your application client id}));
        postParameters.add(new BasicNameValuePair("client_secret", {your application client secret}));
        postParameters.add(new BasicNameValuePair("username", {your salesforce.com username}));
        postParameters.add(new BasicNameValuePair("password", {your salesforce.com password + your salesforce.com security token}));
        // prepare the form, and set the encoding
        UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(postParameters);
        urlEncodedFormEntity.setContentEncoding("UTF-8");
        httpPost.setEntity(urlEncodedFormEntity);
        // place the right content type for the form
        httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
        // execute the request to get the tokens
        HttpResponse httpResponse = httpClient.execute(httpPost);
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode == HttpStatus.SC_OK) {
            ObjectMapper objMapper = new ObjectMapper();
            InputStreamReader inputStreamReader = new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8");
            JsonNode rootNode = objMapper.readTree(inputStreamReader);
            accessToken = rootNode.get("access_token").asText();
            instanceUrl = rootNode.get("instance_url").asText();
        }
        System.out.println("AccessToken: " + accessToken);
        System.out.println("instanceUrl: " + instanceUrl);
  3. Query the SalesForce API
    • The instanceUrl is the salesforce.com server that all subsequent queries must be sent to, and the access token must be set as the "Authorization" header in all subsequent requests
    • One of the simplest requests is to retrieve the details for the customer accounts associated with your salesforce.com account, this list can be seen in the Account header on your dashboard
    • Use the following code snippet to request the list of accounts and store the JSON string in the accounts String object
      • URIBuilder uriBuilder = new URIBuilder(instanceUrl + "/services/data/v28.0/query");
        uriBuilder.addParameter("q", "SELECT Name, Id, BillingStreet, BillingCity, Phone, Website from Account LIMIT 100");
        String accounts = null;
        HttpGet httpGet = new HttpGet(uriBuilder.build());
        httpGet.addHeader("Authorization", "OAuth " + accessToken);
        try {
            httpResponse = httpClient.execute(httpGet);
            if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
             InputStreamReader inputStreamReader = new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8");
             accounts = objMapper.readTree(inputStreamReader).toString();
            }
        } finally {
             httpGet.releaseConnection();
         }
        System.out.println(accounts);
While these snippets will work perfectly well in a command line application, in a web application, it is prudent to persist the instance url and access token in the user's HttpSession object.

Thursday, June 20, 2013

Sending a Node.JS request module request through a proxy

all very simple really, just add the "proxy" attribute to the request call
    request({
        proxy: ':',
        url: endpointUrl ,
        method: requestMethod,
        body: requestBody
    }).pipe(res);

Tuesday, June 04, 2013

How to delete multiple jobs in Jenkins

over time, a Jenkins server can amass a large of jobs (or projects as the "Delete" link calls them) and having to delete them one by one can be laborious to perform through the UI.

Fortunately, Jenkins includes a scripting engine that can be run through the UI that handles the task very well.

Open the following URL: http:///script
and enter the following code in the textbox:

for(job in jenkins.model.Jenkins.theInstance.getProjects()) {
    job.delete();
}

and moments later, all the jobs are removed!

Tuesday, April 16, 2013

Thoughts on thoughts and prayers, and prayer

Following the explosions in Boston yesterday, my timelines in facebook and twitter are filled with outpourings of grief and sadness for the victims, but the phrase "my thoughts and prayers" is frequently included in all online missives. This made me think - what does "my thoughts and prayers" actually mean?

Going on my browser history today, my thoughts have been on Nintendo's plumbing brothers Mario and Luigi, the maven build tool, footballer Sean McGinty, the casting of Splinter in Ninja Turtles, and some of the online reactions to the explosions in Boston. But I can honestly say I haven't really thought about the victims, or their familes.

What about prayers? While raised Catholic, I only attend mass infrequently throughout the year, the last time a little under a month ago, and I rarely pray for anything, except when explicitly asked to do so.

Has the phrase itself lost some of its meaning? Has it become one of these catch all, non offensive colloquialisms that people use? Another one in frequent use is "have a good one!" for an online friend's birthday. Particularly if you don't really know this "friend" or haven't spoken to them recently so you can't include any references to recent events in their life, and you don't want to wish them to have a bad one, do you? Having seen countless going away cards in my decade of full time employment, the phrase "best of luck mate" is another one in frequent use, often multiple times on the same card.

In both cases my internal translator reads them as "I can't think of anything else to say".

Maybe that's the reason why we use the "thoughts and prayers" phrase in cases of atrocity, we simply cannot think of anything else to say. Our own words fail us, so we use someone else's.

Maybe we need to think more about people and pray for them before telling people we are thinking of and praying for them.

Friday, March 08, 2013

Irish in the Premier League

A recent post on foot.ie stated the the author could not remember when Ireland had so few players starting in the Premier League. Taking this on board, I resolved to examine the Irish Abroad database and get the list of players who have started at least one Premier League game in each of the last seven seasons. With 25 players starting at least one game in the 2012/2013 season, it is below the average for the previous six season, which is 28, but Irish players are still the third most represented nation in the PL, after England and France

2006-2007: 24
Stephen Carr, Lee Carsley, Kevin Doyle, Damien Duff, Richard Dunne, Steve Finnan, Caleb Folan, Derek Geary, Shay Given, Matt Holland, Stephen Hunt, Stephen Ireland, Robbie Keane, Paddy Kenny, Kevin Kilbane, Shane Long, Alan O'Brien, Andy O'Brien, John O'Shea, Stephen Quinn, Alan Quinn, Darren Randolph, Andy Reid, Steven Reid

2007-2008: 27
Stephen Carr, Lee Carsley, David Connolly, Colin Doyle, Kevin Doyle, Damien Duff, Richard Dunne, Steve Finnan, Caleb Folan, Shay Given, Ian Harte, Stephen Hunt, Stephen Ireland, Robbie Keane, Stephen Kelly, Kevin Kilbane, Shane Long, Paul McShane, Liam Miller, Daryl Murphy, Andy O'Brien, Joey O'Brien, Roy O'Donovan, John O'Shea, Steven Reid, Andy Reid, Anthony Stokes

2008-2009: 24
Keith Andrews, Rory Delap, Damien Duff, Richard Dunne, Caleb Folan, Darron Gibson, Shay Given, Stephen Ireland, Robbie Keane, Stephen Kelly, Dean Kiely, Kevin Kilbane, Liam Lawrence, Paul McShane, Liam Miller, Daryl Murphy, Andy O'Brien, Joey O'Brien, John O'Shea, Steven Reid, Andy Reid, Keith Treacy, Glenn Whelan, Marc Wilson

2009-2010: 32
Keith Andrews, Stephen Carr, Lee Carsley, Rory Delap, Kevin Doyle, Damien Duff, Richard Dunne, Keith Fahey, Steve Finnan, Caleb Folan, Kevin Foley, Darron Gibson, Shay Given, Stephen Hunt, Stephen Ireland, Robbie Keane, Stephen Kelly, Andy Keogh, Kevin Kilbane, Liam Lawrence, Chris McCann, James McCarthy, Paul McShane, David Meyler, Daryl Murphy, Andy O'Brien, John O'Shea, Andy Reid, Steven Reid, Stephen Ward, Glenn Whelan, Marc Wilson

2010-2011: 27
Keith Andrews, Leon Best, Stephen Carr, Ciaran Clark, Seamus Coleman, Rory Delap, Kevin Doyle, Damien Duff, Richard Dunne, Keith Fahey, Kevin Foley, Darron Gibson, Stephen Hunt, Stephen Ireland, Robbie Keane, Stephen Kelly, James McCarthy, David Meyler, Andy O'Brien, John O'Shea, Steven Reid, Andy Reid, Conor Sammon, Jonathan Walters, Stephen Ward, Glenn Whelan, Marc Wilson

2011-2012: 34
Keith Andrews, Leon Best, Ciaran Clark, Seamus Coleman, Simon Cox, Rory Delap, Kevin Doyle, Damien Duff, Shane Duffy, Richard Dunne, Kevin Foley, Anthony Forde, Darron Gibson, Shay Given, Wes Hoolahan, Stephen Hunt, Stephen Ireland, Robbie Keane, Stephen Kelly, Paddy Kenny, Shane Long, James McCarthy, James McClean, David Meyler, John O'Shea, Anthony Pilkington, Steven Reid, Conor Sammon, Marc Tierney, Jonathan Walters, Stephen Ward, Keiren Westwood, Glenn Whelan, Marc Wilson

2012-2013: 25
Ciaran Clark, Seamus Coleman, Damien Duff, Robert Elliot, Darron Gibson, Shay Given, Ian Harte, Wes Hoolahan, Noel Hunt, Stephen Ireland, Stephen Kelly, Shane Long, James McCarthy, James McClean, Joey O'Brien, John O'Shea, Alex Pearce, Anthony Pilkington, Steven Reid, Enda Stevens, Jay Tabb, Marc Tierney, Jonathan Walters, Glenn Whelan, Marc Wilson