Lance Wicks
Kiwi,
Judoka,
Geek,
Husband
Daddy!

JudoGeek Blog

cpan day 2014 

August 2014 marked the 19th anniversary of the amazing resource that is the Perl cpan. Node developers already know why cpan is so cool, they have npm which is a very similar tool.

cpan for those who don't know is the online collection of modules for Perl. These are the components you use when for example you want to connect to Facebook or Twitter. Rather than writing all the code to handle connecting and authenticating and then posting to twitter or facebook; you can simply install a module from facebook and away you go!

So for me as a person that makes a living currently from writing Perl code and relying on cpan to provide the linkages between what I want to achieve and the technical elements I need to use.

One of my early experiences was writing a interface layer between a windows application and some robotic hardware interfaces. The initial code implementation was done with TCP sockets with adhoc commication. Later in the project it was decided to use XML to format the communications; this was a pretty big change and could have been a nightmare, but with Perl is was really use a case of using a XML library from cpan. It was really a simple change (much quicker and easier than it was for the .net developers working on the other side).

As a Perl guy, I know and love the cpan and cpanday was something I wanted to support in some small way. I have had a cpan upload account for a longtime but never had something I wanted to upload. But somewhere I heard that one suggestion for cpan day was to upload something to cpan... so I decided that was what I would do.

But what to wrote and upload?

This was easy, I had been joking with a work colleague for a while about writing a Perl::Critic policy to prevent his use of Perlserets in the corporate code base. I even added it on (the written in perl) questhub.io site.

So this was the project I started last week: https://metacpan.org/release/Perl-Critic-Policy-Perlsecret

Now, I have never written a Perlcritic policy before, or contributed to cpan, so I did what any good perl developer would do; I stole!

I did some googling and looked at some other policies.

One that caught my eye was Perl::Critic::Policy::ValuesAndExpressions::PreventSQLInjection, which has it's code on GitHub. Including having tests on Travis-CI. So I checked out a copy of it and then used this as the starting point for my module.

So I created a git repo https://github.com/lancew/Perl-Critic-Policy-Perlsecret and used the files from the PreventSQLInjection as the basics for my module. I started by striping out and replacing names and files that I needed or didn't need.

The next step was to get the integration to Travis-CI working. Travis-CI allows you to run your test suite on a variety of Perl version without having to do it yourself. It took a while but after some misteps I had https://travis-ci.org/lancew/Perl-Critic-Policy-Perlsecret up and running including the button in the readme in the Gitgub repo. Next I did the same for Coveralls, which provides test coverage for reports: https://coveralls.io/r/lancew/Perl-Critic-Policy-Perlsecret?branch=master

It then got a bit interesting, I had some issues getting the pre-requisite modules working on my laptop. But interestingly, the travis-ci build worked nicely (mainly as I copied the setup). So I did have a working test environment (four in fact). Luckily, I wanted to approach this little project in a Test Driven Development (TDD) style. So I made the decision to stop wasting time fixing up my local environment and trying to put together a dev VM etc and decided to simply use the tools I had already setup.

My decision was simply to write my changes to github, then let the automated testing take place on Travis-ci and react accordingly.

So I got started, I looked at Perlsecret and wrote a test for the first entry, the "Venus Operator". I pushed it to Github and looked at Travis-CI and as expected, it was red (fail). Then I wrote the code to detect a Venus operator and pushed that. Travis-CI turned green as the test I wrote now started passing as my code detected the Venus operator.

Then I continued with each of the operators, with the same process:

* Write a test.
* Test fails
* Write code
* Test passes
* Repeat

So after some days of working evenings on it and some of Saturday (cpan day) 16th. I had a completed Policy with tests built and passing tests. Time to upload to cpan.

This again is something I have not done before, so more googling. It seemes I needed a TGZ to upload via the web interface. Now, if you remember; I said my actual local build was not working. So I could not actually build locally. But a couple of references talked about being able to upload direct from Github; so this is what I would attempt. Thankfully a very handy PerlMonks thread has all the details I needed... well almost. ;-)

So I created a release, the only trick being I needed to name it just right "Perl-Critic-Policy-Perlsecret-0.0.1". That done it was really as easy as pointing CPAN at the github release url.

Done!!

It took 30-40 minutes before it was easily found on cpan metacpan etc but there it was/is, online and available for anyone to use. By morning it got even better, the massive cpan testers community had picked up the module and I had passing tests on Windows, Linux, Mac, BSD etc. Now as I write this (a day later) I see that the testing has continued and I even have some failures, something to look into already.

