Another One Bites the Dust

As if enough hadn’t gone wrong already lately, I got up this morning and my computer told me there were important system updates, so I installed them. When it finished updating, it rebooted. Only when it did, it had a fatal error on reboot. I would have expected as much out of Windows but this was a Linux machine. I didn’t have time to troubleshoot it so I booted the Windows partition and was able to read my email, record my vital signs, and write my morning journal entry (different from my blog). I had to fight off the requests to update my windows installation but I  was able to get what I needed to do done.

When I got home this evening, I booted Linux from the install disk and was able to backup my files. I am writing this blog post as my Linux home directory is copied over to an SD card. When that finishes, I’m going to see if I can repair the current installation. If not, I’ll reformat these partitions and start again from scratch. I need to buy a couple of external disk drives so that I won’t be stuck in this situation again.

I know that hearing my tale of woe about my computer problems is hardly satisfying fare for a blog post but I promise to do better tomorrow. I refuse to let a little thing like a computer malfunction get me down. Sleep well and have pleasant dreams. Tomorrow will be another day, resplendent in all of its glory. Enjoy your fleeting time upon this Earth and above all, be kind.

 

So Long and Thanks for the Fish

I’ve had it with Facebook. I have had no less than two people that I considered friends make broad generalities demonizing the opposition without even realizing that I was one of those they were so thoughtlessly calling names. Then the final straw was when I inadvertently hurt the feelings of my sweetheart. I have too often done that without the help of Facebook.

I have learned not to make statements containing dramatic absolutes like “I’m never going to participate in Facebook ever again.” I am not saying anything of the sort now.  I am saying that I am going to quit reading Facebook as a regular part of my day. In fact, I’ll be surprised if I check my news feed at all until after the election.

I will still be blogging daily. If you comment on my posts here, I’ll see them. If you want to get in touch with me directly, you can private message me and I’ll get back to you. If you want my email address, private message me and I’ll give it to you.

I am basically a shy person. You might not guess it to talk to me because I come across like a confident extrovert. I don’t have a lot of close friends or even long term acquaintances. I don’t intend to let a mud slinging, hate filled election season rob me of any more of the few friends that I do have.

Have a good life. Tell the people you love that you love them. And be kind.

A Modest Proposal

There needs to be a selection on every ballot that reads “None of the above”. If “None of the above” wins the election, then there is another election, only this time all the candidates that were on the previous ballot are banned from running. If we had such an option, I know how I’d be voting in November.

I won’t disrespect either candidate by sharing my opinion of them in this public forum. I don’t think either one will be the kind of president that I want leading our country. I am upset that I am being forced to vote for someone just because I believe that they are the lesser of two evils. I don’t think that this is what our founding fathers had in mind when they created our great republic.

The situation has gotten this way slowly over time. We have allowed our news channels to become more about entertainment than information. Even so, things were already bad a century ago when Mark Twain made this comment on the state of the press.

If you don’t read the newspaper, you’re uninformed. If you read the newspaper, you’re mis-informed.   — Mark Twain

Our news media have one goal, to engage our attention so that we watch the advertising so that they make money. They don’t care if they cover the important events in the world. They love the current campaign because everyone is so agitated by it that they are watching just to see what will happen next. Meanwhile the advertising dollars are rolling in.

I guess we get the politicians we deserve. The way we treat our politicians, the only people that run for office are usually criminals and/or megalomaniacs. Anyone with sense enough to be a statesman wouldn’t put up with the abuse that we put our candidates for public office through.

I’ll vote in November. I won’t let the lousy quality of the ballot disenfranchise me. But I  hope we can do better the next time we elect a president. If there is a next time.

Quickie Blog From My iPad

This is going to be short. Our internet is out tonight. It has been strangely calm around the house tonight. No TV. No internet. Just me, Pam, Belle, and Cory. It reminds me of what life used to be like. Maybe we ought to turn off the TV, put down the iPad, and read a book for a change. Oh, right. I have most of my books on my iPad. It’s still better than randomly surfing.

This blog post is brought to you by wifi tethering off my iPhone. There’s nothing like it for access to the Internet in a pinch. Now that I’ve met my commitment to blog daily, I’m going to go back to the peace and quiet of a household without cable or internet.

Of Puns and Monkey Patching

