Category Archives: Programming

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); } }); 2. Apply filter to field {{someField | MonetaryUnit}} For example, if someField has a value of “2000” it will render as “20.00”.

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

Xamarin View Fails To Bind To Model

MvxBind:Warning: 9.81 Unable to bind: source property source not found Property:SomeObject on null-object One of the causes of the above error is mixing up the order of base.OnCreate and SetContentView calls in the Views OnCreate method. Below is an example … Continue reading

Posted in Programming | Tagged , | Leave a comment

5 Minute NLog Wrapper: Limiting The Number Of Emails Sent

If you’re using an Email target to send notifications when an error occurs, it may be useful to limit the frequency of those emails. One way of achieving this is to wrap your target that sends email in a Wrapper … Continue reading

Posted in Programming | Tagged , | 3 Comments

Unit Testing WebMethods Services With JUnit

Unit tests are ubiquitous (or at least should be) amongst software projects. Some environments are easier to unit test than others, and WebMethods is somewhere in the middle. As the services run on a server and the tests in your … Continue reading

Posted in Programming, Software AG | Tagged , , , | 2 Comments