Thought For The Day

“I can only think of music as something inherent in every human being - a birthright. Music coordinates mind, body and spirit.”
Yehudi Menuhin

 

 

Job Stress Got You Down?

Stress can be a killer.  It’s associated with heart disease, strokes, insomnia, unhealthy eating, relationship troubles, headaches, and fatigue.  And perhaps not surprisingly, jobs have been identified as the number one source of stress.[1]  Whether it’s due to problems with a coworker, a demanding boss, or work pressures, it’s obvious that job-related stress can have a detrimental impact on health, as well as relationships.  If you’re experiencing job stress, there are things you can do to improve the situation:

  1. Delegate.  While this may not be possible for everyone, we recommend that you do it if you can.  Oftentimes, job stress is related to taking on too many work responsibilities out of a misguided belief that no one can do the same work as well as you can i.e. perfectionism.  However, trust that your coworkers are capable and competent, give them clear responsibilities and expectations, and then rely on them to alleviate some of your workload.

  2. Prioritize.  One of the most important things that you can do to minimize your job stress is to prioritize.  Realize that not everything needs to be done yesterday, and instead, identify—with the help of your boss—your most important priorities.  Then, spend the bulk of your time working on those issues.

  3. Take Time Off.  By and large, Americans are known for their work ethic.  In some countries, employees get 7 weeks of vacation time whereas most employees in the US only get 2 weeks off.  And ironically, Americans use only about 51% of their paid time off.  Yet, US workers are reporting higher levels of stress than in the past.  Use your vacation time—having the opportunity to recharge and relax will help you to return to the office feeling less stressed which will increase your productivity.

  4. Focus.  Rather than turning your attention from task to task, take time to work on one thing in a focused manner.  While multitasking might seem like the solution to your stress, research shows that it results in less productivity rather than more i.e. the vast majority of people don’t do it well.

  5. Exercise.  Yes, we know—telling stressed out people to add exercise to their day seems counterintuitive.  However, exercise releases endorphins, improves the mood, and reduces feelings of stress.  Rather than looking at this as a challenge, find simple ways to get your exercise in.  For instance, you might go on a 20-minute walk outdoors during your lunch break.

Thought For The Day

“It would be a considerable invention indeed, that of a machine able to mimic speech, with its sounds and articulations. … I think it is not impossible.”
Leonhard Euler

 

 

Good Practices in Programming

So far, we’ve learned quite a few things about programming.  We can now write some basic C programs, and this would be a good time to mention some things that are on a more advanced level—unwritten rules of programming, optimizations, conventions and generally, simple things that contribute to the readability and accuracy of your code.

Input Checking

Almost every program you write needs some kind of user input (like the number of points and their coordinates from the video example).  In order to preserve simplicity, we didn’t check this input in our program, but what would have happened if the user had entered a negative number or a sequence of characters?  Our program would most likely have crashed.  It wouldn’t handle the error elegantly, and we would say that it wasn’t robust.  A robust program is one that can handle errors and malfunctions well.

To achieve this, we need to check if the user input is correctly formatted.  For example, if we want the user to enter a positive number, we would write the following C code:

int n;

printf(“Please enter a positive number: “);

scanf(“%d”, &n);

Now, let’s add the check:

if(n<=0)

printf(“The number you entered isn’t positive!\n”);

else

{ … }

Note: the “\n” sign means “new line”: the text after the error message above will simply be printed in a new line.

There is also a way to prevent incorrect input multiple times, by writing an “infinite” for loop, which will execute as long as the input is wrong:

for( ; ; ) /* infinite loop */

{

int n;

printf(“Enter n: “);

scanf(“%d”, &n);

if(n<=0)

{

printf(“Wrong input!\n”);

continue;

}

break;

}

The continue keyword is used to stop the current iteration of a loop and begin the next one.  So, after an incorrect input, the user will be prompted to enter the value again.

The break keyword is used to stop the current iteration of a loop and begin the next one.  So, after a correct input, the program will exit the infinite loop.

User Interface

As we previously discussed, if you want the user to enter correctly formatted values as input to your program, you have to make it clear what that input should be, i.e. there should be some kind of user interface.  When we say “user interface,” we mean that the user should be instructed through the program by writing clear messages to the console or a text file.

For example:

printf(“Please enter the coordinates of points, one by one, without commas: “);

printf(“Executing program: 53% done”);

printf(“Exited – Division By Zero error occurred”);

Commenting

Another useful thing you should do is comment your code.  By commenting your code, you’re providing information about what specific lines of the code are accomplishing—basically, the logic behind the code.  These comments are not executed by the program but offer programmers an instructional manual of sorts.

For instance, commenting some important parts of the code—complicated functions or steps of an algorithm—can help you locate a mistake or malfunction more easily and contribute to the overall readability of the code.  It’s also a great tool if you’re returning to a program after not working on it for some time, and an absolute must if you’re working on a project with other programmers.  This step is very simple to do, and it can save you a lot of headaches and sleepless nights later (every programmer will confirm this).

How to Develop the Renaissance Man or Woman Within

On April 13th, we celebrate Thomas Jefferson Day in the US.[1]  While Jefferson is most well-known for his role as president, few people realize that he was one of the original Renaissance men.  Not only was he a politician, but he was also an architect, a skilled writer, president of the American Philosophical Society, and the founder of the University of Virginia.  Additionally, he was conversant in French, Greek, Italian, Latin, and Spanish.[2]  Today we suggest that you let Jefferson inspire you to become well-rounded, an excellent quality to possess in the professional realm.

For starters, well-rounded employees are often able to take on additional work responsibilities, making them more valuable to their employers.  They also are typically able to interact with a wide variety of people, because their diverse interests mean that they can often find common ground when networking.  Furthermore, well-rounded individuals appear interesting and intelligent, two desirable traits in any employee.

If you’re interested in further developing your inner Renaissance man or woman, here are some easy ways you can do so:

  • Take a Class.  Is there something that you’ve always wanted to try but feared that you would look foolish?  Enroll in a new class that challenges your comfort zone.  The more you can get in the habit of trying new things, the easier it becomes.
  • Read.  Reading can be a great way to familiarize yourself with new ideas.  Grab a book on a subject that interests you and spend a little time reading each day.
  • Attend Cultural Events.  Being open to novel experiences is one way to get your creativity flowing—the hallmark of a Renaissance individual is a creative mind.
  • Travel.  While this requires more time and money than the other ideas on this list, exposure to new locales is a great way to become well-rounded.  Who knows?  Maybe on your trip to the Bahamas, you’ll discover a new passion for scuba diving.
  • Learn from Others.  Be an engaged listener by asking questions, rather than focusing on what you’re going to say next.  Oftentimes, new interests are sparked by our conversations with others.