Saturday, 7 September 2019

Microangelo - IT Solutions, MIcrosoft Power BI

When you hear the word “Excel” chances are you think of “spreadsheet” instead of “superior reporting tool.” But depending on your organisation’s size and strategic reporting needs, Excel may not be the best fit and or software built specifically for reporting and there is a better option.

Let Microangelo provide you with a business analytics solution that lets you visualize your Excel Data in an easy to use dashboard. We can connect to hundreds of data sources and bring your data to life with live dashboards and reports. The dashboard helps propel your organization into a modern technology culture. With powerful self-service abilities, no longer are business users dependent on IT for gather transforming and analyzing data.

Using Microsoft Power BI, Microangelo can produce dashboards that are easy to use and visually powerful and appealing compared to Microsoft Excel. Power BI is mostly used for data visualisations and dashboard where as Microsoft Excel is mostly used for in depth analysis. Microsoft Power BI is a more powerful reporting tool compared to Microsoft Excel.

Let our examples speak for themselves.

Please visit www.microangelo.com.au to see details about our service

Our examples are live and include

http://sqlmicropowerbi.australiaeast.cloudapp.azure.com/reports/powerbi/AdventureWorks-Report

http://sqlmicropowerbi.australiaeast.cloudapp.azure.com/reports/powerbi/Customer-Profitability

http://sqlmicropowerbi.australiaeast.cloudapp.azure.com/reports/powerbi/Maven-Market-Report

Remember login is Guest with no password.



Thursday, 28 June 2018

Relational Databases Advantages and Disadvantages


Relational Databases

Advantages
RDBMS minimize data storage by not repeatedly the same information row by row. This is because relational database can store reference data in one table and allow other tables to reference it. Hence it is allowing a One to Many relationship through relational references Example: Students and Classes
This is not available in Flat Files and NoSQL Database Minimize Updates Example: Let say the student address changes but classes stay the same. Because every row has a student address the whole data must be updated accordingly.
RDBMS ensure data integrity. Not available in Flat Files and NoSQL
RDBMS ODBMS ensure data is kept central live. Not available in FlatFiles multiple copies.
RDBMS ODBMS ensure data is transactional and accurately tallied. Not available in FlatFiles and NoSQL.
Example: School Fees and Credit Card Payment Tallied correctly even if one fails. Flat Files

Relational Databases

Disadvantages
RDBMS does not maintain integrity rules over specific types of data away from the data storage layer. ODBMS does. Example: Object Oriented Relational Database can specify English / Mathematics / Humanities as Classes (Subjects) away from another Class like ART. RDBM does not distinguish this through its structure. They are both though accurate and centrally located data stored in centrally located server.
RDBMS Integrity makes it difficult to import 3rd part non-conforming data. Thus data integrity is enforced rigorously in RDBMS. Same for ODBMS. FlatFiles and NoSql does not enforce this rule.
RDBMS Performance Slow for storing data like html and is slow than transforming to table format and does grow the database making it slow down. As a result Indexes need to be optimised for inserts and updates and viewing. NoSQL does not have a performance hit and is very fast. So are Flat Files.
RDBMS Table(s) Requires programs to be written to display data in a user friendly manner to display business information. FlatFile is raw format of the data and software already available. NoSQL and ODBMS has the same limitation.

Conclusion
As a result, the main reason for RDBMS is for real time live data inserts, updates and viewing. Also, when interfacing to other systems RDBMS accomplishes this to be done with full data integrity in real time using Transactions

Thursday, 28 January 2016

Greek Pronoun Verbs - AngularJS - KnockoutJS


I have read and briefly investigated the 2 libraries AngularJS and KnockoutJS in the past looking at others code and looking more at KnockoutJS rather than AngularJS

So I decided to explore and write a demo demonstrating my AngularJS and KnockoutJS skills just so can understand the differences and pitfalls.

Once I completed the solution I found AngularJS to be much more of a feature set than KnockoutJS. Also the implementation is cleaner. Hope to do some more work on AngularJS.

What I did was embark on writing a Greek Pronoun Verbs dictionary online using both Javascript libraries to demonstrate how to use these libraries for user interface without postback etc...
Hence the Greek Pronoun Verbs Solution.

Let me explain the problem and what the solution very simple does.
In english you would say

I graph, You graph, He she it graphs, We graph, You (Plural) graph , They (He,She,Neuter) Graph
Not much of a problem graph is always said as graph



