Calendar May 22, 2016 12:20

Blogger Blogger

To Do App - Mockup

Since I don't have any experience with web development, I have been looking into how to build my to do app using Microsoft's MVC framework. For now I have an idea of how I want the final thing to look like, here are a couple of images of the mockup I made:


This is the home page, where it will show the list of outstanding tasks with a few buttons for actions on each task.


To add a new task, I want to create a modal that would allow the user to type in all the important information and then add it to the list.

As I mentioned before, this is just a mockup, so none of it is actually being persisted on a SQL database. I don't really know how I'm going to do all this, but I am still working on it. All that you see up there is just some tweaking that I made to the sample project and some simple UI updates using Bootstrap.

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 20, 2016 19:58

Blogger Blogger

Prepping for the New Job

So since I got the new good news a couple days ago about my new position next week, I have started to try and learn more in the areas that I didn't do well during the interview.

Over the next few days I plan to learn as much as I can about SQL and websites using the MVC framework.

The first is obvious, like I've said before, my knowledge of SQL is very limited. I know that I won't become a SQL master over the weekend, but I hope to know at least the basics. My job actually bought me a book that I can use called Teach Yourself SQL in 10 Minutes. There are plenty of free resources available online to help me, but my manger thought this would be a better option so they got me the book for free. I really love working there.

I will also try to build a simple website using ASP.NET and the MVC framework because that is usually what new developers do in the company. For the first few weeks, new developers have to build a simple To Do List web app. Basically its an app that should allow a user to keep track of tasks, a user should be able to: Create, Read, Update, and Delete tasks. These tasks should be persisted to a database of some kind. Normally they use a NoSQL data base like RavenDB, but since I am learning SQL I will use MySQL DB for this web app. I don't know a single thing about web development, but I will try my best.

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 18, 2016 17:27

Blogger Blogger

So I Got the Job...

So a couple of days ago I posted about an interview I had at work for a Jr QA Engineer position, and by what I can only call luck... I got the job! I start next week after my current sprint is over at work.

Basically what happened is that a couple of other people had applied for the position, but on the day of their interview (yesterday), they canceled since they had accepted job offers somewhere else. So I guess by default I got it?

I know that I shouldn't be happy that I got the position by pure luck, but I am truly grateful that they decided to give me an opportunity since they could have easily just kept looking for someone else. Since there was a lot of stuff I didn't know about databases in general, I am actually joining the team as a temp. If I do well in the first 90 days, then I get to stay on the team. I am going to give it my all and try to learn as much as possible in this position. I hope that with this job I will get the required experience needed and one day be a full fledged QA Engineer one day.

Needless to say, I am super happy right now and I can't wait for this next challenge. I am also super nervous, but I will just face it as it comes.

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 16, 2016 23:33

Blogger Blogger

Jr QA Engineer Interview

So today I had an interview for a Jr QA Engineer at my work place, and since it was my first engineering interview I didn't really know what to expect. And I have to say that I was not ready for some of the stuff that they were going to ask me.

The interview started with some SQL and database questions. I had tried to study some basic SQL stuff over the weekend, but I didn't think that they were going to ask me anything about it, I figured they would focus more on my C# experience. Since my experience with SQL and databases is very limited, I think its safe to say that I failed this part of the interview.

Next they moved on to some OOP (Object Oriented Programming) questions and I'm happy to say that I did much better in this sections. They asked me a few different questions on what inheritance was, when would you implement inheritance, and a few other questions. I struggled a bit on explaining myself, but I got through it.

Next was probably my favorite part, actual coding on a white board. They asked me how I would write a function that would calculate the factorial of a given number. This part I spent probably a couple of minutes since it was really straight forward. This is the code I wrote:

public static int Factorial(int n)
{
    int result = 1;

    for (int i = n; i > 0; i--)
        result = result * i;

    return result;
}

