Are You Fair Dinkum?

Are you “Fair Dinkum” or do “you seek confirmation of the genuineness or truth of something” or do you just “go with the flow?” In Australian, this phrase means a bit more, to have total commitment to what we are doing. Do not be lukewarm, be hot or cold. Bilbo Baggins of Bag End, is the protagonist and titular hobbit of the story, the Hobbit. He was asked to go on a great adventure by Gandalf, but had to leave right away. In many ways we are like Bilbo Baggins starting a new adventure when we start a new project or when we start a new job. Are we totally committed, or do we have in the back of our minds that I can always try something different. Even if the project will be over quickly or the job is not our desired job, intend to contribute as much as possible and learn as much as possible. People with whom we work will be grateful and be willing to help in the future. Some of these people become some of our closest friends. If we do not fully commit, this will never happen. When we work with others, our goal should always be to do what is best for ourselves and for others we work with and serve.

Notice that in this article I prefer to use the terms I and we instead of you. There are two reasons. This applies to me as much as to anyone else. Another reason for this is that when a person uses “you” to start a sentence it may make the other person feel less. Part of being fully committed is to be fully committed to good communication. I teach computer science, many of you who are reading this are students in these classes. As an example of this, which feels better? 1) “I noticed a problem with the code that was produced, to solve that problem, the solution is to …” or 2) “You know better than doing that, you have made that mistake so many times.” Which seems better? Which would each of us prefer hearing? How should we talk with others? 1) “I feel concerned about…” or 2) “You always…” Choose words wisely in working with others. Be totally committed to be “Fair Dinkum.”

I am very impressed with my CSC160 class, each student is dedicated to learning new material and doing it well. I enjoy this group and hope I can work with them second semester. There are many aspects of life that can be related to an acorn. Acorns cannot do much at first, but as they blossom as a tree they can produce so much more, including eventually producing other acorns. Using the computer programming example, as we learn new concepts, we can first implement those concepts in our programs, eventually we can go from using the exact code to using the concepts presented to produce new code, then eventually teaching other people how to best use these new concepts (being the producer of more acorns). Are you Fair Dinkum?

Act on best Instincts (or GUT) and not Intentions. Our intuition works far better than our intentions in making good choices. We all have choices, some are good, some are better, and a few can wind up our best decisions. How do we weed out the best solution in a reasonable amount of time. Each situation is different and requires intuition to solve the problem. Even with the best of plans, we are not guaranteed success the first time around. Failure is one of the biggest teachers to bringing success. When Thomas Edison set out to invent the light bulb, he was not successful for at least 5,000 times. When asked about his “failures” he said that he had not failed but learned 5,000 ways to not create a light bulb. As we learn new skills, we will probably learn many ways that will not solve the desired goal. Those attempts are great learning experiences, treat them as such. To be successful, have high concerns and high expectations. Be Fair Dinkum!

Desired solutions change as we learn more. Some new solutions are more difficult to find than solutions we can base on intuition and past experiences. Whenever we come across a tough situation we think we may have not encountered before, look for similarities to solutions we have developed previously. Other people in our organization may also have ideas on how to solve problems. Freely share ideas. We are all better together. As long as we do not worry about who receives the credit, so much better solutions are created. We each need to be our best to encourage others to be. Share knowledge and experience and others will usually do the same. Occasionally we each come across someone who does not freely share, Usually there is a reason for this. Help each other to be the best to have the best possible team to come up with the best possible solution. No one is the keeper of all good ideas and decisions. Be careful and caring, help those who are in new positions that they have not held before. succeed. We are all in this together. From past experiences leading teams, it is vital that the leader listen to all stakeholders and make decisions that are best for all members of the team. Decisions need to be made, but members of the team will have information that is vital to creating the best outcome for the team. Be Fair Dinkum!

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Choosing a Career

