xpam.pl

Category: Programming

  • Protecting your vBulletin 4 registration against spambots with email domain whitelist

    If you are still hosting a vBulletin 4 forum for whatever the reason may be, you are probably experiencing the spambot hell. Captcha plugins are out of date or simply bypassed and protections like human verification questions just do not seem to work. You could throw Cloudflare in front for some bot detection and that…

  • Building Qt 5.15 on Windows with OpenSSL

    I have written about the many problems of building Qt 5 with OpenSSL in the past. Several years later, it is time to upgrade to latest Qt 5.15 which is presumably the last in the Qt 5 series. This time I decided to drop the Windows XP support since it is just too much work…

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

  • 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.…

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

  • Can JPA @Version column be nullable?

    When using @Version with yor JPA entities you might be wondering, should you make the column nullable or not? There is no answer to this question in the documentation or the internet in general. The only way to find out was to test it. The answer is: column has to be not-null, at least for…