Everything Fibonacci

Sun Oct 07 2018

If you have ever taken a computer science class you probably know what the fibonacci sequence is and how to calculate it. For those who don’t know: Fibonacci is a sequence of numbers starting with 0,1 whose next number is the sum of the two previous numbers. After having multiple of my CS classes give lectures and homeworks on the Fibonacci sequence; I decided to write a blog post going over the 4 main ways of calculating the nth term of the Fibonacci sequence. In addition to providing the python code for calculating the nth perm of the sequence, a proof for their validity and an analysis of their time complexities both mathematically and empirically will be examined.

Slow Recursive Definition

By the definition of the Fibonacci sequence, it is the most natural to write it as a recursive definition.

def fib(n):
    if n == 0 or n == 1:
        return n
    return fib(n-1) + fib(n-2)

Time Complexity



C to C++ Tutorial

Thu Aug 02 2018

This post aims to cover all the major topics that C programmers need to know before they start writing C++ programs. I kept this post as short and concise as possible to enable people to use this as a quick reference to quickly jump into C++. This post assumes that you have prior knowledge of both C and object oriented-programming concepts. Each topic is quickly covered in a code snippet and some additional explanation is provided if necessary.

Input/Output

Input and output in C++ is easy, you use “cout” and “cin”. When printing with “cout”, you separate what your printing with “<<”; “endl” prints a new line.

using namespace std;                        //namespaces talked about below
#include <iostream>                         //Include statement for terminal IO.

int main()
{
    cout << "Hello World" << endl;          // HELLO WORLD!
    
    int a;
    cin >> a;                               //inputs an int into a -- notice how arrows face the direction of IO
    
    cout << "You entered: " << a << endl;   //prints what you entered
    
    return 0;                               // return sucess code
}



Gremlin in 10 Minutes

Sat Jul 28 2018

What is Gremlin?

Gremlin is a graph traversal language: think of Gremlin as the SQL for graph databases. Gremlin is not a graph database server, it is a language; but, there is a Gremlin Server and a Gremlin Console available for interacting with graph databases. It is possible to use Gremlin on large database platforms like Titan and HBase.

Graph Data Base Basics

A graph database is based on graph theory. A graph is composed of nodes, edges, and properties. A key object/component in a graph database is stored as a node. Nodes are connected via edges representing relationships. For example, you may represent people as nodes and have edges representing friendships. You can assign properties to both nodes and edges. A person (node) may have the properties of age and name, where a friendship (edge) may have a start date property.

Why Graph Databases?



Node Website Optimization

Sun Jul 22 2018

It is a well-known fact that a fast website is critical towards having high user retention. Google looks favorable upon websites which are well optimized and fast. If you are using a CMS like WordPress or Wix, a lot of optimization is done automatically. If you like to build stuff from scratch like me, there is a ton of work required to optimize a website. This post will cover the 8 things that I did to decrease the load time of this blog written in node by two seconds.

Final Results

Final Website Speed Test
Final Website Speed Test

This is the result for a single blog post.



Steam Friends Graph

Tue Jun 26 2018

Links

Project Description

This project utilizes the steam API and graph databases to create friend graphs for clients in a web browser. Currently there are two types of graphs available: - Friends of Friends Graph: This graph displays all the steam friends of a single person and all their friend’s friends. - Common Friends Graph: This graph will only display your friends; however, it will draw edges between your friends’ if they are friends with each other.

Motivation

While learning about graph databases I thought that it would be awesome to create a massive graph database with steam friends in it. After a quick google search, I realized that some other people have done similar things in python, however, nobody has ever made a live website do this. Using my prior knowledge of the steam API and new knowledge of gremlin, Hadoop and HBase, I figured that this would be a great weekend project. Although I got most of the functionality done in the first weekend, I ended up working on it for 3 weekends hammering out all the edges. After ample work, I am satisfied with the appearance and functionality of the website, but, I am looking forward to making some improvements in the future.

Lucid chart diagram
Lucid chart diagram

Technical Details



My College Essay

Fri Mar 16 2018

Students hate writing essays. It is easy to get wrapped up in the traditional 5 paragraph essay which is dull and boring. When writing a college essay, you have more freedom since you are telling a personal narrative. Since you are writing a story, you want to make it interesting. You should not rephrase the prompt which you are responding to, and you should not write about anything that the admissions office already knows. Your application already mentions all the clubs, classes, sports, and volunteer service you do– so don’t mention them.

I don’t want to go off on a huge tangent about how to write the perfect college essay, I’m not an expert. However, I would like to share my personal college essay which got me accepted into RIT and Clarkson last year. As a computer science applicant, it is a great idea to write your college essay based on the programming experience you had outside of school.

/**
 * Title: HTTP ERROR 500
 *
 * Prompt: Describe a problem you’ve solved
 *
 * @author Jeffery Russell
 *
 * September 13, 2016
 */

#include <stdio.h>

