public-facing, public-learning; the job search process begins; what are algorithms anyway; meche and cs mindsets

soooooooo today i had an actual coding interview (okay, it was like a snack sized one, a 10 minute one)

i’m slowly swinging around from my pre-grad school mindset, where Big-O was some random notation thing that was not relevant to real life (okay maybe i was working in a meche lab heh)

to my new friends circle ™ where Big-O notation isn’t some Abstract Greek Letters but a living breathing concept. data structures tools to solve common problems you keep running into in your life !

sure, i can solve the problems if i need to; but in a kludgy way. and darn if someone hasn’t invented the wheel already

( that’s always the case working on your own — if only you knew this additional knowledge, you would’ve solved your problem ages ago. but now i’m seeing a whole interesting class of problems and spaces that get opened up if i climbed up this ladder )

i guess in the end these concepts can be my friend and not my enemy 🙂 which means learning about them is no longer a meaningless chore / hoop to jump through, but instead something that will let me do more Terrible Projects; and in fact come up with those Terrible Project Ideas in the first place !

for instance, today i interviewed with a travel-oriented company. i really liked the people, and the problems they spoke of seemed really interesting and relatable

… i’m starting to sound like a computer science major, i’ve been corrupted … i’m not sure when it started to happen. was it really just this past year? maybe even just this past semester, after i passed quals?

I think quite possibly so! I feel so free now that I’ve passed quals…

the learning in public thing — nowadays companies always ask you for your github, and tbh my code is terrible and i know it. i’m not proud of it but y’know busy getting the research done

i think part of it is this weird really hindersome feeling of “oh people expect that i should be more than i am” so it’s hard to be so public about stuff. but whatever ! my life is mine to live.

admittedly also, i feel a lot better having actually gotten an interview instead of just emails or lack of responses lol

actually one company forced me to use ripplematch and i am finding it really interesting

it’s essentially a tinder interface: swipe left or right on company matches. then it has a whole hand-holding hinge feeling to it: you get little tutorials emailed to you about how to do this or that. i actually really appreciate the hand holding.

also, churn: my collaborator in the justice system mentioned that it used to be common to work with the same partners for 10 years — now people come in and out, and are moving about. According to a whitepaper by the same company i interviewed for — that’s about Company Innovation instead of Company Stagnation, but man. Talk about the overhead and the churn.

of course !! this is all complicated by the fact that my work is on illegal activity that’s public on the internet. so i would normally blog about all my interesting findings, but that feels a bit awkward. still … at this point i am starting to think that i should be less concerned and simply do what i naturally do: document my findings, be enthusiastic about it, be public about it, and try to build momentum instead of wallowing about indecisively doing nothing

oh

i was going to find a personal project that i could iteratively improve with algorithms, but then i realized there’s an interactive version of project euler

https://www.freecodecamp.org/learn/coding-interview-prep/project-euler/

livestreaming working on these challenges??? oh boy haha

brb there goes a hundred hours of my life

(oh, the public learning idea is here: https://www.codewars.com/post/learn-in-public-the-community-based-learning-strategy-that-improves-programming-skills)

(related link, programming project ideas: https://github.com/karan/Projects)

an hour with react.js official tutorial

note

note that there’s nothing particularly interesting about this, I just followed the https://beta.reactjs.org/learn/tutorial-tic-tac-toe official tutorial for the most part.

the only issues with the official tutorial that I ran into were

1. I needed to put in “import React from “react”;” at the top of App.js (it was only at the top of index.js for me) and

2. I needed to use <React.Fragment> and </React.Fragment> instead of <> and </>. So I guess that the “shortcuts” don’t work for me. (Perhaps I am using an old version of node or react, I don’t even know how to check)

onwards

I made this in the course of about an hour (+/- another 30 mins installing things >_<) ! It was really satisfying, since it’s a tweak on the existing tutorial (I also only got halfway through that ^^;)

video of my first “app” 😀

the tutorial is reasonable to speed run if you already know some programming concepts. but i really liked the “learn by doing” approach (and also the nod to the other approach of starting from the basics, which i really admire but struggle to implement. i’ve never e.g. read through every function of every module of scipy)

how i got here (yadda yadda)

after apparently deciding to redo my entire resume in jekyll, i also decided to procrastinate my looming thesis deadline (also my entire room reorganizing which exploded my room into our common living room) by futzing around with react.

unfortunately all the react tutorials are like “start out with a zillion files!” but after following https://www.w3schools.com/react/react_getstarted.asp “React directly in HTML”, aka React with just one file, I felt a lot more confident. Especially reading the last line on the page “If you want to follow the same steps on your computer, start by stripping down the src folder to only contain one file: index.js.”. I felt a lot better.

But the promise of tic-tac-toe lured me to the official tutorial, and I’m glad. (I also had a bit of competitive spirit to egg me on, from my coworker. Though I had a definite advantage having spent so much time on scrapy and css selectors the past two weeks).

notes on speed run: mapping react to general programming concepts

so the following are my notes. they might be wildly representing the actual concepts so take heed. it will be fun to read later about how off i was understanding what was actually going on.

passing parameters to functions

curly braces denote “props” or properties, and functions can take them in when they are called (with the special syntax, triangle brackets with a slash at the end, />). aka

<Square value=”1″ />

calls the Square function and passes the value in, that is

function Square({value}){ blah … }

handling clicks

well, in the button (or other element) declare the “onClick” should be handled by a function of your choosing.

function handleClick(){ blah ... } 

< button 
  className='square'
  onClick={handleClick}
>

Finally,

normal variables (that store their own value and can be changed)

apparently there is a “useState” syntax for what i think of as normal variables.

const [value, setValue] = useState(null);

This means that there is a variable value, which can be changed by a function of our choosing, specifically setValue().

finally

this is my final code for my “put X’s on a grid, and be able to remove them”. Basically, I create a variable “is X set”. I’m either changing the “value” of the square to a ” ” (blank space) or an “x” depending on the flag “is X set”.

import React from "react"; // FIXED by adding this line, why is official tutorial broken  

import { useState } from 'react';

//note: value is discarded
export default function Board() {
  return (
    <React.Fragment>
      <div className="board-row">
        <Square/> 
        <Square/>
        <Square/>
      </div>
      <div className="board-row">
        <Square/>
        <Square/>
        <Square/>
      </div>
      <div className="board-row">
        <Square/>
        <Square/>
        <Square/>
      </div>
    </React.Fragment>
  );
}

function Square() {
  const [xIsSet, setXIsSet] = useState(true);
  const [value, setValue] = useState(null);

  function handleClick(){
    console.log('clicked');
    if (xIsSet) {
      setValue('');
    } else {
      setValue('X');
    }
    setXIsSet(!xIsSet);
  }

  return (
    < button 
      className='square'
      onClick={handleClick}
    >
      {value}
    </button>
  );
}

that’s all folks

other life news

got my first job/internship rejection, which is good, means i finally got an application in. or at least that’s the mindset i’m working on (new year, new me?)

will try to get a dozen more in this week and not be attached to any particular outcome. there are groups i want to work with, but i need to remember my own work (on counter-trafficking with machine learning — more on this later) is cool too