Tuesday, April 16, 2019

Notre Dame in Flames

Along with much of the rest of the world I am saddened by the huge damage of the Notre Dame fire. This is a great visual guide describing what happened. You can even slide the before-and-after pics there.

It does not look like terrorism is involved... that's good. The world will vow to kick any groups dare to do that.

Just the lots-of-wood structure catches fire somehow. And gosh, the roof is so high that firemen can't reach. Now the Notre Dame is a few hundred years old... and took more than one hundred years to build! Back in those Middle Age Days... there were nothing else much better to do than to build ever-bigger cathedrals and make complex symphonies... a display of power.

Now to reflect.. what's the use of the cathedral just before the fire? Do people still worship in there? Not really it is a hot tourist spot and awesome architecture display. People (with plenty of money) vow to reconstruct it! What for? So they can go back to worship? You do not need a spectacular building to worship. I hope they reconstruct with plenty of fire safety features built in... and it is time to... fire protect other great buildings in the world, especially if it is made of wood.

I am glad nobody say it is a omen.. or wrath of higher being onto the people there.

Who would be responsible for this terrible incident/accident?

Monday, April 1, 2019

This is why one should learn some history

Especially if you are part of history.

1) GOP did not make an amendment to block FDR

Ocasio-Cortez falsely says GOP changed Constitution to block FDR from re-election.

2) There aren't 3 Mexican countries

https://www.nbcnews.com/business/business-news/fox-news-apologizes-graphic-about-3-mexican-countries-n989526

Calling http/https API

The apache httpclient is a de facto standard in calling http within Java.

Here is an excellent introduction with examples: https://www.mkyong.com/java/apache-httpclient-examples/

Now in http calls, you using do POST and GET, and pass parameters like in a html form... sometimes you have to header variables and pass JSON in body too in calling API. The link above provides nice examples. Hard to do from scratch.

What if you have to do https?

Boom! You may get this infamous exception:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: 
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
 unable to find valid certification path to requested target 
The problem here is you need certificates, you can create one with not-so-straightforward commands lines with the keytool command that comes with your JDK. (Go ahead google for it)... and you have to pass in -D parameters in your JDK call.

Or you can choose to allow everything. See this Stackoverflow doc: https://stackoverflow.com/questions/875467/java-client-certificates-over-https-ssl