The English language is plagued by a plethora of words that have many different meanings. Often, words get twisted over time until they mean something entirely different than they originally did. I suspect this is true in most natural languages. It can be the source of many misunderstandings, quarrels, and even wars. It is no surprise then, that computer languages are also subject to these kinds of problems.

One of the first recorded instances was in the original FORTRAN implementation. It allowed the redefinition of literal values. Consequently, you could add a statement like “0 = 100” to the beginning of a program and redefine the value of 0 to be 100. This rendered all of the computation in the rest of the program suspect if not totally wrong.

Being able to redefine the meaning of words in computer languages isn’t always a source of consternation though. In some modern languages, like Ruby for instance, it is used as a mechanism for fixing software. In Ruby, functions are called methods. A method can either be anonymous, in which case it is only useful in an immediate context, for instance as an argument to another method. Or, it can be assigned as the value of a name. Then it can be executed whenever it is required by “calling” the method using its name.

Because of the way that Ruby works, you can also do something colloquially  called “monkey patching”. This works by first assigning the value of a named method to another, auxiliary  name. At this point both the original name and the auxiliary name both refer to the original method. Then, you redefine the original name. You can insert expressions before and after a call to the auxiliary method. This new method is now the new definition for the original method. Any method that called the original method will now get the newly defined method.

To give an example of how you might use this feature, suppose you wanted to print a message “Now entering myMethod” every time you called the method named myMethod. You could easily define the new method to print that message before calling the original method using the auxiliary name. Later, when you were finished using this new monkey patched method to analyze the behavior of the program, you could restore the method back to its original state by assigning the value of the auxiliary method back to the original method.

This is a feature that can easily mess up your program. But it can also let it do things that would require much more effort if done any other way. As Spider-Man’s uncle Ben is known for saying, “With great power comes great responsibility.”

There are other interesting analogies between natural languages and computer languages. We’ll discuss them more in a future blog post.

Belle’s Big Adventure

Today Pam and I (and Belle) went to Logan’s Roadhouse for lunch. Pam had been craving prime rib. Belle and I were happy to humor her. This was Belle’s first time at Logan’s. She liked it from the very start. There were peanuts on the table. Belle loves peanuts. Pam took her picture eating a peanut and posted it to Facebook. Belle is used to being Facebook famous. She is, after all, the cutest service dog in the world.

Next, they brought out hot rolls and butter. Belle loves hot rolls almost as much as she likes butter. After many bites of buttered roll and a few dozen more peanuts, the entre arrived. Belle had never tried prime rib before but she made a note to be sure that we got it again sometime. She ate so much that her belly was round.

Then it was time to earn her grub. Belle is a migraine dog. She can tell when Pam is about to have a migraine. She lets her know by jumping up and licking her face. Pam and Belle go everywhere together. Belle likes to go places that smell good. She loves to smell fresh baked bread and hot pizza. We had to stop at the store on the way home and Belle dutifully trotted along next to Pam while we shopped.

When we were finished and checked out, I took our bags of groceries and went on ahead to take them to the car. Belle panicked. She was afraid I was going to leave them behind. We finally got home and put up the groceries. Belle got her new stuffed animal and settled down to gnaw it’s ears off and take a well deserved rest. Life is hard for a working dog.

If at First You Don’t Succeed…

I notice that there are all sorts of people following me on Twitter and Facebook. I don’t think I know them. I only accept friend requests from, or follow, as the case may be, people that I have at least met. I also have been known to accept friend requests from people that share an interest with me. For instance, I accepted a friend request from a ham radio operator in Italy that I  had never met before. That is primarily because I could look up his information given his ham radio call sign and verify that he is, in fact, who he says he is.

This is not so straight forward with most of the people I get friend requests from. I don’t mean to be unfriendly, but if I don’t know you or have a common interest with you, I don’t want you stalking me. I know. I have a blog site. I am pretty much “out there” on a bunch of social media sites. I am just trusting my gut to tell me how much sharing that I’m up for.

If you have sent me a friend request and I haven’t responded and you have some reason to be my friend, like you’ve met me or we share an interest or something, go ahead and send another request and tell me about what we have in common in the request. I won’t be mad or anything. I may still decide not to friend you but it doesn’t hurt to ask that second time with more details about why you think we should be friends. But two or three times is probably enough. Give it several months or a year before you try again after three strikes.

 

