Redesigning my site by hand

Hi all. Since I just finished my semester which included taking my first client side web scripting class, I’ve decided to redesign my personal site as an ongoing project. So far it has been in WordPress but I am now doing it by hand with html and css. I’m not sure if the blog part will remain WordPress or if I will make that, too.

Today I am learning: Angular, JSON, AJAX, and jQuery

Working on pipe ‘|’ and wait() for Linux shells 🍽️

Today I am trying to finish up my Linux shell. I am looking through the functions I wrote to determine where I need to use the wait() or waitpid() command. As I understand it, if a function is using a pipe ‘|’ then the parent process which is reading from the pipe should be told to wait for its child process which is feeding into the pipe. That makes sense. If you’re a waiter, you need to wait for the food to be put on a plate before you go and try to bring it to a patron. 🍽️

Learning about processes and threads in Linux. I’m specifically reading a lot about the fork() function and the exec() family of functions.

Updating my JS piano

I’m working on adding more features to my JavaScript piano. I was able to add two listeners so that you can play it either with the keyboard or with the mouse.

For this assignment in our web scripting class, we are to let someone alter some aspects of the piano. Since I use a colemak keyboard layout, I would like to let people alter which keys fire which notes. When I look in my switch statement for the keyboard listener I see:

/* keyboard listener to enable playing with standard keyboard input*/
document.addEventListener("keydown", function(event) {

        var note; /*used to track which note is pressed*/


        /* setup a switch statement for keyboard presses */
        switch (event.keyCode){
            case 65:
                note = "key_e";

            case 83:
                note = "key_f";

            case 68:
                note = "key_g";

            case 70:
                note = "key_a";

            case 71: // left thumb
                note = "key_b";

            case 72: //right thumb
                note = "key_middleC";

            case 74:
                note = "key_d2";

            case 75:
                note = "key_e2";

            case 76:
                note = "key_f2";

            case 186: // right hand pinkie
                note = "key_g2";
        }  /*end switch*/

In this program, my JS piano framework adds an event listener to the document to listen for keyboard events. What I can try is adding 10 parameters to the JS object which let the person set which keyCode should trigger an event. Then I’ll use those parameters in the above switch statement, instead of letting the switch statement look for which keyCode was pressed.

I’ll update this later after I see what happens.

Update from the next morning….
Holy shit that didn’t work. I spent a few hours pulling my hair out. Well, I don’t have hair… pulling my beard out. I tried every which way to get the note to update but it’s giving me trouble.

I was able to abstract out the note settings so that I pass in the keycode event I want the piano object to use, but I am not yet able to update that object to a different key whenever I want to.

As you see below, I can let someone pass in keycode events for a specific note or set a default keycode event. The defaults below are for QWERTY keys. You’ll see noteE doesn’t have a default parameter. I found that if I didn’t initialize noteE, then when I create a new myPiano object and pass in an initial parameter for noteE then it will take.

var myPianoObject = myPianoFramework.makePiano( { id:"pianoObj", noteE:90 } );

If I initialize my noteE to be (65||, then then noteE will be set to keycode 65 and not 90, even when I create the object with the line of code above.

myPiano.makePiano = function(params) { = ("" ||;
    myPiano.noteE = ("" || params.noteE);
    myPiano.noteF = (83 || params.noteF);
    myPiano.noteG = (68 || params.noteG);
    myPiano.noteA = (70 || params.noteA);
    myPiano.noteB = (71 || params.noteB);
    myPiano.noteC = (72 || params.noteC); /*middle c*/
    myPiano.noteD2 = (74 || params.noteD2);
    myPiano.noteE2 = (75 || params.noteE2);
    myPiano.noteF2 = (76 || params.noteF2);
    myPiano.noteG2 = (186 || params.noteG2);

The trouble is when I want to let the user type in a new keycode event and update the javascript object. I’ve tried every manner of things that look like:

myPianoObject.noteE = 90;


myPianoObject.noteE.value = 90;


myPianoObject= {noteE:90}

…but nothing there is working. I wonder if I need to make a specific function within my javascript object that lets me update that parameter. I will keep trying.

Visual metaphor for cache memory

Personally, I need visual metaphors. To understand cache memory I constructed this elaborate system in my mind connected to Temple’s Paley library, some fictional shelves displaying photos, and the elevator down to the basement where my friend works.

The shelves(cache slots) hold boxes(blocks) and each shelf has a Tag. There’s a map pointing to where each tag is. There’s a “write policy” on the wall that says if you alter a photo, you must update main memory!” Lastly there’s an elevator (to indicate slowness) down to Main Memory where you see many shelves and many boxes. The part I had to stick in at the end is a little robot called Replacement Algorithm who keeps track of which block hasn’t been requested in a long time and replaces that cache with new data when space is needed. It’s working for me.

I first tried to do this with visualizing a Bus and passengers getting on and off, but it broke down. Unintentional dad joke.

Today I am: watching Gary Vaynerchuk videos, struggling with understanding fork() & exec() & threads & processes, and writing pseudocode for my Linux shell. Last night I could not get CLion to compile anything on my Ubuntu install, and after cursing at it for an hour, I gave up and went to bed. This morning I decided coding the shell in Sublime text will make me a better programmer anyway, so that’s what I’ll do.