Now the one confession I have is that I have not actually used my shiny new module on anything at all! My plan is to try it Monday on the corporate codebase as a test. I know I have written a pretty naive module, pretty sure it will detect errors even if in comments (a false positive).
Also, it's probably a policy nobody will use, but that was not the point. The point was to do it, to wrote something and submit it to cpan on cpan day.

The result of cpan day was pretty impressive. 775 uploads from 107 people. Mine was one of 10 from new contributors.

You can read about it over at http://blogs.perl.org/users/neilb/2014/ ... e-1st.html

For me it was a worthy use of my time, I make a living from writing perl and I was happy to be able to contribute a little something to the community that I have enjoyed being a part of on and off for such a long while.

It was also a good technical challenge and I got some "deliberate practice" in. I developed the code in a pure TDD style, this has meant that when I got to the end, the tests were already in place and I have confidence in it working; and the cpan testers successes show that it passes on a wide variety of platforms.
I have also learnt how to upload to cpan, the requirements and the methodology.

So for me, the inaugural CPAN day was a good experience and I am pleased to have participated in my own small way. I hope next year for the 20th anniversary that the community does even more and I will I think attend (or perhaps even organise) some form of hackday to celebrate with.

Thanks Perl, you've been great!

Lance
[ view entry ] ( 3601 views ) permalink related link
Games of the moment... 

Just a quick one about a couple of games I have been playing and why.

The reality is I don't play much in the way of games. Too busy by far. But occasionally I want to relax and play a game. I have a bunch of consoles and steam and yet the two games I am playing the most recently are pc based and to be frank... weird.

1. SailX
This is a sailing simulator, as in sail boats. It's web based, though as I am a Linux user I am using the stand alone client for Linux. You can play in 2d or 3d (I alternate between the two).

It is basically exactly what it sounds like, you sail a boat. It's not expansive, you only sail races around a course.

It is multi-player; no NPCs here. You sail against real people and the winner is the best sailor as all the boats are the same.

It is statistics. I think I discovered the game when I was researching ranking systems for the http://rwjl.net/ research project as it uses the ELO system for ranking.


2. Dwarf Fortress
This is a dwarf simulator, I guess. It can probably only be described as a cross between minecraft, the sims, simcity and archlinux.

This is a game that you really struggle to even get started with unless you have the dwarffortress wiki open.

The learning curve is immense, the graphics ASCII. The complexity huge, the frustration even larger.

I blame my brother entirely for getting me into Dwarffortress. He prompted me to try it a couple of times. And then a little while back I had my 4/5/6th try and it stuck. I got it and enjoy not doing well when I get a chance to embark.

3. Ingress
This was previously Android only, but now is iOs also. Niantic labs' augmented reality game can be addictive. Especially with the ARG elements to this go be somewhere in the realworld game.

It's really interesting and I like geo based anything. (I geocache and trying Munzie).

Give it a go, join the resistance and let me know.


Summary
Not sure why I was prompted to write this, possibly just that it was a dreary day and I didn't fancy actually playing anything. Possibly because the blog has not been updated for months and I want to correct that. Possibly because I am curious if I am not the only one who is enjoying quirky indie gaming more than firing up the console.

I'm not a fast twitch FPS guy, so major AAA releases on old and next-gen consoles don't appeal that much. And I also get tired of the power on, start game, wait for updates, wait, start playing, realise you are out of freetime, turn it off cycle. Sometimes, I just want to get on, play, turn off.

Also, these quirky games are far more intricate it seems in areas. The SailX community is pretty serious about the rules for example; yet will happily help a noob. They have simple one design boats, but that opens up tactical play so much. Not freemium style powerups or such like.

Dwarffortress is obsessive both in the way it is developed and in the way people react to it. The level of simulation is creepy high, yet graphics are awful. But intentionally so. The fun is in the details not in pretty graphics (I confess however I play trhe Ironhand version which adds a little graphically).

Everything matters, nothing is just filler. No cut scenes. If your characters express emotions they matter. As in, you probably need to keep tabs on how they are feeling, who they are hanging out with, any budding relationships etc.

When you build, you need to plan for the future as well as short term. You need to keep thinking and keep enjoying the little touches that make the game so rewarding.

