Recent Posts

More Posts

So we create a concurrency-safe LRU in the last post, but it was too slow when used concurrently because of all the locking. Reducing the amount of time spent waiting on locks is actually not trivial, but not undoable. You can use things like the sync/atomic package to cleverly change pointers back and forth with basically no locking needed. However, our situation is more complicated than that: we use two separate data structures that need to be updated atomically (the list itself and the index.

CONTINUE READING

In my job, I often catch myself having to implement a way to keep data in memory so I can use them at a later time. Sometimes this is for caching purposes, sometimes it’s to keep track of what I’ve sent some other service earlier so I can create a diff or something. Reasons are plenty. I noticed that I keep writing versions of the same thing over and over and when we’re doing that, maybe it’s time to try and create a more generic solution.

CONTINUE READING

I’ve just spent much more time than I ever wanted to get this right, so here’s how I did it for future reference. I have a function that returns an http.Handler, kind of like this: func Handler(prefix string) http.Handler { r := mux.NewRouter().PathPrefix(prefix).Subrouter() r.HandleFunc("/foo/", fooHandler).Methods("GET") r.HandleFunc("/bar/", barHandler).Methods("GET") return r } The prefix could be something like “/api/” or “/ui” or whatever, so this http.Handler will serve /api/foo and /api/bar, for example.

CONTINUE READING

China wants to be the first country to build a practical space-based solar power station. Space-based solar power would presumably be much more sustainable and clean than fossil fuels and more efficient than the current sustainable energy sources we have on Earth. There are many problems still to be solved before these power plants can exist so China’s expectations are more wishful thinking than based on reality. Astronomers have found a massive gas-giant that is astonishingly 23.

CONTINUE READING

Rodney Brooks writes about the 7 Deadly Sins of AI Predictions. The text articulates a lot of my personal doubts about much of what I see on the news regarding AI. Some people seemed to read this article as a rebutal of AI itself, which I find puzzling as I did not read that at all. If anything, Brooks seems to believe AI will be much bigger than we can possible imagine.

CONTINUE READING

Contact