• How to create and register Spring Boot custom request filter

    Creating a custom request filter in Spring Boot is a relatively simple process that can be accomplished by following a few basic steps.

    • Create a new class that extends the OncePerRequestFilter class. This ensures that the filter will be executed only once per incoming request.

    • In your filter class, override the doFilter method. This method is called for each request that is sent to your application. In this method, you can perform any logic you want to execute for the filter, such as logging, authentication, or validation.

    • Annotate your filter class with @Component so that Spring Boot can automatically discover and register it as a filter.

    • Use the @Order annotation to specify the order in which the filter should be executed relative to other filters. Filters with a lower order value will be executed first.

    @Component
    @Order(1)
    public class MyCustomFilter extends OncePerRequestFilter {
    
        @Override
        protected void doFilterInternal(
            HttpServletRequest request,
            HttpServletResponse response,
            FilterChain filterChain
        ) throws ServletException, IOException {
        
            // do some stuff
    
            filterChain.doFilter(request, response);
        }
    }
    

    To apply the filter to specific URLs, use a @Bean annotation to assign the filter only to request that meet criteria. For example, the code below attaches the MyCustomFilter.class only to request that match the /api/* patch pattern.

    @Component
    @Order(1)
    public class MyCustomFilter extends OncePerRequestFilter {
    
        @Override
        protected void doFilterInternal(
            HttpServletRequest request,
            HttpServletResponse response,
            FilterChain filterChain
            ) throws ServletException, IOException {
        
            // do some stuff
    
            filterChain.doFilter(request, response);
        }
        
        @Bean
        public FilterRegistrationBean<MyCustomFilter> myCustomerFilter()
        {
            FilterRegistrationBean<MyCustomFilter> bean = new FilterRegistrationBean<>();
     
            bean.setFilter(new MyCustomFilter());
            bean.addUrlPatterns("/api/*");
     
            return bean;
        }
    
    }
    
    Read more...
  • Vintage lens Helios 44-2 review

    There is a sentiment to old lenses. Many say that modern one are too good, too sharp, too sterile. While vintage lenses thanks to all the imperfections and softness have soul. The cheapest of vintage lenses in Helios 44 from USSR! Let’s take a look at one of my Helios 44-2 58mm f/2 lenses and compare how it stands against modern Panasonic Leica DG 12-60 Vario Elmarit f/2.8-4.0. Let’s take a look at sharpness, color, contrast and bokeh. Oh, I know those Helios 44 very well! When I was growing up, they were basically only lenses one could afford. And you know what, we were not the biggest fans of them.

    Read more...
  • How to change Timeline framerate in DaVinci Resolve

    When I started my adventure with DaVinci Resolve, one of the biggest limitations I discovered what that it’s not possible to change the framerate of a Timeline. If you created a 30fps timeline, it would remain 30fps timeline. Once you start editing, you even can not change the project framerate! Luckily, there is a trick that allows, to some extend, change the framerate of the timeline. It’s not the most obvious one, but it does the trick and in no time you will be able to change the framerate in DaVinci Resolve!

    Read more...
  • ArteryTek AT32 Flight Controller - NeutronRC F435

    OK, I’m kind of hyped with this! What you see on the image looks like an any other flight controller, right? Looks again! It’s not STM32 but ArteryTek AT32! And F435 as a bonus 😉 With the continuing chip shortage supply of STM32 is limited and prices high. Maybe have an alternative source of MCUs will help. What you see is a NeutronRC F435 with AT32! For now, it runs a special fork of Betaflight.

    ArteryTek AT32 Flight Controller

    Read more...
  • How to normailize audio for YouTube with DaVinci Resolve

    Audio mastering/normalization is very important. If your audio levels are too low, viewers will not hear well. If they are too high, clipping and distortions will lower the quality. On top of that, platforms like YouTube expects you to upload materials with certain loudness. If your loudness is too high, YouTube will lower your videos volume. But if it’s too low, it will not bring the volume up. Setting correct audio level by ear is not the best idea. Luckily, loudness can be measured with LUFS and we can modify audio tracks to reach desired loudness. In this tutorial I will show you how to do it with DaVinci Resolve for YouTube.

    Our goal will be to reach -14LUFS with BS.1770-4 loudness and around -1.5dB True Peaks with DaVinci Resolve 18 and Fairlight module. I will show you how to measure loudness and how to use audio compressor to reach desired levels. Because just setting up the gain if often to enough.

    Read more...
  • Spring HDMI cable for a field monitor

    I had no idea that connecting a field monitor to a camera can be that hard! Yes, mount or a small head is important, but the biggest problem is a HDMI cable. It turned out that my Panasonic Lumix GH5 mark 2 needs around 30cm long HDMI cable to connect to Feelworld F6 PLUS field monitor. And when I added a SmallRig swivel mount, it was even worse. All the short cables from companies like SmallRig or just generic short HDMI cables were just too short! Believe it or not, but I was not able to find anything on Amazon! Only after a long search on AliExpress I’ve found a spring, extensible and angled HDMI cables that fit perfectly! What a waste they are so hard to find in Europe!

    Spring HDMI cable is a angled HDMI cable with a springy coil inside. The cable is designed to be used with field monitors, but it can be used with any HDMI device. The springy coil allows you to easily extend and retract the cable. It is also very flexible and can be bent in any direction. The cable is also exceptionally durable and can be used in any weather condition. It is a great cable for field monitors, but it can be used with any HDMI device.

    Read more...
  • Ulanzi VL110 RGB tube light review

    Ulanzi VL110 are small but pretty powerful RGB tube lights. Each tube light has 3 modes (white, pulsing, RGB), USB-C charging, an OLED display, and 1/4” tripod mount. On top of that, Ulanzi VL110 can be stacked together to make bigger and longer light. Pretty cool!

    Read more...
  • How to exit VIM? 4 simple ways

    VIM is one of the best pieces of software ever created. But the way you are supposed to exit it can be a major PITA. Of course, only if you don’t know how to do it. Here are four ways of exiting VIM with and without saving your work.

    Read more...
  • Wide zoom Olympus 9-18mm 1:4.0-5.6 ED review

    Good lenses are usually expensive. Turns out, there is a reason for that. I wanted an ultra-wide lens for my YouTube studio. I have a small room and wanted to have more breathing room in the shots. The Olympus Digital 9-18mm 1:4.0-5.6 ED was the cheapest ultra-wide zoom lens for Micro Four Thirds mount and I got it. Cheap.

    Guess what, I now kind of regret the decision. I mean, it works, it’s wide but the lens has 2 major problems:

    • Autofocus is extremely loud and slow
    • Only the center of the frame is sharp (or sharpish). Everything else is blurry and out of focus. And yeah, like expected bokeh sucks as well
    Read more...
  • Authentication vs Authorization - What's the difference?

    Authentication and Authorization are mixed together. Some developers even swap them randomly. But authentication and authorization are very different things and describe different processes.

    Read more...
Paweł Spychalski

I'm Paweł Spychalski and I do things. Mainly software development, FPV drones and amateur cinematography. Here are my YouTube channels: