Author: Richard

Find Your Leadership Style

Leave a comment
leadership

When you have sports coaching, whether that be for martial arts or golf etc, often the coach will look at your technique and say “you’re doing it all wrong!”. And then you find that each coach has their own theory on how it should be done, even claiming other coaches don’t know what they’re talking about. But when you look at all these different theories and techniques, when you put them into practice, at that […]

Welcome

Uncategorized

Hello and welcome! My name is Richard Hart. I specialise in helping organisations build great products with technology. This is my personal site where I write a mix of blog posts and notes on various topics. In many cases these are un-finished thoughts and ideas. This stems from the ideas of having a digital garden and learning in public. Leadership Find Your Leadership Style

Learning to learn

Leave a comment
self-development

The best developers I have worked with have all been incredible in self-directed learning. And yet a common pattern that I see more junior developers get stuck on is not knowing what to learn to progress their skills as a developer. I spend a lot of time reading, whether that be blog posts or books, watching talks or listening to podcasts, I have never found myself short of topics to look into more or things […]

Spring Boot JAXB unable to marshal type error

comments 8
java / programming

Working with a SOAP API with Spring Boot WS. I was getting the following error trying to create the request. I was originally directly using the JAXB generated classes to form my requests: The correct way is to use the provided JAXB ObjectFactory: But to prevent marshalling errors you need to wrap your object in a JAXBElement object: [crayon-5f374bc612a1d968923919/]

No more computing books

Leave a comment
books / computing

One of my bad habits is constantly buying computing books. This wouldn’t be so bad if I read them, but I have amassed a huge backlog of books that will most probably never be read and which ends up being a waste of money. A couple of posts I read recently have led me to the decision that I should stop, or at least drastically cut down on, buying computing books. The first post talked […]

Stupid coding mistakes

Leave a comment
programming / ruby

Made this mistake today while writing some code to delete data out of Redis. [crayon-5f374bc6149c1446393896/] The mistake was in the final method keep_keys. Every check to see if a key should be rejected I was adding an element to the flattened_keys array over and over again, causing my deletion to slow down over time. A simple change to memoize the keep keys made the process go from never finishing to, completing in a few seconds. […]

Product recommendations in Spree using the Jaccard Index

Leave a comment
rails

Being able to recommend products to shoppers is a vital part of any online store. The “Customers Who Bought This Item Also Bought” section can lead to a lot of extra sales if done well. The Jaccard Index is a way of measuring similarity between items. Using some custom SQL we can extract the values we need: [crayon-5f374bc614a28807819367/] With these values we can then calculate the affinity between sold products: [crayon-5f374bc614a2c971730198/]  

Using Typeahead.js without Bloodhound

comments 14
programming

A great library for adding typeahead support to your site is Twitter’s Typeahead.js. Even better is the excellent Bloodhound suggestion engine which comes with it. Sometimes though if you’re dealing with a remote suggestion engine like Elasticsearch’s completion suggester you don’t need to run remote results once again through another suggestion engine. Bypassing Bloodhound is as simple as hooking your own source function into your Typeahead definition. [crayon-5f374bc614adc763391441/]  

Naming service classes in Rails

Leave a comment
programming / rails

One of the core ideas of Rails is convention over configurations. Models go in app/models, controllers go in app/controllers and views go in app/views. The danger is that we stick to those conventions no matter what and we end up either with fat controllers, fat models or even worse a mixture of both. Many times we don’t take enough advantage of Ruby’s object oriented nature and the ability to extract functionality out into separate classes. Doing […]