19 Sep 2012

Making the Weight…

At the start of this year, I spent a lot of time analysing how I had met my goals for 2011, and setting my goals for this year.  One of those new goals was to get my weight below 70kg.

A quick look at my bodyweight log shows that my progress at the start of the year was slow but steady… Until April, when my weight jumped back up to 75Kg and it has remained consistently there ever since. 

It is pretty obvious I need some more motivation to get my weight done.  So if I get my weight below 70 kg by 1st December of this year, I’ll be taking a holiday in USA in 2013.  If I don’t make the weight, I’ll be spending a wet weekend in Portrush.  If that doesn’t motivate me to get into shape, I don’t know what will. 

You can continue to monitor my bodyweight log, and I’ll let you all at the end of the year whether I’ve achieved my weight goal.

19 Jul 2012

The Dublin Maker Faire

On Saturday (15th July), I was lucky enough to attend Ireland’s first Maker Faire at Trinity College, Dublin.  It was a fantastic and incredibly inspiring event.  For those of you who don’t know what a Maker Faire is, it is ‘a family-friendly showcase of invention, creativity and resourcefulness, and a celebration of the Maker movement.  It’s a place where people show what they are making, and share what they are learning.’ So there!

Some of the exhibits on display included:

  • Scalexercise, from Buildbrighton, that uses exercise bikes to power a Scalextrix track. 
  • Breandan Lane brought along his SteamPunk carousel, which I thought was rather scary looking, and the product of a warped mind.  But he more than made up for it with his simply outstanding musical rocket, which was a centre of attention for the entire day:
  • The simply amazing Lego Faire that was built by Presentation School Warrenmount. For me, a recovering Lego addict, this was the highlight of the Faire:

There was a lot more happening at the faire, including an underwater ROV built from everyday parts and controlled using an Arduino, the 14ft drum from Fuinneamh, and loads more!

Personally, I found the faire incredibly inspiring.  Particularly as I have recently signed up as a STEM Ambassador to try and promote STEM subjects in local schools.  I’ll be especially interested in encourage coding in schools, and I hope to mentor a school taking part in this year’s Lego League, hosted by W5 at the Odyssey.  To prepare for this, I will be playing researching Lego MindStorm and the Raspberry Pi over the summer. 

24 Apr 2012

Time for Programmers to Grow Up?

Over the weekend, I came across a tweet sharing an image of a profane commit message.  The tweet originated from a developer from a small but well known Belfast software company.

Original Tweet Sharing Image

Commit Messages Containing Profanity

I wasn't impressed with this, so I replied to let the originator of the tweet know I thought it was pretty immature.  This lead to a (civilized) Twitter discussion with a couple of interested parties about the tweet. 

In this particular case, the screenshot was from a commit to a local repository, which will be cleaned up prior to pushing to a public repository.  It was tweeted by a developer in the company who wasn’t the original committer.  The code wasn't for a client deliverable, but for a community project.  It is worth pointing out that the company concerned does a lot of good work with the local developer community.  The overall feeling was from the guys at the company was that the both commit messages and the tweeted image were no big deal.  I disagree, and this blog post will explain why I think there is a problem:

  1. Profanity Doesn’t Work

Swearing is guaranteed to offend someone.  In this case, it offended me.  It may well have offended others.  I'm not saying this as someone who is blameless -  I do curse.  But there are plenty of ways of expressing yourself without swearing.

  1. Professionalism

I don't doubt the above commit messages were just a way of letting off steam.  We've all been there; my language is certainly not perfect.  But I seriously question the wisdom of tweeting an image with a colleague's name, the name of your company and a load of profanity.  Once it is broadcast on a social network, it is out there for ever.  Would you be happy seeing this one of the top 10 search results for you personally, or for the company you work for?  No, neither would I.

Something relatively minor like this can affect on how professional we are perceived.  In this case, it has diminished my personal opinion of a company who were doing sterling work to support the local developer community.  In the same way, if I walk into a business meeting dropping F-bombs in every sentence, it reflects badly both on me personally and the company I work for.

In this particular case, the code was being committed to a local repository before being cleaned up for release to a public repository, and this was seen as a mitigating factor.  I would ask why take the chance of something like this getting released publically or to a client by mistake?  Why not  hold yourself to the same standard for personal/community code as for a client deliverable?

