Coding 101


A journey into the life

Check your inputs

One of the lessons from flatiron school was to make sure you validate your inputs - never trust user inputs. This thought came up recently where I read an article about using SQL queries as inputs and by doing so you can query certain information if it is allowed to be passed through into the back end. Anything that requires an outside source needs to be validated for security reasons, programming is so flexiable that without any forms of test or security it can be easily circumvented or altered in some malicious way.


Binary trees

Recently I started to play more with binary trees to try to understand the data structure. This all came about as I was trying to build out a delete function that deletes a given node from the tree. I have manage to successfully delete nodes that either have only 1 child or no childe at all. My only problem is to delete a node with two children. I understand the concept of how It should be done - the nodes needs to be replaced by the lowest node (if the node is to the right of the root) or the largest node (if the node is to the left of root).


Work from both sides

Recently I had a technical interview involving strings and reversing the letters in a string. So given a string that can contain multiple words, reverse each word but leave the punctuations where they are at. As I was working through it, I was doing it one at the time, but the interviewer gavea great suggestion what if you work from both ends?


Git Version Control

I recently read this article entitled “Understanding git under the hood”. It was quite an interesting read, I’d defintely recomment the read to someone trying to understand how git works. It goes through a simple example of commiting 1 file ‘a’ then another ‘b’ and then commiting a change to ‘a’ and finally a change to ‘b’. The general graph shows how git keeps data.


nuisances of sql

I recently had a coding challenge and wanted to share my thoughts. I was working with a SQL query and my original answer invovled joining two seperate queryies to create a new table where something that was ‘checked out’ is not ‘commited’. After the actual challenge I decided to take it upon myself to implement it to see how well it does; in thought it was sound - you want things that are “checked out” but not “commited” so it would make sense to have one not in the other.