Today, I was working with a code base that was using Hibernate‘s schema generation facilities to create the database schema for a customer on the fly. The application creates separate database schema for each customer. Then, depending on the client specific identifier it connects to the correct database. This blog will not talk about how you should design your application with multi tenant database. I will cover that in a future post. In this post, I will share the code snippet that helped me generate database schema with Hibernate 5. In this post, I am using MySQL database as an example. The same code snippet should also work with other RDBMS as well.
Continue reading “Programmatically Generating Database Schema with Hibernate 5”
Welcome to the ninth blog of 52 Technologies in 2016 blog series. Recently, Google released Cloud Vision API that enables developers to incorporate image recognition in their applications. Image Recognition allow developers to build applications that can understand content of images. Google’s Cloud Vision API is very powerful and support following features:
- Image categorization: The API can help classify images into categories. You can build powerful applications like Google Photos that do automatic categorization.
- Inappropriate content detection: The API can detect inappropriate content in an image like nudity, violence, etc. It uses Google Safe search capabilities underneath.
- Emotion detection: This allows you to detect happy, sad or moderate emotions in an image.
- Retrieve text from the image: This allows you to extract text in multiple languages from the images.
- Logo detection: It can help you identify product logos within an image.
There are many possible applications that you can build using this powerful API. In this tutorial, we will learn how to build a realtime people counter. The application will subscribe to a twitter stream for a topic and would return number of people found in each image. We can then use this data to get advanced statistic like number of people in a time frame using RxJava buffer capabilities.
You can read full blog https://github.com/shekhargulati/52-technologies-in-2016/blob/master/09-cloudvision/README.md
We all understand that we should code to interfaces. Interfaces give client a contract which they should use without relying on the implementation details(i.e. classes). Hence, promoting loose coupling. Designing clean interfaces is one of the most important aspect of API design. One of the SOLID principle Interface segregation talks about designing smaller client-specific interfaces instead of designing one general purpose interface. Interface design is the key to clean and effective API’s for your libraries and applications. Continue reading “Day 5 — Default and static interface methods in Java 8”
Every Java developer whether beginner, novice, or seasoned has in his/her lifetime experienced
NullPointerException. This is a true fact that no Java developer can deny. We all have wasted or spent many hours trying to fix bugs caused by
NullPointerException. According to
NullPointerException JavaDoc, NullPointerException is thrown when an application attempts to use null in a case where an object is required.. This means if we invoke a method or try to access a property on null reference then our code will explode and
NullPointerException is thrown. You can follow the 7 Days with Java 8 series at https://shekhargulati.com/7-days-with-java-8/ Continue reading “Day 4 — Let’s write Null free Java code”
On day 2, you learned that Stream API can help you work with collections in a declarative manner. We looked at the
collect method, which is a terminal operation that collects the result set of a stream pipeline in a
collect method is a reduction operation that reduces a stream to a collection. The
collect method takes a
Collector which let us implement functionalities like group by, partitioning, very easily. Continue reading “Day 3: Let’s collect data using Stream API”
On day 1, we learnt how lambdas can help us write clean concise code by allowing us to pass behavior without the need to create a class. Lambdas is a very simple language construct that helps developer express their intent on the fly by using functional interfaces. The real power of lambdas can be experienced when an API is designed keeping lambdas in mind i.e. a fluent API that makes use of Functional interfaces(we discussed them on day 1). Continue reading “Day 2 — Let’s learn about Streams”
Last few weeks I have spent considerable time writing integration test suite for one of our product installers. The goal of this test suite is to automatically test functionality of the product on various operating systems. Currently, we are running our automated test suite on Windows 2008, Windows 7, and Windows 8 systems. In this blog, I will first talk about the technology stack that we used to build our automation framework and then I explain how you can write such test suite using Java installer as an example. Continue reading “Writing Test Automation Framework for Installers”