Thomas Baldock
Melbourne, Australia -
day, month 00 0000
View number: loading...
Certified Cloud Practioner BadgeAWS Re/Start Graduate Badge



C U L8R

Labs - Inheritance

While initially daunting, this lab ended up being quite easy to complete. The only issue I came across was a small error although it took my a while to identify

I was able to allocate memory for each new person, and then then set the values for each of the new person's variables, however I was not returning these values and thus not populating each new person into the family tree.

Once I changed the return NULL to return new_person my code succeeded.

Just a matter of not reading all the supplied code throughly, because I had overlooked the TODO in the code supplied by CS50.

Just as an extra, I was receiving a valgrind error and segmentation dump because I was not freeing the memory used for current person, because my freeing function was working on the p structure, not the current person structure

Once I returned the current person to p, I didn't need to free the memory used by current person directly. This was managed by using the free function with 'p' as the argument.

Read more.



COMMITTING TO MEMORY

Labs - Smiley

For this first lab exercise we needed to transform a smiley face represented by black and white pixels by changing the black pixels into a new colour.

The majority of the code was already provided for us. All we needed to do was provide the code for the colourise function inside of a helpers.c file, which was called in the main function of the colourise file. To link the helpers function to the main function in colourise file, the colourise function was initialised in the beginning of the helpers file, instead of the usual main. These two c files were then linked by the makefile also provided to us already.

Once I wrapped my head around this new approach, I set about planning my approach. I realised that the three input parapets of the colourise function gave us hint on how to approach lab. We were given the image height width and the array of pixels. Immediately my mind want to a solution that involved for loops which iterated through values up to the height and width, much like our solutions to previous tasks like the Mario Pyramid. By this point, such a solution comes easily.

The difficulty I faced in this lab was identifying how to represent the 24-bit colour of each pixel. I overlooked the information in the Lab background which explained to us how the RGBTriple structure was made.

Correct structure

I knew that I needed to use a for loop, and for each pixel which was found to be black, using an if statement to change it into the colour I desired. My first attempt at representing the pixels was using (0,0,0). I then tried to use a hexadecimal system, binding all 3 bytes together (0x000000). After several errors, searching online for answers, I reread the lab background and found the RGBTRIPLE structure which put my on the right track.

Using the hint which told me that each individual colour of a pixel could be called by pixel.rgbtBlue, I had both the correct strategy and syntax needed to successfully complete the lab.

Read more.



THE BIG A WORD

I have decided to take a new approach with my blog posts because I am now using Notion as a tool to manage information and take notes for my courses. From now on, I'll only document my experience with the problem sets in my remaining CS50x blog posts. My summary of the week's learning will instead be found in study notes. This week, we returned to the topic of algorithms, which were introduced in Week 0 as the components that transform inputs into outputs. With a deeper understanding of data types and arrays, we can now perform more advanced transformations and improve the efficiency of our code.

This week's lecture notes can be found here. Our lecture and lab discussed Big O notation as we compared the efficiency of different sorting algorithms. However, our problem sets focused on consistent and successful sorts rather than speed.

I encountered my biggest challenge this week when small errors in my code resulted in inaccurate answers. My understanding of how to write "correct" code was high and while it also appeared legitimate, as no errors were presented when compiling, I was not achieving the expected results. I learned that understanding style and form is not the same as accuracy. I need to pay closer attention to how my algorithms handle information in each step and use debugging tools to track the flow of my algorithms.

My main takeaway from the week is that I need to be mindful of the information flow in my algorithms and use debugging tools, such as local variables and watch expressions, to ensure efficiency and accuracy. I'm making this week's blog more of a diary entry to keep myself accountable and stay on track, as I have also taken on a part-time cybersecurity course and don't want to fall behind.

Read more.



An Awry Array

Computer-image
In week 2 of edX's CS50x, we returned to our study of the programming language C. This week we took a deeper look at the building-blocks of computers and how a programming language works from the bottom up.

I went into this week confidently after last week's success but struck the wall in the last problem set. I will explain in detail later however I learnt many things - not just about that particular problem set - but also how to approach issues more generally.