They looked at the code, and told me it was good. Then they asked me to rewrite the function using recursion. I struggled a bit on this part, I had trouble trying to put into code what I had already done in a different way. They gave me a hint saying that 5! = 5 * 4! and that was all I needed. Here is the code I wrote:

public static int FactorialRecursive(int n)
{
    int current = n;

    if (n == 1)
        return n;

    int next = FactorialRecursive(n - 1);

    return current * next;
}

Overall I think I did much better in the second part of the interview than the first. I am not too hopeful on getting the position, but at least now I know what I need to work on and I am ready for the future. That is all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 11, 2016 23:40

Blogger Blogger

Learning Selenium WebDriver

So as you can probably tell my my recent blog posts, I have been trying to get more into coding and learning different things that will help me become a developer in the future.

Since I am a QA Specialist, I've heard the buzzwords "selenium" and "automated test" thrown around the office, but I didn't really know what any of those were. So I decided to start looking into it and try to understand how Selenium works and how to make automated test.

After spending sometime looking at some videos on Pluralsight, I got the basic idea that basically you can use a programming language like C# and write a "script" on what you would like to do in a website. I did some basic examples, but I didn't really think about it until yesterday.

In my current project at work, we are currently working on migrating our existing database from RavenDB to MartenDB. There are many documents that we have saved in the Raven database, and we are going to migrate each type of document. But in order to test it correctly, we were trying to find a simple way that would allows us to generate a lot of activity on the site, like customer's trying to reset passwords and see if it would affect the migration.

I had the idea that I could write a Selenium script that would do this for us on the site. Here is what I came up with:

using System;
using System.Diagnostics;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

namespace SeleniumTest
{
    class GenerateTokens
    {
        public static void Main()
        {
            Generator();
            Environment.Exit(1);
        }

        private static void Generator()
        {
            IWebDriver driver = new ChromeDriver(@"C:\Libraries\");
            driver.Url = "some-site.com";

            Debug.Assert(driver.PageSource.Contains("A message has been sent with directions on how to reset your password.") == false);

            for (int counter = 0; counter < 100; counter++)
            {
                driver.FindElement(By.Id("forgot-link")).Click();

                IWebElement email = driver.FindElement(By.Name("Email"));
                email.SendKeys("some-email@some-domain.com");

                driver.FindElement(By.ClassName("btn-primary")).Click();

                driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(2));

                Debug.Assert(driver.PageSource.Contains("A message has been sent with directions on how to reset your password.") == true);
            }

            driver.Quit();
        }
    }
}

This script would essentially go to a site and go through the steps a customer would take to recover their password on their account. The script would repeat it 100 times (but it can be increased if we wanted) and we wouldn't have to worry about doing it ourselves manually. The downside to this script, is that it would perform the same action for the same account/email address provided. I was thinking of maybe modifying this script to read a text file that contained a lot of different email address that it would just input on the site.

I don't think this script will actually get used at work since I am not a QA Engineer, and I think they might have a better approach at doing this with some internal tool, but I thought that it was interesting how easy this was to write.

Anyways, that's all for now. Thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 11, 2016 00:37

Blogger Blogger

The End of Disney Infinity

As most people know by now, Disney Infinity has come an end... by the sound of things is was kind of a surprise to everyone that Disney decided to end the production of the game.

I haven't worked at Avalanche since September of last year, so I don't really know what went down but all my friends that still worked there are really shocked at the news. I just hope that everyone there is able to find another position at other studios soon.

I was only a game ester in my short time at Avalanche, but I loved my time there and it thanks to them that I am now a software tester.

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 8, 2016 21:14

Blogger Blogger

Caesar Cipher in C#

So I was talking to a co-worker the other day and the topic of a Caesar Cipher came up in our conversation. We talked about how it wouldn't be too hard to code something quick that would be able to "encrypt" some text.

So I was kind of bored over this weekend, and I decided that it would be a good exercise to write a Caesar Cipher. Here is my code:

class CaesarCipher
{
    private string Sentence;
    private int EncryptShift;
    private int DecryptShift;
    private bool IsEncrypted = false;

    public CaesarCipher(string input, int shifting)
    {
        Sentence = input.ToLower();
        EncryptShift = shifting;
        DecryptShift = -shifting;
    }

    public string Encrypt()
    {
        if (IsEncrypted)
            return Sentence;

        char[] char_array = Sentence.ToCharArray();

        Shuffle(char_array, EncryptShift);

        Recunstruct(char_array);

        return Sentence;
    }

    public string Decrypt()
    {
        if (!IsEncrypted)
            return Sentence;

        char[] char_array = Sentence.ToCharArray();

        Shuffle(char_array, DecryptShift);

        Recunstruct(char_array);

        return Sentence;
    }

    private void Shuffle(char[] char_array, int shift)
    {
        for (int index = 0; index < char_array.Length; index++)
        {
            char letter = char_array[index];

            if (letter >= 'a' && letter <= 'z')
            {
                letter = (char)(letter + shift);

                if (letter > 'z')
                    letter = (char)(letter - 26);

                else if (letter < 'a')
                    letter = (char)(letter + 26);
            }

            char_array[index] = letter;
        }
    }

    private void Recunstruct(char[] char_array)
    {
        Sentence = null;

        foreach (char letter in char_array)
            Sentence += letter;

        IsEncrypted = true;
    }
}

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar May 4, 2016 23:11

Blogger Blogger

Max & Min Heap

So now that class is over and I took my final for my CS2420 class last night, I find that I have come to love programming and I miss not having an assignment to work on. So today I decided that since I had already created a Max Heap class, that I should also create a Min Heap class.

While I was working, I found that 99% of the code was going to be the same, and I didn't want to just create a copy and tweak a few lines. So instead I decided to create a abstract Heap class that I could inherit from.

So I created the base class and moved most of the code to that file. Then I made the Max and Min Heap classes and made the changes required in each class to make it work. While this also wasn't that hard, I think that it was a good exerciser. I did something similar in the Components assignment, but I think this was a much better example of how to use inheritance.

Here is my code:


That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 29, 2016 13:48

Blogger Blogger

Stack Class in C#

So this week there is no more homework for my C# class since the semester is coming to an end and we have a final exam next week.

Since I was bored at work, I started thinking that we never created a stack for one of the class assignments. So I decided to create my own, which wasn't that hard since its essentially just a wrapper around an array.

I started to work on it yesterday for a couple hours and finished it this morning.

Here is my code:


Thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 27, 2016 02:48

Blogger Blogger

CS 2420 - Assignment 9 - Max Heap

This week's assignment is not as hard as the last one, we just have to create a heap data structure. We had the choice of either creating a min heap or max heap, so I went with Max since it made the most sense to me.

While the assignment its self wasn't too hard, it took me a while to do all the conditional logic behind the Sink() function.

Here is my code:

using System;
using System.Collections;
using System.Collections.Generic;

namespace Assignment9
{
    class MaxHeap<T> : IEnumerable<T> where T : IComparable
    {
        private T[] UnderlyingArray;
        private int ElementCount = 0;
        private int OldCount = 0;
        private bool IsHeap = true;

        public MaxHeap(int starting_size)
        {
            UnderlyingArray = new T[starting_size];
        }

        public MaxHeap()
        {
            UnderlyingArray = new T[5];
        }

        public int Count
        {
            get
            {
                return ElementCount;
            }
        }

        public void Clear()
        {
            UnderlyingArray = new T[UnderlyingArray.Length];
        }

        public T this[int index]
        {
            get
            {
                return UnderlyingArray[index];
            }
        }

        public void Add(T new_value)
        {
            if (!IsHeap)
                BuildHeap();

            if (ElementCount == UnderlyingArray.Length)
                Resize();

            UnderlyingArray[ElementCount] = new_value;
            Swim();
            ElementCount++;
        }

