Thursday, October 25, 2018

Simple Macro in Excel

As a growing software developer I've begun to contemplate what I can automate to make personal tasks easier and convenient for me. For instance, between my cousins I am in charge of an account we hold to save money for family funerals. I have an excel spreadsheet with everyone's details, 19 rows and 4 columns. I wanted to find a way to highlight a row when it's someone's birthday to display to anyone using the spreadsheet.

Excel macros came to mind and I got excited to figure them out. I remembered at my first job the senior developers used them quite often so I thought "Why not teach myself?"

Before you can use macros you have to enable the "Developer" ribbon in Excel. Go to File >> Options >> Customize Ribbon and select the Developer option in the list box on the right.

Go to your worksheet and select the Developer ribbon then select Macros on the left. In the pop-up, type the macro name, select "This Workbook" option then click the Create button. The Visual Basic Editor will open but before you add code to that module, go back to your worksheet.

Select Macros again and click the Options button. Enter the shortcut key combination that you want to fire your macro. Ctrl + Shift + something else will reduce the chances of overriding any predetermined shortcuts in excel. Add a description and click OK.

Now click the Edit button on the main macro pop-up and it will take you back to the editor. Below is some code I wrote for my birthday macro. The code has to be in Visual Basic for Applications(VBA).


















The code first loops through the birth date column to remove any highlights. Then it loops again to find the day and month equal to the current day and month to highlight the row of the person whose birthday it is. If there are no birthdays a message box pops up.

This was a simple and fun macro to do on excel for the first time. They can get complex and you can automate almost any repetitive task you find yourself doing on excel.

UPDATE: I've improved the macro to show upcoming birthdays as well by highlighting the rows        in a different color.

Saturday, October 13, 2018

From Paperless Offices to Server-less

First we were making our offices paperless and now we are basically trying to eliminate server rooms. Atleast, that's exactly what organizations can achieve through storage and server services over the internet (cloud). Techopedia describes cloud computing as the use of various services over the Internet such as servers, storage, databases, networking, software, analytics, intelligence and more.

Cloud computing is not so mystic when you consider its uses. The Microsoft Azure website brings out how "if you use an online service to send email, edit documents, watch movies or TV, listen to music, play games or store pictures and other files, it is likely that cloud computing is making it all possible behind the scenes. "

We can now begin to understand its most profound benefit: convenience. Not only are we creatures of habit but also convenience which is why technology is the bedrock of civilization.

Types of Cloud Services

The following are the four types of cloud services described in the Microsoft Azure website:

Infrastructure as a service (IaaS)

This is the most basic category of cloud computing services. IaaS entails renting IT infrastructure such as servers, virtual machines, storage, networks and operating systems, from a cloud provider on a pay-as-you-go basis.

Some examples taken from bmc.com are: DigitalOcean, Linode, Rackspace, Amazon Web Services (AWS), Cisco Metapod, Microsoft Azure, Google Compute Engine (GCE)

Platform as a service (PaaS)

PaaS reduces the complexity of creating web or mobile apps in that developers don't have to set up or manage the underlying infrastructure of servers, storage, network and databases needed for development.

Some examples taken from bmc.com are: AWS Elastic Beanstalk, Windows Azure, Heroku, Force.com, Google App Engine, Apache Stratos, OpenShift

Serverless Computing

Serverless computing focuses on building the functionality of software applications without spending time to continually manage the servers and infrastructures required to do so. The setup, capacity planning and server management is handled by the cloud provider. Resources are only used when a specific function or trigger occurs making serverless architectures highly scalable and event-driven.

Some examples taken from cloudreach.com are: AWS Lambda, Microsoft Azure Functions, Google Cloud Platform Cloud Functions

Software as a service (SaaS)

SaaS is a method for delivering software applications over the Internet on demand. This is typically done on a subscription basis. Cloud providers host and manage the software application and underlying infrastructure and handle any maintenance, like software upgrades and security patching, and users connect to the application over the Internet.

Some examples taken from bmc.com are: Google Apps, Dropbox, Salesforce, Cisco WebEx, Concur, GoToMeeting

Advantages

