Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

Full repo available at https://bitbucket.org/createdbyx/codefarts.utilities-extension-methods-only

/// <summary>
/// Inserts a source array into the three dimensional sequence.
/// </summary>
/// <typeparam name="T">The type of the array.</typeparam>
/// <param name="array">The array whose value is to be retrieves.</param>
/// <param name="width">The width of the three dimensional sequence.</param>
/// <param name="height">The height of the three dimensional sequence.</param>
/// <param name="destinationArray">The destination array.</param>
/// <param name="depth">The depth of the three dimensional sequence where insertion takes place.</param>
/// <param name="sourceArray">The source array to be inserted.</param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException">
/// width or height is less then 1. Or depth is less then 0.
/// </exception>
/// <exception cref="ArgumentException">'sourceArray' must not be larger then '(width * height)'.</exception>
/// <remarks>The length of the 'sourceArray' parameter cannot be larger then '(width * height)' otherwise the data it contains would overwrite any data
/// stored at a deeper depth.</remarks>
/// <returns>Returns the updated 'destinationArray'.</returns>
public static T[] Insert3D<T>(this T[] destinationArray, int width, int height, int depth, T[] sourceArray)
{
    if (width < 1)
    {
        throw new ArgumentOutOfRangeException("width");
    }

    if (height < 1)
    {
        throw new ArgumentOutOfRangeException("height");
    }

    if (depth < 0)
    {
        throw new ArgumentOutOfRangeException("depth");
    }

    if (sourceArray == null || sourceArray.Length == 0)
    {
        return destinationArray;
    }

    // ensure source array is no greater then width * height
    if (sourceArray.Length > (width * height))
    {
        throw new ArgumentException("'sourceArray' must not be larger then '(width * height)'", "sourceArray");
    }

    if (sourceArray.Length < (width * height))
    {
        Array.Resize(ref sourceArray, width * height);
    }

    destinationArray = destinationArray.Insert(depth * (width * height), sourceArray);

    // return the updated array
    return destinationArray;
}

Full repo available at https://bitbucket.org/createdbyx/codefarts.utilities-extension-methods-only

/// <summary>
/// Sets the depth of the three dimensional sequence.
/// </summary>
/// <typeparam name="T">The type of the array.</typeparam>
/// <param name="array">The array whose value is to be retrieves.</param>
/// <param name="width">The width of the three dimensional sequence.</param>
/// <param name="height">The height of the three dimensional sequence.</param>
/// <param name="value">The new depth of the three dimensional sequence.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// width or height is less then 1.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">'value' must be greater then 0.</exception>
public static T[] Set3DDepth<T>(this T[] array, int width, int height, int value)
{
    if (width < 1)
    {
        throw new ArgumentOutOfRangeException("width");
    }

    if (height < 1)
    {
        throw new ArgumentOutOfRangeException("height");
    }

    if (value < 1)
    {
        throw new ArgumentOutOfRangeException("value");
    }

    // resize the array preserving contents
    Array.Resize(ref array, value * (width * height));

    return array;
}

Full repo available at https://bitbucket.org/createdbyx/codefarts.utilities-extension-methods-only

/// <summary>
/// Gets the value in a single dimensional array that represents a three dimensional sequence.
/// </summary>
/// <typeparam name="T">The type of the array.</typeparam>
/// <param name="array">The array whose value is to be retrieves.</param>
/// <param name="width">The width of the three dimensional sequence.</param>
/// <param name="height">The height of the three dimensional sequence.</param>
/// <param name="x">The x index (0 to width - 1).</param>
/// <param name="y">The y index (0 to height - 1).</param>
/// <param name="z">The z index (0 to depth - 1).</param>
/// <returns>Returns the value stored in the array.</returns>
/// <exception cref="ArgumentOutOfRangeException">
/// width or height is less then 1.
/// </exception>
/// <remarks>
/// <p>This method provides an alternative to working with three dimensional arrays "var value = new int[3,3,3];" by operating 
/// on a single dimensional array using a math formula to determine the index into the array.</p>
/// <p>Think of a multi-layered image. Each image layer consists of a grid of cells defined by width * height.</p>
/// <p>We can use the formula "layer * (width * height)" to get the starting index of the layer in the array. 
/// To get the index in the image we can use the formula "(y * width) + x". 
/// Combining these two formulas we can access any grid cell of any layer in the array like so "(layer * (width * height)) + ((y * width) + x)".</p>
/// <p>This method does not perform range checking and will throw index out of range exceptions if invalid arguments are specified.</p></remarks>
public static T Get3D<T>(this T[] array, int width, int height, int x, int y, int z)
{
    if (width < 1)
    {
        throw new ArgumentOutOfRangeException("width");
    }

    if (height < 1)
    {
        throw new ArgumentOutOfRangeException("height");
    }

    return array[(z * (width * height)) + ((y * width) + x)];
}

