Memories of Grandmother and Granddaddy

I remember my maternal grandfather was a jolly fellow. He loved to joke and sing. Often, he would get up early in the morning and start a pot of soup before breakfast. Then he would cook a big breakfast for everyone. He was in the restaurant business for most of his life. He had a big family. My mother had a sister and three brothers. She told me about waitressing for my grandfather.

One time when I was thirteen I went on a trip with my grandparents. We went to Saint Louis to visit my grandmother’s sister, Helen.  We were sitting around the table after dinner. The conversation turned to which direction the Mississippi River flowed past a point where there was a crook in it so that it flowed north for a short stretch before it turned back to flow south. Aunt Helen had the idea that north was uphill and south was downhill. My grandmother was trying to explain that this wasn’t so.

Every time when she had just about convinced Aunt Helen that there was nothing untoward about the river flowing north for a bit and then curving back around to the south, my grandfather piped in and said something like, “but that would mean that it was flowing up hill.” This would get aunt Helen confused and she would start arguing with my grandmother and my grandfather would sit there and laugh quietly to himself. He did this three or four times before he got tired of it.

The next day we went to see the Gateway Arch. It was newly completed and we rode all the way to the top and looked out the windows. Later we stopped at a Radio Shack. Radio Shack didn’t have nearly as many stores in those days and I had never been in one of them. I got their catalogs in the mail all of the time though. I bought a small audio amplifier kit. When I got home I soldered it together but I must have overheated the transistor. It never worked.

My grandmother was a Superintendent of a school system in Tennessee. She always had text book samples. I loved to read them. I remember one time when I was on spring break and she let me go to work with her. I was impressed with her office.

I started thinking about my grandparents when I realized that I am as old now as they were when I knew them. I don’t feel old. I understand now that they probably didn’t feel old either. Time sneaks up on you. Of course I stand a good chance to live a good bit longer than they did. Our medical science is a good bit more advanced than it was back then. It still makes me ponder my mortality though.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Fiddling with Blog Formatting

WARNING: This post is primarily an experiment in how to format code in-line in a blog post. If you don’t understand this post, it’s probably because I’m doing a lousy job of explaining myself. I am concentrating on form instead of content. Tune in tomorrow and I’ll probably be back to making some kind of sense. And now, back to your regularly scheduled blog post, already in progress.

I found that there is a style pulldown in WordPress that lets me put preformatted source code in a blog post. Surprisingly enough, it is called ‘Preformatted’.  There is an example of how it looks in the box below.

def hello():
    print('Hello, world!')

if __name__ == '__main__':

There are better looking ways to embed source code in a blog post but this is the simplest one. Some of the other ways provide syntax highlighting to make the keywords of the programming language stand out. Most of them provide line numbers to make it easier to talk about the various lines in the program. I will investigate those tools and report back on them as I learn how to use them.

Since I have a piece of Python code to talk about, I will attempt to explain what the program in the box above actually does. When loaded interactively into a Python interpreter, it defines a function called hello() that prints the string Hello,world! on the screen.

If the file containing this code is run from the command line, the variable name is given the value ‘main‘. The code after the if statement at the bottom of the box checks to see if name is equal to ‘main‘ and if so, the function hello() is called in the body of the if statement.

If the code is imported as a library, on the other hand, name will not be equal to ‘main‘, so the body of the if statement will not be executed. The code that imports the file can then call the hello() function at its own discretion.

If you know Python, this post has probably been boring. If you don’t know Python, it has probably been confusing. This post has been more of an exercise in how to format code in a blog post and less of an actual tutorial on Python.

If you are interested in a tutorial on Python, look here. I will probably write more about Python in the future. I will make the code prettier next time. I will make the prose more illuminating. But there is just so much time available to blog each night and I didn’t have time to experiment with formatting and write riveting content in the same post.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

A Pixie has Stolen My Heart

We have a little Maltipoo puppy. We named her Pixie Woo. I think she imprinted on me. When we were at the breeders to pick out a dog, she stood up on her hid legs and and begged me to pick her up. I did. She rode home on my lap and by the time we got home, I was her human.

My wife tells me that Pixie cries for half an hour every morning after I leave for work. When I get home in the evening, she barks with glee and dances around on her hind legs until I pick her up and give her a hug.

And the affection goes both ways. I have never had a pet that I loved like her. She is such a smart girl. She has a large vocabulary and it’s growing all the time. She knows steak, chicken, and fish. She knows carrot and greenie. She loves carrots and greenies.

My wife plays a game with her where she gets her nose while saying “Boop!” She decided to be the “booper” and jumps up and tags our nose when we are playing the game.

