Days 56-60: Code with Benny
If you're curious what this is all about, check out the Introduction to Code with Benny
Check out my last two posts: Days 46-50, Days 51-55
Follow me on twitter! All of these logs are posted there daily in short-form π
What I've done so far:
- Completed all 100 days of Replit's 100 Days of Python course. Wrote about what I've learned in Day 30 "Thoughts"
- Harvard's CS50, weeks 0-8.5! (85% done)
- Started my own project: ShouldIReadTheNewsToday? A tool that automatically analyzes today's news headlines from major news providers around the world, and, uses an AI model to tell you if you should read the news based on your tolerance of bad news π. Currently on pause to focus on marathon training and balance traveling!
- Daily log posts and several fun threads (follow me on twitter!)
This week, I'm in πBali! My friend, Joe, is visiting from the UK, and we are doing a travel trip, from the south of the island to the north, with stops along the way. I'm going to see some touristy things I haven't seen yet, and we will be hiking one of Bali's tallest mountains.
Oh, and 7 days until the marathon πββοΈ!!
Day 56 (May 8th, 2023)
What I covered/did
More of Week 9 Lecture of Harvard's CS50!
- Templates
- How to insert code in HTML from other HTML files (Layout (templates), which is Jinja syntax)
- GET/POST review
- redirect function review
Resources I used
Thoughts
Cruising through Week 9. One thing that the lecture started with was clarifying the purpose of CS50: that it's meant to help you learn how to learn programming, rather than learning specific languages. I think this has been a fundamental difference between this course and Replit's 100 days of python course. CS50 is more comprehensive, and is doing so by giving you the fundamental compsci building blocks that are similar across languages. Then, with these building blocks, CS50 points out how each language differs in their implementation of the blocks (i.e. in syntax), which is useful for understanding how developers think through tradeoffs when creating languages.
All this to say - when I write my summary of these 100 days, I'll definitely include most of CS50 as an important component of the coding journey, and encourage others to make use of this fantastic resource.
In marathon news: my feet are mostly healed up from my scooter crash last week, which means I can unpause my training again. 12 days to go, and I'm feeling a bit behind on my training. Hoping I can pick it up without any issues over the upcoming 12 days, and get the result I want at the race (completion, and bonus points for doing it in under 4.5 hours). Fingers crossed!!
Day 57
What I covered/did
More of Week 9 Lecture of Harvard's CS50!
- Select menu (HTML)
- Building a sample site with Flask + HTML + Templates
- More of jinja (for loop syntax)
Resources I used
Thoughts
Jinja allows for iterating on a dynamic web page - pretty cool! Can imagine this being useful for listing data coming in from users in real time. An interesting technical thing I learned: when using a "select" tag in your HTML file and trying to assign user input from that select tag to a dictionary in your python code, you have to be clear in the HTML where that user input should come from and where it should go. To do this you have to name the select tag "sport" if the variable assigned to represent values in the dictionary is called "sport". See my specific notes on that here.
Marathon training: ran a 17mi/27.5km run yesterday, nearly tying my longest run of 18mi. It was a tough one - it was through a hilly part of Bali (south Bali, "Uluwatu"), which added significantly to the challenge. I ended up stop-starting a lot (running, stopping to walk, then running again) for miles 9-15, and then picking it back up for the last 2 miles of the run. Despite the inability to run it through without stopping, I'm actually quite proud of how it turned out. I hadn't run consistently for about 1.5 weeks before that run as a result of my foot injury and scooter crash, and yet I managed to do a run of this length on difficult terrain, and push myself through a mental block around mile 9 (I was very ready to quit and call a Grab scooter to pick me up and take me back home). This is a huge confidence boost for me - I know that on race day, with a bunch of others running beside me, and people cheering us on from the sidelines, I'll have more than enough internal and external motivation to finish this thing. The only remaining question is what time I'll get. Goal is to finish under 5hrs, and stretch goal is to finish under 4.5. Fingers crossed I can make it happen π€
Day 58
What I covered/did
More of Week 9 Lecture of Harvard's CS50!
- Server-side vs client-side validation of user inputs
- Flask & SQL - how to use together
Resources I used
Thoughts
Super important lesson on the importance of validating user-input on the "server-side" vs the "client-side". What this essentially means is that, since HTML is available for all to see on the browser side, then if you are taking user inputs and validating them with code available to the public, the user can just change that code and hack your web app. Server-side validation just means that you are checking user-inputs on your private, gated server as opposed to doing it in front of the user.
It was interesting to see the examples of how to easily hack client-side HTML code in simple ways (like changing the options available in a form to put in your own inputs, and submitting those to a database on the server-side).
Day 59
What I covered/did
Finished Week 9 Lecture of Harvard's CS50!
- Sessions & Cookies with Flask/Python/HTML
- APIs review
- JSON review
Resources I used
Thoughts
Great end to Week 9 lecture. Looks like Week 10 will be a "half-lecture", with the other half being more of a wrap up on the course. I'm very impressed with the course and loved the way they explained and introduced easy and difficult concepts. I think it's clear the goal of the course was to get someone from no coding experience to having the tools to figure out what they don't know, and the knowledge of what they need to figure out.
Onwards!
Day 60
What I covered/did
Week 9 Labs/Problem Sets/Practice Problems of CS50!
Resources I used
Thoughts
I'm finding that my metric for determining whether or not to dive deeper into practice problems depends on if I can imagine how I'd get to the solution. With Lab 9, which asks you to build a web application to keep track of friend's birthdays, I think I would just need to synthesize my lecture notes to build the thing with Flask, Python, HTML, and some Jinja to iterate within the HTML. So I skipped it π. I did watch through some of the solution video to double check my understanding though, and I think I'm where I want to be there.
Problem Set 9, however, is a doosy. It's super dense, but I think I want to dive into it deeper another time, as I think it'll provide me enough flexibility to learn skills outside of the confines of the course as well. I think order of operations here will be to finish ShouldIReadTheNewsToday (after the marathon), and then jump into this problem.
Having technical difficulties with my broken phone from the scooter crash, so no pictures this week :(
Member discussion