In order to choose a good career with which you will be happy, start looking at your options early in your schooling. There are several aspects to consider. One of the most important is researching whether the area is increasing or decreasing. There is nothing worse than working hard to gain the knowledge in a field that is disappearing, or minimally not growing. My father wanted to be an astronomer, until he found that the only way a person obtains a job in astronomy is to have the current astronomer die or quit. There was not a lot of opportunity there for a future. He decided to study nuclear physics and that was a very important field in the 50s and 60s. Because I admire my father, I started following his footsteps but upon some research I discovered physics was no longer a growing field. I had the opportunity to work with a computer between my junior and senior year of high school. That is the basis of why I chose Computer Science as my career. Find something you really enjoy doing and then explore possibilities in thate field.

One quote that I recently saw, but did not see who said it fits in with choosing a career that you love;  “You often feel tired, not because you have done too much, but because you have done too little that sparks a light in you.” If any of us feel tired, look for a possible cause in how we spend our days.

You need to also explore for what type of company do you wish to work. Do you even want to work for a company or do you want to start your own business? IEEE (The Institute of Electrical and Electronics Engineers) Spectrum has an excellent article discussing the differences between working for a large corporation and a startup. The article is titled Software Engineering Grads Lack the Skills Startups Need. This article describes some of the differences between working for a large corporation and a small startup. Some of the skills needed in a small company are actually important no matter where you work. They are especially important if you start your own company.

The best gauge for each of us to determine what we would enjoy the most, is knowing our own strengths. Do you know in what areas you are good? Are you exploring different areas? While in high school, explore as many different areas as possible. If you find something you enjoy, explore it even more. Know your own interests, strengths, and skills. Develop your own passion. Ted Talks are a good area to explore different ideas. One on career choices videos is excellent on students finding their own strengths and building on those strengths. It is  by Chris Wejr:

What are your strengths? How can you best use them? How can you help you teaches help you develop these skills? Have you talked with your teacher about your strengths and interests. Most teachers want to help you succeed. Be the best advocate for what is best for you. Come with a good attitude and do your best. Have the grit to accomplish anything. Be your best in all things.

Posted in Attitude, Becoming, Do, Goals, Mentor, Planning, Self-Worth, Serving, Uncategorized | Tagged | Leave a comment

What is the main difference between C and Fortran?

The answer here is based on FORTRAN IV, the version of FORTRAN with which I have the most familiarity. The newer FORTRANs may have fixed the following problems.

FORTRAN simply means Formula Translation. It is one of the first languages developed after Assembly language. It is more prone to spaghetti code than C since there is no “structure.” FORTRAN was a great development when it was created. It was the first language I learned and I programmed several major projects with it. But it is not a structured language like C.

C is a structured language based on Algol and developed by Bell Laboratories to develop the UNIX operating System. A structured language has indentations and blocks of code surrounded by curly braces “{“ and “}” that indicate the beginning and the end of each block of code.

FORTRAN passes all variables to subroutine by reference. This means that when the variable is changed in the subroutine it is also changed in the calling program, something that can cause problems. C allows calls by either reference or value. By value is the default. By value passes in the value of the variable in the calling routine and then assigns that value to a variable locally defined in the subroutine. C also allows you to recursive call a subroutine. This cannot be done in FORTRAN IV.

Posted in C, Computers, FORTRAN, Software, Uncategorized | Tagged | Leave a comment

The Memory Module for the Saturn V rocket

The Saturn V rocket went to the moon in the summer of 1969. Think about the technology back then and how hard it might have been to program the controls for a rocket that was to fly to the moon and back. The astronauts had not control over the flight of the rocket. It was all done by a computer program dependent on memory made up of individual iron cores that were either magnetized for a “1” or demagnetized for a “0” with the additional knowledge that every time an iron core was accessed, it would demagnetize. The programmer had to remember to rewrite the value into each iron core every time it was accessed.

Videos and Descriptions

YouTube has several good videos describing the memory on the Apollo Saturn V’s. The first one describes the memory module and Saturn V Computer ring in the rocket itself. The second one describes the Apollo rope memory. Advertisements may come up at the start of the videos, since they do not allow embedding. Skip the ads. I will create a Discussion group in either Teams or D2L to allow you to comment.

Re-entry of Apollo XIII

Apollo 13 had a major catastrophe on its flight to the moon. The final problem was that the heat shield was damaged in the explosion. If it failed, the module would not be able to re-enter. Most re-entries took about three minutes for radio silence. After four minutes of silence, the people in the Houston ground-center became very worried.

