I am happy to announce 0.4.0 version of strman library. strman is a Java 8 library to work with String. It implements a number of helper utility functions that you makes it easy to work with String. You can refer to strman documentation to learn about all the supported functions.
In this release, we have implemented following functions
- chop: This function chops the input String into parts
- dasherize: This function converts a underscored or camelized string into an dasherized one.
- humanize: This function converts an underscored, camelized, or dasherized string into a humanized one.
- lines: This function split input to lines
- zip: This function aggregates the contents of n strings into a single list of tuples.
- underscored: This function converts a camel or dashed string into an underscored one.
- isBlank: This function returns true if a string is blank or null and false otherwise.
Welcome to the first post of X-things-I-learnt-reading-Y’s-source-code series. In this blog series, I will share what I learnt after reading source code of popular open-source projects. Each week I plan to spend at least couple of hours reading source code of an open-source project and then sharing it on my blog. I plan to cover aspects such as design patterns project use, coding practices , API design, how they solved particular problem with their design, or any other aspect that I found useful to share. The purpose of this series is to learn how good developers design and build software. Then, I can apply these learnings to my work. Continue reading “10 Things I Learnt By Reading Retrofit Source Code”
Today a colleague asked me how he could unit test a Spring MVC REST resource. I am using Spring MVC test support for some time now so the obvious answer was to use
MockMvc. In case you have not used
MockMvc, it allows you to declaratively write tests for your Spring MVC controllers. Rather than calling controllers directly, you use the MockMvc fluent API to make a request to a URL and verify the response returned by the API. You can read Spring MVC documentation to learn about MockMvc in detail.
Continue reading “Unit Testing File Upload REST API using Spring MVC MockMvc”
Today, I decided use Teradata Covalent components in my Angular 4 application. After adding the dependency, my project stopped compiling. I started getting following errors
ERROR in /Users/dev/app//node_modules/@covalent/core/common/animations/toggle/toggle.directive.d.ts (2,10): Module "/Users/dev/app/node_modules/@angular/animations/animations" has no exported member 'AnimationBuilder'.
ERROR in /Users/dev/app/node_modules/@covalent/core/common/animations/fade/fade.directive.d.ts (2,10): Module "/Users/dev/app/node_modules/@angular/animations/animations:" has no exported member 'AnimationBuilder'.
I tried googling this error but couldn’t find a fix. Then, i looked at the Covalent Github repository to find the Angular version they are using. It turned out to be Angular version issue. I was using Angular 4.1.3 and Covalent needs Angular version 4.2.0 and above. After making the change, I was able to get my app working.
Today, I tried to play a video with
.mkv extension using VLC media player but I was greeted with error message. The problem is that VLC does not have the right codec to play the audio. So, video will work but there will be no audio 😦
VLC does not support the audio or video format “undf”. Unfortunately, there is no way for you to fix this.
The fix that worked for me was to update VLC to latest version. I was using VLC version 2.1.5 and I upgraded it to 184.108.40.206. This solve my problem and I was able to watch and hear video.
I am a big fan of Spring Boot. It is my preferred choice for building REST APIs in Java. It takes less than 5 minutes(given that you have Maven dependencies on your local machine) to get started with Spring Boot thanks to its auto configuration. In this blog, I will talk about a specific aspect of building REST API with Spring Boot. We will look at the request and response objects. The request object that you receive during the HTTP POST request and response object that you send in the response of HTTP GET request. I will discuss how you can keep these request and response objects to the bare minimum so that we can avoid writing and maintaining useless getters and setters.
Continue reading “Keeping Spring Boot Powered REST API Request and Response Objects Minimal”