Tidbits – Streams in C++

If you have watched Red with Bruce Willis you may recall the opening scene. Frank Moses (Bruce Willis) is a retired CIA operative and he is sleeping in his bed. On the night stand next to him there is a clock. The clock is ticking down to 06:00 AM. Just as the clock reaches 06:00 AM, without the need of an alarm, Frank Moses wakes up and calmly walks down to the kitchen to get breakfast. Obviously Frank Moses is a very disciplined and a morning person. Continue reading “Tidbits – Streams in C++”

BST Diameter

Earlier this morning I read a post “Binary Tree: The Diameter” by David Pynes. The post showed up on Medium but was initially written for Towards Data Science. After quickly reading the post I decided to spend time reading the article in my computer, thinking about it and writing a solution in Java. The original article used C++. Continue reading “BST Diameter”

C++ Tidbits – Polymorphism

Good morning. It is a relatively cold Saturday in the Twin Cities. For some reason, this winter season has been warmer than usual with very little snow coverage. For example, today the high temperature will be around the freezing point. Some people (like me) like it while others hate it. There is no way to please everyone at once.

In an attempt to review in a systematic way some features of C++ I will be experimenting with polymorphism. In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types. To read more about it you may refer here.

Continue reading “C++ Tidbits – Polymorphism”

C++ Tidbits – Inheritance

I am about to complete a course on Neural Networks and Deep Learning. I am amazed at how one gets absorbed into the subject and language (in this case Python). Lately when I am working with C, C++, Java or Python I occasionally use a syntax from a different language.

In this post I will be covering / reviewing Inheritance using C++. Many years ago when I wanted to review C I would pull from my bookshelf the book “C Programming Language” by Brian Kernighan and Dennis Ritchie. During the years I have owned several copies. A few minutes ago I tried to locate my latest copy, but it seems that it grew legs and walked away. For C++ I have … (I guess I have also misplaced it) a book by Bjarne Stroustrup. Given the fact that I want a quick refresher, decided to go over an Advanced C++ Programming course by Mike McMillan. For this post (and a few more that I will write in the next few days) I am using this course as a guide and will be coding C++ on Visual Studio 2017 from Microsoft. Continue reading “C++ Tidbits – Inheritance”

Returned Value versus Exception Handling

Most software developers now a day write code using object oriented (OO) programming languages. In some cases, due to performance reasons, some code may be written using a non OO language. One way or the other, the question may come up if return codes are better than using exceptions. I do not believe you can come with enough reasons to justify one method or the other which would be accepted by most software developers. What I will do is discuss some considerations and give my opinion. Please take it all with a grain of salt. Continue reading “Returned Value versus Exception Handling”

Two Dimensional Array

A few days ago a group of software engineers were discussing how the order in which the numbers of rows versus columns in a two dimensional array affect performance. That is; if an array has more rows than columns as opposed to more columns than rows, the time it takes to traverse the array will be affected. Continue reading “Two Dimensional Array”

Regular Expressions

A regular expression is a sequence of characters that define a search pattern. Usually this pattern is then used by string searching algorithms for “find” / “match” or “find and replace” operations on strings. Continue reading “Regular Expressions”

Curl to call RESTful API

In this post I will perform some basic interactions with a RESTful service running on ASP.NET written in C#. I will access the RESTful server using the cURL (a.k.a. curl) command line interface. On a future post I will access the curl API using the C# programming language to illustrate its use. Continue reading “Curl to call RESTful API”