Incidentally, in one company I've worked for, I'm aware of someone wasting time going through the source code for a major contract and removing the various profane comments before releasing the code to the client.  This stuff can have a cost to a business.

The company concerned doesn't feel this is an issue. But as this recent story shows, just because a company doesn't care doesn't mean their customers will take the same view.  Geeklist lost a significant number of users following this online spate.

  1. Sexism

I have no doubt I will told to lighten up for mentioning this.  But the fact is there are very few female developers.  If we want to start attracting more women into careers as coders, we need (as a start) fewer "brogrammers" and a more gender neutral environment.  Posting a commit messages with references to a sexual act doesn't help, it just perpetuates programmer stereotypes.  If you think I'm grasping at straws here, please take the time to read the following articles:

Possibly you think that I'm making a mountain out of a molehill with this.  Or that I'm just showing my age.  But I seriously think tweeting an image like that is out of order.  Just as I think that a company that allows a culture where it is OK to have developers documenting code in this way has issues.  I would encourage you to respond with your thoughts via the post comments.  If you want to get in touch with me directly, please DM at @AndyParkhill.  Thanks.

23 Feb 2012

Calling Executable Files in PowerShell

I was called out on my approach on this in work today, so I thought I would share my thoughts on this topic.  The actual executable concerned was STSADM command line tool for SharePoint 2010 (yes, STSADM is still useful in SharePoint 2010, for example in enabling self-service site creation). Unfortunately, I don’t have STSADM installed on the machine I’m writing this blog post on, so I use the example of calling Internet Explorer instead. The principal is the same in both cases.

To call Internet Explorer from the command line, you would use the following command:

C:\Program Files\Internet Explorer\iexplore.exe

But if you try and run the above command in PowerShell, you will get the following error:

PowerShell Error

To correct the error, we need to enclose the path to the iexplore.exe file in quotes:

“C:\Program Files\Internet Explorer\iexplore.exe”

But this will not actually result in IE being called; this is because PowerShell treats the input as a string, and will simply write the text enclosed in the quotes to the console.  To run the string as a script whose path is enclosed in quotes, you preface the string with the call operator (ampersand):

& “C:\Program Files\Internet Explorer\iexplore.exe”

Alternatively, we can use the Invoke-Item cmdlet:

Invoke-Item “C:\Program Files\Internet Explorer\iexplore.exe”

And both approaches will successfully start an instance of Internet Explorer.  Alternatively, you could break the statement into two:

CD “C:\Program Files\Internet Explorer\”
iexplore.exe

Which would also work.  Note, if you needed to return to the original directory from which the PowerShell script was called, you could do so using the following code:

Push-Location “C:\Program Files\Internet Explorer\”
iexplore.exe
Pop-Location

The cmdlet Push-Location is virtually identical to the CD command; however, it saves your previous location before moving to a new one.

So, can we now specify at the PowerShell prompt the URL that IE opens with? The command line switch information for IE tells us that we can, by adding an additional parameter:

& “C:\Program Files\Internet Explorer\iexplore.exe” http://www.bbc.co.uk/news/

And again, this successfully works.  Can we now call IE with several parameters?

& “C:\Program Files\Internet Explorer\iexplore.exe” http://www.bbc.co.uk/news/ –private

And this PowerShell statement will call Internet Explorer so that it opens at the BBC News site in p0rn InPrivate mode.  So that we can see that to call STSADM from PowerShell, we could use the following command:

& “C:\Program Files\Common Files\Microsoft Shared\Web server extensions\14\bin\stsadm.exe” -o enablessc -url http://myserver –requiresecondarycontact

And this would work.  Except, of course, that no self respecting software developer would leave should a horribly long line of code in a script.  They would refactor this line of code by using an alias for the STSADM executable, and so avoid having to repeatedly use a hard-coded literal for the executable path.  They would also realise that the location of the common programs varies according to how Windows itself was installed on the target computer, and make use of the %CommonProgramFiles% environment variable:

set-alias STSADM "${env:commonprogramfiles}\Microsoft Shared\Web Server Extensions\14\BIN\STSADM.EXE"
$serverUrl = http://myserver
…
STSADM –o enablessc –url $serverUrl –requiresecondarycontact

