Saturday, April 7, 2018

Dumb Clients and Smart Cloud ? 
 
 
Introduction:   
As cloud computing becomes ubiquitous, compute and storage has become elastic for backend processing which facilitates moving much of the logic away from applications and mobile clients. This writeup challenges the notion whether clients want to retain any logic on their end. 
Description: 
Software evolved to become a service and offered via browsers in software-as-a-service (SaaS) model. At the same time serverless computing and containerization technology has evolved. While the SaaS has been powered by a single service usually a monolith sitting somewhere in an enterprise, its migration to the cloud was somewhat straightforward. Take the service that powers the SaaS and move it to the cloud.  
There were two problems with these. Changes to the service needlessly impacted the rest of the functionality from the software. At the same time front-end evolved to using more and more services so it became fatter and fatter.  
Neither of these two technologies have taken advantage of modular deep allocation of resources in the form of containers, services and even serverless computing. The idea behind serverless computing is that a modular chunk of code can spin up on demand resources for its exection without affecting any of the existing production support requirements. If the mashup of the services and the portal could be achieved in the backend and the applications or clients consuming the services were merely using native software development kits or a browser enabled markup, stylesheet and script combination, then they could be leaner, meaner and more efficient in their processing.  
The benefit of using a homogeneous and thin application / client is that it does not need to do any processing on its end and can merely treat the data from operation done via services as viewmodels. These viewmodels are sufficient for the front-end be it an application or client. 
Success with the Model-View-Controller pattern was widely acknowledged to have separated their respective concerns. Here we are separating services into fanned out serverless compute that can be brought together at the backend before sending the associated viewmodel to the frontend for rendering. 
The notion of service and resources is never lost. Similarly there seems no loss of fidelity in using a thin overall mashup of services or serverless computing as long as it is done on the backend so that there is only one set of endpoints for the application / client to talk to and anything behind that is entirely at the discretion of the provider. Internal services can be upgraded to serverless computing without any change on the front-end and therefore prepare a path for migration. 
Conclusion:  
Newer applications have embraced webAPI frameworks but these same frameworks could not facilitate a newer organization that enforces thinner simpler clients and applications with consistency. 

Friday, April 6, 2018

Today we will continue to discuss Microsoft Dynamics AX. We briefly reviewed the user interface features to get to know Dynamics AX. Then we looked at the variety of tools for viewing and analyzing business data. Data is usually presented in Reports. Reports can be standard-reports, Auto reports or ad hoc reports. Tasks might take longer to execute. Sometimes its best to let it run elsewhere and at some other time where they can be prioritized, queued and executed. Documents may be attached to data. This is helpful in cases where we need to add notes and attachments to the data.  The enterprise portal enables web based access to the dynamics instance on a server installed in the enterprise network. Access is role based such as employees, Sales representatives, consultants, vendors, customers etc. This completes a brief overview of the user interface.
The General Ledger is probably the core financial section of the user interface. It is used to record fiscal activities for accounts for a certain period. For example, it has accounts receivable and accounts payable sections.  The entries in the ledger may have several parameters, defaults, sequences, dimensions, dimension sets and hierarchies. In addition, tax information and currencies are also included.
Cost accounting is another key functionality within Dynamics AX.The cost of overheads and the indirect costs to the entities can be setup as cost categories and they can be defined for use within cost accounting. These cost categories can have a link to the ledger accounts. This way ledger transactions show up under the appropriate category. Costs can even be redistributed among other categories and dimensions so that the cost structure of the business can be analyzed. The dimensions of a cost usually include the cost center and the purpose.
#codingexercise
Recently I was asked how to avoid a while loop to ensure that a random number generator does not repeat the same number In C# for example Random object instance has a Next method and it already has a uniform distribution.  This is sufficient to say that the retry can be bounded to a finite number so that duplicates are avoided. Otherwise we can split the range and sequentially exchange with a random candidate from the other half of the range . 
Also a note on format specifiers in C++:
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
string s;
double d;
cin >> s;
cout << s << " World" << endl;
cin >> d;
cout << fixed <<  setfill('x') << setw(10) << setprecision(6) << d << endl;
return 0;
}
Hello
Hello World
3.14
xx3.140000

int pacmanMoves(vector<vector<int>> board, int I, int j)
{
Int rows = board.size();
Int cols = board[0].size();
If (i >= rows || j >= cols) return 0;
Int down = board[i][j] + pacmanMoves(board, I+1,j);
Int right = board[i][j]  + pacmanMoves(board, i, j+1);
return (down > right ) ? down : right;
}

Thursday, April 5, 2018