main()  
{  
printf("

        On a dim screen in the corner of my room flashed the dreadful message- HTTP
    ERROR 500. That simple warning taunted, probed, and questioned my mind for
    hours on end. As I pivoted my binocular gaze from the computer to out the
    window, I saw the front yard dimly lit by the drowsy moon. Time for a second
    stood still as the crickets chirped and the trees swayed in the cool summer
    breeze. Closing my eyes for that second of silence made me realize how tired
    I really was. A beeping, piercing, and dinging sound focused my gaze back to
    the computer. Still flashing was that error reminding me that I had a long
    night ahead.
    
        For the past two weeks I had been working on an employee management system
    for a store. This web based system was to keep track of employee hours for
    payroll. The project was near complete; however, there was a few bugs left
    to fix. The most annoying of which was password verification for the
    webform. Now nearing the end of the development cycle, the project was
    suppose to go live tomorrow.
    
        Debugging a project is often a daunting task for programmers. Simply finding
    an error is like finding a misspelled word in the dictionary. Correcting the
    misspelling may be easy but finding that word is another story. What I love
    about programming is that the program does exactly what I tell it to do. If
    it makes a mistake it’s because I told it to, not because it feels tired, or
    doesn't like me. Every bug, error, and glitch I unintentionally create.
    These bugs eventually come out to the surface like a fish gasping for air.
    An error is never just a mistake. It represents something much larger- an
    error in my way of thinking. Debugging is a process that enables me to
    further understand the program and crush the bug like the parasite it is.
    
        Sitting back in my chair in deep thought I resumed the process of scanning,
    poking, and probing my code for any source of the error. For the past hour I
    narrowed the source of the error to ten lines of dubious code. Pondering
    these lines of code I added an echo statement which allows me to see the
    inner workings of the code. The error became as clear as day, the password
    was not getting hashed: a feature that adds security to password storage.
    Excitedly I typed a few lines of code to fix this problem. Then swiftly I
    pressed execute, only to my disappointment to receive a different error
    code. Eyes glazed over, I realized my mistake. In the process of debugging I
    left a block of code commented out.
    
        On a dim screen in the corner of my room beamed the message- Currently
    Working.

");  
}



Musical Floppy Drive Build Log

Tue Mar 13 2018

It is fun to find an interesting use for old technology. Being someone who has tons of old floppy drives and loves music, I decided to turn my old floppy drives into an orchestra. I’m not sure where I first learned about musical floppy drives, however, there are thousands of videos on YouTube.

This project first started over a year ago when I connected two floppy drives to a Raspberry Pi to play the Star Wars theme.



Deepfakes

Fri Feb 23 2018

What are Deepfakes

We all know that you can do silly face swaps with snap chat and other apps. Previously face swapping faces on videos was terrible because you simply sequentially swapped all the faces frame by frame. As a result, the quality was very poor and did not handle head movements well. A Reddit user by the name of Deepfake created a recurrent neural net which accurately face swaps videos. Deepfake(the user) initially gathered a following by swapping celebrity faces onto porn videos.

Reddit has banned Deepfake and Pornhub has banned deepfakes from their platforms. Despite the attempts to remove fake deepfake videos, they are currently all over the internet.

How Can You Make Deepfakes



University vs Teaching Yourself Programming

Tue Feb 13 2018

Many people on the internet furiously debate whether it is better to learn how to program in college vs teaching yourself. This is not necessarily a one-sided debate, there are merits of both teaching yourself how to program and taking computer science in college.

University

The main advantage of taking Computer Science in college is that you are also taking a lot of math and science courses. When talking to a professor from Clarkson University he said that they were not teaching students simply how to get jobs, but how to pioneer and shape the field. It is possible to buy a book and teach yourself how to program Python or attend a coding boot camp. However, the tech field is changing at a rapid pace, and what you learn now may be irrelevant in five years. The combination of programming courses and other math and science related courses allows students to create the tech of the future. Think about all the advancements in artificial intelligence we have made in the past year, all that requires higher level statistics and calculus.



Using English Conventions To Write Clean Code

Thu Feb 08 2018

Is that English?

private boolean canCompressBlock(Coordinate start, int size){
   return size == (int)Arrays.stream(this.rawImage, start.getRow(), start.getRow() + size)
           .filter(r-> size == (int)Arrays.stream(r, start.getCol(), start.getCol() + size)
                   .filter(c-> c == this.rawImage[start.getRow()][start.getCol()])
                   .count()).count();
}                   

After 30 minutes of brain boiling work, I finally finished crafting the most beautiful lambda statement in Java. What could have simply been done in two nested for loops, I decided to tackle the problem with the infamous lambda statement– feared by most programmers. Lambda statements by no stretch makes code any easier to read since the same tasks can be accomplished through using simpler and more recognizable syntax. Yet I decided to utilize this excessive lambda statement. After much contemplation, I realized that I was only using lambda statements due to the fact that people inside of a field typically try to write to impress their peers. This code chunk is clearly a sophisticated use of functional programming and will likely impress people inside the computer science community; however, 95% of my computer science class would not understand a single word of this statement. This poses a dilemma to newer programmers which may have difficulty reading this “sophisticated code”. After years of helping students learn to program in my high school, I know that students struggle with making their own code legible. Their code often lacks sophistication and clarity. However, at the same time many of my college professors which are embedded in the field of computer science often write code that is too sophisticated and obscure for anybody to easily understand. This got me thinking, how can we teach students to programming in a way that yields legible code for everybody in the computer science field? I turned towards English. It turns out that programming can take a few pointers from English to improve its clarity. The same skills used to teach writing can be applied when teaching students to program because excellent code and writing contains thought through structure, clear phrasing and readability.