When I call my wife to make plans for dinner, she asks our dogs what they want to eat. She goes through a list of possibilities. When she says something that they want, they high-five her.

I have spent a good part of my life studying computer science with the goal of creating artificial intelligence. Part of the challenge is coming up with a test for determining whether a program is exhibiting intelligence behavior or is just doing what it has been programmed to do. By all criteria I can think of both my dogs are extremely intelligent. But Pixie more so than Belle our older Maltipoo. One thing is for sure, I am lucky to be the human of such an intelligent, affectionate little dog.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Ode to British Television

The BBC makes such exquisite documentaries. For instance, tonight they are running a documentary on Paris of 1928. He has taken us to the places where people were meeting, where the artists lived, where the musicians played. They explore the reasons that people flocked there. The philosophical and artistic ideas that it inspired. I am a big fan of PBS but the BBC outshines it in almost every way.

There are a few PBS shows that can hold their own though. Ken Burns’ documentaries illuminate American History in a style uniquely his. And of course Austin City Limits showcases the best of our musical talent. There are others but those two stand out in my mind.

I think it is probably because American television entrepreneurs are more interested in broad popularity. Thus we have Seinfeld where they have The Office. They sometimes attempt to import some of their shows to American television with mixed success. On the other hand, they have produced such extremely popular shows as Dr. Who and Sherlock. But these are not the Crown Jewels of British television.

Such shows as Midsomer Murders, Poirot, and Jeeves are just a few examples of the highest standards of both production and story telling. I’m obviously a hopeless anglophile but I think even those not nearly as obsessed with all things British will agree that the British produce engaging television.

The documentaries are the hidden gems though. They are usually standalone offerings on a given topic. They rarely exceed an hour and a half duration. But they inspire enthusiasm whatever their topic.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Fibonacci Fun with Python

I’ve been playing with numbers with Python. I wrote a function that returns the nth Fibonacci number. Fibonacci numbers are generated by taking zero and one as the first two numbers, then adding the previous two Fibonacci numbers together to yield the next one. The next Fibonacci number after 0 and 1 is also 1 since 0+1=1. The next one is 2. The next one is 3. The next one is 5. And so on. Strictly speaking, the first Fibonacci number is 1 since there is another trait that Fibonacci numbers exhibit and 0 can play no part in that. Given two successive Fibonacci numbers, the ratio of the greater to the lesser of the two will tend toward the golden mean or phi.

The golden mean is approximately 1.61803398875 although, like pi, it is an irrational quantity that has no exact expression. It can be written as the expression (1 + square_root(5))/2. It is the square_root(5) term that makes the number irrational. But, if you will notice, 1/1 is 1, 2/1 is 2, 3/2 is 1.5, 5/3 is approximately 1.667 and as you continue to compute the ratio with larger and larger Fibonacci numbers, the result gets closer and closer to phi.

Phi is an interesting quantity. It shows up in many places in nature. Some of the claims about it, for instance that it is evident in the logarithmic curve formed by a Nautilus shell, have been disproven by empirical study. Others, like the fact that the ratio of the length of a diagonal of a regular pentagon to the length of one of its sides is phi, are on sound footing. In any case, computing Fibonacci numbers and phi can be an interesting pastime.

I found a simple function in Python that yields the nth Fibonacci number in relatively short order without having the unfortunate side effect of consuming the entire stack.

This function takes an integer argument n. It initially sets a to 0 and b to 1. Python allows you to set multiple values with one assignment statement as shown in line 2 above. Then, for  a variable x assigned to every value between 0 and n-1, which is to say n times, you set a to b and b to (a+b). When you are done, you return a because it will be the nth Fibonacci number.

I learned several things while writing this blog post. First, when you are computing Fibonacci numbers, the values get large very fast. For example, the 100th Fibonacci number is 21 digits long. The 1000th Fibonacci number is 209 digits long. Another thing I learned is that the square root symbol does not render as such in a standard web page. I am somewhat baffled by that as it renders fine in the WordPress editor. Perhaps I will discover a way around this.

I also learned how to use GitHub to create a gist, that short block of code above. A gist allows you to display the program formatted as it would be in a code editor instead of formatted as prose as it would be if typed directly into the blog post.

I learned other things tonight but I don’t intend to belabor this post with a lengthy explanation of everything I learned. Perhaps another night.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Features Running Out My Ears