This is not the case in Greek and the end of the word is altered accordingly.

Graph - Γραφω
See - Βλεπω

The following is the result.

Εγω - (I)
Γραφω
Εσυ - (You)
Γραφεις
Αυτος - Αυτη - Αυτο - (He) - (She) - (It)
Γραφει
Εμεις - (We)
Γραφουμε
Εσεις - (You (Plural))
Γραφετε
Αυτoi - Αυτες - Αυτα - (They He) - (They She) - (They)
Γραφουνε

The demonstrations are available online at the following addresses with source code. Please go ahead and look at the code and try it out.

Greek Pronoun Verbs - AngularJS

https://jsfiddle.net/alaris/k07p60gh/

Greek Pronoun Verbs - KnockoutJS

https://jsfiddle.net/alaris/xr42zscr/

Enjoy

Wednesday, 13 January 2016

C# .NET - Interview A4 Cheat Sheet

I sarcastically title this as a  C# .NET - Interview A4 Cheat Sheet simply because of the scope of questions in the .NET framework and C# arena. Looking at the summary it shows how extensive the .NET framework has become and how developers are now more than ever retaining large amounts of technical information. I remember doing most of my exams in open book or an A4 sheet of paper. Maybe I should create one for .NET and bring it in the interview.

I should call Interview A4 Cheat Sheet. Might be a good idea :-) Comments\.

Anyway
I am writing this because I recently did an 2 hour phone interview whereby the questions touched on all different aspects of development.

For a phone interview I was amazed at the number of questions asked and the time it took to convey all the answers. I normally feel they can get you off guard. Interviews in IT are sometimes a hit or miss. So I decided to write my experiences on this one. Especially as to what happened at the beginning.

In summary for those who like to experience an indepth preliminary interview here are some of the questions which were asked included.

Reflection allows a .Net developer to inspect public/private objects, methods and properties.
Dynamic only allows access to public objects, methods and properties.

There is a type called dynamic similar to var but its value is not defined in declaration.

Interesting to see how there named the same but there is a difference. Hmmmm.

WeakBinding  - Object properties and methods etc not know until runtime. Typical var or dynamic variable
StrongBinding - Object properties and methods known at runtime.

Array is slower than collection for inserting/deleting records. Array is faster for index and iteration.
IEnumerable Forward only List with iterator. Has Functions like Where SelectFirstOrDefault Count Union Join Min Max Last First to name a few
IQueryable has LINQ to SQL.

Mapping Table is need to correlate a many to many relationship.

SQL Clustered Index Primary Key Flat structure. Slow to create fast to lookup
SQL Non Clustered Index B - Tree structure faster to create than clustered but slower lookup.

CTE - Common Table Expression - Self Referencing Recursive Query.

WITH Sales_CTE (SalesPersonID, SalesOrderID, SalesYear)
AS
-- Define the CTE query.
(
    SELECT SalesPersonID, SalesOrderID, YEAR(OrderDate) AS SalesYear
    FROM Sales.SalesOrderHeader
    WHERE SalesPersonID IS NOT NULL
)

Multithreading
Threads in a process and a seperate process all together.
In a single process a single thread can crash all the app while a process allows independently other threads. (Never saw it that way).

Serialisation
Binary
Xml
SOAP --> I thought that was XML.

HTML5 New Features Introduce Include
Audio
Video
2D
3D
CANVASS

Unmanaged Code
Including unsafe accessed via pointer variables.

Why unmanaged
Avoid Serialisation
API calls
Performance

Generics
Any type safe data structure. Collections are using generics
Others include Queue, Array, SortList, SortedArray.

Always dont like the left/outer join sql questions get left and right muddled up verbally.
Basically the join correlate link 2 or more tables together.
Left Join returns all rows on the left.
But only return rows matching on the right. Where the rows dont match on the right the returns are null.

WCF
The ABC of WCF.
Never saw it as
Address        URL
Binding        Encoding
Contract    Contract

The contract can be further split to
OperationContract
ServiceContract
DataContract

Message - Data without serialisation to class
Stream - Data without serialisation to class
ChannelFactory - Allows retrieval of parts of a data contract without the data contract.

SVCUTIL able to get datacontract C# for wsdl or class or xml etc.

Attributes

Provides metadata (not!!! properties) on class or method.

Entity Framework.

