Monday, August 11, 2014

The DB is the Foundation

I am surprised how little understood is still nowadays the importance of having clean, validated data in a DB.

DB schemas devoid of any NULL check, referential constraints and range checks are still commonplace, and management shuns attempts to enforce rigor perceiving it as "lack of flexibility". How flexible it is to have a "status" spelled in 5 different ways, or a date field represented as String and expressed in 10 different formats, or a boolean value expressed sometimes as True/False, other times as 0/1 and other times as YES/NO, I have no clue.

The DB is like the feet of your company, if feet are unstable, then your knees, your back, even your neck will start hurting and degenerating and making your life utterly miserable.

Statements like "we do all our validation in the front end" are ludicrous, ad history tell that Operations will make sure that a lot of DB changes will happen through custom scripts, independent UIs and even manually.

There are many analogies to DB constraints: control entropy (Physics), anti-cancerous cells (Biology), closed loop feedback (Control Systems), Secret Services (Fascist state - well all States are fascists inherently, so calling Fascist a State is a tautology)....

Saturday, August 9, 2014

Book: The Ethnic cleansing of Palestine



Professor Ilan Pappé does a wonderful job at explaining in the most minute (and horrific) details the events leading to the foundation of the State of Israel. It was simply a very well prepared, large scale military operation of Land Grabbing and Ethnic Cleansing quite similar in its dynamics to the one perpetrated by the Nazi Einsatzkommandos in Eastern Europe.

Zionist soldiers would reach villages mostly in the night, launch a few grenades, kill some people and expel the others, mostly without meeting any resistance, then loot their houses, grab their land and bulldoze mosks.

To his honor, Pappe never makes the all-too-easy comparison Zionism = Nazism, recognizing that the sole aim of the Zionist was to expel the Palestinians from their homeland, not to exterminate them. Of course they had to do some massive killing, but the target was mostly adult males. Nor they established death factories of the like of Nazi KZ, normally the Palestinian males would be shot on the spot in front of their families, while all the rest of the population was simply driven out in long foot marches to the neighboring countries.

The book also dismounts the Zionist myth of the "Israel besieged by Arabs" and "second Holocaust", showing that the Zionist had always an overwhelming military supremacy, and full support from the British. Jordan was always quite cooperative with them, and the other Arab armies were very limited in size, weaponry and coordination, and they intervened way too late when already 1 million Palestinians had been robbed of their land.

What makes this book even more valuable, is that it was written by a Jew whose family escaped from Nazi prosecution. This blunts the weapons of those ready to call Nazi and Anti-Semitic whoever criticizes Israel policies. Go get it.

Thursday, August 7, 2014

HTTP GET in Java, performance issues

My first version was:

import java.net.*;

URL url = new URL(theURL);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String wholeInput = "";
String inputLine = null;
while ((inputLine = in.readLine()) != null) 

{ wholeInput += inputLine; }



The above code proved to be EXTREMELY slow. The below version is MUCH faster:

URL url = new URL(theURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String wholeInput = "";
String inputLine = null;
while ((inputLine = in.readLine()) != null) 
 { wholeInput += inputLine; }
in.close();