2017-08-22

Web server and new glasses

Some years ago I wrote my first Node.js Hapi.js program. Now it was time to write the second, or rather extend the first with a new function. First I upgraded  Node and Hapi from releases 0.x.x something to node vs  8.4.0 and Hapi vs 16.5.2, it looked like a giant leap and I expected to rewrite all from scratch, but only a few simple adjustment was needed.
The first version run a Data Warehouse job in the background and at the end responded if it was a success or not. That was fine until some long running made the HTTP interface time out. After many futile attempts to fix the timeout, I called Andreas he told ‘you don’t do it that way, create one function that starts the job and immediately return the pid of the submitted job, and another function that replies if the pid is active or not. I should have figured out that myself, but I didn’t.
Anyway that should be simple and it actually was except for one detail, I have new glasses, text is a bit blurred with the new lenses.


var foo = spawn("/bin/ps", [' -p ' + pid]. {shell: true});
The invalid dot magnified, should be a comma.
I had by mistake written a . (dot) instead of a , (comma), but I did not see the dot to me it looked the same as the comma it should be. Spending an entire day on google trying to figure out what the problem was, I finally rewrote the spawn statement and it worked just fine. Sometimes programming is so frustrating, simple things can take forever.
Now I will rewrite this simple web server into a proper REST server. This should be easy, my program is more or less a REST server as it is, I just have to tweak the code a bit.
But as usual I’m confused with the never ending list of ever growing Node js frameworks. I am thinking adding TrailsJs to Hapi.js just for the hell of it. I have absolutely no clue what the implications of that is.


The new “PID active” function:

It remains to be seen if I have to set the spawned process as detached or not. According to the documentation ‘detached’ is for Windows only.

2017-08-11

The growth of

The Data Warehouse still surprises me. After 16 years it still grows in terms of users, jobs, sql queries, reports etc. I had a look the other day at a Twitter published graph and saw jobs/month has increased from 58000 to 71000 during the last year, a staggering 22% that’s a lot.
Number of jobs or resource consumption are not a very good measures of the useful production of a Data Warehouse or any other application. It is very hard to measure the useful production of most computer apps. Number of jobs may indicate inefficiency or a stupid divide of logical tasks into too many jobs. Anyway it is a measure, assuming the Data Warehouse is not deteriorating the increase of jobs is an indication of increased use. As far as I can see the Data Warehouse is not deteriorating, if anything it is getting better.

Never in my wildest dream did I anticipated the phenomenal progress of the Data Warehouse when we started 2001 by solving one problem for one purchaser. And never did I expect the Data Warehouse be alive and kicking 16 years later. I'm not surprised however, useful applications have a tendency to live long. After my rewrite of the first version 2006, the Data Warehouse was superior to anything there was on the market. Some claim it still is, I don't know about that but it is certainly different from anything on the market.
   

2017-08-06

Amazon delivery time

2017-07-07 I ordered a book in paper format from Amazon. I choose the most economic transport without looking at delivery times. When I looked a my order, to my astonishment I realized the delivery date was 2017-08-17!
My word, what kind of process can result in that delivery time for a book year 2017? Does Amazon send the paper book from USA? With a sailing ship to Holland? And from there with a horse coach to Stockholm, Sweden?
I thought Amazon was a rational modern company with a serious customer focus. Not in my wildest dreams could I imagine such a long delivery time. I get the feeling Amazon purposely extend the delivery time to ‘punish’ me for not choosing a more expensive delivery alternative.

It would be interesting to know where Amazon prints my copy of the book and the route Amazon sends the book to me.
Looking at the order I can see the book is on its way to me😈