Sep 4, 2017 · 1 minute read · Comments
elm
Last Wednesday I gave a second talk about Elm at Elm Prague Meetup. This time I talked about a toy project animating SVG bubbles received over a WebSocket inspired by Listen to Wikipedia. The source code for the application is available on GitHub, the slides are available as well.
We're looking for developers to help us save energy
If you're interested in what we do and you would like to help us save energy, drop us a line at jobs@enectiva.cz.
Jul 23, 2017 · 9 minute read · Comments
golang
In our services written in Go, we quite heavily rely on Go kit. You can build anything with just Go’s standard library. It has very little opinions about how to do things and gives you a lot of latitude when architecting your application. That’s great for trying things out or even if you have a single application, but when you develop multiple services in a team, it’s useful to have a common baseline for routine tasks and Go kit does exactly that.
Read On →
Jun 17, 2017 · 3 minute read · Comments
elm
At the end of May, we gave a talk about Elm and JS interop at Prague Elm Meetup. One of the sections naturally talked about native modules and their dangers, so it shouldn’t come as a surprise that they came to bite us just a few days later.
The initial manifestation was that some parts of the Elm application were using the wrong copy, more specifically a wrong language of the copy.
Read On →
May 31, 2017 · 5 minute read · Comments
elm
I’m preparing a talk about Elm and JS interoperability for Prague Elm Meetup and I got to the topic of flags, i.e. how to initialize an Elm app with data passed in from JavaScript. Looking into it, I realized how much I don’t know and had to find out. There was one special question which bothered me from the moment I tried using flags: Elm automatically decodes the data which limits it to elementary types and their combinations.
Read On →
May 1, 2017 · 3 minute read · Comments
golang
Last week I ran into an unexpected behaviour in Go regarding type switching. In the end, it makes perfect sense but the initial reaction was complete confusion.
The algorithm in question needed to perform different types of actions based on incoming messages. Each message could provoke different number of reactions which could take form of different data structures or operations to be performed later. Message handlers therefore returned a slice containing either values of struct A, B or C, or an anonymous function.
Read On →
Mar 23, 2017 · 3 minute read · Comments
golang
Recently, we developed a web application which involved the use of multiple goroutines. As a result data races were just around the corner. Fortunately, Go comes with go race detector — an incredible tool which makes them easier to detect.
Let’s look at a simplified example:
var servedDevices []Device devicesToProcess := make(chan []Device, 1) go func(devicesToProcess chan[]Device) { select { case devices := <- devicesToProcess: for _, device := range devices { go func(device Device) { // Operations on Device servedDevices = append(servedDevices, device) }(device) } } }(devicesToProcess) A channel for slices of Devices is passed as an argument to a goroutine.
Read On →
Mar 7, 2017 · 4 minute read · Comments
golang
Last week, I was working on extending goworker to use Sentinel, a Redis HA solution, instead of plain Redis. The high level goal was clear enough, but the way there was anything but.
The root problem which made me go through all stages of programming:
that’s easy; huh, strange; WTF?; smashing head agains a wall; and facepalm/double facepalm/n-facepalm turned out to be that nil != nil. At least not always.
Read On →
Feb 6, 2017 · 1 minute read · Comments
css
While updating styles for Enectiva to make it more responsive I came across a problem with flexbox — there are some restrictions in particular browsers.
For instance, one issue I encountered was that some HTML elements can’t be used as flex containers. For instance, we wanted to use fieldsets because of their semantics both alone and combined with legends and make them flex containers. This, however, doesn’t work in Chrome. The following example shows that using the same CSS properties (display: flex; flex-flow: row nowrap) the elements inside the fieldset are in a row in Firefox but not in Chrome.
Read On →
Jan 8, 2017 · 3 minute read · Comments
golang
One of Go’s advantages is its familiar syntax and vocabulary. Parentheses, brackets, and braces have the meaning you expect. Programs are composed of well known keywords like var, const, for, or return. This familiarity, however, means that one might forget that Go might have slightly different semantic for those terms.
One such example is the keyword break. Recently, we wrote a program which boiled down to an equivalent of:
for i := 0; i < 10; i++ { fmt.
Read On →
Nov 26, 2016 · 2 minute read · Comments
gitruby
Last week, we moved our git repositories to GitLab so we needed to change all deployment scripts. We deploy using Capistrano and looking at deploy.rb file the task looks simple. Right at the top is something like:
set :repo_url, 'user@domain:repo.git' Having learnt from experience, I consulted the docs to verify my assumptions. It was exactly as I thought, I changed the URL, ran a deploy to make sure everything is ok and all permissions are set up properly.
Read On →