Full repo available at https://bitbucket.org/createdbyx/codefarts.utilities-extension-methods-only

/// <summary>
/// Sets the value in a single dimensional array that represents a three dimensional sequence.
/// </summary>
/// <typeparam name="T">The type of the array.</typeparam>
/// <param name="array">The array whose value is to be set.</param>
/// <param name="width">The width of the three dimensional sequence.</param>
/// <param name="height">The height of the three dimensional sequence.</param>
/// <param name="x">The x index (0 to width - 1).</param>
/// <param name="y">The y index (0 to height - 1).</param>
/// <param name="z">The z index (0 to depth - 1).</param>
/// <param name="value">The value to set.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// width or height is less then 1.
/// </exception>
/// <remarks>
/// <p>This method provides an alternative to working with three dimensional arrays "var value = new int[3,3,3];" by operating
/// on a single dimensional array using a math formula to determine the index into the array.</p>
/// <p>Think of a multi-layered image. Each image layer consists of a grid of cells defined by width * height.</p>
/// <p>We can use the formula "layer * (width * height)" to get the starting index of the layer in the array.
/// To get the index in the image we can use the formula "(y * width) + x".
/// Combining these two formulas we can access any grid cell of any layer in the array like so "(layer * (width * height)) + ((y * width) + x)".</p>
/// <p>This method does not perform range checking and will throw index out of range exceptions if invalid arguments are specified.</p>
/// </remarks>
public static void Set3D<T>(this T[] array, int width, int height, int x, int y, int z, T value)
{
    if (width < 1)
    {
        throw new ArgumentOutOfRangeException("width");
    }

    if (height < 1)
    {
        throw new ArgumentOutOfRangeException("height");
    }

    array[(z * (width * height)) + ((y * width) + x)] = value;
}

If you are writing custom scripts there may be situations where you don’t want the same component added more then once to a game object. For such situations Unity provides the DisallowMultipleComponent attribute that you can specify in your scripts code.


Takes in an array of floats representing pixels ordered left to right top to bottom. Width & height arguments specify the image dimensions.

        /// <summary>
        /// Smoothens out the image.
        /// </summary>
        /// <param name="image">The source image.</param>
        /// <exception cref="ArgumentNullException"><paramref name="getPixel"/> or <paramref name="setPixel"/> is <see langword="null" />.</exception>
        public static void Smoothen(this float[] image, int width, int height, Func<int, int, float> getPixel, Action<int, int, float> setPixel, float smoothinValue = 9f)
        {
            if (getPixel == null)
            {
                throw new ArgumentNullException("getPixel");
            }

            if (setPixel == null)
            {
                throw new ArgumentNullException("setPixel");
            }

            for (var x = 1; x < width - 1; ++x)
            {
                for (var y = 1; y < height - 1; ++y)
                {
                    var total = 0f;
                    for (var u = -1; u <= 1; u++)
                    {
                        for (var v = -1; v <= 1; v++)
                        {
                            total += getPixel(x + u, y + v);
                        }
                    }

                    setPixel(x, y, total / smoothinValue);
                }
            }
        }

It’s not something people think about these days. Back in the 90’s when MS-DOS was king, alerting the user to a problem involved both a visual alert as well as a auditory alert in the form of a “beep”. It’s actually something I miss from those days. Luckily the unity editor has an API to alert the user and wouldn't you know it, it’s called “Beep”!