Abstracts SQL and C#
edmx - scripting/xml based file describing the
conceptual model C#
storage model SQL
mapping between them

Lazy, Eager, and Explicit Loading (JOINED READS)

Lazy does not load all related records until you access data.
Eager loads all related records the first go.
Explicit you will need to call load every iteration to read related records.

MVC Filters
Authorisation
Action
Result
Exception
Service Filter
Type Filter
Model - Data Representation  @Model Employees
View - Cshtml (Razor) @Html. @Model.Value
Controller - HTTP Directs To Method and Data Model and View.
return View(employeeModel);
return RedirectToAction("Index");

WEBAPI
[HttpPost]
[HttpGet]
[HttpPut ("{id}")]
[HttpDelete("{id}")]
 
[Route('/Employee/Details/{id}')]

[Route("api/[controller]")] public class TodoController : Controller 

[HttpGet] public IEnumerable<TodoItem> GetAll()  
{ 
    return TodoItems.GetAll();  
}  

[HttpGet("{id}", Name = "GetTodo")] 
public IActionResult GetById(string id)  
{  
    var item = TodoItems.Find(id);  
    if (item == null) { return HttpNotFound(); }  
    return new ObjectResult(item); 
}

JSON / XML application/json


LINQ

SELECT
 
from cust in customers
select cust;

WHERE

from cust in customers
where cust.Name = 'ABC'
select cust;

JOIN

from cust in customers
join dist in distributors on cust.distributorID = dist.distributorID
where cust.Name = 'ABC'
select cust = customers.name, dist = distributors.name;

I hope I have provided a good summary of C# architecturally. From there you can explore the details of each area.





Monday, 11 January 2016

C# Illustrating Object Orientated Programming

On many occassions I have been asked to describe and illustrate Object Orientated Programming.

I struggle to how to describe this in average person terms.
Recently I was asked to write classes for Animal, Dog and Cat

Initially the classes

public class Animal
{
}
public class Dog : Animal
{
}
public class Cat : Animal
{
}

Then provide the following attributes.
Name Property for all Animals
MakeSound method for all whereby Dog returns "Woof" and Cat returns "Miaow" but extensible by using abstract.

The modifications were made below.

public abstract class Animal
{
    public string Name { get; set; }
    public abstract string MakeSound();
}
public class Dog : Animal
{
    public override string MakeSound()
    {
        return "Woof"
    }
}
public class Cat : Animal
{
    public override string MakeSound()
    {
        return "Miaow"
    }
}


Finally suppose you want a generic sound for all animals allowing for instance a Rabbit where the response is unknown so generically speaking its an animal and it makes a noise.

The modifications were made below.

public abstract class Animal
{
    public string Name { get; set; }
    public string MakeSound()
    {
        return "Noise";
    }
}
public class Dog : Animal
{
    public override string MakeSound()
    {
        return "Woof"
    }
}
public class Cat : Animal
{
    public override string MakeSound()
    {
        return "Miaow"
    }
}
public class Rabbit : Animal
{

}


This should help someone explain OO principles with a real life example.


Tuesday, 5 January 2016

Using C# The Cheque (Check) Writer


Using C# The Cheque (Check) Writer

Recently I was given a test to test my coding skills not just functionally but also aesthetically as well. My wife is an art teacher and I always believe coding is an art form as well as an engineering discipline. 

So I decided to blog and plan to seek from the IT community any feedback on the infinite possible ways to tackle the solution.


The test was to write a cheque printing application that needs to be able to display numeric values on the screen using the equivalent text. So I went ahead and design and implement an application that does take a numerical value for a cheque and displays it in words on the screen.

For example if I entered

1234.56

The program would return


one thousand two hundred and thirty four dollars AND fifty six cents 

As a team leader in my previous roles I have done many interviews. I have in the past used this test without much success and it usually only done by candidates who have gone through and succeeded simpler tasks.

I have to be fair I feel my solution could be better hence why I have blogged and interested in feedback regarding this problem.


The approach I have taken is to split and group the number based on their significant values i.e. their numerical significance. For example:

1234.56

Will be grouped in the following way

1 thousands represented as one thousand.
2 hundreds represented as two hundred.
3 tens represented as thirty.
4 units represented as four.

Then the cents are grouped in the same manner.

Hence the output will be one thousand two hundred and thirty four dollars AND fifty six cents

