Tag Archives: Coding

Three notions / plans for 2016

Hello. I haven’t written here in a while. That’s something I hope to change.

I realise it is 6 weeks into the year already, but after a trip to California last week, my own vague ideas about what 2016 should mean for me, have solidified.

  1. Travel (a bit) less / be more thoughtful about travel. I’m in an International role, and I work for a company with headquarters and many of the decision-makers 8 hours behind me. This makes the notion of travelling less in 2016 a little ironic and possibly, untenable! Nevertheless, I work with a great team and I hope to be more thoughtful about where and when I travel (and for how long) this year. I know I’ll do more again, but right now, I’m at a point in my life where I need to be setting more roots and plans locally. Interestingly, my trip to SF this week was my first significant travel since October, so this is already working (to an extent), but the global #HelloWorld tour will of course eat into that significantly – not that I’m complaining!
  2. Make more Stuff. Per Chris Heilmann’s fantastic post about Developer Relations / Evangelism / Advocacy this past week, “how often do you code?” is a key question in understanding our role(s), and I’d been aware for a while that I simply hadn’t been doing much of it lately (beyond testing out examples where devs said they were unable to make samples work). My plan in 2016 is to build something – anything – at least once a month. So far this year I’ve dabbled in Twitter ebooks bots and Alexa skills – both built on the backs of others – but I hope to build, publish, and write about more in the coming months. I’m particularly excited by the growing trend towards No UI / conversational interfaces and it has been great to re-connect with friends like Matt and Haje in the preceding months on these topics. I’m also hoping to write a lot more, as blogging and sharing is a major part of where the amazing ride and network I’ve enjoyed since ~2006, started.
  3. Invest more time in mentoring others. In my previous lives at IBM and Pivotal I had a lot of opportunity to get involved in these activities. I’ve been at Twitter very close to 2 years now, and it is incredible to realise how much I’ve learned “through osmosis” – partly from amazing individuals like Isaac, Sylvain, Taylor, Craig, Chris, and Romain – and more often, from others still around me. My goal in 2016 is to share my knowledge and support much more widely: both to co-workers, third party developers, and up-and-coming members of the tech community around me. Time to hit the local meetup circuit, and to do more coaching of others in public speaking, career mentoring, and personal support.

I’ve got a lot of exciting stuff to look forward to this year professionally – I’m deeply involved in a number of initiatives, and I’m excited that @jack has put Developers firmly on our list of priorities! This is where I’d always hoped we would get back to. Nevertheless, on top of that, these are three of my personal plans for the next ~10 1/2 months. I’ve made a good start.

As always, I’m open to comments here, but you’ll also find me open to discuss on Twitter @andypiper.

(also on Medium)

Advertisements

A little bit of Spring and MQTT

I’ve been involved with Spring (the Java framework, not the season…) for a couple of years now – since I joined VMware in 2012 through the former SpringSource organisation in the UK – and I’ve remained “involved” with it through my transition to Pivotal and the framework’s evolution into Spring 4 / Spring.IO under Pivotal’s stewardship.

To be clear, although I’ve been a “Java guy” / hacker through my time at IBM, I have never been a hardcore JEE coder, and my knowledge of Spring itself has always been limited. My good buddy Josh (MISTER Spring, no less) has done his best to encourage me, I briefly played with Spring Shell last year with @pidster, and the brilliant work done by the Spring Boot guys has been helpful in making me look at Spring again (I spoke about Boot – very briefly, as a newcomer to it – at the London Java Community unconference back in November).

Taking all of that on board, then, I’m still an absolute Spring n00b. I recognise a lot of the benefits, I see the amazing work that has gone into Spring 4, and I’m excited by the message and mission of the folks behind the framework. I would say that though… wouldn’t I? 🙂

[considering this is my first blog post in a while, I’m taking a while to get past the preamble…]

This week, I chose to flex my coding muscles (!) with a quick diversion into Spring Integration. With a long history in WebSphere Integration back in my IBM days, this was both something of return to my roots, and also a learning experience!

With the new Spring.IO website (written with Spring, and hosted on Pivotal Web Services Cloud Foundry, fact fans!), the Spring team introduced the new Spring Guides – simple and easy-to-consume starter guides to the different technologies available in the Spring family. I knew that the team had added MQTT support via Eclipse Paho, so I thought I’d take a look at how I could modify a Spring Integration flow to take advantage of MQTT.

