Categories
Code and Tools

How to Learn a New Tool

If you work in technology, the fast pace of the industry means that you have to keep learning.

When you have to update your knowledge on a new tool, what is the “best” way to go about it.

This article will provide tips on how to learn a new tool.

Have a Strong Reason to Learn

Why do you want to learn this new tool?

Without a strong enough “Why” the “How” doesn’t matter.

You have to have an expected outcome in mind before you can consider learning something new.

Learning is an investment of time, money and effort. So careful consideration must be made like you would do for any investment.

Before investing your time, you should consider opportunity cost.

Will it be easier to just pay someone to do the job for you?

If the answer is yes, then there is no point learning how to use a new tool.

Search the Web

The web is a trove of information.

With the availability of internet access in Nigeria, you can do research on any task you want to carry out before you start.

This is important because for every task you wish to carry out, there are a plethora of alternative tools.

You may also want to check out the reviews of the alternatives before you make a final decision.

You should consider the entry point for the tool you are planning to use.

Some tools are meant for absolute beginners. Others require a higher level of knowledge to use.

Don’t frustrate yourself before you get started.

Try it Out

At this point, you have decided on the tool to help you get the work done.

If it is meant for offline usage, download and install it. From that point, try to accomplish the task you have in mind.

Online software usually requires a login. Once you do, try to see if you can do what you set out to do.

The goal here is to “Figure it Out”.

Start from Source

Always try to read through the training materials provided by the creators of the tool.

There is always a blind spot you will miss if you don’t follow this approach.

Being Nigerian, I understand why we like to “Terisi”. However, this doesn’t allow for mastery of the tools.

So go through the training provided by the creators of the tool that you are interested in.

Refer to Third Party Tutorials

Only if you have gone through the tutorials provided by the creators of the software that you are interested in should you then look for third party tutorials.

Trust me on this, it is a “rabbit hole”.

You cannot finish all the tutorials out there so make sure that you start with the creator tutorials first.

Conclusion

Tools are not a substitute for work.

Work is hard.

The choice of a good tool makes doing the work easier and quicker.

A good tool is indispensable in improving the productivity of a worker.

This article has looked at the process you should follow in selecting and learning a new tool.

If you have any suggestions, I welcome them in the comments.

Categories
Drawing Adinkra Symbols using Python

Adinkrahene

Adinkrahene is the symbol for leadership and charisma. This symbol is reportedly the inspiration for the design of the other symbols. Its simple yet abstract design, consisting of three concentric circles emphasizes the importance of ideas and abstract concepts.

In the last section, I introduced the grid. The grid will allow us create any symbol we want to because we can analyse and replicate the symbol of our choice.

We will draw a grid of 5 pixel squares on the image of the Adinkra symbol of our choice and replicate that on our grid. The squares on our grid are 10 pixels each. The goal of our program would be to create a grid that is two times the size of the original grid.

Drawing the 5 pixel squares on the Adinkrahene symbol will look as shown below:

Adinkrahene on a Grid
Adinkrahene on a Grid

Analysing the Symbol

The first circle is 8 squares away from the centre of the circle. So multiplying by 5 would give us 40 pixels.

The second circle is 13 pixels away from the centre of the circle. So multiplying by 5 would give us 65 pixels.

The third circle is 18 pixels away from the centre of the circle. So multiplying by 5 would give us 90 pixels.

The outer circle doesn’t touch the edge of the grid. It leaves a space of 1 square. The thickness of the circles are all 10 pixels.

The Plan to Draw the Symbol

To draw the Adinkahene symbol, we have to compensate for scaling up the shape to twice its size.

As a result of this, we shall increase the size of our pen to 20 pixels.

The first circle will have a radius of 80 pixels. We will move the pen to the location (0, -80) and draw a circle of 80 pixels.

The second circle will have a radius of 130 pixels. We will move the pen to the location (0, -130) and draw a circle of 130 pixels.

The third circle will have a radius of 180 pixels. We will move the pen to the location (0, -180) and draw a circle of radius 180 pixels.

Algorithm to Draw the Symbol

