Sunday, January 27, 2008

Farewell President Hinckley

I received a Phone call from home. President Hinckley passed away at 7:00 PM Mountain Time today. He will certainly be mourned and missed. He was a great and courageous leader of the Church of Jesus Christ of Latter-day Saints.

While he will be missed, we certainly look forward to sustaining the Man who will fill his shoes.

Thursday, January 24, 2008

Spreadsheets

I got my spreadsheet start in Quatro pro. Now days I now use Excel quite allot. It was an easy transition.

What is cool about spreadsheet programs like these, is what you can do with them.

Most people use them to create stuff for finances like budgets, schedules, Payrolls etc. Excel is really good at those sorts of things. After all that is what it was designed for.

But it's the other things it can be used for that I find interesting. For instance I created a spreadsheet which every morning at Work I enter the time I arrived and then at the end of the day I enter the time I left so that I can calculate my hours every week.

When I first started at my current job I created a spreadsheet to keep track of where things are and what and when to do it. Basically I used it as brain storage. Pretty soon it became a piece of a model for organization for the team. It's strange.

When I was at school I had finished several programs and wanted to see how close I was to achieving any certificates or degrees. So I took the Syllabus and duplicated it in Excel then plugged in some formulas so I could set some check marks which would then highlight certain cells if the achievement was accomplished.

While at it I discovered that the Syllabus hadn't been calculated correctly. So I asked my Instructor about it and when he looked at it he asked if I could finish it so he could use it. He also said it was worth extra credit. So I finished it, and in the process helped fix the credit distribution.

Believe it or not Excel is also pretty good at geometry too. Using the right kind of chart it is simple to create graphs, but by indicating x and y the graph can go back on it's self. Then by doing this it is relatively simple to create a graph of a circle or square or whatever.

Back when I was small and One of my Uncles was going to school to be a Math Teacher he showed me this really cool Quatro pro graph he had done. It produced a Spirograph where you could change certain cells and get really neat designs.

Whenever I have something I want to formulate like how to write a program which draws an ellipse I'm likely to draft it out in Excel.

The more I use spreadsheets the more I think of the possibilities of what they can be used for.

I bet one day someone will figure out how to write a game of Asteroids all using Excel cell formulas. It would be difficult for sure. But it would sure be cool. even though it would be equal to using a screwdriver or a wrench as a hammer.

Friday, January 18, 2008

CRT RF Ghosting

I'm sitting here watching TV and finding it a little weird that I'm seeing a few second delay precursory ghosting in the screen.

It seems to be the DVR sitting on top of it, for some reason, as it records the analog signal of the live broadcast, produces RF interference which, with the 2 second + delay on the signal out, overlaps the interference as the ghosting effect of what will soon occur.

It's kinda interesting. And even stranger when there is an hour or so delay.

It reminds me of a computer we once had, which if it was turned on within 5 feet of a powered on CRT monitor or TV, would ghost whatever the Video card was displaying.

It was entertaining to watch the cursor moving Solitaire cards on Windows 3.1 superimposed over the news.

Fun days.

Sunday, January 13, 2008

Reverse

While helping my office mate prepare for his Interviews a whole bunch of us were coming up with questions and challenges for him. We were really hoping he would make it. One of the challenges asked was to reverse a string.

Having been asked to do it in an interview before (I did it in VB then) I had, had the time to come up with other possible solutions to the challenge. Here is a C# version of the method from memory:

/// <summary>
/// Reverses a sequence of chars in a string.
/// </summary>
/// <param name="value">String to Reverse</param>
/// <returns>the reverse of the provided string.</returns>
/// <remarks>
/// Reverse by back stepping through each char in the string 
/// and filling a StringBuilder with the result.
/// </remarks>
public string reverseStringFill(string value)
{
    StringBuilder temp = new StringBuilder();
    // Iterate backwards through each char and copy 
    // it's equivalent from the source string.
    for (int index = value.Length - 1; index >= 0; index--)
     {
         temp.Append(value[index]);

     }
     return temp.ToString();

}

Here is another variation:

/// <summary>
/// Reverses a sequence of chars in a string.
/// </summary>
/// <param name="value">String to Reverse</param>
/// <returns>the reverse of the provided string.</returns>
/// <remarks>
/// Reverse by back stepping through each char in the string 
/// and filling the resulting array.
/// </remarks>
public string reverseStringBFill(string value)
{
    char[] temp = value.ToCharArray();
    int length = value.Length - 1;
    // Iterate backwards through each char and copy 
    // it's equivalent from the source string.
    for (int index = length; index >= 0; index--)
    {
        temp[index] = value[length - index];
                
    }
    return new string(temp);

}

My Office mate having learned in C/C++ most of school came up with a swap method that he had learned in class, but when he tried to run it in C# it had compile errors. because he was trying to do things the C way in a type safe language. After a hint about casting he figured it out. What he ended up with is something similar to the following:

