Category: Programming Language
-
Webpack: Managing Tree Shaking
PROBLEM Sometimes, Webpack’s tree-shaking may accidentally eliminate imported code from import statements. For example, we may have a root JS file that imports a CSS file:- … and for some reason, the CSS file will never appear in the final bundle even if the Webpack config contains proper rules to handle CSS files. SOLUTION To… Read More…
-
Feign + Eureka: UnknownHostException when Attempting to Invoke a Service
PROBLEM When attempting use Feign to invoke a service through Eureka, the following exception occurs:- SOLUTION Go to the donkey-kong-service app and add the following line to the application.properties:- Now, when Feign tries to invoke the service, the IP address will be used instead of the OS’ reported hostname. Read More…
-
Spring Boot: Connecting to IBM MQ over JMS using non-IBM JRE
There are several ways to connect to IBM MQ:- This article shows you how to connect with Spring’s JmsTemplate. CONNECTIVITY INFO Typically, the MQ admin will provide the following connectivity info that allows you to connect to MQ:- DEPENDENCY Add the following dependency:- SPRING CONFIGURATION While the connectivity info can be hardcoded in Spring Boot’s… Read More…
-
React: Debugging Layout Thrashing
PROBLEM When the React app grows larger over time, it is highly likely to run into situations where the component keeps re-rendering for no apparent reason. There are many reasons why this is happening… to name a few…. parent component re-renders, this.props or this.state has changed, etc. The key is to quickly find out what… Read More…
-
Groovy: Handling Byte Order Marks When Reading a File
PROBLEM Given a file with the following content:- When reading the file:- … the following values are printed:- Even though the value is trimmed, there is still a leading space in front of text. A further inspection reveals the leading space is not a regular space:- SOLUTION Some editors prepend a special Unicode character called… Read More…
-
Spring Web: Encode ‘+’ Value Using UriComponentsBuilder
PROBLEM Given the following code… When using Spring Web 4.3.18.RELEASE, the URL is properly encoded:- However, when using version between 5.0.0.RELEASE and 5.0.7.RELEASE, the URL containing “+” value does not get encoded:- SOLUTION There is a ticket opened regarding this breaking change. To properly encode “+” value, use 5.0.8.RELEASE or later. Then, ensure encode() is… Read More…