I’ve had my new MacBook Pro since right before Christmas last year. That’s roughly four months. I finally got around to setting the default font size on the terminal application to a size that I can read without having to lean forward. Font sizes are expressed in points. 72 points is supposed to be an inch but characters are drawn on the screen by turning pixels on or off. The problem occurs when the number of pixels per inch changes, typically becoming greater. Then where there were say 2 pixels per point before there are now 3 or 4 pixels per point. If the program hasn’t been written to be aware of the different pixel densities between models of computer, the font appears smaller than it should on the newer computer.

I knew all of this, but I just couldn’t be bothered to take a couple of minutes to figure out where the preference setting was to change the default font setting on my computer. Now that I have, using the terminal program is a lot more comfortable.

That isn’t the only thing that I haven’t taken advantage of much yet. For example, the latest version of MacOS has a feature where you can split your screen between two applications, one taking up the left half of the screen the other taking up the right half of the screen. This is an ideal way to read directions on a web page with the browser in one half of the screen and follow them with another program on the other half of the screen, An instance from earlier today will show what I mean.

I was using the Python programming environment called Spyder, I needed to look up a detail about the language. Instead of switching back and forth between the two applications I put Spyder on the left side of the screen and Safari (the Apple web browser) on the right. That way, I could see both the Python manual in the browser and the program that I was writing at the same time.

There are a lot of things like that in our fast paced technological world. We learn to do something one way with our computer or phone or whatever. Then when they add a convenience feature we don’t even think to use it until long after we’ve upgraded our device.

Perhaps the point is, we should take a little bit of time every now and then to explore the features of our devices. We might find that they are even more useful than we knew.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Python For The Win

Today I remembered what I love about programming. It’s that feeling that you get when you know what you want to accomplish. You have an idea of how to start realizing your vision. You are comfortable with your tools, that is the language and the editor that you are using to write your opus. With these elements in place you are set to experience flow. Flow is a state of mind, studied and characterized by Mihály Csíkszentmihályi, where the task at hand is difficult enough to be engaging but not so difficult that you get stuck trying to accomplish it. As you finish one task, the next one becomes apparent to you. It is an exhilarating feeling.

What happened today is that I found a Python package called openpyxl that allows you to read and write Excel files from Python. This was the solution that I was looking for to my problem with analyzing large data sets stored in an Excel spreadsheet. I had been struggling to do it with VBA (Visual Basic for Applications) but I found it to be difficult to use. I found plenty written on it but nothing that spoke to my problem domain. If anything, there were too many mediocre books targeted at spreadsheet power users that were novice programmers. I am the opposite, a casual spreadsheet user that is an expert programmer.

I figured out after I thought about it for a while that experienced programmers just weren’t going to put up with a language as shabby as VBA. Not only was it a bad language but it had no standard definition and was proprietary to Microsoft. Consequently, it was subject to Microsoft’s favorite ploy of making radical changes to the behavior of the language from one version of the product to the next. It made no sense to me to invest any significant amount of effort into crafting a solution only to have to entirely redo it at the next release of Excel.

To summarize, I made more progress today than I would have in a week with VBA. And as a bonus benefit, my code is readable to the large and ever growing cadre of Python programmers. It was a brilliant idea and I’m still floating on air over having figured it out.

Basic was a good first cut at a first language but we have learned a lot about how computer languages should work since it was first released in 1964. Bill Gates and Paul Allen started Microsoft with Microsoft Basic in 1975 and it was a clever implementation that made the limited resources of the early personal computers more approachable by total computer novices. In the intervening 42 years, we have developed a number of languages that fill the niche that Basic originally targeted much better.

Python has become very popular for both casual scripting and implementation of large projects. It has the inertia associated with a large user community and a responsive team of implementors. There is a clear definition of the language and a carefully controlled process governing the evolution of the language. I can develop in it with confidence that my work won’t be rendered obsolete by the next release of the language.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Stone Knives and Bearskins

Thirty seven years ago I briefly worked for a little startup based in Hoover, Alabama, which is a suburb of Birmingham. The personal computer era was just dawning and this company was selling personal computers to small businesses and writing software to fit their needs. The computers were from an outfit known as Ohio Scientific and the software was written in a very early version of Microsoft Basic.

This version of Microsoft Basic provided two letter variable names and all variables were globally visible. That means that if you used a variable in a subroutine you couldn’t use it anywhere else in the program without clobbering it every time you called the subroutine. And recursion was definitely not supported. I spent a month debugging a primitive Numeric Control compiler that I wrote in that Basic. I swore I’d avoid writing any software in Basic after that.

Flash forward to the present and I find myself trying to automate analysis of a large data set that is stored in an Excel spreadsheet using Microsoft’s Visual Basic for Applications (or VBA as they like to call it). I will admit, it is slightly improved over the language that gave me fits four decades ago. But, it is still giving me fits. I am in the unenviable position of being too aware of what I want to automate and too ignorant of the mechanisms that might help me achieve that automation in VBA.