The text are kept in string arrays indexed by the quotient for efficiency in lookup and translation from number to text.

i.e. 200 / 100 will be 2.

The array will arrUnits[2] which returns a string two etc.. as per initialisation.

This allows for easy adjustment to another language which will require a small code change and initialisation differently.

I include the code below with comments. I welcome comments and likely will get the community to provide possible solutions.

Anyone thoughts would be appreciated.

The link is https://www.dropbox.com/s/7cte6kdonky4i0d/ChequeWriter.zip?dl=0

Whilst the actual code is included below.

using System;
using System.Collections.Generic;
using System.Text;

namespace ChequeWriter
{

    /// <summary>
    ///  This class performs the number to written text functionality.
    ///  It exposes one public member function OutputNumberToString
    ///  Implementation:
    ///  All Cheque Writing Texts are stored indexable arrays.
    ///  I choose this over collections/lists simply because of memory efficiency.
    /// 
    ///  The arrays are initialised in the constructor.
    /// </summary>

    public class ChequeWriter
    {

        // Array Containing Currency Dollar / Cents easily adaptable to Pounds
        string[] strarrCurrency;//[4];

        // Array Containing Singular Unit Texts
        string[] strarrUnits;//[10];

        // Array Containing DecaUnits and Teens
        string[] strarrTens;//[20];

        // Array Containing HundredUnits
        // Reproduction of strarrUnits and deemed not necessary but kept as I coded the solution. Shows how code can adapt to language if necessary.
        string[] strarrHundreds;//[10];

        // Array Containing Thousandths.
        string[] strarrThousands;//[3];

        /// <summary>
        ///  The arrays are initialised and language dependent texts are populated in the array.
        /// </summary>
        public ChequeWriter()
        {
            strarrCurrency = new string[4];

            strarrUnits = new string[10];//[10];
            strarrTens = new string[20];//[20];
            strarrHundreds = new string[10];//[10];
            strarrThousands = new string[3];//[3];

            strarrCurrency[0] = "dollars";
            strarrCurrency[1] = "dollar";
            strarrCurrency[2] = "cents";
            strarrCurrency[3] = "cent";

            strarrUnits[0] = "";
            strarrUnits[1] = "one";
            strarrUnits[2] = "two";
            strarrUnits[3] = "three";
            strarrUnits[4] = "four";
            strarrUnits[5] = "five";
            strarrUnits[6] = "six";
            strarrUnits[7] = "seven";
            strarrUnits[8] = "eight";
            strarrUnits[9] = "nine";

            strarrTens[0] = "";
            strarrTens[1] = "ten";
            strarrTens[2] = "twenty";
            strarrTens[3] = "thirty";
            strarrTens[4] = "fourty";
            strarrTens[5] = "fifty";
            strarrTens[6] = "sixty";
            strarrTens[7] = "seventy";
            strarrTens[8] = "eighty";
            strarrTens[9] = "ninety";

            strarrTens[10] = "ten";
            strarrTens[11] = "eleven";
            strarrTens[12] = "twelve";
            strarrTens[13] = "thirteen";
            strarrTens[14] = "fourteen";
            strarrTens[15] = "fifteen";
            strarrTens[16] = "sixteen";
            strarrTens[17] = "seventeen";
            strarrTens[18] = "eighteen";
            strarrTens[19] = "nineteen";


            strarrHundreds[0] = "";
            strarrHundreds[1] = "one";
            strarrHundreds[2] = "two";
            strarrHundreds[3] = "three";
            strarrHundreds[4] = "four";
            strarrHundreds[5] = "five";
            strarrHundreds[6] = "six";
            strarrHundreds[7] = "seven";
            strarrHundreds[8] = "eight";
            strarrHundreds[9] = "nine";

            strarrThousands[0] = "thousand ";
            strarrThousands[1] = "million ";
            strarrThousands[2] = "billion ";

        }

        /// <summary>
        ///  The console application entry point. The user is prompted for entering a number.
        ///  This number will be then converted into text.
        ///  The ChequeWriter class is used to provide this functionality.
        /// </summary>

