Skip to content
May 21, 2013 / Michael A. Allison

Converting a String of Numbers to an Integer

When working with a string of numbers that you wish to convert to an integer, it isn’t a matter of simply casting it; each individual character has to worked with separately, as each character has its own ASCII code. I’ve written a function that can be used to perform this task. The function is included at the bottom of this post. Please note that if at any time a character is found that is not a number, the function returns zero.

There are two steps to accomplishing this task; one, each character version of the number must be converted back into a number. Second, this number must be added to our working integer at the right position, which can be accomplished through working with the appropriate power of 10. Take a look at the following code and see if you can figure out how it works. I also recommend attempting to improve the function if you can!

Good luck!

(Please forgive my indentation. Proper indentation is apparently a pain on wordpress!)

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
 
using namespace std;
 
int AscToInt(const char* num) {
char fromString[500];
strcpy(fromString, num);
int i;
int returnInt=0;
bool toNeg=false;
int writePos=1;
int readPos=0;
int stringLength = strlen(fromString);
//Sets a flag if the first char is a minus sign. Also decreases stringlen and increases readpos to accomadate the space the – sign takes.
if (fromString[0] == ‘-‘){
   toNeg = true;
   readPos++;
   stringLength–;
}
//Perform a loop to convert the string to an int.
do {
   //should only convert if the character is a number (check ascii range)
   if ((fromString[readPos] > 47) && (fromString[readPos] < 58)){
   //If it is a number, add the number to the appropriate position in the int by using powers of       10.
   returnInt += (fromString[readPos]-48)*(pow(10,(stringLength-writePos)));
   writePos++;
   readPos++;
}
   //If ever it encounters something that isnt a number, return 0. This number cant be converted.
   else {
   return 0;
}
//Only happens until nul byte is reached.
} while(fromString[readPos] != ”);
 
//If the negativeflag was set, convert int to negative.
if (toNeg==true){
returnInt = returnInt * (-1);
}
//return the converted int.
return returnInt;
}
 
int main(){
char holderArray[500];
cout << “Please enter a number.” << endl;
scanf(“%s”, &holderArray);
cout << “After converting to an int, the result is: ” << AscToInt(holderArray) << endl;
}
Advertisements
April 18, 2013 / Michael A. Allison

Negotiations

When two parties negotiate, it’s often a very inefficient process; both sides choose a position and stick to it, and it becomes an exercise of futility. There are better ways to negotiate. In Getting to Yes by Roger Fisher and William L. Ury, we’re given an excellent system to properly negotiate a solution that can potentially make everyone happy. Here is a video in which me and my team demonstrate a negotiation based on the Getting to Yes system:

It’s important to note that the reason this system is so effective is because negotiations are based on each party’s interests instead of their positions; we are able to identify and work with the reasons behind both party’s positions instead of grandstanding. 

April 18, 2013 / Michael A. Allison

10 Steps Video

Another video that we had to make in TEC701 is a video demonstrating the 10 steps required in providing excellent technical support. The plan that we made to accomplish this video was made in a previous post. Here is a video containing my personal demonstration of these steps:

http://www.youtube.com/watch?v=xoPDZwNdXmQ

It is important to note that in this video, in order to properly troubleshoot the issue, I continually paraphrased what the caller had said in order to make sure the issue was completely understood. From there, we worked together to troubleshoot the issue together.

It’s also important to understand the mindset of your caller. In this video, I could see that the caller was getting discouraged, but with proper guidance we were still able to solve the issue.

April 18, 2013 / Michael A. Allison

ITIL: Knowledge

In my tech support class, we had to create a video demonstrating the usefulness of the ITIL, or the Information Technology Infrastructure Library, in the IT business. Here is the video we made:

http://www.youtube.com/watch?v=8JzV5hCOwqA

ITIL is definitely worth the investment; it will allow you to provide more efficient service and keep your userbase’s downtime due to tech issues to a minimum .

April 18, 2013 / Michael A. Allison

Teamwork and Collaboration – Our Plans

In my tech support class at Seneca College, we were given many group projects to complete. One of these projects was a video demonstrating the 10 steps involved in providing customer support. Here is the plan that we constructed to get the job done.

 

Mission

Our mission is to become a leader in the technical support industry by assisting customers experiencing technical difficulties by utilizing our technical and communication skills that will be simple for the customer to comprehend and reach contentment.

 

Vision

To assist customers with novice, intermediate, or expert computer skills to resolve technical issues by providing the most efficient, empathetic, and accurate technical support service.

 

Behaviours

To be amiable to the customer through any sort of character being demonstrated by them (happy, aggressive, and/or anxious behaviours) so the customer can feel relieved and satisfied.

  • patient
  • respectful
  • willing
  • persistent
  • agreeable
  • dependable
  • concerned
  • relaxed
  • organized
  • mature
  • empathic

  

