WTF is are Stacks, Queues, and Deques ?

Stack

A stack is a stack of books, or a stack of sandbags or a stack of elephants or even a stack of unicorns. Basically a stack is anything that follows LIFO (Last In First Out), which means that if the last thing you put onto the stack is the first thing you have to take out, then its a stack.

Lets say you build a tower of blocks, that tower is a stack. Why ? Cause to get to the block at the base you need to take off all the other blocks. Below you will see a visual example of what I am talking about.

stackexample

 

Queue

A Queue in programming is the same thing as the Queue while in line to buy food, or go to a movie, or get into a night club, its a first come first serve basis. Meaning the first thing to get out of a Queue was the first thing to go into the Queue.

You can also think of Queues as pipes that transport things. In the case of plumbing, the steel pipe and the water moving through it the Queue. Since the water that first enters the pipe is the water that first leaves the pipe.

Below is a diagram to show what I am talking about:

queuesexample

 

Deques

Deques are like the cooler older brother of the Queue, since it lets things flow in more then one direction. Now the user of the data structure can choose how they take elements out of it. If you understood how Queues worked, then you should be able to understand the diagram below.

dequesexample

Project – Cognative Oncology Systems (COS)

Overview

COS is a Saas product designed to help Oncologists better diagnose and track tumours in their patients. This MVP is for my end of degree capstone project.

COS uses a trained neural network to do Image Segmentation on CT and MRI Scans.

Here is a link to the presentation that was made in 2018: https://docs.google.com/presentation/d/1jemo6qzxRQu7MUc8TgouUCiTZMz8LapDyJOfqdsiyLM/edit?usp=sharing

Technolgies Used

COS uses a number of open source and closed source technolgies:

  • ASPNET MVC
  • Flask
  • Razor Pages
  • JQuery
  • Tensor Flow
  • Docker
  • MS SQL
  • Python
  • C#

Hosted On:

  • Azure Web App as a Service
  • Azure VM (Ubuntu)

 

WTF is Token Authentication ?

So your working on a web app and you realize you want to allow them have accounts and login and out. To accomplish this, you can use a number of different things, or just use what ever your web framework (ASP.NET MVC, Express, Rails, and etc) of choose does.

Or you can use this thing called “Token Authentication”. Now what it is, exactly what it sounds like, its just a token you pass between your client (browser) and server to validate your request.

You might be thinking well that sounds okay but what stops someone from capturing your token and pretending to be you. Or what would stop someone from making a fake token ?

JWT (JSON Web Token) stops all those things. It is self contained and can hold a variety of different information. Its structure can be broken down into three parts:

  1. Header (can be decoded by anyone)
    • Contains what algorithm was used to encrypt it
  2. Payload (can be decoded by anyone)
    • The info (user name, id, expiry date and etc) stored inside the token
    • Got to be careful with what type of info you put in here
  3. Signature
    • What the server uses to actually validate the token.
    • Generated by doing the following :
    • HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)
    • That “secret” part is what is used to generate the signature, and lives on your server.

     

So that is why:

  1. A person cannot capture your token and infinity use it , since we can specify a expiry date.
  2. A person cannot make a fake one, since we hash the token with a secret that only lives on the server

A few cool side features of using a JWT is that the server does not need to validate the user by interacting with the data store. Which may be a big deal if you want to have a high performance application. The other cool feature is that since you have reduced your authentication method to a JWT, it gives you a lot more flexibility in what ( maybe a mobile app ) can interact with your API.

WTF is an Extension ?

Have you every want to modify your car ? Well if you have then you already know the basics of what a extension is. Since you modify something that someone else has made (maybe you also made it too, but thats okay).

OR have you ever been in a situation where, you are working on something. And you thought “maybe I should write a new class to extend this other class, that way I add to the functionality”. You could do that, “could” being the keyword there. OR you could just use Extentions 🙂

Extensions let you add new functionality to existing classes, structs, enumerations, or protocols. All you have to do is extended them.

WTF is a closure ? 

Your going about your normal programming life. Everything is fine, your using functions and classes and variables, and etc. And you’ll be thinking “I got this programming thing pretty much in the bag”

But then you see “it” what “it” is your not sure. Its something coming out the side of your function … OMG is looks like another function. A function against a function ???

We all know what a function is, it is just piece of code that we can use in different places. It some times takes in varables and spits them out. This is all “normal”, however what if I told you that you could return a function from a function ? Or even add a function as a input value ? Pretty crazy right ?

Some of you out there might be thinking, “why would you need this ? stop making things soo complicated !” Well if you want your applications to run asynchronously, your gonna wanna use closures when ever you do something that takes alot of time.

So the use case would go something like this:You wanna log someone in, and execute something else as soon as it finishs, without freezing up the UI (in a iOS app).

Instead of doing it the standard way of writing the code that needs to be executed right after the method call. You can just pass the login function, another function to execute once done.

The in depth code will come in part two.

Hope you found the theory behind it easy to understand 😅

Project – Pins

Pins is a hyper causal game I made awhile ago. It revolves around trying to get all your pins stuck into a circling object above. The challenge comes in getting all the pins to stick, with out touching any of the other pins.

Here it is on both the iTunes and Google Play Store:

Here is a link to the Github repo: https://github.com/RedGhoul/Pins

Here are a few of the screen shoots:

 

Project – The Event Horizon

This is a game I have in development. It is an atmospheric horror FPS, with rogue lite elements. I am using Unity to make it. Whats funny is that I hate scary games, and have almost never played one, but now I am making one lol. Below is what I have done so far.

And here is link to the github repo: https://github.com/RedGhoul/FPS_4