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.
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 220.127.116.11. 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.
If you use Docker for Mac or something similar, Docker Compose will be installed along with it. Docker Compose has a different release timeline for Docker for Mac so you will not be able to try latest version of Docker compose until you upgrade Docker for Mac. This is limiting. You should be able to install Docker compose independently. To achieve that, you can run following command
$ curl -L https://github.com/docker/compose/releases/download/$composeVersion/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose$ chmod +x /usr/local/bin/docker-compose
In the above commands,
$ signify bash prompt. You don’t have to type it. Now, you can check Compose version using the command shown below.
$ docker-compose version
One of the best talks on SOLID design principles and OO design that I have watched recently. This talk is 4 years old but more relevant today as many programmers are trying to follow functional programming bandwagon without understanding what they are getting into. One of the best advice speaker gave is to use OO at the outside boundary of your system and FP in the inside where you are doing data transformation and processing. A lot of good literature exists on OO design so let’s make read it and try to first do OO right.