Thursday 23 May 2019

1.1.1.1 - the Cloudfare DNS

Somebody heard of Cloudfare?

If not, visit them at 1.1.1.1.

Yes, the fastest public DNS resolver is from Cloudfare, and the IP is the above stated fancy IP address.

Now let's talk serious. Till the recent past, I have seen most of the people trying out 8.8.8.8 as well as 4.4.4.4. These are the public DNS from the most loved Google. But there are multiple faster options. Like the OpenDNS and Cloudfare.

Google is notorious for using people's data for their business benefits, this is for sure within the terms and conditions we agree upon, and 99.9999999999% of users don't even bother to read the terms document before clicking on agree or accept button.

Now, how fast?

As per www.dnsperf.com, 1.1.1.1 is more than 30% faster than the c competitor, OpenDNS.

How to make use of the DNS?

There are multiple ways. If you are a mobile device user then, just download the free app 1.1.1.1 available in the Play Store. If you have a home router, then a better idea would be to manually override the DNS settings to use 1.1.1.1 instead of the internet provider's automatically assigned ones.

The backup IP for Cloudfare is 1.0.0.1, another fancy one!

Saturday 18 May 2019

Dynamic or Anonymous arrays in Java

As a Java developer, many might have encountered a silly problem which is very trivial to solve!

I have one variable or may be two. And there is some kind of processing to be done, of they need to be passed to a method as an input. Also assume that there exists a method(function) that could be reused. All good! But there is a minor problem if the method accepts only an array.

What is a the best way to solve this problem?

Creating an array which need not be us d further in the caller code could be polluting the code. A better way could be to create an array and just use it for calling the method alone.

How to do that?

Easy. Just try this:

new String()[]{variable 1, variable 2}

// Assuming the variables are of string type!

😇