Margaret Hamilton

Programming of the Saturn V was difficult. It had room for the large ring containing the computer. Think about the Lunar Lander. Every ounce counted, so the computer had to be much smaller and the program had to be very precise. Margaret Hamilton was the person who had the astronauts lives in her programming skills. She had the privilege of celebrating when the first lunar lander landed and took off safely.

Posted in Uncategorized | Leave a comment

Adding File I/O to a C++ Program

We have already covered console reads from the keyboard and writes to the display using cin and cout. If you do not know how to use cin and cout, please review it before proceeding. ifstream is for an input file connection and an ofstream is for an output file connection. Once set up, they can be used the same as cin and cout respectively. Both ifstream and ofstream are C++ classes and so you need to create an instance of each class in order to use it. You have been using classes throughout your coding work with C++. The one that is easiest to explain is the class “string”. String is a class and the name of your string is the instance of the class. In your header section, it would described as:

string myString = "This is a string."

later in the code, you might want to find its length.

int len = myString.length();           // This finds the length of the string store in your instance of string.

To be fair, there are five different ways to find the length of a string. The first four are more useful than the fifth. https://www.geeksforgeeks.org/5-different-methods-find-length-string-c/

length() is considered a method of the class string and can be called by adding it to the instance of the class string by adding a “.” and then the name of the method to the instance name, as seen in the example above.

Now getting back to ifstream and ofstream.  First create the instance of each class to use.

ofstream outFile;       // define the interface to the file for writing information.
ifstream inFile;        // define the interface to the file for reading information.

The next thing to do is to open the file and seek the start of the file, again done by two methods:

   inFile.open(fileName);
   inFile.seekg(0);

Now to read something from the file one line at a time until no more lines are left in the file and divide up the line into phrases that are separated by commas:

for (string line; getline(inFile, line); ) {   // Read a line, stopping at newline (\n), keep going until EOF (end of file).
       stringstream stream(line);                // Set up the line to be readable through a stream.
      index = 0;
      while (getline(stream, word[index], ',')) {
          cout << headers[index] << word[index] << "\n";
          index++;
      }
      sum += stod(word[2]);
      count++;
 }

Output to a file is even simpler, First open the file. You have to see if the file exists. If it does, give the user the choice to write over the file or append to the file. If the file does not exist, create it.

if (isFileExist(fileName)) {
     // The file exists, so give the user the choice to start a new file or append to the existing file.
     int appendToFile = stoi(input("Do you want to:\n1) Open fresh file?\n2) Append to current file?\nChose"));
     switch (appendToFile)
     {
        case 1:
           outFile.open(fileName);     // Open an existing file, overwriting current content..
           break;
        default:
           outFile.open(fileName, fstream::app); // Open an existing file and allow appending new data.
           break;
      }
}
else outFile.open(fileName, fstream::out);  // Force the creation of the file and then open.

Once you have opened/created the file you can write to it just like you do to the console through cout.

 outFile << employee << "," << birthdate << "," << wages << endl;

The above code will write a comma separated list with three fields to one line in the file. Be sure to close the files when you are done.

outFile.close();
inFile.close();
Posted in Uncategorized | Leave a comment

Celebrating July 4th

Celebrating the 4th of July is important to me and others in the United States of America. Each country has special celebrations based on their own history. Ours is declaring independence from England, a treasonous act that could have brought death to each of the signers of the Declaration of Independence. Having an ancestor, Lieutenant Colonel Cornelius Ludlow (who was in charge of General Washington’s rear guard on the move to Valley Forge), it is a doubly important day to me. Unfortunately, a lot of revisionist history has been given out recently. That is a disservice to the memory of those who set the foundation for our nation. Yes, there were actions some of our forefathers did that were not good. But they set the stone in motion that would eventually lead to the emancipation of slaves and the various civil rights that have been put into law more recently.

Two examples of people who were anti-slavery at the time of the American Revelation were Betsy Ross and Edward Coles. Betsy Ross was the creator of the first flag of the United States. Edward Coles is a cousin of one of my ancestors and freed the slaves he inherited.