Steps to completing the video with projected dates to be completed:

 

 FEB 10 –16:

 – Review lesson materials – Weeks 1- 4; Knowing ourselves and others, stress management plan, powerful teamwork, steps 1-3 as a group and establish a customer and employee persona

 – Write script to be acted on camera for customer and employee

 

FEB 16-23: 

– Review lesson materials – Weeks 5-8; Steps 4-5, steps 6, steps 7-10

MAR 3

 Complete script to be acted on camera for customer and employee

 

MAR 5

 Practice and Record final video situation in Library

 

MAR 6

 Edit video and sound to make presentable

 

MAR 7  

 Submit 10 steps video on BlackBoard

MAR 12 

– DUE DATE FOR 10 STEPS VIDEO

 

 

With this plan, we were able to complete a top quality video and achieve an excellent grade. 

April 18, 2013 / Michael A. Allison

Stress Management

An important part of being able to work efficiently is being able to properly manage your stress. To manage my own stress, I’ve come up with a plan that will help me both keep my stress levels low, and allow me to relieve some stress when things get rough.

First, it’s important that I follow a balanced diet.

Breakfast:

Two fried eggs.

Two pieces of buttered brown toast.

One cup of coffee.

Lunch:

Soup

Crackers

Yoghurt

Dinner:

Steak

Boiled Rice

Steamed vegetables.

 Note: I am on a diet and I’m trying to lose weight, this should total approximately 1350 calories.

Physical exertion is a great way to keep stress levels low, so here’s my current exercise program:

I have started and will continue to run 3 days a week for an hour at a time. When I am more comfortable with my physical endurance I plan on adding weight training in the future, to build some muscle and improve my overall fitness level.

Including sources of humor also helps keep stress levels low:

I’m an avid user of the website “Reddit”. I frequent the areas of the site that make me laugh, in particular the “funny” and “pics” subreddits. I also engage in conversation with my girlfriend as often as possible through text, and we’re always joking around with each other. There is no shortage of humor in my life!

When things do get rough, you should always have someone to talk to about it.

I talk to my girlfriend. We always vent to each other when we’re stressed… which is often.

Practice spirituality.

To practice spirituality, one thing that I like to do (when I can) is go camping. It’s a great way to disconnect from the world temporarily and regain my sanity. It provides a great opportunity to think and look inward.

Lastly, another great way to keep stress levels low is proper time management, and that can be accomplished through keeping and maintaining a schedule. Here’s the schedule that I made to get me through my current semester at school, made through Google calendar:

https://www.google.com/calendar/embed?src=neoslasher%40gmail.com&ctz=America/New_York

 

This stress relief plan has helped me immensely throughout the school year. 

April 18, 2013 / Michael A. Allison

My Personal Style

A person’s personal style has a great impact on how they act in the workplace. I’ve done a few tests to determine my own styles. If you’re curious about what they are and what characteristics they demonstrate, then please read on.

My Jungian personality type is:

INTP (Introvert, Intuitive, Thinking, Perceiving)

Psychologist David Keirsey refers to this type as  “The Architect”

I’ve also determined that my top two enneagrams, according to the enneagram personality system, to be  Type 1 – The Reformer and Type 4 – The Individualist.

Charactersitics

There are a few characteristics that are shared between my enneagrams and my personality type.

One characteristic would be my need to change things for the better. Both the Reformer Enneagram type and the Architect Keirsey type aim to change the world.

“For Architects, the world exists primarily to be analyzed, understood, explained – and re-designed.” – From Keirsey personality typing.

“They are teachers, crusaders, and advocates for change: always striving to improve things, but afraid of making a mistake.” – From Reformer Enneagram

Another characterstic shared by the reformer and the architect is that we are perfectionists. Both the Reformer Enneagram type and the Architect Keirsey type won’t stop until the job is done correctly.

“They tend to see distinctions and inconsistencies instantaneously, and can detect contradictions no matter when or where they were made.” – Keirsey personality type

“they try to maintain high standards, but can slip into being critical and perfectionistic.” – Reformer enneagram

One final trait shared this time by the individualist enneagram and my keirsey type is that we’re introverted, and we work best when we have time alone to think.

“They are inclined to be shy except with close friends, and their reserve is difficult to penetrate.” – Keirsey personality type

“Withholding themselves from others due to feeling vulnerable and defective, they can also feel disdainful and exempt from ordinary ways of living.” – Individualist personality type

This information is very helpful in understanding the way that my personality works, and the methods by which I work. Hopefully you’ve been able to glean as much information about me from these personality tests as I have. If you’re interested in finding out more information about your own personality traits, doing a quick Google search for “Keirsey Personality Test” or “Enneagram Test” will result in many options for tests that you can opt to take for yourself.