Latest Posts

Learning JavaScript 101 (wad-js-01)

JavaScript

Introduction

  1. Java and JavaScript?
  2. EMCAScript ES6
  3. V8 Engine
  4. The JavaScript Ecosystem
    • Browser and HTML
    • Server Side: Node.js
    • Mobile
      • Apache Cordova
      • React Native, Redux
      • (more…)

Easy Web Application Development for Beginners with Node-RED

Objective

The objective of this tutorial is to create two applications: a Node.js application that functions as a web client, and a Node-RED application that functions as the server. You will create an input form in the client that lets a user send a registration request to a server. The server will save the registration in a database and send a spoken response back to the client using IBM Watson’s Text to Speech service.

Requirements

You must have access to a Bluemix account.

1. Create a Client Application with SDK for Node.js

First, I will create a Node.js web application, which will function as our client and we will create web pages to ask for user input. Technically, this client application is also running on a server, so it is perhaps confusing to call it a client, but in our scenario and architecture, this client application functions as the user interface that initiates the request to a processing server.

  1. Go to http://bluemix.net and click to ‘LOG IN’ button to log into your Bluemix account,
  2. If this is the first time you log in, Bluemix will ask to create an organization and a space. You can create multiple spaces, for instance a different space for each
  3. Click the ‘CATALOG‘ menu on the top right of the page,
  4. To create a Node.js based application with the ‘SDK for Node.js’, find the ‘SDK for Node.js’ in the ‘Runtimes’ section and click the icon,
    bluemix-catalog-nodejs
  5. (more…)

Philip Roth, Indignation (2008)

philip_roth_indignation_2008Philip Roth, Indignation (2008), 231p

“of the terrible, the incomprehensible way one’s most banal, incidental, even comical choices achieve the most disproportionate result.”

Marcus Messner is the son of Jewish parents, a kosher butcher and his wife, in Newark, New Jersey. Messner is phonetically close to the German word for knife: ‘Messer’. The knife and cutting is a returning and central symbol in Indignation, Marcus dies by the bayonet, his father’s livelihood depends on his knife skills, Olivia Hutton has cut her wrist in an attempted suicide.

Another thread in the story is the indignation Marcus feels about having to attend mass 40 times as a requirement at Winesburg college. At Dean Caudwell’s office, he recites two full pages from Bertrand Russel’s “Why I am Not a Christian.” This theme is closed at the end of the book, with the White Panty Raid. The ‘Panty Raid‘ was a historic phenomenon that started in 1949 and lasted through the 1950s at American colleges. In 1971, a student uprising at Winesburg college resulted in the abolishment of the mass attendance requirement. Marcus Messner’s final doom is caused by this requirement and Ziegler’s proxying for him at the chapel.

‘Indignation’ is associated to ‘American Pastoral’ and ‘I married a Communist’ and has been called the ‘American Trilogy’ by Roth.

Indignation (2016)

QAVideos (3) – Extend Model and Using Swagger.io in Node.js

This is part 3 in a series to build a sample application called QAVideos using StrongLoop (now API Connect).

  • In part 1 ‘QAVideos (Part 1), Adding User Management to Node.js’, I added User Management to a Node.js app using StrongLoop.
  • In part 2 ‘QAVideos (Part 2), Add Custom Model and ORM in Node.js‘, I added a custom data model, i.e. a Video model, and used ORM to persist the model to a PostGres database.
  • In part 3 ‘QAVideos (Part 3), Extend Model and Using Swagger.io in Node.js‘, I extend the built-in User model with Member, add a Question and Answer based on a Video model, and add a Sticker, while using Open API Specification or Swagger.io to define and manage the application from a Swagger specification file.
  • In next parts, I will add Object Storage for video support, create an Ionic/Apache Cordova based mobile client, add an automated build, deployment and test script, add a Content Delivery Network (CDN) to the backend, containerize the application, add chat, and more.

Prerequisites

  • Node, npm, StrongLoop and API Connect must be installed,
  • Check if the ‘slc’ tool is installed, by running ‘slc’ from the commandline. If not, follow the installation instructions, here.
  • Check if the ‘apic’ tool is installed, by running ‘apic’ from the commandline. If not, from the commandline run ‘npm install -g apiconnect’.
  • Get the source code from part 2 of this tutorial and follow the installation instructions.
  • Test if QAVideos (part 2) is running correctly by typing ‘node .’ in the root directory and browsing to ‘http://localhost:3000/explorer’ in your browser.

Open API Initiative (based on Swagger)

The OAI is based on the Swagger API specification, which is a description format for defining Restful APIs. The current Swagger API specification can be found on GitHub: https://github.com/OAI/OpenAPI-Specification.
(more…)

Running your own Blockchain

Requirements

Hyperledger and Fabric

The fabric is a ledger of digital events, called transactions. A transaction is a request to the blockchain to execute a function on the ledger. The function is implemented by a chaincode. Chaincode is application code (aka a smart contract) stored on the ledger as part of the transaction. Chaincode runs transactions that can modify state. In a permissioned blockchain, entities register to acquire identity credentials.