Today we will continue to discuss Microsoft Dynamics AX. We briefly reviewed the user interface features to get to know Dynamics AX. Then we looked at the variety of tools for viewing and analyzing business data. Data is usually presented in Reports. Reports can be generated in a variety of ways. The standard-reports are pre-constructed views of business data and they number in hundreds. Reports are available from their data sources such as general ledger. Auto reports enables us to view the data from a form and these data can be saved to the Application Object Tree AOT. Ad hoc reports provide greater flexibility for generating reports although they still use a report template. This is helpful when parameters have to be passed in to generate the reports. OLAP reports span more duration of data for analysis where trends in business data becomes more important.
Tasks might take longer to execute. Sometimes its best to let it run elsewhere and at some other time where they can be prioritized, queued and executed. For this purpose we can submit batch jobs which are maintained in a batch job list.
Documents may be attached to data. This is helpful in cases where we need to add notes and attachments to the data. Multiple notes may be attached to the same data.
The enterprise portal enables web based access to the dynamics instance on a server installed in the enterprise network. Access is role based such as employees, Sales representatives, consultants, vendors, customers etc.
#codingexercise from yesterday: https://ideone.com/cirMb7
and another:
Fill out a given matrix of size N x M with B mines so that a player playing minesweeper can find them using clues that are given as numbers in each cell that indicate the number of mines in the adjacent eight cells: 
https://ideone.com/kPGtZ5

Wednesday, April 4, 2018

Today we will continue to discuss Microsoft Dynamics AX. We briefly reviewed the user interface features to get to know Dynamics AX. Then we looked at the variety of tools for viewing and analyzing business data. Data is usually presented in Reports. Reports can be generated in a variety of ways. The standard-reports are pre-constructed views of business data and they number in hundreds. Reports are available from their data sources such as general ledger. Auto reports enables us to view the data from a form and these data can be saved to the Application Object Tree AOT. Ad hoc reports provide greater flexibility for generating reports although they still use a report template. This is helpful when parameters have to be passed in to generate the reports. OLAP reports span more duration of data for analysis where trends in business data becomes more important.
Tasks might take longer to execute. Sometimes its best to let it run elsewhere and at some other time where they can be prioritized, queued and executed. For this purpose we can submit batch jobs which are maintained in a batch job list.
Documents may be attached to data. This is helpful in cases where we need to add notes and attachments to the data. Multiple notes may be attached to the same data.
The enterprise portal enables web based access to the dynamics instance on a server installed in the enterprise network. Access is role based such as employees, Sales representatives, consultants, vendors, customers etc.

#codingexercise
In an M×N board with Q horses and their coordinates, moves are only possible by swapping horses.
These horses move as usual to any of their eight location from their current position . How many distinct chess board arrangements are possible.
We discussed one solution as to enumerate all the squares that can be occupied by individual pieces say n and permute k horses in that space which leads us to P(n,k). Another way to do this would be to identify each square that can be occupied and the pieces that can occupy it together with all the pairs that can swap. If we confirm that the available squares can be occupied by all pieces in one or more moves, then we can lean towards permutations as an easy way to determine the answer.

This can also be solved with a graph and finding paths where the intermediary nodes are the positions occupied by the other horses.

Tuesday, April 3, 2018

Today we will continue to discuss Microsoft Dynamics AX. We briefly reviewed the user interface features to get to know Dynamics AX.
We saw that the navigation pane provides access to the modules and functionality such as General Ledger, Bank etc. Modules contain folders such as Journals, Inquiries, Reports, Periodic and Setup. Folders contain menu items which execute a function within the program such as opening a form, report or dialogbox.
The toolbar helps us with frequently performed tasks. Tasks include such things as converting units, creating language texts, displaying amounts in a different currency, navigating to other companies, clipboard actions, and changing dates.  Favorites are a way to create shortcut to items such as forms, reports, and queries that we use frequently. Favorites can be organized into folders and can be grouped.
Data appears in the form of records. Records may be created using templates. Templates give pre-filled data that can be used to create records. They may be available only to the user, or to all the users within a selected company, or they could be a system template such as to manage users. Records can be found, filtered and sorted.
We can also add notes, documents, spreadsheets and other files to records. Multiple notes can be created for the same record.
Dynamics AX provides a variety of tools for viewing and analyzing business data. We will go over these now. Reports can be generated in a variety of ways. The standard-reports are pre-constructed views of business data and they number in hundreds. Reports are available from their data sources such as general ledger. Auto reports enables us to view the data from a form and these data can be saved to the Application Object Tree AOT.