The above code is now more easily read and maintained.  If you want to investigate further how PowerShell parses quotes, etc., check out this StackOverFlow question, and Keith Hill’s answer:

13 Feb 2012

Sending Email Using PowerShell

I’ve just been called out on the fact that I didn’t complete my mini-blog series on sending emails using PowerShell.  So, to finally conclude those articles, an example of using the Send-MailMessage cmdlet that was introduced in PowerShell V2.0.

Send-MailMessage –From "recipient@target.com" –To "sender@source.com" –Subject "Test" –Body "A test of the Send-MailMessage cmdlet"  -Attachments "c:\Attachment.xls" –SmtpServer smtpServer.com

In order to send a email with multiple attachments, you need to pass an array with the full file paths of all the attachments to the -Attachments parameter. This is easily done in PowerShell by simply piping the contents to the Send-MailMessage cmdlet.

Get-ChildItem "C:\Folder" -Include *.txt | Where {-NOT $_.PSIsContainer} | foreach {$_.fullname} |
Send-MailMessage -From "recipient@target.com" -To "sender@source.com"  -subject "Test" -smtpServer smtpServer.com

Or to send each attachment separately:

foreach ($attachment in $attachments)
{
	Send-MailMessage -From "recipient@target.com" -To "sender@source.com"  -subject "Test" -smtpServer smtpServer.com -attachments $attachment
}

2 Feb 2012

My Personal Goals for 2012

After reviewing my goals for last year, it is time to reveal my goals for 2012:

  1. Reduce my weight to under 70 kg.
Lose weight now

Over the past few years, my weight has gradually crept up. With a tagline like “will code for cake”, how could my weight not increase?  As a software developer, my job is sedentary, and due to a chronic knee injury, my running days are over.  But this year, I’m going to lose the middle age paunch, and get back in shape.  I’m currently weighing in at 75 kg; back in my University days, when I was running and climbing daily, I weighted 68-69 kg.  I’ve already starting looking seriously at my diet, and I am exercising daily.  You can follow my progress by checking my bodyweight log – I update it daily.

  1. Release a mobile application and a web application.

Over the past few months, I’ve been pretty disheartened about my career in general, and about programming in particular.  After taking some time to reflect on this, I realised it was for a very simple reason – I wasn’t doing any serious coding.  At work, I’ve spent the last 3 years working with SharePoint.  This isn’t the place for a Zed Shaw-esque rant on SharePoint development – suffice to say that the SharePoint isn’t the most stimulating platform to work with, and could definitely count as one of the most frustrating.  In particular, I’ve spent the past two months configuring SharePoint demos, as opposed to actually coding.  At home, I’ve haven’t done in serious coding on personal projects in far too long.

To get my passion for programming back again, I am going to start following Scott Hanselman’s advice and start doing more.  In particular, I will stop watching TV in the weekday evenings, and start work coding my personal projects.  As well more coding, I will be learning a new language – at the minute I'm still deciding whether to learn Python or Ruby. But my first project will be a Android application.  More news to follow soon!

Android Logo
  1. Save 30% of my net income (in addition to pension contributions).

This follows on from my goal to increase my saving to 20% last year.  In the event, I saved 18.76% of my salary in 2011.  To increase my savings to 30% will be a major challenge, but one that will be useful to attempt, even if I fall short of the actual target.

Save Money Vacation

The three goals above definitely reflect the lessons I learnt from last year’s goals.  The new goals are:

  • Limited in number and scope – I’ve only got limited time and attention to focus in specific problems. So I need to focus on a small number of goals that can give the most benefit.  That is the main lesson form one of the best books I read last year – The Power of Less
  • SMART.  I (and for goals 1 and 2, you!) will be able to track my progress.

Hopefully, I will successfully achieve all of my goals – but even if I don’t, I intend to have fun trying!

31 Jan 2012

Review of My Personal Goals for 2011– Part 3

This is the third and final part of my review of last year’s goals.  In my previous posts, I covered the first three goals.  My fourth goal was:

  1. Career - Become Microsoft Certified in SharePoint 2010.

