<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: websplee</title>
    <description>The latest articles on DEV Community by websplee (@websplee).</description>
    <link>https://dev.to/websplee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F252460%2Fccb42701-dc50-4e1c-b094-772fc4d14b09.jpg</url>
      <title>DEV Community: websplee</title>
      <link>https://dev.to/websplee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/websplee"/>
    <language>en</language>
    <item>
      <title>Angular - ERROR in 'router-outlet' is not a known element:</title>
      <dc:creator>websplee</dc:creator>
      <pubDate>Sun, 21 Jun 2020 06:53:36 +0000</pubDate>
      <link>https://dev.to/websplee/angular-error-in-router-outlet-is-not-a-known-element-22b3</link>
      <guid>https://dev.to/websplee/angular-error-in-router-outlet-is-not-a-known-element-22b3</guid>
      <description>&lt;p&gt;I have been supporting this massive Angular app and from the time I took over support, I was told "ng build --prod" never works. Of course, we did a couple of things that I am not proud of to go round this issue.&lt;/p&gt;

&lt;p&gt;So the detailed error when building for prod has been: -&lt;br&gt;
ERROR in 'router-outlet' is not a known element: 1. If 'router-outlet' is an Angular component, then verify that it is part of this module. 2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("     [ERROR -&amp;gt;]   ")&lt;/p&gt;

&lt;p&gt;A quick  Google (I actually did a lot of searching) took me to these places, which have great material about this issue: -&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stackoverflow - &lt;a href="https://stackoverflow.com/questions/44517737/router-outlet-is-not-a-known-element"&gt;https://stackoverflow.com/questions/44517737/router-outlet-is-not-a-known-element&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of that worked for me :(.&lt;/p&gt;

&lt;p&gt;I then started working my way through all the app modules and discovered that there were a couple of modules which did not have routing defined. Voila. I added routing to all of these modules and this app is now successfully compiling with the --prod flag.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Implementing Standard Calculator</title>
      <dc:creator>websplee</dc:creator>
      <pubDate>Fri, 27 Dec 2019 12:02:34 +0000</pubDate>
      <link>https://dev.to/websplee/implementing-standard-calculator-3gcj</link>
      <guid>https://dev.to/websplee/implementing-standard-calculator-3gcj</guid>
      <description>&lt;p&gt;I was recently challenged to develop a standard basic calculator that would evaluate a given expression following the BODMAS rules and of course, return the answer. The one rule to this was that I did not have to use any inbuilt evaluation methods.&lt;/p&gt;

&lt;p&gt;So lets get started. I began with an interface that defined the methods I was going to use.&lt;/p&gt;

&lt;p&gt;interface IBaseCalculator&lt;br&gt;
    {&lt;br&gt;
        string EvaluateEquation(string equation);&lt;br&gt;
        string EvaluateOperation(string equation, char op);&lt;br&gt;
        double EvaluateAddition(double a, double b);&lt;br&gt;
        double EvaluateSubtraction(double a, double b);&lt;br&gt;
        double EvaluateMultiplication(double a, double b);&lt;br&gt;
        double EvaluateDivision(double a, double b);&lt;br&gt;
    }&lt;/p&gt;

&lt;p&gt;I then went ahead and implemented this with a constructor taking in the set of operations that I needed to support. In this case division, multiplication, addition and subtraction. This is the interesting part. I created an array of characters to represent the operations allowed for this calculator.&lt;/p&gt;

&lt;p&gt;NOW, in order to make sure the rules of BODMAS were adhered to, I had to declare the array in the order representing BODMAS rule.&lt;/p&gt;

&lt;p&gt;The EvaluateOperation method iterates through the equation and starts breaking it down following the BODMAS rules. It does this by invoking the appropriate Evaluate method. In case of multiplication, it calls EvaluateMultiplication.&lt;/p&gt;

&lt;p&gt;public string EvaluateOperation(string equation, char op)&lt;br&gt;
        {&lt;br&gt;
            int i = 0;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        if (equation.Contains(op))
            i = equation.IndexOf(op);
        switch (op)
        {
            case '(':
                throw new NotImplementedException();
            case ')':
                throw new NotImplementedException();
            case '/':
                answer = EvaluateDivision(Double.Parse(equation[i - 1].ToString()),
                         Double.Parse(equation[i + 1].ToString()));
                break;
            case '*':
                answer = EvaluateMultiplication(Double.Parse(equation[i - 1].ToString()),
                         Double.Parse(equation[i + 1].ToString()));
                break;
            case '+':
                answer = EvaluateAddition(Double.Parse(equation[i - 1].ToString()),
                         Double.Parse(equation[i + 1].ToString()));
                break;
            case '-':
                answer = EvaluateSubtraction(Double.Parse(equation[i - 1].ToString()),
                         Double.Parse(equation[i + 1].ToString()));
                break;
        }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Please go ahead and play with the solution located here &lt;br&gt;
&lt;a href="https://github.com/websplee/StandardCalculator/blob/master/StandardCalculator/BaseCalculator.cs"&gt;https://github.com/websplee/StandardCalculator/blob/master/StandardCalculator/BaseCalculator.cs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>calculator</category>
      <category>bodmas</category>
    </item>
  </channel>
</rss>
