Book Review: Science and Technology in World History Volume 1. Ancient World and Classical Civilization by David Dennings.

What I hoped to gain by reading this book was a knowledge of Science and Technology history. It has more history (that is not science and technology ) than I expected and thus I was a little disappointed.

It starts with examining the Egyptian and Babylonian civilizations and explaining how they weren’t really scientific in their methods. The first civilization that could be qualified as scientific were the Greeks. There were three significant factors that contributed to the rise of Greek science. The first was intellectual freedom. Compared to other civilizations, greek society was open. Ideas could be critiqued. The second factor was naturalism. “Naturalism is the explanation and interpretation of phenomena in terms of the natural law rather than the interdiction of supernatural forces or beings.”. The third was the idea of demonstration or method. It wasn’t enough to come up with an idea. A proof was required.

Then author then moved on to talk about different important people in Greek science from Thales to Socrates, to Plato to Aristotle. It goes from teacher to teacher and explains what their views of the world were. It examines evolution of ancient beliefs like the flat earth to how various people have estimated the size of the earth.

The book was heavy on Political history. It contains tales of Greece’s war with the Persians. All of this to provide a certain background with which science and technology was developed. I felt I was reading mostly a historical account and not enough explanation of tech, I would rather have picked a book on history – I guess that’s what this is, but I wasn’t expecting it to be like this. There was quite a bit on philosophy, politics and historical facts. It was okay.

The Internet Of Things

What is the Internet of Things?

IoTDefinition

The internet of things is known by many names – the web of things, the industrial internet. It is the next evolution of our current internet infrastructure based on advances in sensor technology, communication infrastructure and many other things.

The internet today, is dominated by human beings. We are the main generators and consumers of data on the internet. We are on social media, we are blogging, we are adding videos, viewing videos, downloading and uploading documents. The internet as it is now, is dead without us.

The internet of things world is instead a world where machines are the main generators and consumers of data. In this world, potentially, everything is connected to the network i.e.your car, your table, your door, your window. Everyday objects all connected the internet. Some embedded with sensors and others with actuators, all connected to the internet

Why the Internet of Things?

But why would you want – say your window to the connected to the internet, what could be the possible advantage(s)? Well, It might be you want to be able to open the windows remotely from anywhere in the world or you want to check if your window is open or be notified when a burglar is trying to open the window. That’s just one application but there are many possible others with different objects. All of this made possible by sensors, connectivity and actuators.

Internet of Things today

The first thing to get “pimped” to internet of things device (as in pimp my ride style) was the telephone. The product of this is the smartphone. What are the differences between a nokia 3310 and an iPhone? Internet connectivity is a major difference. In addition to internet connectivity, smartphones have several sensors – a typical smartphone has accelorometers and GPS sensors. All of these things together make it an internet connected thing. We already have services that make use of the data from your smartphone sensors for example Uber and Google Maps. More devices are set to make this transistion into smart things.

The Internet of Things Ecosystem

The internet of things applications are fostering the growth of a new industry. There are several technologies, companies, jobs that will be created as a result of it. I will highlight some of them below.

Companies – Intel, General Electric, Phillips Electronics, IBM, Microsoft, Google, Samsung

Sensors – RFID, GPS sensors, temperature sensors

Communication standards – Bluetooth Low Energy, WiFi, 4G LTE

Jobs – Data analysts, Emebedded systems engineer, Software engineer

Languages – Javascript, Node, Python

How does the internet of things affect us in Africa, in Nigeria

It might seem all of this is very futuristic and not very relevant to us today. We have yet to get basic infrastructure like power and internet access still costs a lot but we stand to gain a lot by adopting Internet of things applications and having them in mind as we build our infrastructure. We can use these applications to solve our own unique problems. It can help with giving advance warning on floods, warnings on faminine. We can improve traffic congestion in our cities if all the cars are connected. We can monitor/prevent ourbreaks of diseases like Ebola and Cholera. Imagine if there was a kit that tested for diseases and automatically recorded all the cases of a particular disease. It would be easier to detect a spike in cases of a particular disease and therefore know when we have an epidemic.

The Internet of things in the future

The future is everything being interoperable and we using the data gathered to make smarter decisions. It is a world where we have extrasensory powers. We know the traffic anywhere by tapping into the earth’s nervous system that we have created with our connected things. The Internet of things is here. It holds a lot of promise and also some challenges ( security challenges, objects would become targets for hacking) . But we can use IoT apps to make our world a better place

Programmers At Work

I randomly came across this compilation of interviews of 19 great programmers. I am not sure what the criteria was but there were a lot of interesting people. Interviewed were Bill Gates, Charles Simonyi, Jeff Raskin , the designer of pacman and so many more.

I enjoyed reading it. They all had interesting perspectives on issues like A.I, the future (then.. now present) of the computer industry, some complaints about the current state of things. One of the gems was getting book recommendatins like Zen and the Art of Motorcyle maintenance, a book one of the programmers credited with getting him more interested in doing things right. I am also impressed by the discipline some of these programmers had. It was also interesting that most of the them (I didnt count but that’s my impression) didnt study computer science. One even went as far as saying one shouldn’t study computer science but a wider education first.