        public T PopTop()
        {
            if (!IsHeap)
                BuildHeap();

            T max = UnderlyingArray[0];

            Swap(0, ElementCount - 1);
            UnderlyingArray[ElementCount - 1] = default(T);
            ElementCount--;
            Sink();
            
            return max;
        }

        public void Sort()
        {
            if (!IsHeap)
                BuildHeap();

            OldCount = ElementCount;

            for (int i = 0; i < OldCount; i++)
            {
                Swap(0, ElementCount - 1);
                ElementCount--;
                Sink();
            }

            IsHeap = false;
            ElementCount = OldCount;
        }

        public void BuildHeap()
        {
            if (IsHeap)
                return;

            int last_item = OldCount - 1;

            for (int index = 0; index < OldCount / 2; index++)
            {
                Swap(index, last_item);
                last_item--;
            }

            ElementCount = OldCount;
            IsHeap = true;
        }

        private void Swim()
        {
            int current_index = ElementCount;

            while (current_index != 0)
            {
                int parent_index = FindParent(current_index);

                if (UnderlyingArray[current_index].CompareTo(UnderlyingArray[parent_index]) == 0)
                    break;

                else if (UnderlyingArray[current_index].CompareTo(UnderlyingArray[parent_index]) > 0)
                    Swap(current_index, parent_index);

                current_index = parent_index;
            }
        }

        private void Swap(int first, int second)
        {
            T temp = UnderlyingArray[first];
            UnderlyingArray[first] = UnderlyingArray[second];
            UnderlyingArray[second] = temp;
        }

        private void Sink()
        {
            int current_index = 0;

            while (current_index < ElementCount)
            {
                int max_child_index = current_index;
                int left_child_index = FindLeft(current_index);
                int right_child_index = FindRight(current_index);

                if (left_child_index >= ElementCount)
                    break;

                if (right_child_index >= ElementCount)
                    max_child_index = left_child_index;

                if (right_child_index < ElementCount &&
                    UnderlyingArray[left_child_index].CompareTo(UnderlyingArray[right_child_index]) == 0)
                    max_child_index = left_child_index;

                if (right_child_index < ElementCount && 
                    UnderlyingArray[left_child_index].CompareTo(UnderlyingArray[right_child_index]) > 0)
                    max_child_index = left_child_index;

                if (right_child_index < ElementCount && 
                    UnderlyingArray[left_child_index].CompareTo(UnderlyingArray[right_child_index]) < 0)
                    max_child_index = right_child_index;

                if (UnderlyingArray[max_child_index].CompareTo(UnderlyingArray[current_index]) == 0)
                    break;

                if (UnderlyingArray[max_child_index].CompareTo(UnderlyingArray[current_index]) > 0)
                    Swap(current_index, max_child_index);

                current_index = max_child_index;
            }
        }

        private int FindParent(int current_index)
        {
            return (current_index - 1) / 2;
        }

        private int FindLeft(int current_index)
        {
            return (current_index * 2) + 1;
        }

        private int FindRight(int current_index)
        {
            return (current_index * 2) + 2;
        }

        private void Resize()
        {
            T[] new_array = new T[UnderlyingArray.Length * 2];

            for (int index = 0; index < UnderlyingArray.Length; index++)
                new_array[index] = UnderlyingArray[index];

            UnderlyingArray = new_array;
        }