Betsy Ross grew up as a Quaker, which was opposed to slavery and helped Pennsylvania become the first state to outlaw slavery. Many Presidents, including Barack Obama, used the Betsy Ross flag in their ceremonies.

As you can see by the above picture, the Betsy Ross flag was not controversial at Barack Obama’s Inauguration. He used it to show the heritage of our United States. Betsy Ross was not a slave owner. By all indications, she opposed slavery.

Growing up, I heard the story of Edward Coles long before I knew his name. My mother would tell me about how a group of descendants of freed slaves heard about one of her cousins medical needs and offered support to my mother’s cousin to help him through his struggles. Slavery is wrong. The original Betsy Ross flag shows a field of blue with thirteen stars in a circle. This represents the equality of opportunity for all citizens of the United States. I wish all those who celebrate a wonderful fourth of July. I wish everyone all the freedom and opportunity that you desire.

Happy 4th of July!

Posted in Uncategorized | Leave a comment

C++ Hardest New Concept

I teach C++ programming to beginners. All of them seem to quickly understand simple programs like “Hello World.” They can get the logic down fairly well in simple flow charts. But where they seem to have the most struggles is with loops, especially “for” Loops. The odd thing, they seem to understand while loops and do-while loops more quickly than for loops. They understand that while loops will skip the execution of the code within the while loop if the condition is false. One gave the example of checking the chemicals in a pool to a do-while loop. You need to check the chemical level at least once. If the level is not within the specified “safe” range, then the system will do something to fix the problem and then retest. This will repeat until the chemical levels are within the “safe” parameters.

Students seem to understand that within the while(condition) statement (either at the beginning or end of the loop), the looping will continuing as long as the condition is true. The for loop is like a while loop, except it has all three main parts within the for statement:

  1. the initialization of the variable, like int i = 0
  2. the check the value of the variable to make sure that it meets the condition to continue the loop.
  3. the change of the variable by the desired amount, usually incrementing or decrementing the variable.

A for-loop looks like:

for (initialization, condition, change)

where the condition is the test to see if the looping needs to continue, identical to the condition in a while or do-while loop. a for loop may look like:

for (int i = 0; i < 5; i++) {
    // Do something 5 times.
}

The three parts of a for statement are separated by semi-colons (;), just like at the end of a C++ statement. In the above for-loop:

  1. i is specified as an integer and set to 0.
  2. The condition for the loop to continue is i being less than 5.
  3. At the end of each loop, i is incremented by one.

I tell my class that the only way they can fully understand and appreciate for loops is to write code that uses them, when they need to loop through a specific set of code a specific number of times. The first code I give them to use a for loop is to create a 12×12 multiplication table. Of course, then they want to learn about formatted printing, but that is another story.

Posted in C++, Code Reviews, Computers, Do, Mentor, Software, Uncategorized | Leave a comment

Be Our Best

What is important to each of us? What do we want to do with our lives and for what do we want to be remembered when we leave this world? I want to live as long and as healthy as possible, but I know that years are limited unless new breakthroughs are forthcoming. Whether we are a younger or older American (or some other nationality), we need to decide what we want to do with our time. There is a talk at our Church about choosing to do Good, Better, or Best. I recently found a quote by St. Jerome about this subject. It is: 

St Jerome knew how important doing are best is

The point of the talk that I mentioned before is that we need to choose how we spend our time. There can be many good things we can do, but we can choose better things to do with our time. If we know what we want to accomplish, then we can choose what is the best.

As we grow, our best grows also. I teach computer science.  On the first day of class, if a student can write, compile, and execute the “Hello World!” program, that is great an the best they can do the first day of class. After two weeks, much more is expected of each student and “Hello World!” would not be considered that student’s best effort. As we improve in any area, what is expected from each of us will increase also. We all need to grow and improve. I know there are certain areas where there may be a peak, but in most areas we can continuously improve ourselves.