We started the week returning to the concept of compiling. In Week 1 we had used been using the make utility to 'compile' our source code. This week we learnt that this utility is not actually a compiler, rather, it is a command which executes the compiler for C, called Clang, along with some arguments pre-programmed by CS50x.

I did some research of my own to better understand this utility. I discovered outside of the Integrated Development Environment provided by CS50, the make utility needs a makefile to provide the process with the necessary instructions and commands.

I recalled I used a Makefile when I completed the Cloud Resume challenge. You can read about my Cloud Resume here. This file was used by Amazon Web Services Serverless Application Model (AWS SAM), which is a Command Line Interface tool which can build serverless applications on AWS. The Makefile was used to automate the building process when we pushed our code from Github to AWS. Several macros were stored in the file and each one provided AWS SAM with one or more commands, along with any dependencies, which needed to be executed by the compiler. I still don't have a complete grasp of how it works, but being able to link this concept to a previous project strengthened my understanding.

To push this thinking even further, this realisation also gave me a better understanding of how AWS SAM works as well. Effectively, running this tool packages your files in a format with can be understood by the AWS Cloud infrastructure. In other words, we are compiling the code from source code into AWS Cloud machine code.

Back in this week's learning, we investigated the stages that a compiler like Clang goes through.

First is preprocessing. This involves transferring header files into the source code which is to be converted.

Second is a step, also called compiling. In this step, the program is converted into assembly code. This is where architectures like x86 and ARM begin to differ.

The third step, assembling, transforms assembly code into machine code (binary, i.e. 0s and 1s).

The final step, linking, converts the code from included libraries and combines it with the program's machine code. From this point the executable file is outputted. From my experience, the final result is often called the binary of a program. I had trouble understanding what this mean in the past, so I'm glad for the clarification.

Perhaps as some foreshadowing from our teachers of what lay ahead with this week's problem sets, we were told about the inevitability of writing mistakes, or bugs, when coding. We were then provided with some debugging techniques to eliminate these errors.
Read more.

The Man and the C

Mario

After a short holiday I've returned to continue with my learning in cs50's Introduction to Computer Science. This week, we progress from the visual coding language Scratch to a more powerful language called C.

This will be another introductory language which we will use as a springboard to other languages in later weeks. The aim is to gain an understanding of the typical framework of programming languages.

To start the lecture, we recalled our understanding of the basic ideas in programming, like functions, conditionals, and loops and learnt how they can be executed in C.

We learned that C is a more opaque language than Scratch - requiring a knowledge of a more sophisticated and less human-readable syntax - but there are methods to ensure code is made easier to follow. Methods include formatting of code, efficiency of algorithms, adding clear comments and whether the code solves problem as intended.

Our first program mirrored that of our first Scratch demo, printing “hello, world”. Immediately, it's clear there are a few extra requirements in this language for a simple program to function, such as the inclusion of Standard Input and Output header (stdio.h) and the loading of a main function.

After this demo we learnt about Integrated Development Environments which can be used write, translate and run code and terminal windows. And building on our understanding of the binary system - which computers use to represent and process information - we learnt the difference between source code and machine code.

In this week's study, for example, source code is written in the high-level, moderately human-readable language C, however, in it's initial form, it is not able to give instructions to a computer. The source code, in order for the computer to understand it, needs to be translated - or compiled - into machine code by a program called a compiler. In the IDE provided by this course, we can compile our source code by using the 'make' command.

After an overview of Linux concepts necessary for this weeks problems sets we moved onto working through some basic programs in C, in order to introduce to us to the syntax and style requirements of C and how it uses data types, functions, arguments, loops, operators, etc.

Read more.



Thursday, 6th of October

Getting Started




The Shell Game

The Shell Game

Just a quick one here. I have started cs50's Introduction to Computer Science and made it through week 0. In this block we were introduced to the fundamental concepts of computer science.

We touched on how the binary system is used to represent all kinds of information e.g. text, images, videos, sounds, emojis, etc on computers. We learnt computer science can be simplified into two components - inputs and outputs, and that essentially, computer science is a form of problem solving, using algorithms (step-by-step instructions on how to process inputs to produce required outputs).

Through a basic example (finding a name in a phone book) we visualised how an algorithm's efficiency can be calculated. We used this example to show how an algorithm's efficiency can be represented using a simple chart.