        static void Main(string[] args)
        {
            string strName;
            string strInput;
            long lngWholeInput;
            int intCentsInput;

            ChequeWriter ntsOutput = new ChequeWriter();
            do
            {
                // User input is read in.
                Console.Write("Please Enter Your Name ");
                strName = Console.ReadLine();

                Console.Write("Please Enter a number ");
                strInput = Console.ReadLine();

                // Output Verbatim The User Name
                Console.WriteLine(strName);

                // User can enter cents and is optional hence the checking of the decimal point.
                if (strInput.IndexOf('.') > 0)
                {
                    // Validation and Parsing of Input as Numeric before proceeding.
                    // First Parse Whole Amount of User Input.
                    // Not in requirements but could have need for a custom response.
                    if (long.TryParse(strInput.Substring(0, strInput.IndexOf('.')), out lngWholeInput))
                    {
                        // Parse Decimal Portion of User Input.
                        // Proceed and call function and Output Number to String
                        if (int.TryParse(strInput.Substring(strInput.IndexOf('.') + 1), out intCentsInput))
                            Console.WriteLine(ntsOutput.OutputNumberToString(lngWholeInput, intCentsInput));
                    }
                }
                else
                {
                    // Parse Input as Whole Amount
                    // Proceed and call function and Output Number to String
                    if (long.TryParse(strInput, out lngWholeInput))
                        Console.WriteLine(ntsOutput.OutputNumberToString(lngWholeInput, 0));

                }
            }
            // Repeat While User Input
            while ((strInput.Length > 0) && (strName.Length > 0));

        }

        /// <summary>
        /// Output Number To String - Public
        /// Converts a number provided into text.
        /// </summary>
        /// <param name="lngWholeValue"></param>
        /// <param name="intCentsValue"></param>
        /// <returns>String in words of input value as a cheque writer</returns>
        public string OutputNumberToString(long lngWholeValue, int intCentsValue)
        {
            string strOutput = "";
            long lngRemainder;


            // Calculate the indexes for retrieving text from the array.

            long iBillion = Math.DivRem((long)lngWholeValue, (long)1000000000, out lngRemainder);
            long iMillion = Math.DivRem((long)lngRemainder, (long)1000000, out lngRemainder);
            long iThousand = Math.DivRem((long)lngRemainder, (long)1000, out lngRemainder);
            long iUnits = lngRemainder;

            if (iBillion > 0)
                strOutput += OutputHundredUnitsToString(System.Convert.ToInt32(iBillion)) + strarrThousands[2];

            if (iMillion > 0)
                strOutput += OutputHundredUnitsToString(System.Convert.ToInt32(iMillion)) + strarrThousands[1];

            if (iThousand > 0)
                strOutput += OutputHundredUnitsToString(System.Convert.ToInt32(iThousand)) + strarrThousands[0];

            if (iUnits > 0)
                strOutput += OutputHundredUnitsToString(System.Convert.ToInt32(iUnits)) + strarrCurrency[0];
            else
                strOutput += strarrCurrency[0];

            if (intCentsValue > 0)
                strOutput += " AND " + OutputHundredUnitsToString(System.Convert.ToInt32(intCentsValue)) + strarrCurrency[2];
            else
                strOutput += " AND ZERO CENTS";

            return strOutput;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="iValue"></param>
        /// <returns>Cheque Writing within the range of 1 to 999 </returns>
        private string OutputHundredUnitsToString(int iValue)
        {
            string strOutput = "";

            int iTens;          // The number calculated by output of a remainder for hundreds.
            int iUnits;         // The number calculated by output of a remainder for tens.


            // Math Div Rem Allow Quotient and Remainder in 1 function call.
            // It is an optimization. Some processors are able to compute both values at the same time.

            // Number of hundred with remainder.
            // Hundreds are converted to text.
            if (Math.DivRem(iValue, 100, out iTens) > 0)
                strOutput += strarrHundreds[(iValue / 100)] + " hundred ";

            // Number of tens with remainder.
            // Tens are converted to text.
            if (Math.DivRem(iTens, 10, out iUnits) > 0)
            {
                if (strOutput.Length > 0)
                    strOutput += "and ";
                if ((iTens / 10) > 1)
                    strOutput += strarrTens[(iTens / 10)] + " ";
                else
                    strOutput += strarrTens[iTens] + " ";
            }

            // Remainder Units are converted to text
            if ((iUnits / 1) > 0)
            {
                if (((iValue / 100) > 0) && ((iTens / 10) == 0))
                    strOutput += "and ";
                if ((iTens >= 20) || (iTens <= 9))
                    strOutput += strarrUnits[(iUnits / 1)] + " ";
            }
            return strOutput;
        }

    }
}