The top benefits of cloud computing also mentioned on Microsoft Azure include cutting the cost of the capital expense of buying hardware and software and setting up and running on-site data centers, speed, global scale, productivity, and performance. Cloud computing helps developers to focus on the important parts of the product rather than the underlying hardware and software infrastructure.

Disadvantages

As with every technology there are cons. One major disadvantage of cloud computing that Andrew Larkin (2018) addresses is downtime. If your business cannot afford an outage then do not use cloud services as they are entirely dependent on internet access.

Another con to take note of is inflexibility which Susan Ward (2018) warns us of. Make sure your cloud vendor allows you to migrate to another and is not trying to lock you down forever as a client. It's also very restrictive if the applications or data formats of a cloud provider do not allow easy transfer or conversion of information into other systems.

Susan also brings out the issues with customer support and its expenses especially if your business needs a rapid response to customer support issues.

In conclusion, cloud computing is very convenient for start-ups in that they can focus on the product rather than the underlying hardware and software infrastructure especially if the business can effectively handle the disadvantages of cloud computing.

Cloud computing is the way forward for most businesses because of its advantages and most Internet users use it everyday for convenience.

References:

  1. Techopedia (n.d.) Cloud Computing [online] Available from: https://www.techopedia.com/definition/2/cloud-computing [Accessed 13 October 2018]
  2. Mirosoft Azure (n.d.) What is Cloud Computing? [online] Available from: https://azure.microsoft.com/en-in/overview/what-is-cloud-computing/ [Accessed 13 October 2018]
  3. BMC (n.d.) SaaS vs PaaS vs IaaS: What’s The Difference and How To Choose [online] Available from: https://www.bmc.com/blogs/saas-vs-paas-vs-iaas-whats-the-difference-and-how-to-choose/ [Accessed 13 October 2018]
  4. Stewart, N. (2017) Serverless Computing - What is it? [online] Available from: https://www.cloudreach.com/blog/serverless-computing-what-is-it/ [Accessed 13 October 2018]
  5. Larkin, A. (2018) Disadvantages of Cloud Computing [online] Available from: https://cloudacademy.com/blog/disadvantages-of-cloud-computing/ [Accessed 13 October 2018]
  6. Ward, S. (2018) The Cons of Cloud Computing for Business [online] Available from: https://www.thebalancesmb.com/disadvantages-of-cloud-computing-4067218 [Accessed 13 October 2018]

Wednesday, October 10, 2018

The Importance of Unit Testing

One of the qualities of a good software developer is high attention to detail but nevertheless, errors can escape even the very best of developers. That is why testing and debugging is a huge part of the Software Development Life Cycle (SDLC). Software testing even has its own field of specialization; some organizations hire testers who are specialized in testing software, instead of assigning the responsibility to software developers. However, every software developer needs to know how to test their own code to produce quality deliverables.

Four Levels of Software Testing

The "Software Testing Fundamentals" website explains how there are four levels of testing in the SDLC namely: unit testing, integration testing, system testing and acceptance testing.

In unit testing, individual components of a software application are tested to validate that each component performs as designed.

In integration testing, individual components are combined and tested as a group to expose faults in how they interact with each other.

In system testing, the complete, integrated system is tested to determine if it meets specified requirements.

In acceptance testing, the system is tested to evaluate its compliance with business requirements and determine whether it's acceptable for delivery.

Unit Testing

The website also describes unit testing in detail. A unit/component is the smallest, testable part of a software application like a program, function, procedure or method. These units are tested using a software testing method called the "white box testing method", in which the internal structure of the item being tested is known to the tester. Unit testing is often performed by software developers themselves. Testing is based on an analysis of the internal structure of the component or system.

Some of the benefits of unit testing according to Ekaterina Novoseltseva (2017) is that it improves the quality of code, bugs are found at an early stage and it helps in maintaining and changing the code.

An Example of a Unit Test

Below is a method that truncates a string:

public static class StringExtender
    {
        public static string Truncate(this string source, int length)
        {
            //If source is null, return null.
            if (source.Length > length)
            {
                source = source.Substring(0, length);
            }
            return source;
        }
    }

The following code is a unit test built with MSTest on Visual Studio 2017:

    [TestClass()]
    public class StringExtenderTests
    {
        [TestMethod()]
        public void TruncateTest()
        {
            //arrange
            string source = "Original Source";
            int length = 0;
            string sourceTruncated = string.Empty;

            //act
            sourceTruncated = source.Truncate(length);

            //assert
            Assert.AreNotEqual(source, sourceTruncated);
        }
    }

