I’ve started to put various snippets of code up into GitHub, partly because they may be useful to other people, partly so that they are more accessible when I do not have my personal laptop with me. Yes, Virginia, I could put it all on a USB stick (and I probably will), but that poses another problem of keeping that content up to date. And I’m not keen on sticking my stick into random and unpredictably unhygienic places.
Continue reading “Maven releases with Git”On “fencing”…
“So you do fencing then?”
Sigh. Yes, that question again. How best to explain what I actually do? Let us set a scene. It is important that you, the reader, try to place yourself into the first person view here, and enter this scene. After all it is 2016, and VR is The Next Big Thing. Immerse yourself.
Continue reading “On “fencing”…”CSS3 Oops.
Revising my resumé as part of an overall overhaul of my site, I realised that the presentation on mobile devices was not very good. Fortunately since I last did anything major, CSS3 has become widely implemented, so Media Queries are now an option for degrading onto smaller screens. To my pleasure it did (eventually) just work, but I’m embarrassed to say that I spent a good hour wondering why it was not initially working. It would have helped if I’d remembered that CSS files are read from the top down…
On a side note, I’m quite disappointed in the behaviour of the Safari ‘responsive design mode’. While it does allow quick switching of window size, as far as I can tell apart from tinkering with the user agent string it does not register as a mobile device from the point of view of CSS. I’m hoping to find a better way of designing against mobile, because it’s definitely suboptimal to push changes to a server just so that I can test them on the phone.
Robots. They are coming to take your content.
I am in the process of revising my site, and discovered for whatever reason that I had an empty robots.txt file present. I know it is only a voluntary ‘standard’, but as far as I know all the major players do respect it. As the overwhelming proportion of users use a search engine that respects the standard, it does form a useful way of shaping what shows up in the general public eye.
I can never remember the syntax though, so for your reference and my recollection – http://www.robotstxt.org
Addendum: I was not familiar with the semi-standard for site maps so I’ve added that as well to see what the effect will be.
Addendum:Ritta Blens has pointed me to another very useful tool for testing the structure of a robots.txt file: https://www.websiteplanet.com/webtools/robots-txt/
The Australian Government Spill
A very quick primer for people outside Australia who may not know who the players are in the current demolition of the Federal Government in Australia.
Continue reading “The Australian Government Spill”(Mobile) Weapons of Choice
Like any other code-worrier, I have a ton of applications on my (i)Phone, ranging from “things that look shiny but are useless”, through “things that I use once a year”, up to “indispensable and every-day”. Out of interest I’ve tried to work out what apps are the once that fall into the latter category, apps that are essential to getting my work done and which contribute strongly to the sense of never being out of the office.
ORM?
It’s rather annoying that in 2015 the ORM (Object-Relational-Mapping) problem is still tedious to deal with. While in general terms it is a solved problem – JPA and Hibernate and similar frameworks do the heavy lifting of doing the SQL queries for you and getting stuff in and out of the JDBC transport objects – there does not seem to be any way to remove the grinding grunt work of making a bunch of beans to transport things from the data layer up to the “display” layer. It remains an annoying fact that database tables tend to be wide, so you wind up with beans with potentially dozens of attributes, and even with the best aid of the IDE you wind up fiddling with a brain-numbing set of getters, setters, hash and equals methods and more-or-less identical tests.
I would love to suggest an alternative – or build an alternative – but this remains a space where it feels like for non-trivial use there are enough niggling edge cases that the best tool is a human brain.
Doing More With Less (Part 1 of N)
In recent weeks I have been massively overhauling the monitoring and alerting infrastructure. Most of the low-level box checks are easily handled by CloudWatch, and some of the more sophisticated trip-wires can be handled by looking for patterns in our logs, collated by LogStash and exported to Loggly. In either case, I have trip wires handing off to PagerDuty to do the actual alerting. This appeals to my preference for strong separation of concerns – LogStash/Loggly are good at collating logs, CloudWatch is good at triggering events off metrics, and PagerDuty knows how to navigate escalation paths and how to send outgoing messages to which poor benighted bastard – generally and almost always me – has to be woken at 1:00 AM.
One hole in the new scheme was a simple reachability test for some of our web end points. These are mostly simple enough that a positive response is a reliable indicator that the service is working, so sophisticated monitoring is not needed (yet). I looked around at the various offerings akin to Pingdom, and wondered if there was a cheaper way of doing it. Half an hour with the (excellent) API documentation from PagerDuty, and I’ve got a series of tiny shell scripts being executed via RunDeck.
#!/bin/bash
if [ $(curl -sL -w "%{http_code}\\n" "http://some.host.com/api/status" -o /dev/null) -ne 200 ]
then
echo "Service not responding, raising PagerDuty alert"
curl -H "Content-type: application/json" -X POST \
-d '{
"service_key": "66c69479d8b4a00c609245f656d443f1",
"event_type": "trigger",
"description": "Service on http://some.host.com/api/status is not responding with HTTP 200",
"client": "Infra RunDeck",
"client_url": "http://our.rundeck.com"
}' https://events.pagerduty.com/generic/2010-04-15/create_event.json
fi
This weekend I hope to replace the remaining staff with a series of cunning shell scripts. Meanwhile the above script saves us potentially hundreds of pounds a year in monitoring costs.
Roads untravelled
My mind has turned to reflection on the jobs I wish I had pursued in my youth, possibly because it is Monday morning.
Making sawdust
I finally got a chance to spend a few hours in the workshop last night and progress some pieces. My current focus is to finish setting up the workshop, and to make a cat-run for the balcony, both of which are grinding along slowly.