xpam.pl

  • An OpenSprinkler success story

    I wanted to automate the watering system at home preferably using open-source and DIY systems. The initial plan was to go with plain RPi, OpenHAB and some GPIO code driving the sprinkler valves but the problem was creating a useful UI to control the system since OpenHAB is too clunky and generic looking. I was…

  • Debugging Laravel in Eclipse PDT

    I don’t use PHP enough to justify buying a PHPStorm license so I am using Eclipse PDT instead. I am a bit rusty with Eclipse and PHP so I couldn’t really find anything on Google about debugging Laravel projects in Eclipse. Finally figured it out, here is how. Examples are done on Eclipse IDE Version:…

  • 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 );…

Categories