The code that is added in the test method tests whether the original string has been modified to indicate that the truncate method has been implemented. When you run the test you will see whether the test failed or was successful. When the test passes it means the truncate method was executed successfully.

Interview with Lulu Ndhlovu

Lulu is a software developer with 4 years of experience working mainly with web applications. It was a delight interviewing her to gain insight into the importance of unit testing.

Q: Where did you first learn about unit testing?

A: In my first job at Boxfusion

Q: How often do you practice unit testing?

A: Not often I only did it once.

Q: How has it impacted your performance and quality of work?

A: It was very convenient because we were doing testing with Paypal integration so that's something important you need to make sure is working. We tested the methods that were necessary that needed to call the services for Paypal.

Q: Do you recommend unit testing to all developers and organizations?

A: Yeah. If you have the time in your project.

In conclusion, unit testing is the best way to ensure that components of your software application work individually. Every developer should acquire the skill especially for projects that cannot afford to have minimum security.

References:

  1. Software Testing Fundamentals (n.d.) Software Testing Levels [online] Available from: http://softwaretestingfundamentals.com/software-testing-levels/ [Accessed on 10 October 2018]
  2. Software Testing Fundamentals (n.d.) Unit Testing [online] Available from: http://softwaretestingfundamentals.com/unit-testing/ [Accessed on 10 October 2018]
  3. Software Testing Fundamentals (n.d.) Unit Testing [online] Available from: http://softwaretestingfundamentals.com/white-box-testing/ [Accessed on 10 October 2018]
  4. Novoseltseva, E. (2017) Top 8 Benefits of Unit Testing [online] Available from: https://apiumhub.com/tech-blog-barcelona/top-benefits-of-unit-testing/ [Accessed on 10 October 2018]

Monday, October 8, 2018

The Ultimate Graphics Card

I often wonder how life would be like if we could use technology to extract data from the human brain as we see in movies. Like lodging a microchip into the brain that can transmit imagery from the things we imagine, dream or remember, and even text from the things we think.

Life would not be private, but maybe crime could be controlled. But on a darker note, the nature of every human would be exposed. On the upside, we could create our own graphics from the imagination and transmit those images electronically directly from the brain to devices. Graphic designing on a whole new level.

There would be more astounding consequences on ICT. The way we communicate via social media would be almost telepathic.

So anyway, this has sparked curiosity on how graphics cards work because a graphics card is lodged onto the motherboard so that the CPU (the brain of the computer) can translate binary data into an image you can see on the screen (Tyson and Wilson, 2001).

Jeff Tyson and Tracy Wilson describe how the graphics card receives information about the image from the CPU that is carrying out instructions from a software application. It then decides how to use the pixels on the screen to create the image before sending that information to the screen through a cable.

They also explain how the graphics card bears the load of creating an image out of binary data because this is too demanding of a process for the CPU. It uses a motherboard connection for data and power (however newer cards need more power so they also have a direct connection to the computer's power supply), a processor to decide what to do with each pixel on the screen, memory to hold information about each pixel and to temporarily store completed pictures, and a monitor connection so you can see the final result.


A graphics card is a printed circuit board like the motherboard and houses the Graphic's Processing Unit (GPU) and RAM for memory and a BIOS chip (Tyson and Wilson, 2001). The GPU is like a CPU except it does the complex mathematical and geometric calculations specifically to render graphics. The RAM connects directly to the digital-to-analog converter (DAC) which translates the image into an analog signal that the monitor (screen) can use thus sending the final picture to the screen through a cable.

If we had a graphics card lodged in our brains, we would need biotechnology to transfer the information about the images we conjure in the brain to the graphics card to an external device. Wouldn't that be neat?

References:

Tyson, J. and Wilson T.V. (2001) How Graphics Cards Work [online] Available from: https://computer.howstuffworks.com/graphics-card.htm [Accessed on 8 October 2018]

How to Access the Metaverse

In February this year, Bernard Marr predicted that "in 2022, we'll see new, lighter, more portable VR devices, so instead of having...