Create Blockchain Service

This tutorial is a re-cap of this tutorial: learn chaincode.
First create an application on Bluemix:

  • Login to Bluemix and go to the Bluemix catalog, browse to ‘Runtimes’ and click the ‘Node.js Runtime’. Populate the application configuration fields, name the application ‘<username>-blockchain1’, and click the ‘CREATE’ button.
  • Go to the application ‘OVERVIEW’ page, and click the ‘ADD A SERVICE OR API’ link, in the catalog, browse to the ‘Network’ category or in the left menu under Services select the ‘Network’ filter, and click the ‘Blockchain’ service, accept the default settings and click ‘CREATE’, accept the ‘Restage’ popup window.
  • In the left menu of the application detail page, under ‘SERVICES’, click the new ‘Blockchain’ service, and on the service page, click the ‘LAUNCH’ button,
  • You should not see the Monitor page of the Blockchain cloud service. The web address or URL should look something like this ‘https://obc-service-broker-prod.mybluemix.net/v2/monitor’, make sure you are on ‘v2’ or version two. The Blockchain service has its own pre-configured Blockchain network, including one Certificate Authority, and two validating peers, each has a ‘Discovery’ and an ‘API’ endpoint.
  • Click the ‘APIs’ tab to see the API documentation.

(more…)

Using MQTT to publish data and send commands for IoT

MQTT is a publish-subscribe messaging pattern with a light-weight footprint, ideal for IoT devices. This tutorial will create a basic workflow via an MQTT Broker from device client to application server and back. To avoid any hardware dependencies in this tutorial I will simulate the device client and implement it as a Node.js server. The application server will also be a Node.js server.

  1. Requirements
  2. Setup an MQTT Broker
  3. Register a Device on the MQTT Broker
  4. Create an API Key on the MQTT Broker
  5. Create the IoT Device Client
  6. Create the IoT Application Server
  7. Publish Data from Client to Application via Broker
  8. Send Commands from Application to Client via Broker

Requirements

Setup an MQTT Broker

The publish-subscribe messaging pattern of MQTT requires a message broker. One easy way to create one is to create an MQTT broker from a boilerplate application ‘Internet of Things Platform Starter‘ in Bluemix.
(more…)

Uncanny Love

Through this dark night
Your heart is bright
Like a fair moonlight
My soul you guide

Into your loving bed
To suckle your breast
And clamp your chest
Into your womb my head

So you sooth
me like a boy
To be a man

Thus looted
By a woman coy
love uncanny

Faces (53)

The short stubbles of his scruffy goatee blended like a brightly colored motion of a pointillist painting into the detailed foam of ginger waves and the freckled splashes of his reddish face under an orange sky lit by a spiky haircut. His light blue eyes looked gloomy.

QAVideos (2) – Add Custom Model and ORM to Node.js

This is part 2 in a series to build a sample application called QAVideos using StrongLoop. In part 1 ‘QAVideos (Part 1), Adding User Management to Node.js with StrongLoop’, I showed how to add User Management to a Node.js app using StrongLoop. In this part 2, I will add a custom data model, i.e. a Video, Question and Answer models and extend the built-in User object.

Prerequisites

  • Node, npm and StrongLoop must be installed,
  • Check if the ‘slc’ tool is installed, by running ‘slc’ from the commandline. If not, follow the installation instructions, here.
  • Get the source code for part 1 of this tutorial and follow the installation instructions here.
  • Test if QAVideos (part 1) is running correctly by typing ‘node .’ in the root directory and browsing to ‘http://localhost:3000/explorer’ in your browser.

Create Data Model

First, let’s add a custom model ‘video’ so that users can manage a list of videos. To do this, I create a model for the video, define the relationship between Video and User (a User can have many videos), and specify the access level of users to the video object using an Access Control List (ACL).
(more…)

QAVideos (1) – Adding User Management to Node.js

One of the basic requirements for applications is to manage and authenticate users. I will use StrongLoop and Angular.js to add user management to a Node.js application called QAVideos. The QAVideos app is a Question and Answer application using videos instead of text, think of it as StackOverflow meets Youtube. I will add more functionality to the QAVideos app in following parts: adding an Object Model with an extended User object and using Swagger to generate the Object Model among other.

Steps:

  1. Create the Application
  2. Add Static Pages
  3. Add Angular
  4. Generate the Angular services script
  5. Add Signup
  6. Create an Authentication Service Provider
  7. Add Login
  8. Add Logout

Design of the Application

The initial design of the QAVideos application is very simple. A user can register, login and logout. An authenticated user can create, update and delete videos to the platform and see a list of their videos. Unauthenticated users can see all videos.

About StrongLoop

If you are not familiar with StrongLoop, it is an API platform for Node.js and includes Loopback to quicly compose APIs and graphical tools like the API Explorer to document APIs and Arc to build and manage your application. I will use Loopback to compose the model and the APIs.
(more…)

%d bloggers like this: