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 is probably a good idea.
I observed that the major hole in arresting the bots from even registering is the use of various random domains and subdomains in their emails. You do have an email banlist option in Admin CP but that really does not cut it because there is no support for regex and there are infinite domains to block. An email whitelist would be much better because you then force the spammers to create email accounts at major email providers like gmail and outlook which slows them down.
That will block legitimate users who use personal email domains but that is usually a small minority that can be handled on case by case basis. It depends on your use case if you can accept that.
There are no email whitelist plugins out there so I decided to just dig into the vBulletin code and hardcode it.. how hard can it be? Turns out it's easy.
The function that handles the email ban list can be found under the name is_banned_email in a includes/functions_user.php.
Right before the return statement, we can hardcode our email domain whitelist as an additional protection:
One of the good things that cloud brings is that you can easily increase size of your VM disks as they fill up. Unfortunately the process is a bit manual because you also need to resize your filesystem in order to see the change. GCP has this process documented.
We can automate this with a udev rule. This was tested on GCP and Ubuntu 20.04 with ext4.
This rule listens for change events in block device subsystem and filters by the RESIZE property. If conditions are met, it will adjust your filesystem to use the rest of the free space.
You can make the udev rule more specific to target only sdb or sdc for example. I could not find a good documentation on udev rules that would explain exactly which event properties need to use the == selector (for example SUBSYSTEM), which are considered ENV (supposedly these are any custom properties) and which should use an ATTRS filter.
The property could possibly differ depending on OS and cloud provider, so before adding the rule, you can listen for the events and see the full event output while you change the disk size with
I had a bright idea to use my extra 2 mouse buttons to quickly switch to a task in Debian KDE, for example to terminal or browser. Since the mouse is in the palm of your hand most of the time this is quite a bit faster than actually clicking on a task or hitting a key combo on your keyboard.
I started by pinning Konsole and Firefox to taskbar positions 1 and 2 and then went to
Shortcuts like Meta+1, Meta+2 etc already exists so I thought I can simply add an alternative shortcut. Unfortunately, this configurator does not detect the mouse buttons (nothing happens if you click and key is not recorded).
Fortunately, KDE also has a nice feature in your Mouse settings to remap the extra buttons to anything you like in
In there, I simply assigned one button to Meta+1 and the other button to Meta+2. I can see plenty of other useful possibilities like mapping the button to shift through different windows of a task etc.
The mouse I use is Roccat KONE Aimo which also has a third button labeled T3 (and a plus/minus buttons which are bound for DPI sensitivity by default) but T3 does not get picked up by the configurator even after disabling EasyShift (which basically remaps the whole mouse when pressed so all the buttons can have a different function temporarily). The surprising thing is that if I map that button to some functionality like Browser Home (in Windows Roccat driver) it does actually work in a Linux Browser, so I am not sure why KDE Mouse configuratior does not detect this button.
Update: I found an alternative way of doing this which also enables T3. On Windows, using the Roccat driver software, assign each mouse button a shortcut. Try to find something that is not used by anything. I ended up with something like alt+ctrl+Page Up/Down/End.
Then in KDE shortcuts, assign an alternative to Meta+1 by clicking the button. This time, the button is recorded as the assigned shortcut.
Divide and Conquer is a Medieval II: Total War Kingdoms mod in Lord of the Rings setting. Technically a "sub" mod of Third Age: Total War, but at this point it is fair to say it is a mod on it's own since it greatly imroves and expands almost every aspect of TaTW.
I have finished TaTW campaign 3 times before so when the nostalgia kicked in again I decided to give DAC a try.
Difficulty: hard (I personally find the "very hard" setting just a grind with no added value in this case, hard is plenty of a challenge)
Style of play: try to follow the lore
Rohan Campaign playthrough – the beginning
I chose Rohan since I've already done High Elves, Dwarves and Gondor in TaTW. Events described here are as they unfolded in my playthrough but there can be major differences depending on faction politics.
You begin with a handful of known generals such as Theoden, Theodred, Eomer, Hama, Gamling and others. Your initial campaign will revolve entirely around defending and defeating Isengard which will attack almost immediatelly. You need to send all your available armies to Westfold (Foldburg) and defend it at all cost. Losing the region will set you back tens of turns so try to hold out. Place two general units since they are overpowered. You can do a bit of research on the side but most of your spending will go to replenishing the armies to defend wave after wave of attacks. Eventually Saruman himself may lead a siege and by killing Saruman the whole Isengard will fold into rebel territory.
In every captured settlement, the number one building you should always upgrade first is culture and then masonry. You need to convert non-native culture to your own and that takes tens of turns so you want to speed that up as much as possible.
You then proceed to expand further west and defeat the Dunlendings.
You should probably forge an alliance with Clans of Enedwaith to get some help here and secure your west border for the rest of the campaign. Create trade agreements with all the neighbouring nations, even some of the dark forces are acceptable in the beginning when you need to build up your income.
The next natural progression is to go further into the Misty Mountains and defeat the goblins there. At this point Moria will probably be divided so you can gift West Moria back to Dwarves of Khazad Dum and forge an alliance.
Building up your income
Depending on how other factions are progressing, you will probably have the whole west border secured with Enedwaith, Dunedain and High Elves at your borders (forge alliances if possible). This is still not big enough region for sufficient income so you can skip over High Elves and continue your conquest on Remnants of Angmar. Another possibility is to take Dol Guldur which is relatively easy to take but has a slightly negative position. First, if you retake any settlement which belonged to Woodland Realm you should gift it back or they might think about reclaiming it by declaring war on you. The second negative is that you get a likely border with Easterlings. If you take Dol Guldur, take the 2-3 cities inside the safety of forests and do not expand further east, except maybe for one single stronghold (with ballista towers). Having a major war with Easterlings is the absolute number one mistake as it drains a lot of your resources and you will make almost no advances into their vast no-choke point territories.
This far into the game Gondor can start having trouble defending itself so with sufficient income from your expansion you should be able to finance war against Mordor. You still have expansion options on the north to Snow Orcs or Ered Luin (which choose the dark side in an early Blue Wizard event) but if Gondor is getting in trouble you should not wait any longer.
I personally was a bit late and Minas Tirith already fell so I had to re-conquer it which is an unnecessary delay.
War against Mordor is pretty much the same with whatever faction you are playing, except maybe Dale and Dwarves of Erebor (which can backdoor into Mordor from the east). It is all about creating choke points and progressing eastwards settlement by settlement.
Let's focus on the campaign map around Minas Tirith for a bit.
As you arrive to the east, you should take Galebrin (not seen on the picture, region north of Cair Andros) which is a small useless village in the The Dead Marshes and give it to an ally or a neutral faction as a gift. This will block Easterlings or Mordor advancing on your native land across Anduin which is a total waste of time and a distraction so it is an utmost priority to seal that off.
You should also take Calenhad because you want as many cities as possible on the east to develop your armies closer to the war front. Training armies in Rohan and moving them to Gondor takes many turns and is inefficient. If Calenhad is still owned by Gondor when you arrive you can easily swap it with any region you recapture or just buy it off if finance allows it.
Next one is Cair Andros which you also do not really want to own because it creates a secondary target to Osgiliath. Once you take whole Osgiliath, Cair Andros can probably be owned by Gondor since Mordor will have full focus on you and not even attack there. If it is still attacked and falls when owned by Gondor, gift it to a neutral party.
Leave Minas Tirith to Gondor. It does not make much sense tactically but if you are into lore it makes sense to do that. It also leaves them some good income to fight their own wars.
Osgiliath is your primary choke point for quite a lot of turns but is relatively easy to defend because the battle map is hard to navigate and has narrow paths.
This setup makes Osgiliath the only route you need to defend. Once Osgiliath gets army production, you can continue on Minas Morgul. You continue this step by step progression, waiting for conquered cities to be able to produce army and then take the next one.
At some point after Minas Morgul and Cirith Ungol you can capture the two cities to the south for extra production. You can gift the settlement below Ostithil to Gondor or neutral party to avoid a second front with Haradrim.
When Gondor is safe from Mordor they will start thriving and go into big expansion into Harad and Rhun. You don't really need to worry about those two factions unless you arrive late and they already progress deep into south Gondor regions.
Once you have Minas Morgul (and Cirith Ungol) you might feel a bit exposed because you will also get attacked from the Black gate, usually on Osgiliath. You can take a bit of a rest by gifting Cirith Ungol to a neutral party but that might not last long since Mordor tends to attack them anyway and this can last just a few turns. Depending on diplomatic relations you could buy yourself quite a bit of time like this though.
The question of taking Barad Dur is just a matter of time then. Being this close has an annoying effect that each defeated Nazgul commander respawns in Barad Dur and is ready for another siege in a very short time, so you are almost constantly defending against 10 star commanders. You should defend with equally strong commanders to avoid any unnecessary fleeing troops.
You may also encounter Sauron as a commander. As a unit almost impossible to kill, unless you get a catapult kill, but defeating his army will send him fleeing and weaken the faction.
Once you start taking cities inside Mordor it gets increasingly easier to finish it off.
Once a faction is on their last stand, the capital will be filled up with army and can be pretty hard to conquer, especially if it is not an open type terrain like dwarven caves. Barad Dur is basically one small tunnel with only two access points. Bringing catapults to fire directly into the tunnel slope is a must or you will simply run out of time even with enough units in battle. You simply can't kill 3700+ units, a lot of them of heavy type, encamped in such a small area before the clock runs out.
What could go wrong?
Gifting regions to neutral parties works for some time but eventually everyone is at war with Mordor. These can buy you a lot of turns of peace or Mordor might just attack them immediatelly. Depending on your luck, you could start getting attacked by Mordor or Easterlings through Dead Marshes on your core territory where you have your main production and mostly undefended cities.
Another possible drain is attacking Snow Orcs or Ered Luin when you are already neck deep into eastern war. Your northern production takes quite some time to get up to speed and these two factions are holed up in dwarven caves which are hard to capture.
You essentially need full armies and catapults to have any chances to break through heavy units in time.
Rohan in itself is not a particularly powerful faction when it comes to units. You have almost no heavy infantry except Guards of Meduseld which can only be produced in Edoras. Your heavy cavalry is good but not much better than any other heavy cavalry and your archers are poor. In these cave scenarios, you have no advantages. The whole unit production of DAC is very slow, you need many fully upgraded settlements just to be able to retrain damaged armies every turn. A lot of times you won't be able to retrain due to lack of unit availability and you need to send units to far away settlements.
Finally, the biggest problem is how to avoid a major war with Easterlings. If you expand into Dol Guldur you get a border sooner or later (Dale tends to be pushed back). You can usually defend there with fully upgraded walls (ballista towers). You can potentially conquer one of their strongholds nearby and have it as a gravity point. Ballista towers can generally clear their armies a lot before they even break through the walls so defending is quite easy but it is problematic to replenish the defending army in the period when settlement can not yet produce units. You should absolutely not push deeper into their territory while you are fighting Mordor, they will push you back and probably crush you. By staying in close proximity you drain a bit of their resources and help Dale not getting eradicated this way.
Easterlings are basically an overpowered version of Rohan. Their cavalry is on par, archers are better and they have more heavy units so you have no particular advantages over them in battles.
You can have some more fun after bringing down Barad Dur. I personally finished up on the east and then defeated Ered Luin for a good measure.
Weird things can also happen with other factions. In my case, Dwarves of Khazad Dum went on a war path and completely eradicated Lothlorien and the Vale, leaving dozens of armies on my borders. If you don't watch your relationships (like trespassing without Military Access) you get yourself an enemy you can't handle.
Game event dialogs
Throughout the campaign you get events and commander traits as you conquer important settlements. Your commander will receive a title of the last big conquest or generic title such as Aggressive or Defender, depending if they are conquering regions or defending a lot. This attention to detail is incredible.
These events with very nice descriptions make the campaign feel alive.
As factions are near destruction or completely destroyed you also get these.
Trait descriptions are LOTR based and absolutely brilliant. Some samples below.
Soundtrack is absolutely brilliant. It includes LOTR movies soundtrack, The Hobbit trilogy soundtrack, LOTR Online, Battle of Middle Earth and many more for different factions. The best of all, almost all of the picked themes work nicely with the battle scenarios and campaign map, as if they were custom made just for this mod and they really give you that Middle Earth feeling while playing.
All we have to decide is what to do with the time that is given us..
DAC is one of the best mods I played in my life and is everything a Total War and a LOTR fan could wish for. The soundtrack, attention to detail, city models and the campaign maps, everything just screams of incredible effort to make this mod as good as it is. If you haven't yet, give it a try.
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 to get working and XP market share is much lower today than it was 5 years ago.
Since the Qt build documentation is still lacking here is the latest text of the ordeal.
For speedier builds, also install jom. We will also need vcpkg to get the OpenSSL binaries. Needless to say, all these tools need to be in your system PATH.
Now get the code:
git clone git://code.qt.io/qt/qt5.git
git checkout v5.15
I think you can tell the init-repository script to not download some of the modules you don't need (it pulls 12GB of data!) but I couldn't be bothered to find the flags for that. You can probably avoid it by downloading the source archive instead of doing it via git.
Today we finally have the C/C++ package managers available to not bother bulding the dependencies anymore. Vcpkg and conan are both great tools that do the job. So forget about building OpenSSL, just install the binaries with vcpkg:
./vcpkg.exe install openssl
In your user env, add
Now we can run the configure script inside the qt5 folder. First we do a release build and we link to openssl (run in Visual Studio cmd):
Change the location of OpenSSL include and lib folders to whatever your vcpkg installation directory is. I am still targeting msvc2015 for now but I plan to transition to 2019 eventually.
If you change around the configure parameters, make sure to delete config.cache file since in my experience it likes to save unwanted information from previous runs.
Build it with jom:
Now you have a release build and you can add it in Qt Creator under Tools->Options->Qt Versions by giving it the path to C:\Qt\Qt-5.15.1\bin\qmake.exe.
If you also need debug build of Qt, you can repeat the configure and build step by replacing -release flag with -debug (remember to delete config.cache first).
An there you have it.. Qt built from source with OpenSSL support. Once you build your program you will also have to copy all the relavant .dll files into the .exe build directory (Qt5Core.dll, Qt5Gui.dll, Qt5Network.dll…). The amount of libraries you need to copy depends on what you are actually using in your code. You will also need to copy libcrypto-1_1.dll and libssl-1_1.dll from the vcpkg install directory.
For debug builds you need to copy the debug libraries (Qt5Cored.dll) instead.
The future appears to be even brighter now that bincrafters have packaged Qt as a conan recipe. Which means the next time I need to depend on Qt, I will run a single conan command and get the proper build automagically delivered to my PC along with all the transitive dependencies. The future is now.
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 also not quite ready diving deep into embedded programming and OpenHAB programming model. OpenSprinkler seemed to have everything I needed, a RPi hat with all the correct electrical outputs and an open source firmware and android app I could modify myself if needed. In the end, programming the sequences myself and trying to make a decent UI would be just too much work for a small pet project so I went with a ready solution.
Three separate zones around the house, max 7 sprinklers per zone.
Each zone must be turned on separately due to the pressure requirement for the sprinklers to work.
Pump that drives the water must be turned on automatically with each zone valve.
Setting up the OSPi
OpenSprinkler offers fully assembled systems but I decided to go the DYI route using my own RPi and just buying the OSPi hat.
Finding a 24VAC power supply with EU plug was quite a challenge, the listed model from Orbit was one of the rare ones I could find online (on Amazon).
It is mentioned in OpenSprinkler documentation that a separate power supply for RPi is recommended. This was confirmed while testing where I saw dmesg errors about voltage not being sufficient and RPi rebooting endlessly. I ended up using the official RPi charger and the 24VAC charger at the same time.
Installing raspbian and OSPi firmware was easy with no problems encountered. Assembling the OSPi was also not problematic, other than drilling some holes into the supplied enclosure for the USB cable and WiFi adapter.
The built in WiFi on RPi would not work even half of the required distance and was simply horrendous. Onboard WiFi can be disabled by modifying /boot/config.txt and adding
in the [all] section.
After checking compatibility lists and reviews for RPi compatible USB WiFi adapters I went with Edimax EW-7811UN. I disabled the integrated card and configured the /boot/wpa_supplicant.conf to connect to the dedicated WiFi extender AP as a priority.
In the end I managed to achieve a not so great but stable signal from the house to controller box at around -60db. For the WiFi extender I went super cheap using TP-LINK TL-WR840N (15EUR) and positioning it with no walls blocking the signal other than a single garage door. I also added a small script to sudo cron to automatically restart RPi in case of any network downtime.
ping -c4 192.168.1.1 > /dev/null
if [ $? != 0 ]
sudo /sbin/shutdown -r now
echo $(date) "Internet is UP"
Driving the Pump
Looking for a relay to turn the pump on and off I decided to go with an off delay relay as an extra safety that will automatically turn off after the selected period of time. This is just in case OSPi goes haywire and does not turn off as scheduled or someone makes a mistake of turning the sprinklers on for too long. Pump draining all the water and running dry is a very bad scenario I would like to avoid. The model is a Tracon multifunction relay AC/DC 12-240V driven by 24VAC OSPi.
Putting it together
Relay is connected to OSPi port 0 (master zone) which is always turned on with either valve 1, 2 or 3. Relay drives the first power socket for the pump. The other two sockets are for Orbit 24VAC and RPi charger. This way the pump can be disconnected at any time and used manually.
24VAC valves are quite common. I found three candidates from Orbit, Rainbird and Cleber. In the end it came down to price and availability, so I went with 3x Rainbird CP075 off eBay, roughly 30$ each.
Finally, to connect the valves to OSPi I got some 4×0.75mm cable and some waterproof clips to connect them on the valve side. These are automatic clips put in a box full of gel which seals it when closed.
Operation and conclusion
It turns out the OSPi firmware and app has the exact functions I need to drive the setup. Master zone translates perfectly into the pump relay. For each valve, the "continuous" setting (which is default) allows you to setup a single schedule program and OSPi will automatically drive each valve one after another and not all at once (which would not work due to low pressure). Without the continuous setting one would have to write a separate program for each valve which is a bit clunky.
One thing that does not work quite as good is automatic rain delay. The idea is, if sprinklers are scheduled to work today but there is a rain forecast, delay the program for some time, like a day. Unfortunately, if it does not rain at all, delay is still present. It would appear that OSPi only checks the forecasts but does not adjust the delay according to actual mm of rain that has fallen. I need to research this function in more depth to figure out the exact behavior and whether I can improve upon it.
Another glitch that appears once a month or so is that OSPi is randomly not accessible. This is fixed with the main router reboot. I am not sure yet what exactly causes the problem, whether the auto-reboot script works.. more investigation is needed. It probably boils down to not so great WiFi connection.
In the end I am quite happy I went with the OpenSprinkler and not a full DIY solution. It saved time, does everything I require and I am able to modify it if ever needed.
After the system being dormant through winter of 2022/2023, the RPi would no longer boot. The Sandisk Ultra SD card seems to have got corrupted for some reason so I had to re-image and reconfigure OSPI again. I replaced the card with a Sandisk Industrial series card which are supposedly more tolerant to heat and cold. We'll see how long this one lasts.
Other than that the system is still working great.
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: 2019-12 (4.14.0).
Check that XDebug remote is enabled with phpinfo() test site, if not add the following line to your php.ini:
xdebug.remote_enable = 1
Now in Eclipse, we first add a server. In Window->Preferences->PHP->Servers add a new server like this:
Document root is our Laravel public folder and base URL is the default host and port of
php artisan serve
Now check your Debug settings in PHP->Debug, select the newly created server and check that XDebug is set as the debugger:
If XDebug is not present here, configure it under PHP->Debug->Debuggers first.
Finally, under General->Web Browser, we select an external web browser to launch our website instead of integrated Eclipse Browser.
We are done with Preferences so close it. Next to the Debug button in main Eclipse toolbar, click on the arrow for the dropdown and select Debug configurations…
Create a new PHP Web Application config like this.
We point the file to public index and map it to root URL (default by artisan serve). Under Debugger tab check that XDebug is selected.
Now go to the terminal and serve your laravel app as you would with
php artisan serve
Finally, run the "web" Debug configuration from Eclipse. Eclipse should go into the Debug mode and open up your site in your selected browser. You can now place your breakpoints in controllers or wherever and things just work like you would expect.
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 other non-GET) request endpoints (who doesn't?) this behaviour will completely destroy everything. Many guides (top google results) out there for configuring Apache redirect do not mention this problem. The code of choice would be 308 Permanent Redirect but that is fairly new so I would not risk it, older clients don't know it exists. The only thing left is 307 which does not allow changing methods on redirect – exactly how it should be.
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 a shell restriction, so how to do it?
If you use a profile activation with the JDK condition (JDK tags in the POM: <jdk></jdk>), IntelliJ IDEA will use the JDK version of the Maven importer instead of the project's JDK version when syncing the project and resolving dependencies. Also, if you use https certificates, you need to include them manually for the Maven importer as well as for the Maven runner.
Why IntelliJ developers decided to tie the maven profile activation to importer I do not know. It would make much more sense to tie it to Project/Module SDK. If app is being developed with Java 11 target one would expect to activate that profile at build and runtime, not at import time.
With more digging around I managed to find an issue complaining about this problem. Unfortunately the issue is 4 years old now with no apparent activity. Preferrably the default should be changed, if not at least give us an option to choose the source of profile activation in preferences.