        public IEnumerator<T> GetEnumerator()
        {
            for (int index = 0; index < ElementCount; index++)
            {
                T temp = UnderlyingArray[index];
                //Console.WriteLine("Current Value: {0}", temp);
                yield return temp;
            }
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 20, 2016 15:56

Blogger Blogger

CS 2420 - Assignment 8 - Components

This week's assignment is a bit more fun that usual since we are got to build a "game."

The point of this week's assignment to learn how to use components to build a game, instead of hard coding everything like we usually do. We also had a chance to review inheritance and understand how it works.

This time around there is too much code involved for me to put it here like I usually do, but if you are interested in looking at the code you can look here:

https://github.com/fushinoryuu/EAE2420/tree/master/DataStructuresAndSorts/Assignment8

I created these main class files: Component, Entity, Grid, Point, and Power Up.

The Grid was essentially a 2D array and everything ran through this file, it represented the map the player was going to play on. It also updated itself on the position of each enemy and the player and then displayed itself on the console.

The player and the enemies in the game all inherited from the Entity class and used a bunch of components to make each unique. For example, enemies had a component that allowed them to wrap around the Grid but the player was bound and couldn't go past the edges of the grid. To do this there was two components and I just had to make sure to give one to the player and the other to the enemies.

Power Ups are a type of component, but they don't inherit from the component class. I made it so they would modify the player's action. For example I had a Teleport Power Up. When they stepped on it, they would get randomly taken to an empty spot in the map.

I had a lot of fun with this assignment, but it took a little longer than I anticipated.

Anyways, that's all for now. Thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 12, 2016 10:47

Blogger Blogger

CS 2420 - Assignment 7 - Hash Table

This week we had to write a hash table, also known as a dictionary. Hash tables are really nice because you can index with more than just integers, and they are faster running times than a regular array or a linked list.

Here is my code:


That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar April 6, 2016 02:40

Blogger Blogger

CS 2420 - Assignment 6 - A Star

So this week we had to create a node graph and write our version of the A* (A Star) algorithm to find the shortest path. Here is the map we were given:



The map is not to scale, here are the coordinates of each node: 

A: -19, 11        B: -13, 13      C: 4, 14          D: -4, 12      E: -8, 3           F: -18, 1
G: -12, -8        H: 12, -9         I: -18, -11       J: -4, -11     K: -12, -14     L: 2, -18
M: 18, -13       N: 4, -9          O: 22, 11        P: 18, 3

I have seen multiple implementations of A* around the web, but they all use a matrix and it can get really complicated really quickly. I like this implementation better because its simple, but it works.

Here is my code:


That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar March 30, 2016 22:05

Blogger Blogger

Breadth First Search - Matrix

So yesterday during class, we discussed how to make a path finding algorithm for a 2d map. I immediately thought of the example of flooding the map with water like I have seen before.

We didn't have to code it in class, we just had to know how one would write the algorithm. Last night I decided that I would try to code it and here is my work:


In my grid I make the starting cell marked with an X and the destination is marked with a D. The final path would be calculated by simply following the cell values in descending order to the final destination.

That's all for now, thanks for reading!

Replies 0 Comments Reply Reply

Calendar March 24, 2016 02:37

Blogger Blogger

CS 2420 - Assignment 5 - Part 5

So I just turned in my assignment a few minutes ago, and this is probably the hardest assignment yet. Most of the assignment was really simple actually, but the most challenging part was building the Expression Tree in the correct order.

This is because you have to keep the order of operations in mind when building the tree, Once the tree has been built in the correct order, its just a matter of doing a post-order traversal and evaluating as you go up the tree.

I kept thinking about how I should do this, and after talking to one of my friends, we realized that node rotations would be the simplest way to do it. So here is my code:

using System;
using System.Collections.Generic;

namespace Assignment5
{
    public TreeNode<string> root;

        public ExpressionTree(string input)
        {
            root = null;
            ExpressionParser parser = new ExpressionParser(this, input);
        }

        private class ExpressionParser
        {
            private Stack<TreeNode<string>> numberStack, operatorStack;

            public ExpressionParser(ExpressionTree tree, string input)
            {
                numberStack = new Stack<TreeNode<string>>();
                operatorStack = new Stack<TreeNode<string>>();
                string[] expressionArray = new string[input.Length];
                expressionArray = input.Split();

                BuildNodes(tree, expressionArray);
            }

            private void BuildNodes(ExpressionTree tree, string[] expressionArray)
            {
                foreach (string item in expressionArray)
                {
                    double tempNumber;
                    if (double.TryParse(item, out tempNumber))
                    {
                        TreeNode<string> number_node = new TreeNode<string> 
                            { Data = tempNumber.ToString() };
                        numberStack.Push(number_node);
                    }
                    else
                    {
                        TreeNode<string> operator_node = new TreeNode<string> 
                            { Data = item };
                        operatorStack.Push(operator_node);
                    }
                }
                BuildTree(tree);

            }

            private void BuildTree(ExpressionTree tree)
            {
                while (operatorStack.Count != 0)
                {
                    TreeNode<string> tempRoot = operatorStack.Pop();
                    tempRoot.Right = numberStack.Pop();
                    tempRoot.Left = numberStack.Pop();

                    if((tempRoot.Data == "*" || tempRoot.Data == "/") && 
                        (tempRoot.Right.Data == "+" || tempRoot.Right.Data == "-"))
                    {
                        tempRoot = tree.RotateLeft(tempRoot);
                    }
                    numberStack.Push(tempRoot);
                }
                TreeNode<string> subTree = numberStack.Pop();
                tree.root = tree.RotateLeft(subTree);
            }
        }

        private TreeNode<string> RotateLeft(TreeNode<string> currentNode)
        {
            TreeNode<string> tempNode = currentNode;
            currentNode = currentNode.Right;
            tempNode.Right = currentNode.Left;
            currentNode.Left = tempNode;
            return currentNode;
        }

        public void Evaluate(TreeNode<string> node)
        {
            if (node.Left != null)
                Evaluate(node.Left);
            if (node.Right != null)
                Evaluate(node.Right);
            switch (node.Data)
            {
                case "+":
                    double addResult = double.Parse(node.Left.Data) + 
                        double.Parse(node.Right.Data);
                    node.Data = addResult.ToString();
                    node.Left = null;
                    node.Right = null;
                    break;
                case "-":
                    double subResult = double.Parse(node.Left.Data) - 
                        double.Parse(node.Right.Data);
                    node.Data = subResult.ToString();
                    node.Left = null;
                    node.Right = null;
                    break;
                case "*":
                    double multResult = double.Parse(node.Left.Data) * 
                        double.Parse(node.Right.Data);
                    node.Data = multResult.ToString();
                    node.Left = null;
                    node.Right = null;
                    break;
                case "/":
                    double divResult = double.Parse(node.Left.Data) / 
                        double.Parse(node.Right.Data);
                    node.Data = divResult.ToString();
                    node.Left = null;
                    node.Right = null;
                    break;
                case "^":
                    double expResult = Math.Pow(double.Parse(node.Left.Data), 
                        double.Parse(node.Right.Data));
                    node.Data = expResult.ToString();
                    node.Left = null;
                    node.Right = null;
                    break;
            }
        }

        public string TraversePre(MyList<string> list, TreeNode<string> node)
        {
            list.Add(node.Data);
            if (node.Left != null)
                TraversePre(list, node.Left);
            if (node.Right != null)
                TraversePre(list, node.Right);
            return string.Join(", ", list);
        }

        public string TraverseIn(MyList<string> list, TreeNode<string> node)
        {
            if (node.Left != null)
                TraverseIn(list, node.Left);
            list.Add(node.Data);
            if (node.Right != null)
                TraverseIn(list, node.Right);
            return string.Join(", ", list);
        }

        public string TraversePost(MyList<string> list, TreeNode<string> node)
        {
            if (node.Left != null)
                TraversePost(list, node.Left);
            if (node.Right != null)
                TraversePost(list, node.Right);
            list.Add(node.Data);
            return string.Join(", ", list);
        }
    }
}

I was not able to make my Binary Search Tree self balancing. I know what I need to do, but I never had time to actually implement the code. I will try to finish writing the code and post it here when I'm done with my AVL tree.

Anyways, that's all for now. Thanks for reading!

Replies 0 Comments Reply Reply