I'm a total noob, but everytime I manage not not mess something up and see how I should have done it I get a little charge that wants me to play more. I'm kinda addicted and wanting more.

Ingress is the one that is slipping a bit for me now. I'm level 6 slowly creeping to level 7. The recent virus infection(s) are frustrating as I don't live in a city with lots of portals. So the fast decay rates piss me off. I know it was needed and to be frank I'm getting more points for it. But the sudden change was jarring and annoying.

It also seems to be suffering a bit from there being nothing new to discover now I've got to a reasonable level. Maybe level 7 will reveal more?

The ARG elements are really good, but I'm not being drawn in quite so much as I'd hoped. Maybe my busy lifestyle is partly to blame.

Recruiting...
So, I am a geek. I work with geeks.

So, it's been interesting recruiting others to play. Ingress was the first one to catch. Dwarffortress so far has only been me catching it from my Brother and my colleague has just started playing.

If you play any of these games, or better yet have a game you reckon might appeal to me, please comment below or drop me an email.

Lance
[ view entry ] ( 3530 views ) permalink
2014 and a obligatory Perl post. 

So 2014 has arrived and Perl is a dead language... still.

It's been dead for maybe a decade now, despite it celebrating its 25th birthday recently. As I drive to my dayjob each day where I get paid to wrote Perl code for one of the UKs leading websites I tip my hat to the dead language that keeps the bailiff from the door.

As all the other Perl Bloggers have already said. Perl is not dead; it's just not trendy. Perl was the original web language. It has lost this celebrity status. Yet, Perl is still behind many of the top websites and remains one of the most flexible and productive languages on the web... and yes I am completely biased.

For the past 3-4 years I have been back writing Perl day to day; and I am still struck by the sensation from the first few weeks"back in Perl" after some time in PHPland and elsewhere.

It was a pleasure coming back to Perl. Literally a pleasure.
Perl is a language first; a programming language second. It writes like a real language. A bit like English it can be written this way or that way and achieve the same end.

If you like a postfix IF statement, Perl is ready for it. If you hate indentation; Perl can do it! Want concise near magical code, Perl is the language for it. Want expansive expressive code, Perl can do it!

I have written in the last year or two some NodeJS and after adjusting to the whole non-blocking, assymetrical style I wrote some useable code. But for me it's harder work that Perl.

One of the strength of the web's new poster child (NodeJS) is NPM. NPM is the NodeJS equivalent of CPAN. Both allow you to do wonderful things with a simple install of a module from the community.

In 2013 I have layed the foundations to start writing better Perl (and better code in general). I have been exploring the higher order concepts and finding my way around dependency injection, service classes and the dreaded Perl Secrets (it's a cpan module).

The previous few years had really expanded my enterprise development and specifically Agile and Scrum in a large corporate setting. My team had spent a lot of time and energy on agile methods, team working, test driven development and continuous development. 2014 really looks to be a year where my Perl improves and hopefully the skills I pinked up elsewhere help me apply the knowledge I am gaining this year.

My goals for the first quarter of the year are:
1. To finally upload a CPAN and
2. To add a Perl example to at least one web API for a webservice.
3. Do at least one "side project" with Dancer

Having said that; I shall try keep a toe in the NodeJS camp as part of me wants to stay on something "sexy". And of course part of me loves the ideas of NodeJS. Those being that by using the V8 engine the language benefits from all the competition to make web browsers faster and faster. I also love the idea that one language provides serverside and clientside.

Anyway... my final goal this year is blog regularly. I used to be so regular but faded. This year I have resurrected my spreadsheet and shall be using it to cycle me through my various sites and help me blog regularly.

So folks, stay tuned and say hello.

Lance.
[ view entry ] ( 4650 views ) permalink
My ArchBookPro ;-) 

So whilst I was away in Miami, I took the plunge and started installing Linux on my MacBook Pro. Being me, I decided against the sensible option of something easy like Ubuntu. I went with ArchLinux, not Manjaro (again simpler), which meant I had more learning to do and more problems, but eventually and a trip to Rio later I now have a working ArchLinux laptop.

Excluding the very manual setup required as part of Arch, the main problem was negotiating UEFI on the Apple hardware. One I got aroun that, Linux worked great.

I have had a few issues; wifi needed some work (and is still not 100% how I want it). Recently, for some reason suspend/hibernate stopped working properly. So closing the lid does not put the machine to sleep, I'm sure I will get to it.