Madison Adventures

In previous posts I have mentioned that I am in the middle of a commitment to walk 13,000 steps per day (approximately six miles). It had rained this afternoon just prior to the time that I usually walk so I decided to go ahead and come home and get my walk in later. After dinner, I recalled that Microwave Dave and the Nukes, an excellent local blues band, were playing in the gazebo in downtown Madison, just about a mile from the apartment. I took it as a sign and headed out walking.

The grass was still damp and there were muddy spots everywhere but it was nice and cool. As I walked into downtown Madison, a train went through blowing its whistle loudly. There were young adults out hunting Pokemons with their cell phones. The train finally cleared the tracks so that I could get over to the side of the commons where the band was playing.

There was a shaved ice truck and forty or fifty folks sitting in lawn chairs. There were kids climbing on the bleachers and running around chasing each other. The band finished playing a number and I clapped loudly. The rest of the audience responded weakly. They kept playing. I realized that they weren’t through with that number after all. They came to a couple of more false finishes before the end of the number and we dutifully applauded each of them.

I was walking back and forth along the back of the audience getting my steps in. There were folks sitting on the tailgate of their truck. There was one gentleman talking on his cell phone with a little dog sitting in his lap. On stage, the band finished another number. I clapped and startled the little dog. He barked at me and his owner was forced to pause his phone call to try to calm the dog.

The Pokemon hunters came wandering through the audience. The band was just getting good and warmed up. I felt a few sprinkles of rain on my arms. I was standing under a tree. All of a sudden everyone got up and started running for their cars. Dave said, “Was it something I said?” I was already drenched with sweat so the rain didn’t bother me much. It wasn’t raining particularly hard in any case.

I made my way over to the Old Black Bear Taproom without getting too much wetter. I sat at the bar and ordered a beer. The guy next to me asked if I had been playing across the street. I do bear a slight resemblance to Dave Gallaher if you don’t know either of us very well. We are both stout men with gray hair and beard and we were both wearing black hats. Mine was a Panama Jack hat, Dave’s was a newsboy cap. I could have had a free beer if I hadn’t been so honest. I laughed and told a story of being mistaken for Dave on another occasion.

I finished my beer and walked home. I was still twelve hundred steps shy of my goal but I finished them up walking in place in front of the television set. It was an eventful evening in Madison, at least for me. I would have enjoyed listening to more music but it was just not to be.

A Brief Survey of Dynamic Programming Languages

A lot has been written about static languages lately. I am going to focus on dynamic languages. Dynamic languages allow the programmer to develop software by interacting with a “live” language system. The system accepts input and gives feedback about that input immediately as it is entered and evaluated. This encourages an experimental approach to programming. What happens when I do this? Just do it and find out immediately.

I talked at some length about the oldest dynamic language, Lisp, last time. As such, it provides an example of many of the features of subsequent languages. It is classified as a multi-paradigm language. This means that it supports many different styles of programming. You have probably heard of object-oriented programming. Lisp has a very flexible object system called CLOS (Common Lisp Object System). You may have heard of functional programming. Without going into great detail about the details of what functional programming is, Lisp was one of the first languages to treat functions as directly manipulable elements. Lisp also supports rule-based programming, aspect oriented programming, and many other programming paradigms. It has been said that most new languages are just adding features that were pioneered by Lisp.

What other dynamic languages are there? Another venerable and influential dynamic language is Smalltalk. It was developed by researchers at Xerox’s Palo Alto Research Center (PARC). It was the first language to treat every element in the langage as an object. It also was a complete system including editors, code browsers, and a host of other tools, all written in Smalltalk. The system is programmed by interactively defining new objects that are immediately available for use as soon as they are defined. The entire system is graphically oriented. Many of the concepts of modern graphical systems were first introduced by Smalltalk. Unsurprisingly, there are a number of implementations of Smalltalk in use today.

Another dynamic language that has been around for a long time is Forth. Forth is another language that inspires strong opinions. Programmers either love it or hate it. It has been described as write only. It is based on the idea of using a temporary data structure called the stack to temporarily store operands to be used in subsequent computations. The stack is a mechanism where the programmer can “push” values onto the stack and later “pop” the last item pushed. All operations are done on the latest item pushed. This allows an arbitrary number of temporary values to be readily accessible. It also requires the programmer to keep track of exactly what has been pushed onto the stack at any point in the execution of their program. Hence, the “write only” label.

