A Blog With Rails


Warning this only works on Mac OS.

Now before you start thinking your going to make the next WordPress, let me just say we are only going to be making the MVP of a blogging site, that’s right a MVP. What is a MVP you may ask ? It stands for Minimum Viable Product, this thing we are about to build is just a web app that has CRUD functionality. What is CRUD you ask ? CRUD is Create Read Update Destroy.

Don’t be afraid of the terminal, the terminal is your friend for life 🙂 you just got to treat it right.

Up and running:

  1. Install Home Brew, is manages the software you need to manage all the software, your going to use to make software. Just follow the instructions on here: https://brew.sh/
  2. Install Bundler, it manages the specific Ruby software libraries for your application. Type the following command “gem install bundler”.
  3. Install Nokogiri, it gives Ruby the ability to understand HTML and CSS among other things. Type the following command “gem install nokogiri”. This is going to take awhile, chill out and take a break you have been working too hard 🙂
  4. Install Rails, its the thing that you build on top of, to make your web application. Ruby the language has libraries for doing different things. Rails is just a really big library for making web based applications.  As you may have guess just type in “gem install rails”.


Making a Rails App:

  1. CD into a folder you would like to be in and run the following command “rails new <name of your app here> -T “
  2. Now if you look into the folder you just ran this command in, you will see a folder with the name of your app. Open this with your favorite text editor, VSCode is always a good choice.
  3. CD into the newly created folder, and make your database. You can do this by running “rails db:create” and then running “rails db:migrate”. What this is doing is creating a database, and then populating it with boiler plate info.
  4. Now run “rails s” and go to the URL is gives you. You should see your app, YAY you made your first rails app 🙂 If the URL isn’t working try using http: or http:


Actually making the Blog:

  1. Run “rails g scaffold Blog title:string body:text”. What this command will do is create a Blog object, that has a title and a body and can be stored in our database. Rails knows this since “g” is for generate, “scaffold” is for create everything for me, and the rest is specify what type of things you want there to be, in the object you are creating.
  2. Now you got to let the database know about this blog object you made. To do so simply run “rails db:migrate”
  3. Finally the moment you have been waiting for, run your app with “rails s” and ta-da you go your self a working rails app 🙂

“?” in Angular 5

As you an Angular component has a life cycle, much life us humans. In the beginning we are nothing, we do a bunch in the middle and then we die 🙂 However if you want to call a certain service in your “ngOnInit” to dump some values into a var that appears in your html, your going to have a bad time. Or at least angular is by throwing a lot of errors in your console, I mean it will still work.

To get rid of these errors all you have to do it the following add a “?” at the end of the end of the var that’s in the html, and ta-da errors gone. This works since the “?” tells Angular to chill out there will be a value you there “eventually”. Hmm… but why eventually you may ask ? Its because two functions before “ngOnInit” get called , the very first one being the constructor of the class and the second being the “ngOnChanges” method. So for the execution of the first two methods its asking “WTF where is this thing in the html in the .ts file ?”  which makes throw errors.

Override, Virtual, and Super in C++

When you inherit from a class you have full access to it’s variables and methods. However what do you do when you would like to use one its methods, and then add to it ? Well you would try to override the method with your definition. This can be accomplished using the “Virtual” keyword on the function you want to override on the parent class. And then using the “Override” keyword on the function in the child class. After which you would then use the “Super” keyword to call the implementation of method found in the parent class.

A real world application of this is, when you want to override and add to the “BeginPlay” method.


Here we see that the TankPlayerController inherits from the APlayerController that inherits from the Actor class. The Actor class holds the initial implementation of the “BeginPlay” method.


Machine Learning Explained – Part 1.2

Please note that I will not be covering the mathematical portions, but rather the big ideas.

Model Representation

Can come in different forms, however at the end of the day we are trying to learn a function in order to map or training. Such that it becomes a good predictor of an output given a inputs, this is a sort of regression problem. Where as functions who’s outputs are limited to a few discrete outputs, given various inputs are for classification problems.

Cost Functions

These functions are used to measure the level of accuracy of our hypothesis functions (the function we learned), by measuring the difference between our predicted value and the true output. And then computing the average error by way of the “Mean Squared Error” function. In a single variable regression problem the hypothesis function reduces to being the equation of a line.

The objective becomes to minimize the cost (or error) function. If you have ever taken Calculus before you can do that easily by taking the derivate of the function, setting it equal to zero, solving for the parameter, and using that value in your learned function.

However its not always easy when given a large set of parameters. Therefor you can also use contour plots, that act like maps to the values that reduce cost function to zero.

Gradient Descent

An easy way to think about gradient descent is by, imagining your a blind person trying to find a ball in a hilly area. You don’t know where the ball is, but you know the ball has rolled into the deepest valley in the area. However your blind so you can’t see the depth in your surroundings. Therefor you have to use your feet to feel for the steepness of the ground in front of you. By doing so you take little steps in the direction of the most steepness. This is exactly what the gradient descent algorithm does as well. It takes little steps, gauges the steepness, and then moves in that directions till it finds the global minimum of the cost function’s derivative.

You can find the first part of this series here.


Chapter 1


The woman who loved Noah

I am sorry

