It is what it is
Once upon a time I had a very dynamic site running here. Apache at first, Nginx later. PHP at some times. Wordspress at some point because I thought blogging was what sites were about. But then, maintaing wordpress is a hassle. And one day when I was upgrading my hosted machine, I completely fucked it up, lost the backups, destroyed what was there and decided I couldn’t be bothered fixing it for a long time. I put up a few simple pages, sirious.net was gone, and I put up a page that just said: deal with it. ...
Building a network monitor
As so many of us I’m currently working from home. My internet at home is most of the time pretty ok, but it can get very flaky, as in, speed drops, it can’t connect to certain hosts etc. However, every time I report this to my ISP, I get the same routine: restart, unplug, hold for 30 seconds, pray to Ubuntu and other ridiculous demands that make no sense because I didn’t change anything in the hardware (I didn’t even move it). ...
Writing your own Google Apps Plugins
So I am currently between jobs and I like to use that time to learn new programming languages as I believe that you should try to think outside your day to day experiences. Especially in this world of microservices, it makes sense to broaden your horizon to see if you’re not always applying your favorite lawnmower to a problem that requires a hammer. Given that I have about 4 weeks, I figure I can do more than one so I started with Erlang and I used Google docs to keep track of the notes. I quickly ran into a huge issue: there is no ‘format as code’ block functionality in standard Google Docs! Being used to Atlassian’s Confluence and even WordPress I was a bit undone. What next? Obviously I looked for plugins but they always want all the rights (like, run while you’re not around, access to your bookmarks and browser history, credit card details, you name it) ...
Your arguments are invalid.
Because it’s enough to have just one. See, thanks to scope and something called currying, any multi-argument function can be rewritten as a unary chained function. A simple example is this Javascript function to add two arguments: function add(x, y) { return x + y; } it’s easy to see what that function would do, you pass in two arguments and they get added: var sum = add(2, 3); // 5 now, in a functional world, you want to have unary functions that take only one argument. How can you achieve a simple add function if you’re not allowed to take more than one argument? This can be done by currying (and it requires scope) ...
I needed a TriFunction
Since Java 8 you can do such nice functional things, I love it. But, for some reason it has Functions and BiFunctions, but no TriFunctions! So, it was time to add the TriFunction interface. And yes, I’m very immature :-P import java.util.Objects; import java.util.function.Function; @FunctionalInterface public interface TriFunction<S, U, C, K> { /** * Applies this function to the given arguments * @param s the first argument * @param u the second arguments * @param c the third argument * @return K */ K apply(S s, U u, C c); /** * Returns a composed function that first applies this function to its input * and then applies the {@code after} function to the result. * * If evaluation of either function throws an exception, it is relayed to * the caller of the composed function. * @param <T> * @param after * @return */ default <T> TriFunction<S, U, C, T> andThen(Function<? super K, ? extends T> after) { Objects.requireNonNull(after); return (S s, U u, C c) -> after.apply(apply(s, u, c)); } } ...
You are more likely to be killed by an asteroid than by a terrorist.
Though what happened in Berlin today is still ‘most likely’ an attack (by a lone wolf, not by an army of asylum seekers) we can’t generalise and blame this on asylum seekers in general. That’s just what our nationalistic leaders want, what the news papers want because it sells more papers. By these rules of generalisation, all men are rapists, all fathers are incestuous, all mothers are whores, all white people trade slaves and basically all human beings are monsters. You cannot blame anything like this on entire groups of people. The fact is that only one person was driving that truck. Not a nation, not a group, not anyone else but that guy. ...
Fixing ORD fields in Oracle
If you use Hibernate and ordered list, you’re probably familiar with having to add a column to retain the order. If you don’t want nulls in your list, you sometimes need to reorder this (say, for instance, if you manually remove an item from a list via the database). Of course, you can do an update to “set ord = ord - 1 where ord = ” and continue doing so until you have the items nicely sequenced again. But if you have Oracle*, you can use the row_number() feature ...
Doing Enums with Jackson
Recently I’ve been working on a Jersey 2 application (a JAX-RS REST) using JSON. For the JSON serialization and deserialization I’ve chosen to use the Jackson framework. One of the reasons for this is that prior we’ve been using Freemarker templates, but if you use those, you can easily create invalid JSON which will eventually screw up your clients. Using Jackson & Jersey allow me to skip the entire Object graph to template to output chain and simply use POJOs and use annotations to model the JSON request and responses. ...
Security and safety
Recently people who use Mac computers have asked me about security. Good question. I’d say they are pretty secure. They didn’t ask me about safety. That is a different question. I will try to explain why: The only safe operating system is the one that is turned off, disconnected and preferably locked in a safe. And even then, it only takes one human to breach that security. As long as it is not turned on, or plugged into a network, it is still secure, but not safe. ...
T is for Telecom, where communication goes wrong...
It’s a wonderful day in the world of telecommunications… First, the 3G service on my phone went dead (it still showed wonderful connection, but as soon as you tried anything it said I didn’t have cellular data). Since I recently moved from Vodafone to Virgin Mobile who uses Optus, I thought, how bad can it be. But hey, after a few tests with luckily another phone at hand, it obviously showed that there is probably one flag not set correctly at their end. We can only hope that the morning crew is able to set the flag. ...