Enable/Disable profile specific spring security debug flag

Enable/Disable profile specific spring security debug flag

Spring security comes with a handly feature to enable debug flag to see a nice debug log as shown below to see what is happening with your application. You can control this feature from your bean configuration code Still, you may want to control it from application.properties files for some profiles. Like I want to keep it on for dev only.

Why not to fall for a new technology

Why not to fall for a new technology

Technology is changing at an exponential rate. Every day we welcome a new technology which claim to change the world. Solve day to day problem in an amazing way. We all feel tempted to use these, and sometimes end-up into unexpected situations. Here I sum-up three things I consider before using anything new. It’s not mature When it comes to new innovating technologies which challenge the existing paradigm, often start with something small. It takes a significant amount of development, reiterations…

Read More Read More

Serializing an object with static property

Serializing an object with static property

Serialization is often used to convert the in memory objects to stream and vice-versa. But static members are not part the object states so they are not serialized in this process. You need to serialize an object that has some static properties. The answer is, you need to control the process of serialization and De-Serialization for those objects. To do this in java you need to implement the interface Externalizable. This is similar to the Serializable interface but with more control…

Read More Read More

Traversing an array without using length property

Traversing an array without using length property

We often face an interview question when it is asked to search or traverse an array without knowing/using the length property. In Java, if you try to access the element that is outside the length of the array it will give you an exception as java.lang.ArrayIndexOutOfBoundsException. Here I have one implementation of a binary search where I will not use the length property of the array. import static java.lang.Math.pow; public class BinarySearchWithoutLength { public static Integer binarySearch(final Integer[] elements, final Integer find) {…

Read More Read More

Microsoft Azure Machine Learning Studio

Microsoft Azure Machine Learning Studio

Machine Learning has been a buzz word in every field. You can clearly see this on Google trend of search.   Even top giants are no different in this. After all, it has opened a new market for them like we previously had cloud computing now it has become cloud-based machine learning platforms. Microsoft Azure Machine Learning Studio is one of them. It’s a cloud-based platform that gives you features to create a machine learning experiment (at least what they…

Read More Read More

Why a constructor should not throw an exception?

Why a constructor should not throw an exception?

Just imagine if somebody asks you to do some task and when you have done 80% of it they come and ask to stop. Because you have not met preconditions for it. How will you feel about it? Something similar happens when you throw an exception from a constructor. What are constructors? (If you already understand this, let’s revisit or just skip to next para) A constructor is a special method that is responsible for initialization of the variable of…

Read More Read More

How to upload a files in php

How to upload a files in php

At some point in time, we all had requirements to upload some file on a website whether it’s for gallery image or CV for a career page. Here we have created a simple page that will upload multiple files and place them in a directory. We will also have a look at how to manage files using DB so that you can show them in your gallery/front end. Upload some files to directory First, you need to add enctype in your…

Read More Read More