Posts

Showing posts from 2016

Docker for Angular 2 devs

Image
Docker is a Virtual Environment Docker containers are great for adding new developers to existing projects, or for learning new technologies without polluting your existing developer machine/host. Docker allows you to put a fence around the environment while still using it. Why Docker for Angular 2? Docker is an easy way to get up and going on a new stack, environment, tool, or operating system without having to learn how to install and configure the new stack. A collection of docker images are available from Docker Hub ranging from simple to incredibly complex -- saving you the time and energy. Angular 2 examples frequently include a Dockerfile in the repository which makes getting the example up and running much quicker -- if you don't have to focus on package installation and configuration. The base Angular 2 development stack uses Node, TypeScript, Typings, and a build system (such as SystemJs or Webpack ). Instead of learning each stack element before/while learning

An interesting Interview Question: Fibonacci Sequence

Image
Write a function to calculate the nth Fibonacci Sequence is a common interview question and often the solution is something like   int Fib(int n) {    if(n < 1) return 1;    return Fib(n-1) + Fib(n-2); }   The next question is to ask for n=100, how many items will be on the stack . The answer is not 100 but actually horrible! It is closer to 2^100. take the first call – we start a stack on Fib(99) and one on Fib(98). There is nothing to allow Fib(99) to borrow the result of Fib(98).  So one step is two stack items to recurse.  Each subsequent call changes one stack item into 2 items.   For example 2 –> call [Fib(1), Fib(0)] 3 –> calls [ Fib(2)->[Fib(1), Fib(0)], Fib(1) –> Fib(0) ] 4 –> calls [ Fib(3)->[[[ Fib(2)->[Fib(1), Fib(0)], Fib(1) –> Fib(0) ]], Fib(2)->[Fib(1), Fib(0)], Fib(1) –> Fib(0) ] Missing this issue is very often seen with by-rote developers (who are excellent for some tasks).   A better solution is t

Apple Store Passbook UML Diagrams and Error Messages

Image
While working on a recent project, a major stumbling block was a lack of clear documentation of what happened where. This was confirmed when I attempted to search for some of the messages returned to the Log REST points by iPhone.. There were zero hits!     In terms of a Store Card, let us look at the apparent Sequence Diagram     Log Errors Messages Seen and Likely Meaning Passbook Inactive or Deleted or some one changed Auth Token [2016-08-28 11:57:01 -0400] Unregister task (for device ceed8761e584e814ed4fe73cbb334ee9, pass type pass.com.reddwarfdogs.card.dev, serial number 85607BFE98D91A-765F7B05-D5E4-4B32-B16D-69C2038EF522; with web service url https://llc.reddwarfdogs.com/passbook) encountered error: Authentication failure [2016-08-28 20:44:25 +0700] Register task (for device 19121d6b570b31a3fa56dbd45411c933, pass type pass.com.reddwarfdogs.card.dev, serial number 85607BFE98D91A-765F7B05-D5E4-4B32-B16D-69C2038EF522; with web service url https:

Solving PushSharp.Apple Disconnect Issue

While doing a load test of a new Apple Passbook application, I suddenly saw some 200K transmissions errors from my WebApi application. Searching the web I found that a “high” rate of connect/disconnect to Apple Push Notification Service being reported as causing APNS to do a forced disconnect.   While Apple does have a limit (very very high) on the number of notifications before they will refuse connections for an hour, the limit for connect/disconnect is much lower. After some playing around a bit I found that if I persisted the connection via a static, I no longer have this issue.   Below is a sample of the code. Note : we disconnect and reconnect whenever an error happens (I have not seen an error yet)    using Newtonsoft.Json.Linq; using PushSharp.Apple; using System; using System.Collections.Generic; using System.Security.Cryptography.X509Certificates; using System.Text; namespace RedDwarfDogs.Passbook.Engine.Notification {     public class AppleN

Taking Apple PkPasses In-House–Working Notes

This year I had a explicit, yet vague, project assigned to me: Move our Apple PkPass from a third party provider to our own internal system. The working environment was the Microsoft Stack with C# and a little googling found that the first 90% of the work could be done by nuget, namely: Install-Package dotnet-passbook Install-Package PushSharp Created a certificate file on the apple developer site and we are done … easy project… not quite   Unfortunately both in-house expertise and 3rd part expertise involved in the original project had moved on. Welcome to reverse engineering black boxes.   The Joy of Certificates! Going to http://www.apple.com/certificateauthority/   open a can of worms. The existing instructions assumed you have a Mac not Windows 10. The existing instructions found on the web( https://tomasmcguinness.com/2012/06/28/generating-an-apple-ios-certificate-using-windows/ )  broke due to some change with Windows or Apple in April 2016 ( apple forum

One Migration Strategy to Microservices

Image
The concepts of microservices is nice, but if you have a complex existing system the path is neither obvious or easy. I have seen Principal Architects throw up their hands and persuade the business that we need to build a new replacement system and that the old system is impossible to work with. This path tends to lead into overruns and often complete failures – I have recently seen that happen at a firm: “Just one year needed to deliver…” and three years later it was killed off because it had not been delivered.  The typical reported in industry literature statistics of 80—90% failure are very believable.   Over decades, I have seen many failrues (usually on the side lines).  On the other hand, for a planned phrase migration I have seen repeated success. Often success or failure seem to be determined by the agile-ness of the management and technical leads coupled with the depth of analysis before the project start. Unfortunately deep analysis ends up with a waterfall like specifi

Theory about Test Environments

Often my career has faced dealing with an arbitrary environment to test in. This environment preceded my arrival, and often was still there at my departure with many developers became fatalistic towards this arbitrary environment.  This is not good.   The Rhetorical Goal Recomposed “We use our test environment to verify that our code changes will work as expected” While this assures upper management, it lacks specifics to evaluate if the test environment is appropriate or complete. A more objective measurement would be: The code changes perform as specified at the six-sigma level of certainty. This then logically cascades into sub-measurements: A1: The code changes perform as specified at the highest projected peak load for the next N year (typically 1-2) at the six-sigma level of certainty. A2: The code changes perform as specified on a fresh created (perfect) environment  at the six-sigma level of certainty. A3: The code changes perform as specified on a

The sad state of evidence based development management patterns

I have been in the development game for many decades. I did my first programs using APL/360 and Fortran ( WatFiv ) at the University of Waterloo, and have seen and coded a lot of languages over the years (FORTH, COBOL, Asm, Pascal, B,C, C++, SAS, etc).   My academic training was in Operations Research – that is mathematical optimization of business processes . Today, I look at the development processes that I see and it is dominantly “fly by the seats of the pants”, “everybody is doing it” or “academic correctness”. I am not talking about waterfall or agile or scrum. I am not talking about architecture etc. Yet is some ways I am. Some processes assert Evidence Based Management , yet fails to deliver the evidence of better results. Some bloggers detail the problems with EBM.  A few books attempt to summarize the little research that has occurred, such as "Making Software: What Really Works and Why we Believe It"   As an Operation Research person, I would define the o

Mining PubMed via Neo4J Graph Database–Getting the data

I have a blog dealing with various complex autoimmune diseases and spend a lot of time walking links at PubMed.com . Often readers send me an article that I missed.    I thought that a series of post on how to do it will help other people (including MDs, grad students and citizen scientists) better research medical issues.   Getting the data from Pub Med I implemented a simple logic to obtain a collection of relevant articles: Query for 10,000 articles on a subject or key word Retrieve each of these articles and any articles they referenced (i.e. the knowledge graph). Keep repeating until you have enough articles or you run out of them!! Getting the bootstrapping list of articles A console application that reads the command line arguments and retrieves the list. For example, downloader.exe Crohn’s Disease which produces this URI http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=Pubmed&retmax=1000&usehistory=y&term=Crohn&