If you are developing unity editor extensions often it is necessary to know weather or not unity is compiling the projects scripts. To determine if unity is currently compiling you can simply check the EditorApplication.isCompiling flag in your code before deciding what to do. See older related tip and code example here.


ProjectAndHierarchyEnhancements

Unity provides hooks into the Project and Hierarchy windows OnGui event. This allows you to add additional flair to these windows. To learn how to enhance these windows see the fallowing documentation pages

  1. HierarchyWindowChanged
  2. HierarchyWindowItemOnGUI
  3. ProjectWindowItemOnGUI
  4. ProjectWindowChanged

If you want an example project to work off of and learn from there is an open source project called “UnityEditorEnhancements” that you can download as a zip file or you can fork the Mercurial repository.


SteelSeries 7H Final Review

Published 4/13/2015 by createdbyx in News | Reviews
Tags: ,

I don't like to write reviews immediately after receiving an item, I'd much rather wait a good long time before posting. I purchased these headphones back in Oct 25, 2010 and am only posting this now because the headphones are still for sale on ncix and else where.

Ultimately they worked great for about 2 years of infrequent use, but considering that they are a mid range (price wise) headset and I paid $130 after tax & shipping, I expected them to last a lot longer.

After the first few months the glue partly separated on one side of the top padding. (See link to picture below)

Then the cord had a line break at the point at which the cable merges with the micro usb style end (the end that plugs into the left ear muff). I fully admit this was most likely my fault with the cord break. 2-3 times I had my headphones on and while sitting in my desk chair I bent over to pick something off the ground and yanked on the cord. Not enough to pull them off my head but enough for me to curse at my own stupidity. :P  Even though they did not break after being yanked they did eventually stop working and I needed to bend and twist the cable to get the sound working.

I finally contacted SteelSeries support and was able to purchase a replacement cable for just $5 through PayPal. I bought 2 cables just in case it broke again and I would not have to go through the replacement process another time.

Over the last year the right ear muff would periodically stop working. I would only have to twist the headphones on my head slightly to get them to work. I suspected at the time that it was a connection issue at the point where the top head piece clips into the right ear muff piece. There are 4 springy pins in the ear muffs that make the connection with the top piece. I thought there was just a lack of solid connection but the problem got a bit worse even after a bit of polishing/cleaning.

They finally died this last week when the right ear muff stopped working completely. I broke down and decided to take the right ear muff piece apart. I inspected the cable where the ear muff passes through the hinge that allows the muff to rotate 90 degrees and there did not seem to be any issues with frayed/pinched wiring etc. Before putting them back together I did adjust the wire routing slightly to give it more slack but it did not fix the issue.

Next I took apart the top piece. There were 3 screws holding either the connection points at both ends of the top piece and there did not appear to be any issues there. Then I peeled back the padding and tried taking off the plastic panel via 4 screws but there is 2 plastic weld points that prevented me from removing the panel. I suspect that the problems are hidden behind the panel but I can't get access to it without destroying the panel in the process.

Here is a picture showing the breaks in the plastic, glue separation, and stress points. 7H Problems Screenshot

The glue separation is due to a combination of the heat from my head and the flex in the top part of the head band and never came apart more then what you see in the picture.

I rated this two stars because a 5 star headset is perfect, every part works until it has been used for a few years, and can take a beating. Based on my experience these are not able to take much of a beating in day to day use. I only ever used them periodically at night when other people were sleeping otherwise I prefer to use my 5.1 surround sound speakers. I used them a few times when traveling and kept them in a laptop backpack but always took care to ensure there safety.

All in all when they did work they worked great, but ultimately I won't be buying another SteelSeries headset product. I have nothing against SteelSeries but I am the type of person that expects more out of the products I buy. I'm sure others have had great experiences with there 7H's but I feel my experience was lacking. Buying headphones off the internet is always a crap shoot as you can only rely on on line reviews, and each person has different hearing and tastes.

I have since purchased a Logitech G430 as a replacement based on the reviews, specs, and the fact it has a 3 year warranty.


Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume