Author Archives: remkohdev

How to Create an Angular2-Ionic2 Mobile App with a List, Nested Detail and Form Pattern

Salman Akhtar, Selma Kramer, The Seasons of Life (1997)

Salman Akhtar, Selma Kramer, The Seasons of Life (1997) 183p

Salman Akhtar (1946-) is a Pakistani-American psycho-analyst, who was a former pupil of Margaret Mahler (1897-1985). I previously read ‘Immigration and Identity (1999)‘ by Akhtar. In academia, your success often depends greatly on the favor and serendipity of your professor. Akhtar’s chance was to work with world famous child psycho-analyst Margaret Mahler. Mahler is renowned for her pivotal role in the study of normal development of child psychology. Her famous work ‘The psychological birth of the human infant (1975)’ defined the process of separation-individuation in child psychology.

Akhtar’s ‘The Seasons of Life’ is essentially a literature study of articles and works by subsequent psychologists supporting the view that this separation-individuation continues throughout life.
Anni Bergman worked closely with Margaret Mahler and researched the individuation that continues after object constancy throughout life and how this development of the autonomous self impacts later phases of development and later life conflicts and crises.
Calvin Colarusso argues that the lifelong separation-individuation process comes with an inherent threat of object loss in every stage of growing independence, which can be translated into ongoing negotiation and control during the middle years.
Stanley Cath focuses more on the third phase in life, where older individuals balance between ongoing losses and the restitution in anchoraches that hold the self together. Colarusso uses the example of Mr. Holland’s Opus () to demonstrate the conflicts between family loyalties versus career aspirations or aspirations of the self.

Ionic2: if … else … template blocks in Angular2

Angular2 supported an if-condition via the *ngIf directive.

<div *ngIf="edit == false">
VIEW
</div>
<div *ngIf="edit == true">
EDIT
</div>

Since Angular2 v4, the ngIf directive was extended with an ‘then.. else..’ syntax, in which you can reference the identifier of the HTML tags to include.

<div *ngIf="edit; then editDiv else viewDiv"></div>
<ng-template #editDiv>
EDIT
</ng-template>
<ng-template #viewDiv>
VIEW
</ng-template>

Another way to control HTML input-tags to be editable or disabled, is to use the [attr.disabled] syntax.

<input [attr.disabled]="edit ? null : true">

When using Ionic2, this translates to the following code.

<ion-input [disabled]="!edit"><ion-input>

In the TypeScript component, then in the control the ‘edit’ boolean variable.

I use the [attr.disabled] syntax for instance to display a detail page of an object in view (Read) or edit (Create/Update) form, and adding a Delete option to the view modus to complete a CRUD option. This simplifies my application development, imo, cause now the navigation in my application is mostly from List to Detail pages.

See also: NgIf Else lands in Angular 2.x+/4.0, Ashish Singh (Dec 18, 2016)

The Sommelier

The sommelier was a light-black hispanic man in his mid-twenties, perfectly mannered and composed, quick to react to my teasing wit, while at the same time leaving no trace of composition in his smile, displaying an honest exuberance. The sommelier had been held up in the wine cellar while we picked our courses from the menu and had inquired for his advice on the wine pairing. He stood lightly stooped over our table, one hand behind his back and pointed with his hand, extended in a straight angle from his shoulder, at the wine choice, an Austrian Grüner Veltliner by Hirsch from 2013, that paired well with the Spanish octopus and the Japanese hamachi.
“You got locked up in the wine cellar by your co-workers, it seemed?”
“They tend to do that, yes,” he answered with a genuine and gentle smile.
“The Château de Pressac, Grand Cru Classé, from Saint-Émilion is a French wine with a very dark hue and berry that pairs excellent with the Wagyu Beef.”
“Excellent, I trust you.”
As the sommelier walked off, one of the middle-aged Indian backwaiters walked over, holding a dark wood woven breadbasket in front of his pelvis and a silver bread tongs in his right hand hovering above the whole grain, mini bread rolls and elongated berry bread sticks, ready to grasp a single roll with his tongs and transfer it to our plates.
“No, thank you.”
We had gracefully declined already at least 3 times prior.
Immediately following the bread runner, sensing another window of opportunity to prove his value, came the water runner holding a thin, chrome water dispenser, and carrying a white napkin folded over his wrist. I could hear the ice cubes dancing in the can, clinging against the metal sides of the dispenser, creating a wild, loud motion inside. Barely without pause, his arm stretched in one flow with his walk, as his legs came to a stop the dispenser moved steadily forward, being stretched out without delay to the rim of the glass. The glass was not even half empty yet, but water poured down like an avalanche or waterfall in one wholesome fall, everything passing so quickly it could not be helped. Drops of water splashed all over the table, the glass now refilled to the rim in a wild splatter of an instant, the base of the glass soaked in condensed water rolling down the bowl along the stem of the glass and being absorbed by the saturated table cloth. Seeing the refilled bowl of water, the Hispanic runner’s smile was equally full with satisfied content of a job well done.

Nikolay Gogol, The Government Inspector (1863)

Nikolay Gogol, The Government Inspector (1863) p213-306

I am not a big fan of comedy, and certainly not of farce. Humor is too often no more than a coquette compulsion to please, it is by definition a social function, even if we might have evolved to laugh uncontrollably. Yet, watching the adaptation by Jeffrey Hatcher, I found myself to laugh without self awareness. The book however, is especially clever in the first part, but toward the end it slowly evens out into a cleverly written play without depth or wit.

The Government Inspector
Adapted by Jeffrey Hatcher
From The Government Inspector by Nikolay Gogol

The Duke Theater
a New 42nd Street project
229 West 42nd Street (between 7th & 8th)​

An Old Oak Tree Grows There

Only grow
like an old oak tree
that is firm
and will agree
reed does fold
roots do hold

Only hurry
like a steady water
as my heart
a trough of fodder
seed to nourish
love to flourish

Messenger2Watson(1): Connect Facebook to a Watson Chatbot

In Slack2Watson(1) and (2) I created a chatbot and integrated it into Slack Slash Commands. Now, let’s integrate the same chatbot into Facebook Messenger. To accomplish this I need to create a Facebook Application, add the Messenger Platform to my Facebook Application, create a Webhook, have admin access to a Facebook Page to generate a Page Access Token so I can send and receive messages send to the Facebook Page, and create the Node-RED flows to integrate the Facebook Messenger with the IBM Watson Conversation.

Steps:

  1. Create a Flow to Verify the Request for Webhook Edits in Node-RED,
  2. Create an Endpoint for the Redirect URL of the Webhook in Node-RED,
  3. Create a Facebook Application for the Messenger Platform,
  4. Enable Webhooks Integration with Node-RED,

Create a Flow to Verify the Request for Webhook Edits in Node-RED

To prepare the setup and configuration of the Facebook Application, the Messenger platform and Webhooks to enable a chatbot in Facebook Messenger, I will first create the Node-RED flows to implement the required server workflow.

The first flow is to verify the endpoint for the setup of the Facebook Application, using the ‘hub.challenge’ token.

  • Go to your Node-RED application on Bluemix at http://<username>-nodered-slackapp.mybluemix.net/,
  • Click the ‘Go to your Node-RED flow editor’ button,
  • If you’re not logged in yet, log in now,
  • Add a new flow tab and rename the flow ‘Facebook Messenger’,
  • To verify your endpoint during setup of your Webhook, or when you update an existing topic subscription of your Webhook, Facebook sends a GET request. The request will include:
    hub.mode=subscribe
    hub.challenge — a random string
    hub.verify_toke
  • Continue reading

Slack2Watson(2): Connect Slack to a Watson Chatbot with Node-RED

Using:

  • Slash Commands in Slack,
  • Watson Conversation service to create a ChatBot,
  • Node-RED to configure the Application Flow,

Using a chatbot, I want to automate the following scenario:

  1. user: Hello
  2. chatbot: Hello. Where are you?
  3. user: hi, i am at the Rubin Museum.
  4. chatbot: I love the Rubin Museum. Shall I give you some recomendations of my personal favorites?
  5. user: oh yes, I would love some recommendations.
  6. chatbot: do you like sculpture, paintings or ornaments?
  7. user: i prefer paintings!
  8. chatbot: ok, here are my favorite paintings at the Rubin Museum: a, b, c

Steps:

  1. Create the Watson Conversation for the Rubin Museum Scenario,
  2. Test the Conversation for the Rubin Museum Scenario,
  3. Setup Slash Commands in Slack,
  4. Create the Node-RED Flow to Watson Conversation,
  5. Add Token Validation of the Slack Request to Node-RED Flow,

Create the Watson Conversation for the Rubin Museum Scenario

  • Go to IBM Bluemix and login to your account,
  • To create the Watson Conversation, click the ‘Create Service’ button, which will take you to the Catalog, or
  • Go to the Catalog, Under ‘Services’ filter by ‘Watson’, or in the catalog browse to the Watson section,
  • Click the ‘Conversation’ service,
  • Agree or change the ‘Service name’ and the ‘Credentials name’, and click the ‘Create’ button,
  • Under the ‘Credentials’ tab, you will find the username, password, and workspace ID that you need later to configure access to the conversation service,
  • Click the green ‘Launch tool’ button,
  • First create a workspace, click ‘Create’, name the workspace ‘Watson2Slack-Workspace’, and click ‘Create’,
  • You are now in your Conversation workspace, and you should see 3 tabs: Intents, Entities, and Dialog,

    Continue reading

Erik Larson, The Devil in the White City (2004)

Erik Larson, The Devil in the White City (2004) 390p.

I have read ‘The Devil in the White City’ as a trilogy, together with ‘Nature’s Metropolis‘ and ‘The Jungle’, and the overlap and synergies between the three works is so insightful to understand the roots of modern America, which sprouted in the Gilded Age of Chicago. Americans in general have perhaps a short memory and a shallow desire to understand their history or present, as they are so energetically working to build their future, but as they strive thus forward, they fail to see the straight trail they leave behind. The history of Chicago is interestingly also transcending the contemporary spleen of American culture. ‘Nature’s Metropolis’ more than any other work perhaps, gives a more comprehensive insight into the shared destiny of the northern East Coast and the Great West and South. The history of Chicago is the stitching between the common descent, by opening the gap between the White City and the Black City, between the amazing wonders and creative forces of the American Dream on one hand and the devastating destruction and humiliation of the American Psyche on the other, by describing a meticulous history of the ‘World’s Columbian Exposition‘ of 1893 and a portrait of America’s first serial killer H.H. Holmes.

Looking forward to the feature movie with Leonardo diCaprio by Martin Scorsese.