I actually met this goal fairly easily, passing exam 70-573 (Application Development in Microsoft SharePoint 2010), and in addition becoming a MCITP in Business Intelligence Development (exams 70-448 and 70-452), as all 3 exams were required for work.  Of course the fact that Microsoft certifications for developers are effectively worthless is neither here or there. 

  1. Financial – Save 20% of my net salary (in addition to pension contributions)

I feel slightly short on this goal, with a total savings of 18.76%.  Given that this was from a base saving rate of just under 10%, I’m counting this as a pass!

 

 

Overall, I‘m actually happy enough with how I progressed my goals, but there were definitely a number of issues with the goals I set for 2011:

  • Too many general aims, with too many specific goals.
  • The various goals were too disparate, with no underlying theme.
  • Several of the goals weren't of any true benefit to me.

All of which I will take into account in my next post, when I’ll finally spell out what my goals are for 2012.

17 Jan 2012

Developer Community Groups and Buses

Just a quick post to highlight two new Belfast developer groups that are having their first events this month.

The first event is being hosted by Bash! on the topic of Lessons in Clean Fast Code.  The talk is being given by performance guru Martin Thompson, and it is taking place this Thursday evening (19th January) at the Holiday Inn on Ormeau Avenue.  With some 200+ people registered to attend, it is guaranteed to be a great night!

The second event is from the newly formed Belfast Ruby community group, which has been formed by the guys in Rumble Labs..  They describe themselves as “a community of aspiring & experienced developers in Belfast passionate about Ruby and Rails”.  Their first event will be a meetup on making the Jump to Ruby, with the aim of getting complete beginners coding in Ruby by the end of the night.  The meeting is on Tuesday 31st January, at the Rumble Laboratory on Ormeau Avenue, Belfast.

It is great to see new community groups forming, and shows that local developers want to share their experiences and get involved in new(ish) technologies. 

The title?  Obviously, community groups are like buses – you wait forever, then two come along at once.

3 Jan 2012

Review of My Personal Goals for 2011– Part 2

This is the second in an impromptu series of posts reviewing my progress in meeting my 2011 resolutions.  In the first post, I covered my goal of getting fit.  In this post, I look at the second and third goals:

  1. Friends and Family
    • Spend some time each week staying in touch with friends and family.

There are so many things wrong with this goal that I really don’t know where to begin.  I met this goal; but then everyone who isn’t a hermit could have met this goal!

What went wrong?  It certainly isn’t a SMART goal, as it is not specific.  A better goal would have been to say that I would phone a friend or relative weekly. But the worst thing about it is that it such a blatant piece of  “motherhood and apple pie” that it is worthless to state as a goal.  Apologies!

What can I improve on? I need to consider if a goal is worthwhile pursuing – will it help improve me?  Will it improve the lives of those around me?  And is the goal a SMART goal?

Motherhood and apple pie...

  1. Personal Interests
    • Read 100 new books.
    • Watch 50 films.
    • Release an open-source project.
    • Write a new blog post weekly.

Again, I repeated the mistake I explained in the earlier post – too many sub-goals.

A quick check shows that I read at least 73 books last year.  I’m not sure how many of these books were in the original list of 100 books I created at the start of 2011 – I’m guessing under 20. A lot of my reading is spurred by investigating random topics (for example, Judo, WWII, bodyweight workouts, Linux, productivity and self help books).  The list is evenly split between fiction and non-fiction.  The fiction selection is a mixed bag even by my standards.  Some were classics (Never Let Me Go by Kazuo Ishiguro, A Dance With Dragons by George R.R. Martin).  Others were simply dire (A Discovery of Witches by Deborah Harkness – I threw it away from me after 20 pages).  You can view the full list on my Shelfari Profile.

I definitely didn’t watch 50 films during last year. At a guess, I watched around 25-30.  Which I’m very glad about.  Given the number of TV series that I follow, I certainly don’t have time to watch a film a week as well.

I haven’t released an open source project, which I’m very disappointed about.  Indeed, I managed to do very little coding in my personal time.  Likewise, I only wrote 7 blog posts last year, compared to 45 articles in the year before.  This is definitely something I’m looking to change with this year’s goals.

Couch Potato