I was lying in bed, it was a Sunday. The smell of perfume still meandering through the air. I am not sure what it smelt like, it captured me and wouldn’t let go. I wanted to lay in bed with this smell engulfing my very being for all eternity. It made my primordial instincts confused, it smelt like what pleasures of the flesh felt like. I wondered if I lay here, with my eyes closed, and covers drawn, would I ever have the strength to raise up? As I stared up at the ceiling, who’s radiance was amplified by the shafts of light penetrating the window. I was filled with a lingering emptiness, the sort that can’t be filled, the sort that doesn’t ever get filled. For I never the emptiness wasn’t there as I grew. It only appeared after I gave all myself to another person. I shift my body to the right side of bed, without looking I feel around in the draw, for cigarettes. I take one and smoke. As I stare up at the ceiling, I can see the smoke raise up disappear into air almost as if it never existed to begin with. I close my eyes as I think that my life has been a collection of fleeting moments intertwined to others, by the red strings of fate.

I open my eyes. The sun has lurched higher in sky cover in gradients of blues, and streaked willowing white wisps. The light streamed into the room, and reflected off the mirror, creating a kaleidoscopic effect that drowned the room in ever which color of the rainbow. I turned in bed. I was greeted by her angelic face. I wondered why she had come home with me. A creature with so much grace, so much potential has chosen me. I reached out to caressed her face, I stopped half way and bring my hand back. I didn’t want to disturb the peace that she had, it was probably the only peace she would ever have. The world would only ever allow true piece in death. I lay there recovering from the night before, and the actions I had taken. My mind drifted through the vague memories of my life, from the time I first rode a bike, to when I first fell in love.

I felt as though I had lived a life other men could only dream of. I finally mustered up the strength to sit up right. I looked around the space. Was this my space ? There was little to no furniture, just large windows, and minimalist design everywhere. I stare out the window, hoping to reorient my mind. I lost my self, staring out the window, watching the rhythmic crashing of the waves, and smelling the salt in the air. Everything was frozen, everything was clear, I could feel rather than think.

I put on my robe. It wrapped me with a plush softness, and tightness that could only ever be felt, when hugged by a small child. I felt like the only thing in this world that accepted me for all that I was, was the robe. I walked out onto the balcony and let the wind flow over my skin, let the sun’s warmth reach every part of me. I must have stood there for hours.

My trance broke, when I thought I saw a boy and his dog playing catch from the corner of my eye. A smile ran across my face, for the boy reminded me of days where my happiness was never tied to any substance, or anyone. I think I had everything that anyone could ever want when I was five. Everything in the world was so foreign, my state of mind and conceptions of ideas and feels where still so new. I think those were the days I could call myself human. I don’t know how I became the person I am now.

I started to smell iron in the air; my nose was bleeding. It had made a pool on the dark slate floor. Sometimes I felt like it was the only time that I knew without a doubt I was alive. So much of my life was a husk of what it once was. At this point I felt as though it was okay to go back inside. The sand and sea, had stared into me as much as I had into them. I drifted across the room feeling the warmth of my feet, being draw away by the stone floor. I saw myself in the mirror, and asked myself, was that actually me? Is this what I looked like?

I made my way to the front porch, with a black cup of coffee. The bitterness of the dark liquid I swallowed, was drowned away by the intense amount of light and warmth. The sun was always worshiped in civilizations past, how far have we come that we never marvel at the warmth and light it provides us. The world had woken up, I was in the space between spaces, times that don’t have a name. It wasn’t early enough to be early, neither was it late enough to be the late. The exact time would be useless in order to find this time, for what was happening around me could only happen when the fate of objects both be and small where aligned just so.

There was still a bit of a chill in the air, there was still morning dew on the grass, and it wasn’t warm. It was one those rare times where the natural environment matched the artificial ones we created around us.

As I lay in my arm chair, I heard the cries and shouts of children playing. It was 3pm. My nights of debauchery had always resulted me in sleeping and rising at all times of the day. Without warning I was assaulted with a teddy bear. It had been thrown by one of the children. I stared at her as she did me. I saw it, I saw into her, I saw her entire life.

She would never live a normal life that the others did, and I wouldn’t be around to ever see it. This unassuming little girl, with pig tails, curly hair, and missing teeth, would one day hold such unfathomable value.  Although I had seen it time and time again. I could do nothing to help her to transition into the woman she would become.

I had filled my life with everything that people could ever want. I could never find anything satisfying, so I gave up trying. I had thought my life would have been much different as a younger man. I had thought that I would never achieve as much as I had done.

The girl defiantly run up to me and took back her teddy bear. I laughed as she ran away, it was the first time that a laugh wasn’t forced, in a long time. And then… then I remembered her. At the time it was the first time I had ever seen a creature like her. Her face was one that brought out the lust, jealousy, and want in others. I was much younger at that time, much more open to the world around me. That was over 30 years ago.

I finish my coffee, and slipped back into the arms of the past night’s lover. Sometimes I feel as though pleasures of the flesh are nothing but a sick illusion from god himself. As a form spit, since god is god. God, is he who is absolute, as a mere mortal I think god could never feel the same pleasures we could. We are human, and it is our fundamental flaws that allow as to feel the pleasures we do.