I recommend. It was inspiring for me. I even got some ideas for things based on some of their ideas.

You can find it here . I read a pdf not sure where it is.

Understanding the Extended GCD Algorithm

The extended greatest common divisor (egcd) algorithm is used to calculate the greatest common divisor d and find x and y for  a given a and b such that

x×a + y×b = d                    (1)

If you are familiar with the greatest common divisor algorithm you will know that

gcd(a,b) = gcd(b%a,a)

It is all simple but I have been having difficulties coding the egcd till I had this insight.

egcd(a,b)=(d,x,y)………(2)

egcd(b%a,a) = (d,x1,y1)…..(3)

what is x1 and y1?

xa + yb = d

can be rewritten as

xa + y(⌊b/a⌋×a+b%a)=d

if b>a it can be further reduced to

(x+⌊b/a⌋×y)a+y(b%a)=d

and thus

x1 = y

y1 = (x+⌊b/a⌋×y)

and how do you reconstruct x and y given x1 and y1?

y = x1

x =  (y1-⌊b/a⌋×y)

x = (y1-⌊b/a⌋×x1)

Now, we can write the recursive algorithm

def egcd(a,b):
if a==0:
return (b,0,1)
else:
g,x1,y1 = egcd(b%a,a) #the x1,y1 above
return (g,y1-(b/a)*x1,x1)

Voila!

Books aren’t the only way to Learn

I have been actively self-learning for some time now. It started from the time in JS3 I decided to pick up New General Mathematics and learn all the maths therein, to my preparation for the International Mathematics Olympiad to my first year in the university with French and Java. I have been doing quite a lot of self-learning and my predominant method has been books. I love challenging my brain, exposing myself to brilliant ideas I might never use and it has been enough.

But I might have become too fixated on this way of learning. I recently decided to focus my efforts on learning electronic hardware and one of the ways I have done this is to take a look at other people’s real life code. I took a look at the code for the Adafruit_DHT library and I feel I have gained things I couldn’t have gained otherwise. I am happy to say I understood most of what was in it.

I am entering a new phase. I am familiar with the field enough . I can read source code and understand which is due to the reading I have done but books are no longer enough. This new phase doesn’t mean I no longer read but it means I am no longer scared to look at source code. I can now understand and study those directly and see how they correlate with what I have been reading. I feel more confident that I can soon unleash production quality code and do some badass projects. Bring it on!

Understanding the Adafruit DHT Library

I was working on a getting an IoT demo running on the raspberry pi and so I downloaded the Adafruit DHT library. I want to be able to create libraries like this in future so I took a peek inside.

The Adafruit DHT library is written in Python with C extensions. The C code is used to communicate directly to the DHT sensor and I would assume the reason for this is that C code is faster than Python code in general (always? ). The Python code is written with several layers and it works with the Raspberry Pi 1, the Raspberry Pi 2 and the Beaglebone black.

DescriptionOfCodeStructure

It starts with the __init__.py file. This file contains just one line of code

from common import DHT11, DHT22, AM2302, read, read_retry

The point of this is to make it possible to refer to Adafruit_DHT.read(). The common.py file detects the platform on which the program is run ( Pi 1, Pi2, or Beaglebone) and then call the appropriate read function for each one. Platform specific code is under the files named Raspberry_Pi.py, Raspberry_Pi_2.py and the Beaglebone_black.py. These files are now used to make calls to C extensions installed by setup.py. setup.py installs C extensions based on _Raspberry_Pi.c and other files on the same level (check the diagram). _Raspberry_Pi.c contain details of the interface between the C and Python code. pi_dht_read.c takes care of communication with the DHT sensor. The pi_mmio.c is a fast memory-map for memory-mapped io (I am yet to understand why this is required or what it really means).

What I liked was the beauty and the structure of the program, it was very well organized and it reminds me of one of the lessons I learnt from SICP about how programs are built in layers of abstraction. As it is, it wont be hard to extend this library for another platform just because of the way it is written. Bravo!

I need to imbibe and do this in my own programs

You can find the code on github here

Book Review : The Hidden Brain

From Blink to The Tipping Point to the Organized mind and then to this book, I have been reading a number of books that deal with human psychology. This book is Malcolm Gladwell-like, with its anecdotes to support research. I like stories.

The author introduces us to our Hidden brain – our unconscious mind that affects and directs our lives, arguably even more than our conscious one does. He then proceeds to explain how things like racism, crime, terrorism and our empathy during disasters are all influences by our hidden brain.

I liked this book and I recommend. It provides explanations for some of the things that were mere hunches for me.

Happy Birthday to Me!

Today is my birthday. It is gradually hitting me that I am getting old. Well, it has to. I will soon be done with the NYSC (National Youth Service Corp, for non-nigerians) and be thrown in to the deep end (Job market or not 😉 ).

I am happy about the person I am becoming. I like that I am growing, developing, becoming more mature, rounded. I feel good about myself. I am on the right path.

What I want is to continue on this trajectory and not look back. I haven’t arrived by any chance (Will I ever?) but I can say without any shadow of doubt that I am making progress. Happy Birthday Ope once again… from Ope to Ope…lol. 🙂