Incidentally, there’s complete reference documentation on the MQTT support, which is helpful if you’re already familiar with how Spring Integration works.

The resulting simple project is on Github.

Once I’d figured out that it is useful to ensure the latest versions of the various modules are listed as dependencies in the build.gradle file, it wasn’t too hard to adapt the Guide sample. In the example, the docs lead a developer through creating a new flow which searches Twitter and then passes tweets through a transformer (simply flattening the tweet sender and body into a single line of text), into an outbound file adapter.

The bulk of the changes I made were in the integration.xml file. I wanted to replace the file output with the tweets being published to an MQTT topic. To do that, I added the int-mqtt XML namespace information to the file, and configured an outbound-channel-adapter. It was also necessary to add a clientFactory bean configuration for a Paho MQTT connection. You’ll notice that, by default, my example posts results to the test broker at Eclipse (iot.eclipse.org port 1883 – an instance of mosquitto for public testing). Full information on how to build and test the simple example can be found in the project README file.

Thanks to my colleague Gary Russell for helping me to figure out a couple of things, as I was a Spring Integration newcomer!

Sushi, code, and craft

On the recommendation of my friend and colleague Alexis Richardson, last night I went along to the ICA in London to watch a documentary. Not at all my usual fare of sci-fi, action or comedy, but Alexis convinced me over lunch last week that Jiro Dreams of Sushi would be worthy of my time and interest.

Evidently the UK is substantially behind the rest of the world in getting this documentary on release – it’s apparently available to stream on Netflix in the US already, but only arrived in the cinemas here a fortnight ago. Ho-hum.

So, in a nutshell, it’s a film about an 85-year-old man who has been making sushi for a living for 70 years, and works with his eldest son in a 10-seat restaurant in an Tokyo subway station. So far, so quirky.

A few things elevate this documentary to a far more worthy status, though. The cinematography was thoughtful and beautiful; it was nicely paced; I learned a lot about the thinking of the individuals featured. I also came to realise how what I know as sushi, simply is not what Jiro serves to his patrons. What we consume from supermarkets, chains with conveyor belts, even the “good” individual sushi restaurants I’ve visited in London, is more mass market, mass produced popular style raw fish dishes.

Jiro is a craftsman – so are his sons and other apprentices. He’s obsessive, and he aspires to be better every day.

That’s interesting, because tomorrow is the Monkigras – Redmonk’s “craft beer-and-developer craft” event – and the theme this time is Scaling Craft. Over the past few weeks I’ve been back and forth with my very good friend James Governor about the topic of craft, and how it applies in software and technology. I think, after watching Jiro, I have a far better understanding than in the past. Interestingly, afterwards I had a discussion about professionalism, chartering / accreditation, the bcs, and whether or not professions exist to act as a barrier to entry or as an encouragement towards craftsmanship, too. I wonder how those themes will be reflected throughout Monkigras this year.

For what it’s worth, I had proposed a Monkigras talk taking the concept of glass and the craft of glassmaking and applying some technology themes, but unfortunately I’ve not been able to pull it together in time this time around. I’m looking forward to learning and soaking up the atmosphere (and seeing good friends from across the community) again, instead!

Oh, and if fish and subtitles are not your taste, I’d still encourage giving Jiro Dreams of Sushi a try – if not, on a technology topic instead, you really should watch Indie Game The Movie, the best documentary I watched last year and a fascinating insight into programming, obsession, and the gaming industry.

Different Spokes

When Jeff Douglas from CloudSpokes contacted me last week to ask if I would be interested in being a guest on their Different Spokes show to talk about Cloud Foundry, help to review a book on node.js, and generally talk tech, I was delighted to be able to say “yes!”. I met Jeff back at Monktoberfest in October and I love the stuff the CloudSpokes team are doing around application challenges to build skills in different areas.

It turns out that these guys are spending a lot of time with Javascript lately and the brief was to review The Node Beginner Book. We did talk about it for a bit, but I probably talked too much earlier in the show because I was getting excited about all the cool stuff happening around Cloud Foundry lately 🙂