I have made a cursory search for solutions to my problem and so far I have learned several things. First, most people that are using VBA are not experience programmers, they are Excel power users. I, on the other hand am an experienced programmer and at best a proficient beginner with Excel. I have been using spreadsheets for twenty five or thirty years but haven’t progressed much farther than summing a column of figures.

Another thing that I’ve learned is that there are hundreds of books that teach you how to use Excel. Most of these have a chapter or two on writing VBA macros. Macro is what Microsoft calls VBA subroutines and functions to try to make them seem less intimidating to non-programmers. Truth be told, if you are writing VBA macros you are writing programs. There are  even some books that are narrowly focused on writing VBA macros but these all seem to assume that you are already an Excel power user.

I am reminded of the Star Trek episode (City on the Edge of Forever) where Mr. Spock explains “I am endeavoring, ma’am, to construct a mnemonic memory with stone knives and bearskins.” That is what it feels like trying to write analysis software in VBA.

There are other options. I will investigate them. One that comes to mind is to use a more rational language like Python to manipulate the data using one of the libraries that allow you to read and write to Excel spreadsheets from Python. It will probably be a lot better, for me at least, than struggling with VBA. It certainly couldn’t be any worse.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Getting Old is Not For Wimps

I remember one of the first science fiction books that I ever read was A Wrinkle in Time by Madeleine L’Engle. I was a preteen at the time and identified strongly with the protagonist. I think I was vaguely aware that there was a sequel but I didn’t know that she had written so many books in the series.

I’m discovering a lot of things that I have managed to miss in my life. Everything from musicians to authors, movies to paintings. I would love to be able to devote more time to listening, reading, and watching these newly discovered works.

I’ve also been listening to songs with an ear to hearing the bass part. My acoustic electric bass will be here soon and I want to have some new bass licks to try out. I am so excited about this bass. It is a marvel of engineering and a beautiful piece of woodwork all in one.

But the sad truth of the matter is that work takes most of my energy and I find myself nodding off when I sit still for just a moment at home. I have managed to maintain my writing regime but it has been at the expense of so many of my other interests. I need some of the misspent energy of my youth.

I guess I should be thankful I’m still alive and in fairly good health. Thankfulness is important to feeling good about yourself and your place in the world. I will do whatever I can and have fun doing it. I won’t worry about anything that falls off my plate. That’s my plan right now anyway. We’ll check up on how my plan pans out in a couple of months.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

I’m From Missouri, Philosophically At Least

I am not a religious person. I am a spiritual person but religions bother me. They all pretend to have inside information about God or Gods and what they require of humanity. The problem is, all I have is some person’s word that they know what God wants. I don’t buy the argument that I should take them at their word on faith. If God did in fact create me, why would he/she/they give me my senses to perceive the world with and my brain to reason about it if he/she/they didn’t want me to demand proof.

This does not mean that I am an atheist however. I think that atheists are just as radical as fundamentalist. They pretend to know that there is no God. I don’t think that can be known absolutely. If their is a deity or deities, I see no reason why they would bother to make themselves known to man. Do we tell ants what we have planned for them? Do we even have plans for them? Or maybe amoebas would be more apropos.

In any case, as you probably have guessed now, I am an agnostic. A spiritual agnostic, but an agnostic none the less. I don’t know if there is a God or not. I sometimes hope that there is a God and that he or she or it actually cares about me as an individual or even mankind as a race. It seems a long stretch to me though.

I certainly don’t believe that any person has been given exclusive access to the wisdom of a deity. I believe that if a deity were going to reveal a message to mankind, it would be to all mankind. It would be accompanied by some form of evidence sufficient to convince our mortal minds of the veracity of their deity.

But then I am a romantic. I like things that are done with a flare. I may be entirely wrong. I am willing to admit it. I just don’t like anyone preaching at me.

I sometimes think I observe miracles. When I do, I invariably find that there are scientific explanations behind what I have seen. That needn’t reduce the sense of wonder that such things inspire. It just doesn’t seem necessary to give anyone credit for it. The rains come, the crops grow, we are fed for another year. It is miraculous but it doesn’t need a deity to make it so.

Yes, I am a skeptic. That doesn’t mean that I reject all claims of the paranormal. I keep the grain of skepticism at the ready though. If any phenomena is so sensitive to the energy of my skepticism that it can’t exert its effect while I am skeptical, I think it is just a ruse covering up opportunistic exploiters of circumstances or just plain frauds, depending on how charitable I’m feeling at the time.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.