machiel.me
bytes.Buffer for string concatenation in Go · Machiel
https://machiel.me/bytes-buffer-for-string-concatenation-in-go
BytesBuffer for string concatenation in Go. July 13, 2015. Just thought I would write a quick reminder on how to properly do string concatenation in Go. Every now and again I see string concatenation done like this:. MyString := myOtherString anotherString. This is not the most effective way. Let me show you an example. Recently I quickly wrote a library to slugify titles for one of my personal projects. When hacking it together I used string concatenation like demonstrated earlier. Slugify creates a slu...
machiel.me
Small introduction to tags in Go · Machiel
https://machiel.me/using-tags-in-go
Small introduction to tags in Go. July 21, 2015. Go has an awesome feature built in, namely tags. You are probably already familiar with them, they are like annotations in Java for example. This is just a quick introduction: how to use them, and how to implement them. First of all, a quick introduction to tags. Let’s take a look at the. Package. This package makes use of tags for the marshalling and unmarshalling of structs/json. Title : My title, pageviews : 812 }. This will simply output the following:.
machiel.me
Inject JPA Entity Manager with Guice and Play · Machiel
https://machiel.me/inject-jpa-entity-manager-with-guice-and-play
Inject JPA Entity Manager with Guice and Play. December 10, 2014. Recently I’ve been making a lot of use of the Play Framework. Overall I am pretty satisfied, but Play makes use of a lot of static helper classes which quickly lead to tightly coupling Play into your code. For a while I have been trying to find out how to inject the. Into my classes without having to call the. Before, my code looked like this:. As we should all know by now, this is not neat. Here is how I solved it:. Time in Go: A primer.
machiel.me
What framework should I use for my project? · Machiel
https://machiel.me/what-framework-to-pick-for-my-project
What framework should I use for my project? December 28, 2014. Do you recognize this question? You have a great idea for a new side project and after 100 hours of research and looking at benchmarks you’ve finally decided what programming language to use. Well done. So - now it’s time to search for a cool framework to use! Yay, big fun. So you start searching things like. Lsquo;best web framework for X’. So you will simply Google for. Lsquo;framework Y vs. framework Z’. Just try it and ignore other people...
machiel.me
Gracefully stopping goroutines · Machiel
https://machiel.me/gracefully-stopping-goroutines
July 8, 2015. Recently I developed StrangerBot. A bot built using the Telegram Bot API. It’s pretty cool. It got more than 10,000 users in a week. This bot was quickly hacked together, so I keep improving it and deploying fixes on a daily basis. I make use of channels that holds the received messages, and redeploying causes a loss of these messages. So I went to figure out how to gracefully stop all running goroutines before quitting the application, in order to prevent losing the messages. Ndash; Simpli...