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”
Tag: java
Day 3: Let’s collect data using Stream API
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 List. The 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”
Day 2 — Let’s learn about Streams
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”
Writing Test Automation Framework for Installers
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”
Day 18: BoilerPipe–Article Extraction for Java Developers
Today for my 30 day challenge, I decided to learn how to do text and image extraction from web links using the Java programming language. This is a very common requirement in most of the content discovery websites like Prismatic. In this blog, we will learn how we can use a Java library called boilerpipe to accomplish this task. Read the full blog here https://www.openshift.com/blogs/day-18-boilerpipe-article-extraction-for-java-developers
Day 13: DropWizard–The Awesome Java REST Server Stack
I have mainly been a Java guy throughout my 8 years as a software developer. For most of the applications I have written, I used the Spring framework or Java EE. Lately, I am spending time learning web development in Python, and one thing that has impressed me a lot is the Flask framework. The Flask framework is a micro-framework which makes it very easy to write REST backends. Today for my 30 day challenge, I decided to find a Java alternative to Python’s Flask framework. After doing some research, I discovered that the DropWizard framework can help me achieve the same productivity as the Flask framework. In this blog, we will learn how to build a RESTful Java MongoDB application using DropWizard. Read the full blog here https://www.openshift.com/blogs/day-13-dropwizard-the-awesome-java-rest-server-stack
Day 12: OpenCV–Face Detection for Java Developers
Today for my 30 day challenge, I decided to learn how to do face detection using the Java programming language. Face detection helps in recognizing human faces in arbitrary (digital) images. After doing some research, I discovered that the OpenCV library can help me detect faces in an image. However, I wasn’t able to find a complete beginner tutorial for using OpenCV library with Java, so this blog might help others looking for an introductory text on this subject. Read the full blog here https://www.openshift.com/blogs/day-12-opencv-face-detection-for-java-developers
Day 4 : PredictionIO : How to Build A Blog Recommender
Today is the fourth day of my challenge to learn 30 technologies in 30 days. So far I am enjoying it and getting good response from fellow developers. I am more than motivated to do it for full 30 days. In this blog, I will cover how we can very easily build blog recommendation engine using PredictionIO. I did not find much documentation around using PredictionIO with Java. So, this blog might help people looking for end-to-end PredictionIO Java tutorial. The full blog series can be tracked on this page.
What is PredictionIO?
PredictionIO is an open source machine learning server application written in Scala. It provides an easy to use REST API to build recommendation engines. It also provides client SDKs, which wraps the REST API. The Client SDKs are available in Java, Python, Ruby, and PHP programming languages. PredictionIO core is using Apache Mahout. Apache Mahout is a scalable machine learning library which provides various clustering, classification, filtering algorithms. Apache Mahout can run these algorithms on distributed Hapoop cluster. Continue reading “Day 4 : PredictionIO : How to Build A Blog Recommender”
Download JDK 7 update 25 via wget
To download Oracle JDK 7 via wget run the following following command
$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.tar.gz" $ mv jdk-7u25-linux-x64.tar.gz\?AuthParam\=1372827196_48b20a1d74cd809579eb76e369de596b jdk-7u25.tar.gz
Logging JAXWS SOAP Request and Response using a Java Property
Today I was faced with the situation that I needed to log the SOAP requests and responses going in and out from a Java client. I just had the client jar no source code so I can’t any any log or change any other configuration. I needed to log the request and response because I was getting some weird exceptions which I was not able to understand. I got the hold of the SOAP request by passing a Java property
java -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true -jar client.jar