This was my first use of the Google+ Hangouts On Air feature, which allows content producers to publically stream the group chat to a YouTube account. I have to say that I was extremely impressed. We used the lower thirds feature from the Hangouts Toolbox plugin to do titles, and I’m sure there were a bunch of other handy add-on features we could have used to enhance the experience too.

It was great to be able to respond to viewer questions coming in via Twitter, and I’d like to thank my colleague Raja for his cool node app examples (don’t forget to check out nodelogger which uses the Cloud Foundry authentication features too). A shout-out to Brian McClain for bailing me out when I forgot the features of my own product, too…!

All-in-all, a really enjoyable discussion, and I’d love to take part in that show again sometime – smart guys! They’ve posted a nice recap post if you’d like to check them out.

A simple website on Cloud Foundry

I’ve been remiss in blogging since switching job roles, so it’s about time to change that!

One of the goals of a Platform as a Service (PaaS) – like Cloud Foundry – is to enable developers to be more productive, more quickly. It’s about getting out of the way, removing the barriers and setup steps, and enabling developers to write and deploy great code as quickly as possible.

Something I’ve needed to do fairly often since starting work with Cloud Foundry is to quickly put up a “static” web site. The platform supports a number of runtimes and frameworks (Java, Ruby, node.js etc) but it doesn’t currently[1] have an runtime type of “website”. So, I can’t simply put together a bunch of HTML, CSS, images and client-side Javascript files, run vmc push, and have my site online on cloudfoundry.com – I need an “application” to serve the web content.

That’s exactly what my sinatra-static-web project does for me. I’ve found that it’s a very handy and quick template application which enables me to get simple static sites up on Cloud Foundry, and a good starting point to build out from if I want to stretch my Ruby skills 🙂

To use it, simply fork or clone the project using Git; replace the entire contents of the public directory with your HTML, CSS and JS files (with an index.html file as the main page); potentially adjust a couple of settings in the web.rb file; and vmc push the app. You can take a look at the sample site I’ve added to the app, of course… it’s just a load of junk content based on Twitter Bootstrap and with some random Lorem Ipsum-style text to fill it out.

There’s no real need to go near the code, and it is trivial at any rate – but let’s take a quick look.

# a super-trivial Sinatra-based webserver
# for static content
require 'sinatra'

# set all the settings!

configure do
  # this is arguably not necessary... 'public'
  # folder is the static content location by default
  set :public_folder, 'public'

  # optionally configure Cache-Control headers on responses
  # set :static_cache_control, [:public, :max_age => 300]

  # if using mime types not known to Sinatra, uncomment and
  # configure here (by file extension)
  # mime_type :foo, 'text/foo'
end

# serve the files!

# route to starting page (index.html)
get "/" do
  redirect '/index.html'
end

# route to custom error page (404.html)
not_found do
  redirect '/404.html'
end

The code uses the super-handy Sinatra framework for Ruby, which allows an application with multiple URLs to be defined very quickly. In this case, we simply declare a dependency on Sinatra; set the public folder as the one where the static content resides; and then create a default route, so that when a user hits our root URL / they are redirected to the index.html file. We also create an error route so that if the user hits a URL that doesn’t exist, they receive a customised but simple 404 error page (assuming that such a file exists in the public folder!).

As you can see, there’s really only a few lines of code here, and the rest is handled by the framework. I’ve commented out a couple of optional parameters that can be used if desired, but without any changes this will serve the contents of the public folder perfectly happily.

I’ve used this a few times now, for sites of varying levels of complexity – in particular the resources site I created for Cloud Foundry’s sponsorship of Young Rewired State was based on this (the source code is on Github if you want to take a look at that, too – it’s understandably extremely similar!). I was also able to use it to help a number of students who I worked with at YRS 2012 to get their sites online. More on YRS, shortly…

Just a simple little resource that you might find handy for prototyping your next web UI – you don’t even need to know Ruby, Java, or node.js to get going!

[1] … note that I’m not saying that Cloud Foundry should have or will have such a type of container in the future – but the code base is Open Source, so there’s every chance that someone will come along and add this kind of thing one day!

Update 05 March 2013: I just pushed a few changes to the app to reflect a slight change in the way Sinatra apps work on Cloud Foundry now. Use the source!