Go and SQL memory leaks

Posted on

The scenario: You’ve got some Go code. You can run the unit tests individually, but when you try go test -v ./… or try to run continuous integration, the tests fall over from lack of memory. There are lots of things that could be causing the problem, but one you should definitely check for is unclosed SQL database statements and connections. You’re probably aware that the general pattern for SQL queries in Go, assuming you have a sql.…

Read more »

JDBC connections over TLS with IBM DB2 11.1

Posted on

With GDPR around the corner, lots of organizations are suddenly developing an increased interest in encryption. In particular, I found myself asked to ensure that all of our database access was performed over encrypted channels. No problem, I thought, DB2 is bound to support TLS connections. And indeed it does, but the setup process turns out to be a bit involved. While I was changing things, I decided to upgrade to DB2 11 and implement pooled JDBC connections.…

Read more »

Java time conversion madness

Lotus Notes is an old piece of software. It was inspired by PLATO Notes and DECNotes, and its development began in 1984. The first release was in 1989, though that’s not particularly old by IBM standards – IBM is still developing IMS, the database designed in 1966 as ICS/DL/I to keep track of the approximately three million parts that made up an Apollo Saturn V. Nevertheless, Notes predated Java, JavaScript, Unicode, TCP/IP support in Windows, and many other things we now take for granted.…

Read more »

Logging levels in Go

Posted on

I keep seeing people in the Go community suggesting that there’s no need for error levels when logging. Often this idea is pushed through memes like “You don’t need levels if you’re only logging errors”. Perhaps I see this in the Go community because Go’s standard logging API has no support for levels. I think Go’s logging is woefully inadequate. I’ve tried levelless logging, and it doesn’t work for me.…

Read more »

Go, PostgreSQL, time zones, UTC, and +0000 +0000

Posted on

Imagine you’re writing a web application in Go, and storing your data in PostgreSQL. At some point, you find yourself wanting to store timestamps, and display them to the user in local time. Being a smart developer, you decide to store all your timestamps in UTC, and convert them for display. Suppose you use a TIMESTAMP WITHOUT TIME ZONE data type, because you know all your values are going to be UTC.…

Read more »

Go Fish

Posted on

I’ve been trying Fish, the Friendly Interactive Shell. I was driven to do so by two Zsh bugs. The first is that when I SSHed from a Linux machine to a Mac, something was getting messed up or not initiated correctly in my terminal session. There were control codes which messed up the display, and no matter what I set the prompt environment variables or TERM to, they remained. The problem didn’t occur in the opposite direction.…

Read more »

Curried JavaScript

I got contacted by someone who had been stumped by an interview question about JavaScript. The question involved currying functions, and although I’ve mentioned curried functions and JavaScript before I haven’t really done more than assume people know what that is. This person had found my web site but remained confused. Since I’m on vacation and I was drinking my morning coffee and feeling generally benevolent to the world, I wrote up a reply.…

Read more »

Go: Some lessons learned

Posted on

Based on my experience building, deploying and maintaining a small web application for work purposes, I’ve assembled some thoughts on Go. Design patterns I started out with little code organization in terms of files and directories. I eventually migrated to model, view and controller subdirectories, plus an internal/test directory for test utilities. I’m not a big believer in ORMs. I’ve tried them in the Java world, and found that the benefits aren’t enough to make up for the downsides, at least not given my reasonable SQL-query-writing abilities.…

Read more »

Disabled and read only

Posted on

XPages has a “read only” feature for fields. It also has a “disabled” feature for fields. In case that’s not confusing enough, it has a “show read only as disabled” feature too. These three flags determine whether a field’s value is saved, whether it appears as text or as a form control, and whether the form control is read-only or disabled. Read-only fields can be selected normally with the mouse, but (at least in Bootstrap) are greyed out:…

Read more »

Perils of automatic invisible software updates

A couple of days ago I noticed my Google Fiber uplink was only 100Mbps instead of 1Gbps. While debugging with the tech via phone, it seemed as though any time I had something connected to port 4 on the network box, the speed dropped. I moved cables around until the speed was back to normal, and they scheduled a tech to come swap out the box. Today the tech arrived and was unable to reproduce the problem.…

Read more »