We are more capable of greatness than any of us realize. What can we do to achieve this greatness? One interesting discussion that has gone on for several years is whether we should base what we do on improving our weakness or growing our strengths. One of the more recent thoughts is “Do your best and forget the rest.”  Don Clifton was one of the first authors to change the discussion from working to improve one’s weaknesses to building on a person’s strengths. Being a positive influence on our own life and the lives of those around us helps us to be our best. I believe if each of us understands our strengths and builds on those strengths, we will learn to be and do our best.

Posted in Attitude, Becoming, Do, Fulfilling Life, Goals, older Americans, Planning, Self-Worth, Uncategorized | Leave a comment

When You Have a Question – A.S.K.

I teach high school and community college computer courses. I enjoy seeing students comprehend new material. I always tell my students to ask questions. I do not mind interruptions on relevant questions about what is being discussed. I have found that if one student has a question about what is being taught, other students probably have the same question. Also, once a student has developed a question, that student will concentrate on remembering the question to ask later instead of concentrating on what is being taught. I would much prefer a student ask the question when they think of it because the question is usually triggered by the current discussion and the appropriate answer will further explain an important part of the topic. Seeing various acronyms for the word “ask” I have developed my own.

  • Assess what the concern or problem is.
  • Search for a solution.
  • Know that you will eventually receive help in finding the answer.

Assess What the Concern or Problem Is

In a classroom setting this may be a quick process, since it is usually related to what is being taught at the time. Outside of the classroom this may be a much longer and more involved process. Know why you want the answer as well as fully understanding the question.

Search for a Solution

Searching for your own solution often helps you better understand the question and the answer. When you find your own answer, it will mean a lot more to you and you will remember the answer a lot longer.

Know that You will Eventually Receive Help

In class, the answer can often come quickly, but in real life it may take awhile to find the answer. In emergencies, listening to that “still, small voice” that each of us is blessed with, along with heeding other warnings can be essential to our survival. In Idaho, the Teton Dam Collapse was a major catastrophe.

The estimates with the flooding, there should have been about 5,300 people killed in the collapse who lived in two cities downstream. There are conflicting reports on how many people were killed. It was 6-11 people who unfortunately lost there lives. One lived directly below the dam and did not really notice the problems the dam was having. Some did not heed the warnings about the approaching dam collapse until it was too late. Half were out of harms way, but went back in to save material items since they thought they had more time before the actual collapse. Sometimes the answer will come over many years. Know the difference so that you recognize an immediate answer and an evolving answer that may take up to a few years to receive.

End Note

I do not like posting incomplete entries, but I want to properly save my work for k=now and get some feedback. Hope you enjoy this.

Posted in Becoming, Do, Self-Worth, Serving, Uncategorized | Tagged , , , , | Leave a comment

What is the purpose of a pointer in programming?

The full question ended with: “Why not access the variable directly?

It depends on what you mean by “access the variable directly.” In Algol derived languages (like C, C#, C++, Pascal, Ada), the way to access a variable directly is through pointers. Java is a bit different. In Algol derived languages, you can pass a pointer to a variable in a call to a function or method. Then, whatever you do to that variable in the called function or method will alter the variable you passed by pointer in the calling code. In the Algol group of code, this is called “pass by reference” which means something totally different in Java.
FORTRAN started using pass by pointer, without actually stating what it was doing, in order to save space within the program. I learned this the hard way by passing the number “2” to a subroutine (same as a function or a method) and then changing the value of that variable in the subroutine. Since 2 in FORTRAN is stored as a pointer to the value “2” every time I would use “2” after that call, the actual value used was to what the subroutine set it.

One of the purposes of a pointer is to allow other routines to modify the value contained in the memory location(s) referenced by the pointer. As mentioned earlier, Java does not allow pointers. However, there are methods documented, for example in “How to do the equivalent of pass by reference for primitives in Java” to get around this rule for this one purpose.

In the “old” days of programming, before programmers were given a “sandbox” within to work, pointers could point to actual physical locations in memory instead of just locations relative to where your sandbox is located. With these pointers people could (and did) go in and modify the operating system on the fly. Something I do not recommend doing. This is one of the reasons Java was developed to not allow pointers.

Posted in Ada, Algol, C, C#, C++, FORTRAN, Java, Pascal, Software | Tagged , , , | Leave a comment