#codingexercise
In an M×N board with Q horses and their coordinates, moves are only possible by swapping horses.
These horses move as usual to any of their eight location from their current position . How many distinct chess board arrangements are possible.
Another solution possible is to enumerate all the squares that can be occupied by individual pieces say n and permute k horses in that space which leads us to P(n,k)

#sqlexercise
OVER clause is available from SQL server 2008 onwards.
eg:
SELECT ROW_NUMBER() OVER(PARTITION BY PostalCode ORDER BY SalesYTD DESC) AS "Row Number",   <other columns>
FROM <originating view>
ORDER BY PostalCode.

Monday, April 2, 2018

#codingexercise
In an M×N board with Q horses and their coordinates, moves are only possible by swapping horses.
These horses move as usual to any of their eight location from their current position . How many distinct chess board arrangements are possible .
Solution. This is proportional to the product of the number of swaps possible.
Given a position of a horse, we can find the occupancy in the other eight and enumerate the swaps possible as pairs. pairs are distinct only by membership not order

Today we will continue to discuss Microsoft Dynamics AX. We briefly review the user interface features to get to know Dynamics AX.
The navigation pane provides access to the modules and functionality such as General Ledger, Bank etc. Modules contain folders such as Journals, Inquiries, Reports, Periodic and Setup. Folders contain menu items which execute a function within the program such as opening a form, report or dialogbox. The workspace can be customized to include the buttons that appear in the navigation pane. The toolbar helps us with frequently performed tasks. Tasks include such things as converting units, creating language texts, displaying amounts in a different currency, navigating to other companies, clipboard actions, and changing dates.  Favorites are a way to create shortcut to items such as forms, reports, and queries that we use frequently. Favorites can be organized into folders and can be grouped.
Data appears in the form of records. Records may be created using templates. Templates give pre-filled data that can be used to create records. They may be available only to the user, or to all the users within a selected company, or they could be a system template such as to manage users. Records can be found, filtered and sorted.
Alerts provide a way to track critical events. Alerts are nothing but rules which are available as templates. The different event types supported include due date-type events, update-type events, and create-type and delete-type events Alerts can be displayed as pop-up messages or email messages. Alerts can also be listed from the interface so they can be viewed all at once.
We can also add notes, documents, spreadsheets and other files to records.  Documents are archived in a specific directory. Document types are used to enumerate the documents that can be attached to records. A note or document reference can also be copied from record to record. Multiple notes can be created for the same record.
Dynamics AX provides a variety of tools for viewing and analyzing business data. We will go over these tomorrow.




Sunday, April 1, 2018

We return to our discussion of Microsoft Dynamics AX for finance and operations.
AX has a notion of Product Configurator which centralizes the creation of products and determines how the product variants are used.
Allows creation of various category hierarchies like procurement, sales and retail. It allows us to specify vendor evaluation criteria based on procurement categories and to specify approved and preferred vendors for procurement categories.
Purchase and sale agreements can be authored. Microsoft Dynamics AX supports both value-based and quantity-based sales agreements.
The terms and conditions of a sales agreement such as the prices and discounts can be applied when creating an order using the order details forms.
Sales agreements can have a validity period defined and can be put on hold. They are also searchable.
Categories and agreements are browsable. We can control the navigation pane by hiding and re-organizing a module list  and adding a query to a favorite. We can also document our processes if we would like to record tasks.
Sales and purchase orders can have packing slip corrections made.
Intercompany orders, relations and policies are set up in a form that can be specified once and shared.
The Microsoft Dynamics AX supports standard workflows available out of box for users to setup. Workflows are processes that meet business requirements. The AX workflows can be specified using controls like conditional decisions, manual and parallel activities and even sub-workflows. There is ability to escalate workflows.
Purchase requisitions can be entered with approved vendors. There is history of purchase requisitions approvals and it can be viewed. Permissions can be specified to enable a requester to request on behalf of somebody else.
Purchasing policy groups gives us the ability to create multiple purchasing policies.

#codingexercise
Given a triangular structure of members, find the minimum sum path from top to bottom:
int GetMinSum(List<List<int>> A)
{
int n = A.Count();
var sums = new int[A[n].Count()];
for (int i = 0; i < sums.Count; i++)
   sums[i] = A[n][i];
int level = n-1;
GetMinSumRecursive(A, level, ref sums);
return sums[0];
}

void GetMinSumRecursive(List<List<int>> A, int level, ref int[] sums)
{
if (level < 1) {return;}
for (int j = 0; j < A[level-1].Count(); j++)
{
    sums[j] = A[level-1,j] + sums.toList().GetRange(A[level].Count()).min();
    //  + min(sums[j], sums[j+1]);  instead of the min above
   // if the path has to be left or right only
}
GetMinSumRecursive(A, level-1, ref sums);
}