Category Archives: Programming

Almost Useless Top Tip for Today: Lombok @RequiredArgsConstructor

Wiring up Spring Components using @Autowired is convenient but makes testing harder. A better solution is passing dependencies in through a constructor. However, that means creating a constructor. Lombok to the rescue with the @AllArgsConstructor annotation which will create a … Continue reading

Posted in Programming | Tagged , , | Leave a comment

Spring Slueth Stops JMSListener Consuming Messages

Adding the following dependency causes JMS messages to stop being consumed. <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> <version>2.1.0.RELEASE</version> </dependency><dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> <version>2.1.0.RELEASE</version> </dependency> The issue is that Spring Sleuth prevents the JMSListener from being registered as per: Jms listeners not running To fix … Continue reading

Posted in Programming | Tagged , , | Leave a comment

On Ubuntu 16.04 running pharo, from the Moose Technology download, results in the following error: unknown option: -plugins To fix, change: # execute exec “$LINUX/pharo” \ -plugins “$LINUX” \ -encoding utf8 \ -vm-display-X11 \ “$image” To: # execute exec “$LINUX/pharo” … Continue reading

Posted in Programming | Tagged , , | Leave a comment

Error on ‘inverse_transform’ of LabelEncoder

If you get the following error when calling inverse_transform on sklearn.preprocessing.LabelEncoder ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() You could be passing in a numpy.ndarray of strings, not numeric … Continue reading

Posted in Programming | Tagged , , | Leave a comment

Grails Bootstrap Form Field Error Template

Define a Grails template in /layouts/_formFieldError.gsp <div class=”form-group has-error”> <g:hasErrors bean=”${fieldModel}” field=”${fieldName}”> <div class=”errors”> <g:eachError bean=”${fieldModel}” field=”${fieldName}”> <span class=”help-block”><g:message error=”${it}”/></span> </g:eachError> </div> </g:hasErrors> </div> Usage <g:render template=”/layouts/formFieldError” model=”[fieldModel: myModelObject, fieldName: ‘myFieldName’]” />

Posted in Programming | Tagged , , | Leave a comment

Making Sure Our Technical Communities Are Safe Spaces For All

The number of technical user groups in South Africa has grown and we’ve now got several vibrant communities. Which is awesome! If we want to make sure our communities continue to be as awesome and welcoming as they are, we need … Continue reading

Posted in Event, Programming | Leave a comment

AngularJS – Format Cents As Monetary Unit (Dollars, Rand etc)

1. Create a filter app.filter(’MonetaryUnit’, function () { return function (amount) { return (amount / 100).toFixed(2); } });app.filter(‘MonetaryUnit’, function () { return function (amount) { return (amount / 100).toFixed(2); } }); 2. Apply filter to field {{someField | MonetaryUnit}}{{someField | … Continue reading

Posted in Programming | Tagged | Leave a comment

May Jozi JUG – Code Dojo and Open Source Contributions

The Jozi JUG is hosting their May event on Monday the 26th. There will be two tracks on the evening, so there’s something for everyone. What are you waiting for? RSVP today! A big thank to Oracle for hosting and … Continue reading

Posted in IT, Programming | Leave a comment

HMAC SHA512 in Java

When doing some research on authentication tokens I came across the post Don’t Hash Secrets and learn’t of a few new things, one of which was HMAC: Hash-based message authentication code. I use Google Guava for some utility functions, but … Continue reading

Posted in Programming | Tagged , , , | Leave a comment

Submit HTML form using AngularJS

The payment gateway I’m integrating with requires a post from a form to navigate to their payment page. Some of the information I need to post is dependent on the results from a call to my back end server. My … Continue reading

Posted in Programming | Tagged , | Leave a comment