RSSAmplifier

Blog

Yo! Briefcase: index

yobriefca.seRSS feed ↗279 posts

Latest posts

Bashing Ambiguity

I read a great tweet the other year, Was hoping to get some verbose output from pkill, ran pkill -9 -v process_name . Ho boy. — Maxime Chevalier (@Love2Code) September 21, 2016 I can't say I've ever used pkill so had to do a tiny bit of digging through the man pages of pkill PKILL ( 1 ) BSD General Commands Manual PKILL ( 1 ) NAME pgrep, pkill -- find or signal processes by name SYNOPSIS pkill […

How to do unnecessary things in long winded ways...

Quick and Dirty JSON Builder for Java

If you're writing tests involving JSON or trying to return some basic JSON structure in a simple Play or Spark application here is a simple shorthand notation that can be used to build said response. Given the following JSON structure, { "title" : "Test Schema" , "type" : "object" , "properties" : { "firstName" : { "type" : "string" }, "lastName" : { "type" : "string" }, "age" : { "description" :…

ansible-console: An Interactive REPL for Ansible

If you know about ansible-console you can ignore this. If you don't this might be of use to you. Something found out recently is that Ansible has an interactive REPL of sorts in ansible-console for doing some adhoc things on a collection of hosts. Using it is pretty simple > ansible-console -i preproduction Welcome to the ansible console. Type help or ? to list commands. jamhughes@all ( 3 )[ f:5 ]…

Tabularizing output of shell scripts with column

I tend to live in my terminal and as such tend to write a bunch of shell scripts for various project specific things. One script I have lists, form a project directory, the what branch each of my repositories is on. It looks a bit like this, #!/bin/bash projects =( super-service super-client authentication-service infrastructure ) for project in ${ projects [*] } ; do cd $project echo "$project…

Functional Collections in Scala (Lightning Talk)

Kotlin - 2 Years On

I first played with Kotlin back in 2012, I've written some Android apps with and without it and generally played around with it. Since the release of Kotlin 1.0 a few days ago I've decided to jump back into it and see if my original views still hold up. Herein lies opinion of the personal kind. Proceed with an open mind. Scala is my day job, not only Scala but legacy/old Scala. Not only that but a…

alias, union and case in Crystal

So I've been diving into Crystal lately. It's nice. This isn't a post about why I think it's nice, it's a post about a few of the features of Crystal so let’s get straight down to it. alias alias is a very common feature that we can see across many languages but it can be used to build upon other features in Crystal. As the name suggests you use alias to give a type a different name. alias…

entr

entr is a command line utility for running arbitrary commands when files change. Just for clarification - I did not contribute to this project. I just happen to find it useful. Yes, yes you already have all this with guard, live-reload, guardian, watcher, watchy, watch, bouncy, bounce, bouncer, sir-loads-alot, loady, loadup, springy, trampoline, hot-rocket 1 etc. but entr is worth a look. Why?…

An example of refactoring Scala code

I recently had to add code to an old and critical area of a 2 year old, rather large, Scala project. The code which centred around a core function that accepted an object instance, performed various actions that ultimately updated/transformed some properties on the instance. The passed in instance, a case class, used immutable values for all its properties so in order to apply these additional…

Refactoring Pattern Matching in Scala

I want to take a look at making effective use of Scala's pattern matching capabilities for a fairly trivial example. Don't expect any of this to be mind blowing but maybe you're venturing in Scala for the first time or have been tinkering for a while you might find this useful. The example I give below has been taken from a real world example but the context has been changed and made bit more…

On Popularity

Overhearing two developers lamenting someone’s choice of library it seemed that after bit of googling they deemed the library wasn't very good. It didn't have enough stars on GitHub. Popularity is an awful metric to judge anything on and the data behind thumbs or stars or hearts is so skewed to be meaningless too. Birth of a Star Having released a few inconsequential open source projects on GitHub…

The Twelve Factor App (Redux)

More Betterness

This article is adapted from a presentation I gave on team work and understanding Hi. This wont take very long so just sit back and enjoy yourself. I want to start with a quote. Have a read of that, and let it sink in for a moment before we move on. We'll come back to it later. OK? Good. I'd like to introduce you to a few people. This is Alice. Typical hacker, Alice rarely writes tests. Never mind…

Refactoring Towards Transducers

This is a quick post but hey at least I'm not talking about Elm . COMBOBREAKER! Clojure 1.7 introduced a new, fairly large concept - transducers . Transducers are "composable algorithmic transformations" which means they are little isolated transformer functions. They aren't bound to any particular input or output and as such can be stacked or composed ad-hoc to make neat little pipelines for data…

Deconstructing Your First Elm App

This article is similar to the Elm Architecture Tutorial so if you fancy a more official explanation you should check that out too. One of things that has really impressed me in my research of Elm has been the simplicity of the architecture of an application. An Elm app is essentially just a reactive stream of actions that transition the model into various states and in turn these state changes…

Zombie Dice Score Card in Elm

As promised yesterday evening I spent some time re-writing my Zombie Dice Score Card , originally written in ClojureScript and Reagent , in Elm . If you just want to poke around the code then the source for each implementation is available on Github, The Elm implementation The ClojureScript implementation If you want a bit of an experience report then read on. This work was done after spending an…

window.prompt() in Elm

I say "standard stuff" a few times in this article. When I say that I assume, like me, you've dipped your toes into Elm. If that is not the case and you want to change that situation then I recommend go give Pragmatic Studios your money. I was in no way paid or influenced to say that BTW. Having spent last night watching the Pragmatic Studios Elm: Building Reactive Web Apps I am now a fully…

Zombie Dice Score Card

Zombie Dice Score Card with Reagent

Over the weekend I built a Zombie Dice Score Card . I built it because I keep forgetting to get pen and paper for keeping score but mostly because I wanted to build something simple in ClojureScript again. The app is pretty basic, no server side interaction, no local storage interaction and only a few basic actions/features. You simply, Add players Play zombie dice as usual, rewarding points by…

Meteor: An Introduction by an Expert Beginner

Isolation

One morning you woke up and things were different. Not hugely different - just ever so slightly. Almost imperceptibly so. You didn't really notice it at first but eventually you felt that something seemed "off". You had got up, had breakfast, brushed your teeth, cycled to work, showered, made a coffee and sat down at your desk and you just sensed it. Do you remember when you were a kid and you…

Road Trippin'

This is a ramble. There is little originality in this post. It's quite long. There are some pictures. I'm OK with all these things. Projects are a bit like road trips 1 . You know where you want to go and roughly how you think you'll get there, you have your team of people joining you on the journey and no amount of planning is going to ensure you get to where you want to be when you want to be…

Provisioning Postgres via Docker

Previously we looked at provisioning Postgres via Vagrant and Ansible and in the spirit of trying something a bit different lets do the same thing using Docker . This was new territory for me but this guide will get you far enough for hacking around on a project. If this is an awful way of doing things let me know. Same rules apply - we want to provision a project level Postgres instance listening…

Provisioning Postgres via Vagrant and Ansible

This article covers a simple workflow for setting up a Vagrant instance running Postgres provisioned by Ansible . The first time I did this I found that most articles didn't cover everything and I had to look around to solve a few minor issues. It's worth noting that I can avoid all this and use Nic Ferriers very useful Postgres Dev Box . This work may be unnecessary but it's still fun -…

The Builder Pattern

Less Java with Lombok

So Java, you've heard of it right? It's the language thats used to convert XML into stack traces . You know the one... it's really popular and has a massive ecosystem of powerful open source tools and techs but everyone says it's the worst. Sadly making fun of Java lacks any real challenge because, if I can be blunt, Java makes it easy to do so (see I just did it without thinking). There are a lot…

Not All Frameworks

It's interesting, to me at least, that many people in the software industry have very black and white opinions. Maybe its the fact we wrangle binary (albeit at a very very high level these days) on a daily basis that gives rise to such binary views, or perhaps its reflective of the relative young age of the industry (and the mentality this fosters). Who knows. Sadly it does reflect, often…

Quick Markdown Preview in Vim

A while back a rather excellent person ( @tosborn ) posted an article on previewing files in your terminal . The concept is simple. Using Pandoc we can convert the markdown file to HTML and pipe the result into Lynx a terminal based browser. While this doesn't exactly give you an accurate representation of what the output will look like in a graphical browser it gives you an overall quick view of…

Don't Call It A Comeback

Taking a break is only a break if you get back into it. Otherwise thats just retiring. Activity on this site has declined recently. Initially it was intentional (in 2014 I decided to reduce my speaking engagements and focus on contracting), take a break, clear the head etc. but I got sidetracked and kept meaning to get back to a bit of writing and speaking. This proved harder than usual.…

Notes on Wake

I've spent the morning tinkering with Wake because I had time and it popped up on Twitter at the right time. It's an interesting language that aims to be a fast, expressive, type safe language that gives you testability from the ground up. What follows is a write up of my thoughts from the short time I've spent with Wake . Baked in Dependency Injection I have plenty of experience in Java and have…

The Twelve Factor App

Yesql - SQL in SQL in Clojure

Fair warning. This was initially a transcript for a yesql screencast I intended to do but time is dragging on and I really can't see myself getting to that any time soon. Why does this matter? Well I wouldn't be surprised if this reads pretty much like the yesql README.md with some minor embellishments here and there (and perhaps some opinion). But I'm putting it out there just, well, just…

Preflight Checks

What I'm about to describe is in no way a new thing, you'll find evidence of this sort of pattern everywhere. I've noticed some people do it instinctively and others simply fall into the trap that this sort of technique/pattern tries to avoid. Therefore I think its worth a bit of a mention. An Example in a Different Context Lets explore the problem in a slightly different context - dynamic vs…

Operation Sprint Finish

A few months back I closed off a busy period. Between normal 9-5 working and running some workshops and talks , I didn't have much free to devote to side projects and my writing. As soon as things died down I was ready to dive into all those ideas that I had logged and pushed to the back of my mind. Thats about as far as I got. Thinking. Little to no action, and even when I did muster the…

Functional Programming with Clojure

Tyrannosaurus Rx

Simple stubbing with lein-cooper and lein-oneoff

Work on lein-cooper has been pretty quiet. It's not because it has been abandoned but because it does enough for my needs. As and when it starts getting issues or pull requests coming in I can start adapting it to fit the wider needs of others. Recently I came across a lovely leiningen plugin called lein-oneoff . oneoff allows you to specify dependencies for a clojure script at the top of a…

Invasion of Privacy

There is a pattern I see more and more often in Java projects that use Spring as an IoC container thingymajig. I doubt it's limited to Spring and probably common among other IoC containers but I don't really get a lot of exposure to others because, When it's my own project I generally don't need one, and, When it's a project I'm involved in most people tend toward Spring (bar that one time Guice…

React

Nomadic Tendencies

"The future came and went in the mildly discouraging way that futures do." Neil Gaiman, Good Omens: The Nice and Accurate Prophecies of Agnes Nutter, Witch If there is one thing that shows the immaturity of the software industry (relative to other industries) it's the ever present need to jump to the next big technology. Tales of "leaving X for Y" dot the path from one trend to the next. "I'm so…

A Case for Luminus

First and foremost - frameworks. I view frameworks suspiciously and prefer to build my systems out of a core set of libraries and allow it to evolve and breathe a little without the artificial constraints of a framework. There is a time and place for frameworks, but that time and place never seems to be here and now were my work is concerned. This may be one of the many reasons I find Clojure so…

Working with Play apps in the Console

Having spent a fair amount of time working with Clojure in the last 6 months I've become rather accustomed to the REPL driven development approach. If you're unfamiliar with this approach I recommend reading/viewing Jay Fields post on the topic . Long story short RDD involves writing a small bits of code and executing them immediately. This gives you immediate feedback without having to write…

Play for (Java|Scala)

Estimates as Deadlines and the End of Everything

"If you guess how many USB sticks are in the jar you win an iPad" they said with a smile that had been seared into their face from years of standing at conference popup stands selling the same message. I glance over at the sacred prize. For randomly picking a number out of thin air I could easily walk away with a brand spanking new... "Wait", I say noticing something is odd about the prize. "Is…

Publish and Subscribe with core.async's pub and sub

Following on from my previous article that covered core.async 's merge and mix this article will delve into another suite of complementary high level methods - namely the channel driven publish/subscribe model that core.async can support. While the pub/sub mechanism provided by core.async is higher level than working directly with chan s and mult s to achieve the same thing (in fact that is how…

Combining & Controlling Channels with core.async's merge and mix

Most discussions around core.async , be it in Clojure or ClojureScript, tend to focus around the key concepts of the library - specifically chan s and the go / go-loop macros. This isn't a bad thing as that is were the power of the library comes from, on the other hand core.async also has a few powerful higher-level features that let you do some very interesting things and they deserve a bit of…

Basic ClojureScript Setup

ClojureScript is a bit of an awkward one to get into. If Clojure isn't your natural language then you may well find the clojarian setup and the long compilation times a bit of a frustration. Even if you're accustomed to the REPL based development approach that fits so well with Clojure there is still a certain amount of friction to be had with ClojureScript. Recently a strong desire to play with…

lein-cooper - Foreman style process runner for Leiningen

primrose - Experimental promise/future utility functions