Probably all of us saw these “which tank will be filled first?” kind of puzzles online. After seeing yet another one I had an idea to implement a simulator to actually be able to check this with visualization. And so I did :-)
I’ve been using successfully my 2.8″ 320×240 uTouch PiTFT with Raspberry Pi 1 and 2, but recently I’ve tried it with Pi 3 and got a 90-degree rotated touch input.
I’ve installed PiTFT support using adafruit-pitft-helper and this instruction at Adafruit. However, if did not help with the rotated input issue.
In short, I had to edit /usr/share/X11/xorg.conf.d/40-libinput.conf adding this to “libinput touchscreen catchall” section:
Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
This is a transformation matrix for 90 degree rotation of screen, which was the case for me.
Once done, the touchscreen input has got proper rotation.
The software that I use for processing and assembling timelapses now (on macOS):
Darktable is FOSS (GPL/CreativeCommons). Very powerful and quite awesome software, with somewhat clumsy user interface that doesn’t look like native app and takes a bit of getting used to, but is quite functional once you get used to it.
Darktable does the mass-edting of RAW files – all kinds of adjustments and color manipulations, cropping/rotation/resizing and export to JPEG.
Interval is a handy software for assembling bunch of JPEG images into a video file.
Recently I’ve learned that nRF24L01+ radio module can be connected directly to Raspberry Pi via GPIO pins in order for this Raspberry Pi to be used as MySensors library “gateway”.
I’ve successfully installed MySensors on Raspberry Pi using official instruction, but one thing wasn’t exactly clear – how do I specify channel for nRF24L01+? Without specifying proper channel, the “gateway” won’t be able to see other nodes.
It turned out to be quite simple actually – before doing make / sudo make install one has to run configure with these parameters:
./configure --my-transport=nrf24 --my-rf24-channel=123
The 123 is the number of channel to be used.
P.S. Remember to enable SPI via raspi-config.
If you read the documentation on gphoto2 regarding the focus control (“manual” focus as they call it) it mentions that focus control only works while liveview mode is on, and that seemed to be sufficient for Canon, but it turned out that for Nikon cameras there was more to it than just liveview.
First the necessary disclaimer though: I’ve only tried the Nikon D5100 here and Canon 550D and 600D, so YMMV.
But let’s start with liveview (or preview) mode itself first – this one is controlled by “/main/actions/viewfinder” setting in both Nikon and Canon. Continue reading
Spring MVC has nice feature for adding security controls to Controller methods via @PreAuthorize annotation, but there’s an interesting problem that might occur when those methods are mistakenly marked as private or final.
Spring uses CGLib proxy to add calls to authorization logic declared in @PreAuthorize before calling actual controller method, but CGLib fails to process private or final methods, producing error like this in console:
2016-11-28 17:19:14.186 INFO 97079 --- [ main] o.s.aop.framework.CglibAopProxy : Unable to proxy method [public final java.util.Map com.package.controller.MyController.someMethod(javax.servlet.http.HttpServletResponse)] because it is final: All calls to this method via a proxy will NOT be routed to the target instance.
Well, so far so good – nothing special happens, all is more/less expected.
The problem though is that among most console output produced by Spring MVC yet another INFO log line rarely gets noticed. So what actually happens with those private/final methods of SpringMVC controller? Here weird stuff begins.
Say you’re writing a controller method that has a @PreAuthorize added to it, and accidentally copy-paste in a return type with final predicate before it, thus making your method final. You miss the log line in console because it’s just INFO among many other similar lines. And then… all autowired or otherwise injected fields of a controller are somehow null when calling only that particular method. But we know that in Spring MVC every controller is a singleton, so how is this even possible?
The issue appears to be that we’re actually calling methods on a CGLib proxy, that can’t pass them down to actual controller class instance. But proxy itself looks just like the controller class instance, except all fields that were supposed to be injected by Spring are null. A weird looking symptom which does not intuitively lead us to the cause of the problem.
But once one encounters this issue, I bet one remembers well next time what it is a symptom of.
P.S. I’ve encountered this issue with final method, but seems other people had same issue with private methods.