Forth allows the programmer to define new functions interactively through the use of a REPL (Read, Eval, Print, Loop). This is a key feature of dynamic languages and goes a long way toward making up for the cognitive load of keeping track of the contents of the stack.

One of the more recent dynamic language to gain popularity is Ruby. Ruby was inspired by Lisp but adopts the Smalltalk stance that everything is an object. It first gained widespread notice because of a popular web framework written in Ruby called Ruby on Rails. Many of the best practices of modern programming have originated in the Ruby community.

The last dynamic language that I’m going to talk about in this post has had a rather profound impact on computing in the last couple of years. I’m talking of course about Python. Python is an interesting language. Noted for the use of indentation to indicate the start and end of computing blocks and the ease of using code libraries written in other static languages, it has captured the hearts of scientists and educators alike. It is the lingua franca of the popular inexpensive computer the Raspberry Pi. It has carved out a place for itself as probably the most popular modern dynamic language.

In future posts, I’ll talk more about each of these languages and even show some examples of what programs written in them looks like.

Static Vs. Dynamic Computer Languages

I’ve talked about the history of computer languages some in previous blog posts. In particular, I’ve talked about the difference between compiled languages and interpreted languages. Now I’d like to make a further distinction. Some languages are static and others are dynamic. More specifically, static languages are reduced to executable instructions ahead of time during a compilation phase where dynamic languages are processed interactively as the programmer explores the solution space defined by her program.

Static languages can more easily be made to run fast and can more readily be analyzed for correctness. Dynamic languages support organic exploration of the problem and its solution. Dynamic languages can, and have, been made to run fast and analyze themselves for correctness. It’s just typically more difficult to do so.

The surprising thing, to me anyway, is that we have had examples of both kinds of languages pretty much since the first higher level languages were written. FORTRAN was a static language written for engineers to automate the solution of numeric problems. Lisp was a dynamic language to explore the potential for computers to do things other than just numeric computation.

Engineers and Managers liked FORTRAN and its descendants. The applications that were written in them were immediately practical and it was easy to measure how much work the programmers had done. Initially this was measured in Source Lines Of Code or SLOCs. This was all well and good until the programmers realized that a more complicated solution requiring more source lines made them look better to the managers that were measuring their performance.

Over time, we learned a lot about how to write programs in static languages until finally, in recent years, most “serious” programming is done in static languages like C++ and Java. This is a sad situation. Static languages are good for many things but there are a lot of problems that are better served by dynamic languages.

Lisp has a bad reputation among many engineers including many computer scientists. This is often because they were forced to write a project using Lisp in a Computer Languages course by an instructor that didn’t understand Lisp themself. But, to be fair, Lisp does require a little bit of a different mind set from most static languages.

There are also a bunch of myths about Lisp that may have had some basis in fact at one point but over time, Lisp has improved and the hardware that all languages run on have improved, and the myths are, for the most part no longer valid. For instance, it was initially said that Lisp wasn’t any good for doing numerical computing. That was initially true, largely because the authors of Lisp language systems were interested in exploring the non-numerical aspects of programming and consequently made little effort to make the language handle numbers efficiently. This was remedied in the early seventies but Lisp retains a reputation for being bad with numbers in some circles.

The main thing that Lisp is better at than its static conterparts is allowing the programmer to interactively explore a problem space. In a static language, one typically has to write a substantial amount of code before you get to the point where you can run it and see how it behaves. If it doesn’t do what you intend, which is typical for the first couple of attempts, you have to go back to the source and change it, recompile the program, and rerun it to see if you’ve fixed the problem.

With Lisp, one types expressions directly to the interpreter using what is called a Read Eval Print Loop or REPL. The REPL reads a line of code, interprets it and prints the resulting value. Then it repeats the process (hence the Loop). This allows the programmer to explore the problem and potential solutions interactively, getting feedback from the computer after each line. It is amazing how much faster correct programs are developed using this approach.

I’ll talk more about dynamic languages in another post soon. There is much that I want to say about them. And Lisp may have been the first dynamic language but it certainly wasn’t the last. I’ll have more to say about other members of the dynamic language family. I’ll also have something to say about ways that we can realize the best aspects of both of these styles of language by combining them into hybrid languages.