Wednesday, May 4, 2016

Vivaldi...no longer just a composer

Oops, I was drafting this and must have hit publish. Ten people saw my not even half written blog. I need to get better at this whole process. Sorry to those ten readers that probably won't reread this post.

About a week ago I read an article about internet browsers. There aren't many new entrants into this realm and the players seem to be pretty stable. I moved from Internet Explorer to Firefox to Chrome way back in the day. I apparently don't have a good track record with my browsers. Give me one the has better functionality and I will at least look at it. I don't feel there have been many other options come into the market since the release of Chrome in 2008 (granted I am most likely wrong). Well, in comes Vivaldi (don't worry it doesn't play classical music the entire time it is open). Vivaldi was created by the same people that brought us Opera (see a theme here?). I never used Opera, I know that I wasn't as into tech when it came out, 21 years ago! I thought I would give Vivaldi a try, the slogan is "A browser for our friends"

A little on the build of Vivaldi. It is built off Chromium, an open source project, along with other open source software. Given that, it looks a lot like Chrome, but with a few extra options and customizations to help you get the browser you really want. You are able to use all the plugins that you love so much in Chrome I believe that since it is built on Chromium.



I am writing this in the Vivaldi browser now. I really like all the options that Vivaldi offers. The first is the grouping of tabs. Tabs are great, but don't you ever get so many tabs that you have no idea what each tab is and you have to go through each one in order to find what you are really looking for? Well, you can now group them together (I think Opera allowed this as well, but never used it). The attached image shows the two grouped sites I have, blogger and gmail.


Once you have your tabs grouped you can then tile each tab into the same window. It is helpful if you don't want to have two windows open with the different pages open. Okay, not that big of a deal, but who really wants to have two windows open?


You will notice I have a dark theme for the browser, just one of the many options. There are also great options if you don't like using a mouse. You can set a keyboard shortcut for almost anything! In order to best utilize real estate on my screen I have two shortcuts, Alt + t and Alt + a to remove the tabs (at the bottom of my screen and not the top) and the address bar. There are so many other options for key board shortcuts.

There are also mouse movements that will do actions as well. The one I like the most would be the "Rocker" movements. You quickly press the right mouse button and then the left in order to move back to the previous page. Or, do left then right to move forward in the pages. Pretty nice that the browser is build to accommodate those that like to only use the keyboard and those that like to use the mouse as often as possible.

So many other options that can be done. Like how pressing Ctrl + Tab works. You can have it rotate through the order that the windows were last glanced out or go straight down the line. But not everything is good about the browser.

Really the most glaring downfall is that the browser doesn't appear to be as quick as Chrome. Pages load quicker in Chrome, but not too noticeable. You may lose a few seconds of productivity, but nothing that will keep me from using the browser.

I will continue using Vivaldi.Maybe I will find out more that I like about it. The slogan says "A browser for our friends." I have read they mean this to be a browser for those that were power users and wanted something beyond Chrome. I would venture to say that it is a browser for everyone. Even if you aren't a power user, there is something here for you.