What went wrong? Again, too many goals.  Also again, goals that weren’t relevant – what was the point in trying to watch a film a week?  The book list is very useful, but the original list has changed from a list of 100 books to read in a year, to a list of books that I will read at some point.  In fact, I plan on deleting the original list and migrating the list to Google Tasks.  Trying to read all these books and films was part of the reason why I didn’t spend enough time coding and blogging.  the various sub-goals were in fact contradictory.

What can I improve on? Again, I need to focus on what is the true goal I want to achieve.  The goals to read a certain number of books or watch a certain number of films were irrelevant; I needed to focus on spending time on my personal projects, on actually creating something.  It is pretty clear that I’m spending 90% of my time consuming, and only 10% of the time producing, when it should be the other way round.

2 Jan 2012

Review of My Personal Goals for 2011– Part 1

At the start of this year, I compiled a list of goals for 2011.  I thought it would be useful to look again at the 5 general aims that I set out then, to see if there were any lessons I could learn for the year ahead.

To recap, I had 5 main goals for 2011:

  1. Get fit!
    • Reduce weight to 68kg.
    • Eat no chocolate, and work to reduce the amount of sugar in my diet.
    • Exercise daily for at least 45 minutes.
    • Get at least 7 hours sleep every night.
    • Start a martial art by April.
  2. Friends and Family
    • Spend some time each week staying in touch with friends and family.
  3. Personal Interests
    • Read 100 new books.
    • Watch 50 films.
    • Release an open-source project.
    • Write a new blog post weekly.
  4. Career
    • Become Microsoft Certified in SharePoint 2010.
  5. Financial
    • To save 20% of my net salary (separate from pension contributions).

I had hoped to do this review in a single post – it turns out, I’ll need to do a series of post to cover everything.  In this post, I’ll look at the first goal – getting fit. 

Overall, I missed this goal by a mile – I’m definitely not fitter than I was at the start of 2011.  Considering each of the sub-goals in turn:

My current weight is 76.4kg, higher than the start of last year.  A check of my online bodyweight log shows the following graph for my weigh over the 2011:

Bodyweight Chart for 2011

Part of the initial weight loss in the graph above was due to changes in my diet; I didn’t eat any chocolate in the first half of the year.  Unfortunately, I simply displaced my chocolate craving with other sugary treats.  In the second half of the year, my diet started to decline, and I started eating chocolate occasionally, which led to the weight gain.  I experimented at various times with keeping a photo food diary, but found it difficult to keep this going.  In the future, I’m planning on maintaining a written food diary, and looking at the use of portion control.

For the goal of exercising daily, it was partial success.  A quick check of my diary shows that I exercised on 312 days, or approximately 85% of the time.  There were two main periods when I couldn’t exercise – two weeks in April, due to injury, and a further two weeks in November, when due to major  deadline for a work project I couldn’t exercise as planned.  A major improvement in my exercise plan was to start each day with some light circuit training and stretching.  This only take 25-30 minutes, and is a great way to wake yourself up.  It also means that if I miss a scheduled exercise session in the evening, I only need to add a brisk walk for 20-30 minutes to meet my daily exercise quota.  This is something I plan on keeping on in future.

I definitely didn’t get 7 hours sleep every night. I also noticed that a lack of sleep definitely hindered my diet, as I tend to binge late at night. 

I did start a martial art during the year.  In fact, I started two, attending both Judo and kickboxing during the year.  Unfortunately, in my first Judo session, I tore my pectoral muscle (an extremely painful injury – I initially thought I had cracked a rib), which led to two weeks unable to exercise completely, followed by  6 weeks of light exercise.  I started kickboxing in June, and stuck at for 4 months, at which point I ditched it – I found it very boring.  Strangely, I could see myself going back to Judo.

What went wrong?  The overall aim of getting fit was a worthwhile one.  But I attempted to do too much, with too many sub-goals; I should have focused on losing weight.  I was already exercising regularly, but I was still slowly gaining weight.  I didn’t focus on the reasons for the weight gain – my poor diet.  Until this happens, I’m not going to get fitter.  I also wasn’t flexible enough in my goals – I didn’t plan on injury or work commitments stopping me training.

What can I improve on?  Concentrate on the core issue – my diet in this case.  Everything else will fall into place when this is dealt with.  Also, I need to be more flexible in planning to meet the goal.