/// <summary>
/// Reverse String using Swap
/// </summary>
/// <param name="value">String to Reverse</param>
/// <returns>the reverse of the provided string.</returns>
/// <remarks>
/// This is how a C/C++ programmer would reverse a string in C#
/// </remarks>
public string reverseStringSwap(string value)
{
    char[] returns = value.ToCharArray();
    int index = 0;
    while (index < value .Length / 2)
    {
        // Swap chars
        char temp = returns[index];
        returns[index] = returns[(value.Length-1) - index];
        returns[(value.Length-1) - index] = temp;
        index++;

     }
     return new string(returns);

}

While he worked at the problem I was thinking of a similar way to do the same thing from a managed perspective:

/// <summary>
/// Reverses a sequence of chars in a string.
/// </summary>
/// <param name="value"></param>
/// <returns>the reverse of the provided string.</returns>
/// <remarks>
/// This is similar to the swap method except it
/// only pulls it's chars from the source string.
/// </remarks>
public string reverseStringBSwap(string value)
{
   char[] temp = value.ToCharArray();
   int length = value.Length - 1;
   int half = length / 2;

   for (int index = 0; index < length; index++)
   {
      temp[index] = value[length - index];
      temp[length - index] = value[index];
                
    }
    return new string(temp);

}

He had written his in a console app and I in a GUI app so rather than  return new string(returns); His actually used Console.Write(returns); I stumbled around for a little while trying to remember how to cast to a string. But eventually found it, hopefully I can remember it now. I have changed the methods so they work the same in a GUI and a Console app as I like a clean Modular design.

While at it I found Array.Reverse(""); and this nice little, simple, clean and tidy, method ensued:

/// <summary>
/// Reverses a sequence of chars in a string.
/// </summary>
/// <param name="value"></param>
/// <returns>the reverse of the provided string.</returns>
/// <remarks>
/// This is the simple way to reverse a string.
/// Simply by using the power of the Framework.
/// </remarks>
public string reverseStringArray(string value)
{
   // Copy to an array
   char[] temp = value.ToCharArray();
   // Reverse
   Array.Reverse(temp);
   // Return casting the array as a string
   return new string(temp);

}

Now for the real fun. Recursion (Where a method calls it's self over and over until it finishes it's work, then backs out to provide the results.). This method ends up being fairly simple, but it is slower, has potential to crash and is somewhat difficult to wrap one's head around. But it looks clean and impressive.

/// <summary>
/// Recursive String Reverse
/// </summary>
/// <param name="value">String to Reverse</param>
/// <returns>the reverse of the provided string.</returns>
/// <remarks>
/// This method Reverses a string by calling it's self recusively 
/// The method used here is certainly not the fastest method avalible
/// as it uses slow string concatenation and has the possibility of
/// having a buffer overflow recursing to many levels if using a 
/// string which is to long. But the idea is just so fun.
/// </remarks>
public string reverseStringRecursive(string value)
{
    if (value != "")
    {
        // Recurse the incoming string, minus the first char, then return 
        // the resulting string, appending the first char to the end.
        return reverseStringRecursive(value.Remove(0,1)) + value[0];

    }
    else
    {
        return "";

    }

} 

Ah, this was fun! One of these days I should revisit one of my old favorite sites (http://www.xbeat.net/vbspeed/) and try to work out a method for timing the methods and try a few other speedy ideas.

One of the odd things from that site is that you learn that simplicity is not always equal to speed. Rather often the reverse is true. There are some strangely long code snippets setup just for improvement with speed.

Monday, January 7, 2008

Résumé updating

I have less than three months left in my contract, so I'm back looking over my Résumé again, trying to figure out how to add my current position to it, which apparently I had added in June and since forgotten about the contract mix up which required an update. Well, I have updates to add to it anyway, as I have been doing some SDET work lately. Ah, having fun breaking software, he he.

While helping cleaning on Saturday I stumbled across a packet which included a handful of Resumes. I glanced over them and thought about what would cause a potential employer to balk, while trying to read them. I was balking anyway, they were a little brash, slightly pompous and blindingly difficult to read. All written using one of the the standard Word Resume templates. On one the goals mentioned had nothing to do with the position.

If I were the hirer I don't know how long I could stand looking over those resumes unless all of them were similar. So I think I know some things I should remember as I work on mine. But it is hard to detach myself from what I have written, to look at it through someone else's eyes.

One reason for the update is that there are a couple of FTE positions open on my team which I could possibly apply for.

I'm not going to get all excited, thinking I will actually get a position, but if I do interview, it would at least be good practice as I continue to learn and grow in this career path.

Sunday, January 6, 2008

I _ Software

A silly thought came to me the other day of the perfect bumper sticker if I were to ever get one. So I went searching around and finally found a website which allows you to design your own bumper stickers http://www.makestickers.com/customize.aspx?TID=5870 And this is what I ended up with:

But if I was ever to find a way to get in on the Dev side I would have to switch to this one:

I think the first one is funnier.