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 moment where it counts, whether it’s contact with your opponent, or with that golf ball, they all essentially result in the same thing.

Leadership is like this. Some leaders are quiet and gentle, some are loud and angry. But both, when done right and with the right team, at the moment where it counts, the results can be the same.

Find your leadership style. Find what works for you, find what works for your team, and go after those results.

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 to try out. So when I try to picture how someone can feel stuck, I struggle to see where that obstacle is coming from. 

There could be many reasons at play here. A more benign reason being fear and uncertainty: “There are so many things I could learn, what if I pick the wrong one?”. To that, I say start anywhere and see where it takes you. This approach then takes you on a “just in time” approach to learning, where, as you get deeper down the rabbit hole, the topics you need to learn change depending on where you end up. Whereas a more serious reason would be that the individual feels it’s not their responsibility: “My manager should tell me what to learn”. I could see how this way of thinking could be born out of schooling or bootcamps where we are told what to learn. So the responsibility for one’s development has been abdicated. 

Self-directed learning is a skill, but an important one for anyone looking to get ahead. For those that struggle, my advice is to just jump in. Doesn’t matter where and it doesn’t matter how. Pick up a book. Watch a video. Listen to a podcast. But no matter what, put as much of it into action as you can and link the dots. Every step you take will lead to the next, and that next step may require you to change course, but that’s okay, as now you’re learning.

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:

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 about “learning voyerism” where you are really more interested in the idea of learning new things instead of learning the thing itself and the second talked about spending time going deeper into topics instead of boucing lightly through many different ones.

It is very difficult to stay focused on one thing when there are so many things happening in the world of computing all the time. There are a tonne of new and exciting languages and frameworks being released all the time. And while it would be great to try them all, that can only mean that you’ll never actually become good at one of them.

I have always been a bit of a generalist and while knowing a bit about everything isn’t a bad thing, there is a fine line between knowing a bit of everything while being proficient at some things and knowing not quite enough of everything to be unable to do anything at all.

OpenSSL issues building Ruby 2.2.2 with ruby-install

Leave a comment
programming

Trying out chruby and ruby-install and installing Ruby 2.2.2 with ruby-install was giving be the error:

Setting the LDFLAGS env var solved this for me:

 

Stupid coding mistakes

Leave a comment
programming / ruby

Made this mistake today while writing some code to delete data out of Redis.

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:

With these values we can then calculate the affinity between sold products:

 

Generate a random email address in TextExpander with Applescript

Leave a comment
apple / computing / osx

Since my last post about generating random email addresses in TextExpander, I’ve move from using Ruby to Applescript to do so. Here is my script which essentially does the same thing.

 

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.

 

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 so can make an entire application easier to extend, understand and test. I have tried approaching this from different angles in different projects and I’ve found that the two main hurdles to getting this right are naming classes and putting them in the right place.

I have experimented with naming such as UserAuthenticator and UserAuthenticationService, and always end up feeling uncomfortable I constantly wonder if the other name is better or if there is a better way entirely. Using agent nouns in class names is considered a code smell, but the more that I think about it the important part is picking a choice and sticking to it. I was looking at the GitLab repository and noticed that they’ve done exactly that, everything is named in a consistent manner. I think many may dislike that but it makes things extremely clear and easier for anyone contributing as to what they should name their classes and where they should put them.