Posts

Showing posts from January, 2019

Software, the war, the battles

In general terms, the word "War" has a bad connotation. Many lives have been lost and so much suffering caused since the very first dispute over some land or water source, don't make an easy task to argue in favor of war. However, bitter experiences leave lessons and learnings that I can list but, sincerely, I doubt myself doing a better job than what the excellent Lean Enterprise book does as follows: Napoleon used a style of war known as maneuver warfare to defeat larger, better-trained armies. A key element in maneuver warfare, the goal is being able to learn, make decisions, and act faster than your enemy. The Prussian Army, following its defeat by Napoleon, led by Carl von Clausewitz, David Scharnhorst, and Helmuth van Moltke, not only was reconstructed but improved through the idea of Auftragstaktik or Mission Command. Mission Command details go beyond this article but I extract the following as its main contributions: To recognize the authority to make decis...

Unit Testing Solidity Smart Contracts

Image
Hello, world! I consider unit testing one of the most important techniques and habits to create quality in applications from the very beginning. With the advent of Blockchain and Solidity smart-contracts, I keep the habit and continuously looking for improve it. In particular with Blockchain , I don't think the way to test a smart contract is through deploy it to Ganache , set breakpoints through the code of interest, printf-like debug, and tricks like that. There's nothing wrong with them except that this requires to develop a client application (say, an HTML page with web3.js ) and, when testing is against a running Blockchain , it consumes more time and resources. Unit testing works better, is cheaper, and increases productivity while makes the smart contract more resilient to adapts and changes. This article is about using JavaScript to unit test a Solidity smart contract. It assumes you are familiarized with Truffle Framework , the Solidity programming language, Mocha ...

Angular, Azure AD, and Microsoft Graph

Image
Hello, world! In this post I do a 101 intro on Microsoft Graph , an important part of Azure AD and related platforms like Office 365 , and it assumes you have read Angular6 and Azure AD and Angular and Azure AD with a better UX . Microsoft Graph is extensively documented by Microsoft and I extend an invitation to read it starting here . Here is my highly irresponsible definition of Microsoft Graph : I like to think of it as a repository made of nodes connected with each other with the user node being the main. Every node contains data about it and more can be found by traversing the net (graph). For example, a user node contains her name, phone, and email whereas, by traversing the graph, we can find the list of meeting attendees in a given calendar day scheduled through Office 365 . In this post, Microsoft Graph is used to honor a Marketing requirement for greeting the user with the shorter first name instead of the full name because that leaves more room for pleasant ads ;). Th...

Angular and Azure AD with a Better UX

Image
Hello, world! In this post I improve the user experience by adding Bootstrap and greeting the user by her name once she is logged in. It assumes you have read Angular6 and Azure AD . A Better UX It makes little or no sense to have both Login and Logout buttons visible at the same time. Essential state management: the Login button must be visible when the user is not authenticated and Logout must be when she is. This will be accomplished by modifying AuthService and AppComponent . Let's start with AuthService where the userLoggedIn property is added and set when a successful authentication took place and unset when the user logs out: import * as Msal from 'msal'; import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class AuthService { private userAgentApplication: Msal.UserAgentApplication; private _userLoggedIn: boolean; get userLoggedIn(): boolean { ...