<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Mariusz Wyszomierski | DevBlog</title><link>https://mariusz.wyszomierski.pl/en/post/</link><description>Recent content in Posts on Mariusz Wyszomierski | DevBlog</description><generator>Hugo -- gohugo.io</generator><copyright>Copyright © 2008–2022, Mariusz Wyszomierski</copyright><lastBuildDate>Thu, 01 Dec 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://mariusz.wyszomierski.pl/en/post/index.xml" rel="self" type="application/rss+xml"/><item><title>Spring Boot application properties or yml in test resources is a code smell</title><link>https://mariusz.wyszomierski.pl/en/spring-boot-application-properties-or-yml-in-test-resources-code-smell/</link><pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/spring-boot-application-properties-or-yml-in-test-resources-code-smell/</guid><description>
In several projects I've seen application.properties or application.yml files in test resources.
These files were almost exactly the same as files in main resources.
Each time developer adds a new configuration to file in main resources, he/she needs to update a file in test resources.
It's definitely a code smell.
Solution before Spring Boot 2.6 To avoid duplicate configuration files you can create a file src/test/resources/application-test.properties or src/test/resources/application-test.yml.
Override or add here properties needs only for tests.</description></item><item><title>How to export files from git repository without change history?</title><link>https://mariusz.wyszomierski.pl/en/how-to-export-files-from-git-repository-without-change-history/</link><pubDate>Thu, 03 Nov 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/how-to-export-files-from-git-repository-without-change-history/</guid><description>
Often, as a product to the customer, not only binary files are transferred, but also source codes of applications.
It is then worth considering whether you want to transfer the entire GIT repository or only the source codes.
If we were the recipient of a product, the history of file changes can be very valuable information. With the history, we can read the context of the changes - what files were changed within a single commit and read a description of the commits.</description></item><item><title>Editable diagrams in PNG files created in diagrams.net (former draw.io)</title><link>https://mariusz.wyszomierski.pl/en/editable-diagrams-in-png-files-created-in-diagrams-net-former-draw-io/</link><pubDate>Fri, 14 Oct 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/editable-diagrams-in-png-files-created-in-diagrams-net-former-draw-io/</guid><description>
There is awsome, free and intensively developed tool for drawing diagrams and schematics - diagrams.net (former draw.io).
The easiest way to use this tool is to work in a web application accessible through a browser.. There is a desktop option, which could be installed on Windows, Linux and MacOs.
Example diagram: Sometimes you need to update diagram that we created. By default, when you save a diagram from this tool you save an XML file (with a .</description></item><item><title>SDKMAN use any matching java version</title><link>https://mariusz.wyszomierski.pl/en/sdkman-use-any-matching-java-version/</link><pubDate>Tue, 13 Sep 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/sdkman-use-any-matching-java-version/</guid><description>
Unfortunately, we can't use any matching java version using sdkman. We must provide specific identifier like 11.0.12-open.
Sometimes we need to set just java 11, which is installed, patch number and distribution don't matter.
There is open issue on github #920 with proposal of this feature.
SDKMAN autocomplete make it easier to set java version without knowing specific identifier. After you enter in console sdk use java 11 and click TAB twice, it shows list of installed java distributions.</description></item><item><title>redo - application for quick alias creation</title><link>https://mariusz.wyszomierski.pl/en/redo-application-for-quick-alias-creation/</link><pubDate>Mon, 06 Jun 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/redo-application-for-quick-alias-creation/</guid><description>
Redo1 is a tool for quick and easy alias creation from last invoked commands.
Application hstr Check post about tool hstr, which also speed up work in terminal
Installation Below script for installing 0.5.0 version. Before install, you should check newest version on GitHub: release redo.
1REDO_VERSION=0.5.0 2wget https://github.com/barthr/redo/releases/download/v${REDO_VERSION}/redo_${REDO_VERSION}_Linux_x86_64.tar.gz 3tar -xf redo_${REDO_VERSION}_Linux_x86_64.tar.gz redo 4sudo mv redo /usr/local/bin 5rm -rf redo_${REDO_VERSION}_Linux_x86_64.tar.gz redo Unfortunately, variables are not exported by default in Ubuntu 20.</description></item><item><title>Efficiently search and select commands from bash history</title><link>https://mariusz.wyszomierski.pl/en/efficiently-search-and-select-commands-from-bash-history/</link><pubDate>Sat, 30 Apr 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/efficiently-search-and-select-commands-from-bash-history/</guid><description>
Some time ago, during the Devoxx conference, I noticed a very interesting tool used by the speaker. When he wanted to type in the console a command, which he had already typed before, terminal was shown a list of prompts. This makes working in the console more efficient.
Navigating with the arrows By default, when we want to invoke a command from history in the console, we can use the up and down arrows.</description></item><item><title>Can't find java class using reflection</title><link>https://mariusz.wyszomierski.pl/en/cant-find-java-class-using-reflection/</link><pubDate>Wed, 27 Apr 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/cant-find-java-class-using-reflection/</guid><description>
Today I'd like to share an interesting case that took me some time before I came to a solution.
The case was about using reflection in unit tests to check if the established naming conventions are followed.
Problem - reflection does not find all classes Let's assume a project that has 4 classes named:
UsecaseA UsecaseB UsecaseC UsecaseD All of these classes extend the AbstractUsecase class.
The code can be previewed here: github.</description></item><item><title>SDKMAN - application to manage tools versions</title><link>https://mariusz.wyszomierski.pl/en/sdkman-application-to-manage-tools-versions/</link><pubDate>Mon, 25 Apr 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/sdkman-application-to-manage-tools-versions/</guid><description>
SDKMAN1 is a great tool for installing multiple versions of different tools and switching between versions easily. It is safe to say that it is a must-have for any programmer.
Installation is very easy
1 curl -s &amp;#34;https://get.sdkman.io&amp;#34; | bash 2 source &amp;#34;$HOME/.sdkman/bin/sdkman-init.sh&amp;#34; Main commands In this post i'll use an example with java.
sdk list Displays a list of tools that can be installed.
At the moment, the list looks like this:</description></item><item><title>How to change logging level when Spring Boot application is running?</title><link>https://mariusz.wyszomierski.pl/en/how-to-change-logging-level-when-spring-boot-application-is-running/</link><pubDate>Wed, 30 Mar 2022 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/how-to-change-logging-level-when-spring-boot-application-is-running/</guid><description>
When we have a problem with reproducing the bug in local environment, it may be useful to view logs from environment where a bug could be reproduced. Usually it requires to change logging level to DEBUG or TRACE. We can do this by changing logging level in application preferences and then restart application.
1# setting DEBUG level for specific class 2logging.level.pl.speedlog.example.logging_level.SchedulerOne=DEBUG There are times when intense testing is underway in a given environment and we cannot restart the application after changing preferences.</description></item><item><title>Deploy two Spring Boot applications in Wildfly with external properties</title><link>https://mariusz.wyszomierski.pl/en/deploy-two-spring-boot-applications-in-wildfly-with-external-properties/</link><pubDate>Thu, 13 Aug 2020 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/deploy-two-spring-boot-applications-in-wildfly-with-external-properties/</guid><description>
Personally I prefer jar then war (&amp;quot;Make JAR, not WAR&amp;quot; - Josh Long), but sometimes we have constraints that are not depend on us.
This example focus about how to deploy two Spring Boot applications in Wildfly and how to externalize application properties for each application.
The case is:
deploy two Spring Boot applications in Wildfly, each application has its own properties, properties need to be loaded from external source (not from jar) Note There is also alternative solution for example use of Spring Cloud Config, but it requires additional server.</description></item><item><title>Turn off “X-Powered-By” i “Server” headers in WildFly 10</title><link>https://mariusz.wyszomierski.pl/en/turn-off-x-powered-by-i-server-headers-in-wildfly-10/</link><pubDate>Mon, 12 Sep 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/turn-off-x-powered-by-i-server-headers-in-wildfly-10/</guid><description>
According to OWASP recommendations &amp;quot;Fingerprint Web Application Framework (OTG-INFO-008)&amp;quot; you must turn off specific headers, which are sent by application server or used framework. The less informations attacker knows, the harder it will be to attack.
Below are instructions to run in jboss-cli in standalone mode.
1$WILDFLY_HOME/bin/jboss-cli.sh --connect Turn off &amp;quot;X-Powered-By&amp;quot; and &amp;quot;Server&amp;quot; headers returned by Wildfly 1/subsystem=undertow/server=default-server/host=default-host/filter-ref=server-header:remove() 2/subsystem=undertow/server=default-server/host=default-host/filter-ref=x-powered-by-header:remove() 3/subsystem=undertow/configuration=filter/response-header=server-header:remove() 4/subsystem=undertow/configuration=filter/response-header=x-powered-by-header:remove() Turn off &amp;quot;X-Powered-By&amp;quot; header generated by servlet engine 1/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=x-powered-by,value=false) Delete welcome-content 1/subsystem=undertow/server=default-server/host=default-host/location=\/:remove() 2/subsystem=undertow/configuration=handler/file=welcome-content:remove()</description></item><item><title>Mapping Dozer vs MapStruct</title><link>https://mariusz.wyszomierski.pl/en/mapping-dozer-vs-mapstruct/</link><pubDate>Wed, 23 Mar 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/mapping-dozer-vs-mapstruct/</guid><description>
In multi-tier applications there is often a need for mapping between two data models. In this article you can read about comparing two mapping libraries:
Dozer (http://dozer.sourceforge.net/) - popular library, where mapping is configured by XML files MapStruct (http://mapstruct.org/) - library, which is used for example in JHipster generator The most common use case is coping data from entity objects to DTO objects usually used in service REST/SOAP.
&amp;nbsp; Dozer MapStruct Description</description></item><item><title>How to safety turn off Raspberry Pi?</title><link>https://mariusz.wyszomierski.pl/en/how-to-safety-turn-off-raspberry-pi/</link><pubDate>Fri, 29 Jan 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/how-to-safety-turn-off-raspberry-pi/</guid><description>
RaspberryPi card doesn't have no default turn off button.
You can't just disconnect it from power supply - it may cause problems with SD card.
Firstly you should execute command:
1sudo shutdown -h now</description></item><item><title>Generator .gitignore file</title><link>https://mariusz.wyszomierski.pl/en/generator-gitignore-file/</link><pubDate>Wed, 27 Jan 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/generator-gitignore-file/</guid><description>
What is .gitignore file? It's a file containing names or pattern names of directories and files, that should't be included in GIT repository.
These are among others files generated by IDE - in case of IntelliJ IDEA it's a directory .idea and file with extension *.iml.
Generator .gitignore On website https://www.gitignore.io/ you can generate content of .gitignore file for tools, IDE's and frameworks you are using in project.
For example for projects, which using maven and developers are using Intellij IDEA it generates file like below.</description></item><item><title>How to set static IP address in Raspbian?</title><link>https://mariusz.wyszomierski.pl/en/how-to-set-static-ip-address-in-raspbian/</link><pubDate>Sun, 24 Jan 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/how-to-set-static-ip-address-in-raspbian/</guid><description>
Option 1 - set static IP address in router Many routers have settings to assign static IP address based on MAC addres of network card.
Each router has different administration panel, so I won't describe this option in detail.
If IP address of your local network is 192.168.0.15 you probably can access in browser &amp;quot;http://192.168.0.1/&amp;quot; to administration panel of router.
When you choose option 2 or 3 you should configure DHCP server to assign dynamic IP only from selected range.</description></item><item><title>How to check address IP of newly connected Raspberry Pi?</title><link>https://mariusz.wyszomierski.pl/en/how-to-check-address-ip-of-newly-connected-raspberry-pi/</link><pubDate>Wed, 20 Jan 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/how-to-check-address-ip-of-newly-connected-raspberry-pi/</guid><description>
In this post i will show you how to check IP address of your raspberry after you connect it to network.
New IP address in local network Check all of IP addresses in your local network 1arp -a Connect Raspberry Pi to network Run again command from first step. New address on list will point to your device. Recognize Raspberry Pi by MAC address This method doesn't work when you use external network card (for example wi-fi usb).</description></item><item><title>How to install OS on Raspberry Pi without keyboard and screen?</title><link>https://mariusz.wyszomierski.pl/en/how-to-install-os-on-raspberry-pi-without-keyboard-and-screen/</link><pubDate>Fri, 15 Jan 2016 00:00:00 +0000</pubDate><guid>https://mariusz.wyszomierski.pl/en/how-to-install-os-on-raspberry-pi-without-keyboard-and-screen/</guid><description>
What is needed? 8GB microSD recommended Raspberry Pi device Network cable for router connection Preparation microSD First format your card in FAT system. Choose &amp;quot;Disks&amp;quot;
Next in menu on the left, choose microSD card, click on &amp;quot;small cog&amp;quot; and choose &amp;quot;Format...&amp;quot; (CTRL+SHIFT+F)
Download NOOBS archive. While i'm writing this post there is avaible 1.5.0 version.
https://downloads.raspberrypi.org/NOOBS_latest
You can download two options: NOOBS - archive contains Raspbian image. While installation you could choose another OS, it's image will be downloaded from internet.</description></item></channel></rss>