Home

11Jun2022: DS&A, blog setup, Codewars, Party Overflow

Created June 11, 2022

First blogpost on DevDojo! Well this will be fun - I'm really looking forward already to writing posts (and perhaps I will start to dread it later on that I will be writing almost daily) and it's not even the end of the day. I'm setting an intention that I will dedicate myself to this activity, to at least do one thing related to coding every "normal" day (I was going to do 100 days of code, but I'm likely going to be traveling and really wouldn't want to pressure myself) and write about it. It's like this image I saw: Screen Shot 2022-06-08 at 1.43.42 PM.png And it's my intention that even in two weeks' time of this practice, I will see progress in my ability to code and get better at coding.

Data Structures & Algorithms study

So for today's coding work, I first spent half an hour in the morning studying binary searches from Cory Althoff's The Self-Taught Computer Scientist book. I learned that bisect_left is the inbuilt Python function for performing binary searches, but it also actually returns you an index even if the search target is not in the list (I suppose the in keyword already tells you whether it is in there or not).

And just now out of curiosity, I also looked it up and found out that the in keyword in Python does perform a linear search. That's pretty cool.

I also found something interesting, that the book says in the Big O notation of binary search, the log base does not matter. Because it splits the list in half, I would have presumed it would be log base 2. It said that because it can be multiplied by a constant or something like this - I'm presuming it's similar to why the one-off's are ignorable in Big O because at the end of the day when it scales it's not going to matter. Anyway that was something I didn't fully capture because I presume if you have a larger log base it does cut down the search significantly.

Setting up DevDojo

Last night I spent ages trying to get the DNS of my custom domain to point to cattkaizen.devdojo.com - it didn't happen. I think because right now my custom domain is on Netlify, so I can only use it with that? I got so tired it was 1am and I gave up. I was trying to set up a cname blog.cattcodes.com but I think that doesn't work because Cloudflare asked me to remove the custom DNS addresses that were pointing to Netlify etc... anyways unimportant. The only bother I have is this blog always goes to this "Not Secure" page and you have to do Advanced settings to proceed. Might be something for DevDojo to look into but I suppose I'm not trying to be too outspoken.

So I set this up and wrote my 100000th about me. I think it's good though every about me is a new way of thinking about oneself. I like the storytelling practice.

Coding Challenge

Today is Saturday and I have almost day to myself (evening my friend Simon's invited me out to Tall Ship!) so more time to study. Today I worked on a coding challenge from Codewars called Array Difference. I have to admit I spent way longer on this challenge than I would have liked. I was trying to do a double nested for loop, then splice the array, but I think I was getting confused with the true/false (is it in the array or not) so I tried to create another array to push the values that were correct and return that array. I think it would have worked but since my nested for loop was comparing all values, it started double-upping on the array pushing when it was in there and what not - anyway I got so jumbled up, deleted everything, went to the bathroom, ate a Barebells Salty Peanut protein bar, then sat down again to try it.

This time, I was able to get it very quickly using the .filter() method where if the element from a is not in b, then make that array happen. Literally took less than 1 minute (after all that brain struggle on wait I want it if it's in the array to be removed...)

Anyways, I get that I tend to feel very scared and want to console log everything and make sure I'm holding onto the values I need. I hope that I improve on this over time.

Some project work

I've been working on building out an app from a code-along we did not get to in our cohort (the amazing thing about having our notes from class is that there were a good maybe 20 projects that were reiterating concepts we learned and did in class in some projects, but a bit different). It's called Party Overflow and it's basically a copy of Stack Overflow where users can post questions, get comments, mark comments as solution.

Today I coded out the routes and controller functions for creating comments (I'd already done posts a while ago). I tested all the API endpoints in Postman and they worked! So I believe that is most of the backend all set up...there's authorizations and everything in it. I'm looking forward to getting to the React part of the project as I haven't touched React in ages! Looking forward to getting to that part too. It's good to get a refresher on the routes and controller functions.

I think that's all I've done today, that's my wrap-up for what I did in coding today. I'm really pleased and I hope I will have more days like this where I can dedicate myself to sharpening my coding skills and getting better overall as a person as I go along (seems to have an anti-loneliness effect too..although I have just started this today).