"If you don't like this, I'll stop writing music." - Vivaldi (or maybe I'll stop writing blogs)

Saturday, April 23, 2016

Topics...who needs them? (I do)

So, I pretend I know about technology. I actually only know a little about a lot. I need to tell the truth to all my readers. I have been very fortunate, and very lucky, to get my job with my current company. I have been writing about my experiences learning code but lately I have been going to work with challenging days and not enough time to do learning at work. Once I get home I have been wanting a little time with my wife and daughter and then taking down time. 

The reason for such the difficult times at work is that both of implementation specialists (my old role) are moving to new teams. I am moving to another engineering team and the the other specialist is moving to the client operations side of the business. Technically he isn't moving until June 1 and up to that date he should be working 50% as an implementation specialist and 50% in his new role. It has turned out that he is spending a lot more time with his new role and less time with the implementation role.

The time spent is in no way Tim's fault. This is a new role for him on a different team, and we all know that once you are leaving a department/job that you are done and ready to move on. Since I am staying in the same department it is much easier for me to keep doing the work and help to keep the team floating. It is wearing on me. I have been doing a bigger work load and just surviving. I should have brought this up to managers sooner, but I didn't and thought I could handle the load.

Taking time out of my nights to learn, when I just needed to unwind wasn't going to happen. I know there are ways to learn, outside or reading my C# book, but I don't know of these places as readily as pulling out a book. Similar to my previous blog about the communities we all belong to, there are places we can learn that will provide quick learning environments, like Code Wars or reading a blog on technology. Anyone know some good technology blogs or coding blogs that would be good for a newbie coder? I know at this point I shouldn't be as newbie, but I haven't been able to spend as much time as I would like to further my knowledge of coding and C#, life gets in the way.

I hope that once my replacement is hired (he starts on May 10th) and trained that I can get the rest of the sustaining team to help pick up the slack until we are able to get another implementation specialist hired for Tim's position and that I will be able to start working on the new team, which will be more coding and using different technologies. Until then, I need to find a list of topics that I can write about for the weeks where I haven't been able to do much learning or even looking at my C# book. So, what are the topics that a newbie programmer should be talking about?

P.S. thanks to Brett for starting to write a blog again, I am hoping it will help keep me motivated to write mine even after I don't sit next to him anymore. You can catch his blog at: http://technophiletester.hintonweb.com/

Saturday, April 2, 2016

Time sure goes by quick...

I recently made a decision. I decided to put the lab on hold because I was running into roadblocks and have been stuck for a while (it appears three weeks have passed since I last wrote!). So, I am moving on in the book and will come back to the lab to complete after I have been working on something different. When I was working on the lab, I would write code and it would do nothing like I would expect and so I would search, change the code, and find it also did not work. Frustration was growing until I finally said I need to take a break and learn something new. So, chapter nine hear I come. I think this will be an interesting chapter, it is teaching me how to read and write to objects, like a file or database. This is nice, we write to databases at work and I think it will be nice to understand how we are doing it.

This has brought me to think about coding in general. How do you know when you need to reach out to someone for additional help? Yes, I can continue working on the lab (and I will return to it) to finish and ask others around me for help on what needs to be done. I have done some bug fixes and small feature work for my job. I have received help all along the way while doing these. Usually, I would search on Stack Overflow or other forums reading to see if I could find the solutions I need. Then I would try some of the code and if it didn't work after a few times I will reach out to someone. The person I reach out to can usually answer my question and show me what to do in a short 15 - 20 minutes. I have just spent a couple hours working on it myself without getting somewhere.

OK, sometimes I do find the answer and I think I am better for it. I will probably remember the answers I took a few hours to find than those that are shown to me by someone at work. There has to be a balance, but what is the right balance? I find that sometimes I find the answer after just asking someone for help and talking through my issue. It makes me think about what I am trying to do and say what the code is doing out loud to someone else.

Sorry for the disappointment on the many weeks between blogs and not having the lab done. Maybe I didn't disappoint you, but I am bummed.

On a side note, I got a new job at work. I have been an Implementation Specialist. I would mostly work with clients to install our product and trouble shoot tier 2 issues. Well, they asked me to move to be a Software Engineer in Test. A lateral move, but I will be testing our product and possibly even coding more. I am excited for the change. I have been doing the implementations for almost two years and it has been great. I like working with the customers and really digging into our product. I will be moving teams and focusing on one specific function of our products so I will be deep diving into the code and how that portion works. I know I will start by writing tests and looking for bugs. Eventually, I will be coding, probably a lot more than when I was doing implementations because I won't have the tier two support to also work on. Exciting times!

Friday, March 11, 2016

Ghosts, Bats, and Ghouls...Oh my!

My work recently did a day called Open Space (I believe the thought was that it would replace what we previously did called Hack-a-thons). I had no idea what to think going to Open Space and it turns out to be a great idea. Whatever happens was meant to happen. Anyway, if you haven't done an Open Space, it is a cool idea and worth doing. What happened at our first Open Space is that I decided to host a session about learning C#. Turns out it was a popular session, I think we had 15 people in the session. I better know my stuff! 

At the session I talked about what I was doing with the C# book, Code Newbies, Code Wars, and just trying to pick up stories at work. We walked through an example of the last program I wrote and everyone was interested in my blog. Well, it has been a couple weeks since I wrote a post on my coding. I have been working on the latest and greatest game, The Quest. I have been slow going and spending time when I can find it to work on this project. This is a lab though and there is no help. I have been making sure I understand what I am doing with the code and it is taking a while. So far, I believe I have most of it written, I need to write what each of the available weapons do and then wire up the Windows Form to start working. I neglected to write more about the process while I was doing and it turns out that people are actually reading my blog. I was asked today if I was going to blog about the time I was spending on this project. Short story, people read my blog and about the adventures I have embarked on.

Now, onto The Quest.
The picture is the base for the form, it contains all the pictures that will be needed for each level. The form will control when the weapons are picked up and which enemies are present for the level. Well, I get to use inheritance quiet often in this project. I have a Mover class, and abstract Enemy class (which inherits from Mover), three different types of Enemy (inherits from Enemy class), a Player class (inherits from Mover), and the weapon classes (also inherits from the Mover class). My move class controls a large number of what the game does.

To make sure I have good encapsulation, I have the form that will only call the Game class and the Game class will call the correct methods from each of their respective classes. Now, I am having a problem, I am having a hard time deciding which class that methods best fit and if I need to have a private object or public objects. 

I talked to my team lead about the problems I was having with this. I just needed a gentle reminder, Private objects will only be used in their class. Objects should only be public when they will be called by another class. To better encapsulate our objects we call the public object, but the private is the only one that can change our public object.

As I have been writing the code and following the "hints" I am given from the book, I have gotten a few errors, like I created a method using public abstract string Name. I had the lovely red squiggly lines in VS. Hey, you can't have an abstract method when the class isn't abstract! The error was pretty helpful, it still took me a few minutes to realize what the error was telling me. I got it. Another error I got while working on the Weapon class. Below is the picture:

 The NearBy class only has two arguments. I remembered this one pretty quick, I need to overload this method and have it use have one method with two arguments and the overloaded method taking three arguments. 

I am also overriding a method called Move for each of my enemy types. Honestly, this confuse me for a minute on what I needed to call. I had the example the book gave me for the Mover class with the Move method. The enemies need to find out where the player is to determine which direction to move. I forgot that I had method in the Game class that determines where the player is at and the enemy class instantiates a game class. 

 
Things are starting to come together and, after I think about what needs to be done for a while, I have started realizing what needs to be done. It is slow going, but I hope I become better and more efficient with the coding and realizing what needs to be done. Maybe I can give you The Quest in the next week.

Thanks for reading, I'm off to read The Marian.

Thursday, February 25, 2016

Anyone hungry?

So, I was almost done with chapter 8. It was just a few more collections that act similar to lists. They are queues and stacks. The book used language I was used to hearing in my prior job, LIFO and FIFO (last in first out and first in first out). LIFO refers to stacks and FIFO refers to queues. I thought about those and how I choose how to treat my lots when buying stocks, do I want to pay taxes on those I first bought when I sell or those that were the most recent purchase. Okay, an easier way to think about it queues: treated like a line, the people who get in line first are the first to get their food or be seated. Stacks are take the top, like Pringles. You have to take the top Pringle in the can to get to the ones at the bottom.

Alright, seems simple. Let's take a look.To create a queue you add some code like:

Queue myQueue = new Queue();

Then to add to the queue:

myQueue.Enqueue("Piece of data");

Or remove:

myQueue.Dequeue;

Remember FIFO. That "Piece of data" we put in will be the first out. And now to show stacks:

Stack myStack = new Stack();

A little different to put in a stack, we push the piece of data in:

myStack.Push("Stack data goes here");

Then to remove data from the stack we pop it out:

myStack.Pop;

Both stack and queue inherit from IEnumerable and, pretty easily, we can move our data from a queue to a stack to a list and back (probably any combination you can think of) by overloading the constructor. Example:

Queue myQueue = new Queue();
*enter data into the myQueue*
Stack myStack = new Stack(myQueue);
List myList = new List(myStack);

At the end of a chapter we created a flap jack tracker to see and feed lumberjacks (does anyone like soggy flapjacks?). A lot of concepts are starting to come together.



Next up is another lab. No help on this one, wish me luck!

Wednesday, February 24, 2016

cSharpDictionary.ContainsKey("GoFish") - Another section of chapter 8

I still am not done reading Chapter 8. Although I have been reading and coding most nights (except the nights my wife and daughter were both sick or doing my taxes which are always phone *please insert sarcasm*) it takes me a while to get through the material. 

Well, since my last post a week and a half ago, I have mostly been working on a project in chapter 8. I tried really hard not to use the help for this project and perhaps I have learned something during the week. I just finished the Go Fish project in chapter eight and I did use the code that is provided in the book. I was stuck, what was I to do? Sometimes I ask myself, is object oriented programming for me? I felt when doing VBA that I got a relatively good grasp on what I was doing and didn't have to refer to the web much after doing it for a while. Perhaps I will start feeling that way with C#. I will say there are pieces that I look at what needs to be done and a light bulb goes on. Those are the days that help me continue spending any small amount of free time I have trying to become a coder. Just code more each day I guess (I try to do CodeWars but feel sometimes they are above what I know, maybe those are the good ones to actually test my skills) and have joined some communities like codenewbie.org (full of people wanting to learn to code from all backgrounds). What helped you learn to code?

One great thing about this chapter is that it made me really look at overloaded objects. As usual, We have talked about overloading before at work and I have never really grasped what that meant. This chapter was discussing overloaded methods and I probably missed it early on in the book, but I was really feeling lost. I spent some time investigating to find out that I really didn't know much about overloaded objects. Come to find out, they can probably come in handy. I like the definition from MSDN:

Members can have the same name as long as their parameter lists differ. When two or more members in a type are the same kind of member (method, property, constructor, and so on) and have the same name and different parameter lists, the member is said to be overloaded.



Just pass the correct parameters and the code will use the correct overloaded object. The Go Fish project actually uses one so you can find what card the computer will choose and then call the method that the human player uses. pretty nifty.

Hey, you can also create a dictionary to store definitions of keys. Just do:
Dictionary kv = new Dictionary ;

You set your TValue object type and key (keys must be unique just like the dictionary you use!) and enter data. You can then count the data, see if objects are in the dictionary, remove items you don't like, and add items you do like. There seems to be a lot more you can do with dictionaries. 

GoFish! Game - I still have not won the computer, I can only tie the computer. AI must cheat.

Until next time.

"I like to fish. Fishing is always a way of relaxing." Tom Felton

Sunday, February 14, 2016

enum Ch8FirstHalf { Collections, Enums, Icomparable, IComparer }

First, let me start by staying that I may have finally figured GitHub out. I haven't deleted any projects for a while (yeah!) and I actually started using it on two computers. It was helpful this weekend as the computer I have been using my work computer to do all the coding. Well, just the other day I installed VS 2015 Community on my home computer, just in case, with GitHub. As I was coding tonight, I couldn't find my charger for my work computer so it came in handy that I had everything installed so I just cloned my chapter 8 repository and I was back in business. Worked like a charm!

Now, chapter 8, well at least the first part of it. Collections - pretty nice, they allow you to store, sort, and manage all the data that your programs need. I bet these will come in real handy when coding. Let's check them out.

First up was Enummerate Values, a.k.a. Emum. These are a data type that only allows certain values for a piece of data. I have seen those before! Actually, only a few times at work, but I have seen them and now I understand what they are used for and why. We have talked about enums in our stand-ups or in water cooler conversations and now I can actually add to the conversations! "Hey, just take that enum and assign a number value to it and BAM!"

Example to restrict the suits a card can have:
    public enum Suit
    {
        Heart,
        Spade,
        Diamond,
        Clubs,
    }

Sweet! I can make sure the correct values are the only ones used. But! Enums have their limitations. What if I have an unknown amount of items to put in, or you have objects you need to put in a list instead of just a type? *Hint* Use a list

Lists take objects and you can assign anything to it as long as it is polymorphic. That leaves it wide open. So you have your enum that tells you what suits you can use and say that you have one that tells you the values that can be used for your cards. Now you can create a list that contains a card with both a suit and a value (you need a Card class as well):

            List cards = new List();

            for (int i = 0; i <= 4; i++)
            {
                cards.Add(new Card((Suit)random.Next(4), (Value)random.Next(1, 14)));
                Console.WriteLine(cards[i].Name);
            }

Your lists will automatically resize itself when objects are added or removed. Arrays (talked about in another blog) can't do that so you will need to know how many objects to include in an array or leave the correct number blank spots to add to the array. (I understand .Net has a bunch of collections to solve these issues, but I don't know about them yet and I am told List is the most common type).

You also have IComparable and IComparer to help sort your lists. Takes a little bit of coding, but essentially you create an integer output and tell it if it should be higher or lower by returning a -1, 1, or 0 (the same value). Create a method called Compare in IComparer and give it two object parameters then do like below:

    class CardComparer_byValue : IComparer
    {
        public int Compare(Card x, Card y)
        {
            if (x.Value > y.Value) return 1;
            else if (x.Value < y.Value) return -1;
            else
            {
                if (x.Suit > y.Suit) return 1;
                else if (x.Suit < y.Suit) return -1;
                else return 0;
            }

        }

(I know that isn't as efficient as it could be, but I didn't use the books help on this activity AT. ALL!)
Also, remember that if you are comparing Enums it will use the index number assigned. The enum above for the suit would sort by Heart, Spade, Diamond, and then Clubs.

As mentioned above, I haven't used the help yet. I have used my prior projects to check my code or find an example to modify for my new project use. I am feeling pretty good.

https://github.com/robertjorg/Ch8/tree/master/FiveRandomCards
https://github.com/robertjorg/Ch8/tree/master/ListOfDucks/ListOfDucks - I think we will be using this one later as the book had me add some methods that we haven't used yet.