I love Arch, mainly as I hate software getting out of date. It's a rolling release distro, which stops that annoying having to do a major upgrade on a irregular basis like Ubuntu. I have been burned that way in the past.
I have used Arch on desktop office machines for a while, and I find that if you keep it up to date the small incremental updates causes less problems than further spaced out big updates.

It's also fast as hell!
With Arch you only install what you need, so for example I use XMonad so I don't have the big window manager daemons running. Of course I have a SSD which makes it faster yet.

I intended of keeping my OSX boot, but in the end I "manned up" and wiped all the disks and started fresh. So my SSD has my OS and user stuff on it (fast). My 1TB drive (slower) has all my data and works well for storing my larger files (video, old podcasts, etc).

It is really nice to have switched my personal machine to Linux, dev work is so much better in the Linux world. It's a bit similar actually to the Apple eco-system; Perl (my main language) and most of the dev tools of the universe are Linux based, so having a Linux laptop makes it so much better.

And Arch is very very cool in that it has AUR, which adds onto the standard repositories pretty much any software you will ever need!

I love Arch and my bizarre xmonad setup. People freak (especially galling for most people is I as a mac user am hooked on "natural scrolling" so everyone hates using my machines as scrolling is upside down.). They hate my xmonad as after login, all tehy get is a black screen, just that. :-)

The laptop has some tweaking to go but it's getting there fast.

I will eventually right up something more on how I got around my problems, but to be frank it's rather redundant... the ArchLinux wiki is stupendous! More than once I've found myself and others using Arch to solve problems on other operating systems.

So there you have it, gone is my life using a evil proprietary operating system on my shiny macbook pro. I have an open source operating system; a secure machine (I even encrypted my drives) and lots of great free and open software... tool of the month is BitMessage the secure messaging software that might be the peer to peer replacement for email; give it a go.

Drop me an email (or comment) if you have any questions or suggestions.

Lance
[ view entry ] ( 7751 views ) permalink related link
Change is a good thing... right? 

So.... where to start.
The last time I blogged (back in April) I wrote that I was changing from the PHP based web application team back to the Perl based test automation tools team. Well... since then the company I was at made some more changes and the Perl team was directed down a path to merge with some C tools of a similar type to the Perl ones.

There were some other large changes in management (direct and above) and the big picture is that both my immediate manager and then later I decided to move on from the company.

I handed in my notice and decided to look in other directions (more on that later). So the end of July marked the end of that adventure and August is the start of another period of change for me.

August is a fun month for me as I shall be in the USA and Brazil with the IJF IT team for most of it. I will be working to help stream live video (via Youtube) of the World Cadet and World Senior championships. Of course I'll be helping with the electronic scoreboard system and will be running my NodeJS based live tweeting software also ( http://twitter.com/judoticker ).

So why move on?
Lots of people have asked why I am moving on from my current $dayjob. And like all decisons of this sort it is not a simple decision. A big part of the decision was that my immediate manager moved on, he acted as the "Product Owner" for our scrum team and was also the champion of scrum in the company.

So his departing left a big hole, one a non scrum manager stepped into and tried to fill. But sadly the manager was a "scrum but" practitioner and after some very heated attempts at resolving it I "inspected" and the result is my leaving (adapting). Although my temptation and initial reaction was to stay and fight the system; I realised that as AnnMarie De Mars put it, there is a level of futility to doing so. Even if you win you lose as you feel all the pain to get very little reward.

Equally, the technical direction was going the wrong way. Many of our technical improvements were being undone and the work the team was being directed towards were not aligned with my personal direction. In other words, I am a Perl developer who took the role to sharpen my Perl skills and work in an agile environment. Sadly, the company was/is unable to go that direction so I decided that I wanted to grow further. So I'm looking forwards and looking for agile Perl roles, where I hopefully can continue to sharpen my Perl skills and also contribute by sharing the high quality of Agile/scrum with a new team and drive some technical practises in a new environment. Thats the plan at least... lets see what comes about.

Looking out there I am pleased to see the job market is healthy, literally within hours of posting my CV online I was receiving calls. What was of interest too was that there are some good Perl jobs on offer out there. And not just in London. There are Perl jobs all across my part of the south coast of England and up the M3 to London.

So that is really positive!

So the next time I post hopefully I'll be able to share some good news on having found an exciting new challenge!

Lance
[ view entry ] ( 4765 views ) permalink

<Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next> Last>>