Algorithmic-efficiency
We then experminted with writing 'pseudocode' using quasi functions (pick up), conditionals (if, else if), loops (for, return to line x) and boolean expressions (is person on page? yes or no). The pseudocode that was used to find any name in the phone book was this:

1  Pick up phone book
2  Open to middle of phone book
3  Look at page
4  If person is on page
5   Call person
6  Else if person is earlier in book
7   Open to middle of left half of book
8   Go back to line 3
9  Else if person is later in book
10   Open to middle of right half of book
11   Go back to line 3
12  Else
13   Quit

The lecture finished with an introduction to the graphical programming language called Scratch, developed by MIT. This language has a highly human-readable form and bridges the gap between pseudocode and computer code. We had a look at some examples of previous student's projects, before we were sent out into the ether to come up with and execute our own idea.

After a short time experimenting with the language, I decided to recreate the Shell Game in Scratch. Here's my finished project.






I've had some experience making a small game with python (battleship) however, this time my efforts were unguided. Admittedly, Scratch is very intuitive - still, working through the entire process helped reinforce some concepts for me. Most notably - the concept of exit status. It took some time for me to work how to integrate the seperate 'puzzle pieces' of my project, until I discovered the 'broadcast message' feature of Scratch. From this point, it was much clearer how I could integrate my puzzle pieces together.

I had a lot of fun with this week's block - particularly David J. Malan's energetic stage presence. He seems to me to be the Freddie Mercury of the Computer Science world! I'm really looking forward to next week's learning.




Hello world! It's been quite some time since my last blog, back at the beginning of my journalism career.

Now I found myself neither gainfully employed as a member of the press nor in the manufacturing field I followed it into. And yet, here I am, more excited for the future than I have ever been. So what exactly am I so excited about? Before I start, I'd like to acknowledge I will be breaking the cardinal rule of journalism: never, EVER put yourself in the story. However, not only am I allowing myself to ignore my training - but in this era of personal branding - it is encouraged. I can BE the story.

So then, what is my story?

MAN TAKES LEAP OF FAITH INTO CLOUD

Head in the cloud

There are many ways to follow this headline. The truest account - and please respect what remains of my journalistic integrity - goes something like this.

I've always harboured an interest in computers so when the Digital Jobs Program came on my radar I jumped at the opportunity - even though I was employed at the time as an assistant manager at a manufacturing company. I choose the AWS Re/Start course because it covered a wide variety of topics and would provide a decent foundation for a career change. I didn't know much about cloud computing but the syllabus really appealed to me and I was ready to give it my all.

So I left my job to take on this program and take a step into the great unknown. Luckily for me, I loved the course from the outset. I was spending my days and evenings absorbing as much new information as I possibly could. I then came across Forest Brazeal's 'Cloud Resume Challenge' which is touted as the ultimate test for anyone looking to get into a cloud career. The premise of the project is simple - host your resume in the cloud. There are, however, several conditions.

1. Get an AWS certification
2. Write the resume in HTML & styled with CSS
3. Deploy as an Amazon S3 Static website
4. Use a custom DNS Domain name with HTTPS security
5. Include a visitor counter made from Javascript, DynamoDB, API Gateways and Lambda functions (written in Python)
6. Python tests for Lambda
7. Deploy all resources via a Serverless Application Model (SAM) template instead of using the console!
8. Use Github as source control, and Github Actions for CI/CD

Needless to say, I had never done anything like this before - but I saw it as an opportunity to build on my learning. It was a huge challenge, and took me several weeks alongside my coursework to complete. There where many evenings when I had absolutely no clue how to tackle the next step. But with a little bit of research and a lot of head-scratching and persistence, I'm happy to report I overcame the challenge! I'll go deeper into specific challenges I faced during this project in my next post.

Certified Cloud Practioner Badge

I made this diagram showing my architecture and you can see the finished project here. It was such a rewarding experience and my confidence in my practical skills has skyrocketed.

If you've made it this far - I highly recommend the challenge if you're looking to test your skills! There's a supportive community and a plethora of learning materials available at the Cloud Resume Challenge. Finally, I'd like to thank Forest Brazeal and the CRC community for their efforts in making the cloud accessible to all.