The algorithm to draw the Adinkrahene symbol is shown below:

  1. Lift up the pen
  2. Increase the pensize to 20 pixels
  3. Move the turtle to the position (0, -80)
  4. Place the pen down
  5. Draw a circle that is 80 pixels in radius
  6. Lift up the pen
  7. Move the turtle to the position (0, -130)
  8. Place the pen down
  9. Draw a circle that is 130 pixels in radius
  10. Lift up the pen
  11. Move the turtle to the position (0, -180)
  12. Place the pen down
  13. Draw a circle that is 180 pixels in radius

Using Turtle Graphics

We will use the template.py file and rename it to adinkrahene.py.

The first step in drawing the Adinkrahene symbol is to draw the innermost circle and work our way out.

The first task is to lift up the pen. The code to do this is shown below:

turtle.penup()

Next we will increase our pensize to 20. The code to do this is shown below:

turtle.pensize(20)

The origin of the turtle is at (0, 0). To move the turtle to the position (0, -80), we use the command shown below:

turtle.setposition(0, -80)

At this point, place the pen down and draw a circle of radius 80 pixels. The code to do this is shown below:

turtle.pendown()
turtle.circle(80)

Our Python Turtle window will look like shown below:

Inner concentric circle of Adinkrahene
Inner Concentric Circle

Steps 6 to 9 are the steps for drawing the second circle. The code is similar to what you have already seen before and is shown below:

turtle.penup()
turtle.setposition(0, -130)
turtle.pendown()
turtle.circle(130)

When we run the code, our second circle now appears as shown below:

Middle Circle of Adikrahene
Middle Concentric Circle

Steps 10 to 13 will draw the third circle. The code to do this is similar to what you have already seen before and is shown below:

turtle.penup()
turtle.setposition(0, -180)
turtle.pendown()
turtle.circle(180)

When you run the code, the image is as shown below:

Adinkrahene
Final Image

Complete Code

The code for drawing the symbol is shown below:

"""
Project Name: Drawing Adinkra Symbols using Python
Symbol Name: Adinkrahene
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math

# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()

# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Draw the grid
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)

# Change the colour mode
turtle.colormode(255)

# Change the pencolor to red
turtle.pencolor(255, 0, 0)

# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()

# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)

# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)

# Place code here
# Lift up the pen
turtle.penup()

# Set the pensize
turtle.pensize(20)

# Draw the first circle
turtle.setposition(0, -80)
turtle.pendown()
turtle.circle(80)

# Draw the second circle
turtle.penup()
turtle.setposition(0, -130)
turtle.pendown()
turtle.circle(130)

# Draw the third circle
turtle.penup()
turtle.setposition(0, -180)
turtle.pendown()
turtle.circle(180)

# End the program
turtle.done()

Where Can It Be Found?

A brief Google search led me to the following places where you can get branded Adinkrahene products:

  1. TShirts, Mugs and Phone Cases on TeePublic
  2. Pendants on Purple Blessing
  3. Socks on Adinkra Republic

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Adinkrahene symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Support this Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.

Categories
Python Programming

Why We Program

A computer is a machine that processes information under the control of a program.

By seeing the computer as a machine, you can then come to appreciate it like any device around you.

What however makes the computer special is the fact that you can program it.

What is Programming?

Computer programming is a way of giving computers instructions about what they should do in order to complete a set task.

A computer program will have the ability to take input data from a device such as a keyboard, process calculations, and make decisions based on certain conditions.

The practice of programming is one of teaching the computer to do something.

You must know how to do it yourself before you can teach a computer to do it for you.

Programming Languages

The instructions to execute the task that you want the computer to do for your are given to it in a programming language.

A programming language is a language that the computer understands.

Using a programming language, you are then able to transfer the logic of how you solved a problem to the computer.

To learn a programming language, you should be able to do the following with it:

  1. Take inputs
  2. Produce outputs
  3. Declare variables
  4. Use mathematical expressions
  5. Use conditional statements such as IF/ELSE
  6. Using looping statements such as WHILE
  7. Write functions

The Purpose of Programming

The purpose of programming is to automate processes.

When we have a problem that we want to solve, we list out the steps to solve that problem.

The sequence of steps we create is the algorithm.

The algorithm embodies all the logic we need to solve a problem.

With a well designed algorithm, we are confident that if we follow the steps of the algorithm, the result will always be correct.

We then take this algorithm and express it in a programming language as a program.

Once we have the program, the computer will handle the task for us.

We can then free up the time for our task until something goes wrong or we need to update the program’s logic.

This is the essence of programming.

Conclusion

Programming is a task that deals with the automation of the solution to a problem.

It is difficult hence the need to understand why it is needed before you do it.

Learn Python in One Week

If you want a quick and easy introduction to the Python programming language, you should check out my fifth book: Learn Python in One Week on the Amazon store.

Categories
Uncategorized

Mathemagic

Introduction

Welcome to a new week.

Last week was filled was fast paced. Story upon story. Thankfully, we made it to the end.

This post will look at some of the happenings of last week.

How 4th Became 1st

In an amazing turn of events, the 4th would be come first in Imo state.

You can read all the sordid details of the case here.

Election Results for Imo State

I am short of words at the happenings but not surprised. Nigeria has been synonymous with new lows in recent times.

Every time you think it cannot get any lower, it does.

As an engineer, I thought about how 1st could become 4th.

Haven’t you heard of modulus?

It is represented by the % symbol. It is the whole number remainder when you divide one number by another.

4 % 4 = 0
0 + 1 = 1

The proof above should suffice for the mathematically curious.

Forex Intervention

Last year, we spent close to 17 Billion Naira for the defence of the Naira.

No longer is our exchange rate an indicator of our productivity, it is now a measure of how well we can do Currency Warfare.

Such a regime is unsustainable but in this foolhardy administration, the continuation of foolish policies without recourse to common sense is notable.

The first forex intervention happened last week.

Who gives a damn if our banks cannot hold their water?

Group Economics

It wasn’t all doom and gloom.

I would read a story about a group of women who would combine forces to build a 5 storey building in Kenya.

It points to the fact that in unity, there is power.

Amotekun

Amotekun Logo

We all knew that the killings in the country could not go unanswered.

Although slow in coming, the Governors of the South Western states have decided to unite for the defense of their states.

This move marks the beginning of the end for the union called Nigeria.

It has been criticized by the North. Yet, they are unable to state on what basis makes the Hisbah legal and Amotekun illegal.

Amotekun in the South, Hisbah in the North

What will be left will be for other states to follow.

Amotekun means Cheetah in the Yoruba language.

Grid Collapse

Dark Room

It is only common sense that a nation that plans to go to space should have light on earth.

Last week on Thursday, 16th of January 2020, the national grid collapsed.

It would be the first collapse of the year. Nigeria has refused to apply any metric of wisdom in dealing with this problem.

VAT Increase

As if the suffering of Nigerians under bad government policies is not enough, the government has decided to increase the Value Added Tax (VAT).

You can see the announcement below:

VAT Increase Announcement

Not that it will do much good to the economy as the problem with the country is one of capacity.

What Does the Future Hold?

This article covers a possible future for Nigeria.

The writer brings no original thinking to the article and if you read any “Africa Rising” narratives last decade, it is in the same class.

How it Could All End?

Could Nigeria suffer the same fate as Venezuela?

The article gives a harrowing picture of people leaving a defunct nation.

Jetting Off

Despite all the problems in the country, the President is out of the country for another pointless trip.

This time he didn’t slither off. He met with some of his people.

Conclusion

History Repeats Itself

The above image covers all my feelings about Nigeria this week.

Thankfully, the world has been here before.

Have a great week.

Categories
Uncategorized

Simple Interest

The concept of Simple Interest is one of the first things anyone learns in Financial Mathematics.

It isn’t really hard to program.

The formula I am using is given below:

Simple Interest Formula

The code to program this is shown below:

# Print out the purpose of the program
print("This program computes the compound amount using simple interest")
print("Reference: An Undergraduate Introduction to Financial Mathematics (Page 2)\n")

# Ask the user for the initial deposit
principal = float(input("Please enter the initial deposit: "))

# Ask the user for the rate as a percentage
rate = float(input("Please enter the rate: "))

# Ask the user for the number of years
years = float(input("Please enter the number of years: "))

# Compute the compounded amount
rate = rate / 100
compounded_amount = principal * ((1 + rate)**years)
print("\nThe compounded amount is:", round(compounded_amount, 2))

You can also find the code on GitHub.