xpam.pl

  • Apache http to https redirect – use 307

    Who knew that a simple thing like HTTP redirects would be so complicated? It turns out clients will just change POST to GET on 301 (Postman, curl, everyone?), same with 302 which really behaves like 303 and that is also an old implementation “bug”. Yeah, seriously. If you have a REST API with POST (or…

  • Setting env variables with hyphen and running a program

    Docker compose allows you very unrestrictive naming of your environment variables. It allows you to use hyphen and other “special” characters in variables names. When you need to use these variables in regular shell you are out of luck, bash and many other shells do not allow hyphens in variable names. But this is merely…

  • Obscure IntelliJ IDEA “bug” with maven jdk profile activation “not working”

    Since Java 9 it is popular to activate additional dependencies which were removed from the core JDK through maven profile. <profiles> <profile> <id>java9-modules</id> <activation> <jdk>[9,)</jdk> </activation> <dependencies> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> </dependencies> </profile> </profiles> Using Java 11 , jaxb-api would correctly show in maven dependency tree and Docker packaged application would work correctly with…

  • Receive only the data your client needs – full dynamic JSON filtering with Jackson

    A lot of times JSON returned by your REST API grows to incredibly big structures and data sizes due to business logic complexity that is added over time. Then there are API methods returning a list of objects which can be huge in size. If you serve multiple clients, each one can have different demands…

  • Updating server from Debian Stretch to Buster

    Not the most pleasant experience.. I expected a smoother upgrade from Debian team. Upgrading from 8 to 9 was a walk in the park compared to this. 1. MySQL silently fails to start after upgrade MySQL was left behind at version 5.5 after upgrade and would just not start anymore, probably segfaulting. There is no…

  • HTPP Accept-Language request header to ResourceBundle

    HTTP Accept-Language header is specified by the client to inform the backend what the preferred language for the response is. In Java, the go-to utility for handling localization is ResourceBundle. What is missing is a standard way to properly convert the input header to the correct ResourceBundle. Specifically, ResourceBundle i18n = ResourceBundle.getBundle("bundles/translations", request.getLocale()); is insufficient.…

  • resize Fedora root partition

    Default root partition size on my Fedora installs usually becomes too small down the line to the point I can no longer install packages or perform the upgrades without removing packages or clearing dnf cache. Therefore I wanted to shrink my home partition and add that space to root. We can’t perform the resize while…

  • That moment when you need to look up definition of C++ for loop

    I was getting a segfault on an old piece of code which I maintain. The culprit was pinpointed to this: bool found = false; vector<string> :: iterator i; for (i = v.begin(); !found && i != v.end(); ++i) { if (name == *i) { found = true; } } if (found) { v.erase( i );…

  • Tenant resource authorization in JAX-RS

    You have a book REST resource and each book has an owner. Only the owner of the book can access an owned book. JAX-RS specification has no answer to this problem since it only provides a role based security with @RolesAllowed annotation. It is unfortunate JavaEE spec does not offer at last some interfaces which…

  • Creating a new torrent and seeding with Transmission

    You have setup a Transmission server on your Linux box together with Transmisison Web or something along those lines and now you are wondering.. how can I actually seed a NEW file? I couldn’t find a straightforward answer on the web so here is the short tutorial: Upload your file to your transmission download directory…

Categories