Goals/Targets for Summer 2020

With thanks to the Coronavirus, schools have closed ‘indefinitely’, which means they’ve likely closed for the academic year and will be ready again for September 2020 admittance.

This leaves me with ~5 months until September, when I should be due to begin an undergraduate CompSci degree. I figured I might finally make use of this blog and use it to track/log my journey towards achieving some self-set targets/goals in the time I have off.

My main goals are listed below:

  1. Learn the principles of Day Trading
    • also, have a successful, profitable, month with a paper account
  2. Become fluent with intermediate C++ development/projects
    • undoubtedly C++ will play a major role in my University career, so I’d like to get a jump-start and learn what I can beforehand

A couple months ago – when the world wasn’t crumbling – I made this exact post, but I had about 8 different goals. There’s a reason that post has mysteriously vanished; I have set myself 2 goals, and no more, with the hopes that I’ll employ the method of quality over quantity.

Have a great day.

I need a fourth post! (API project)

jQuery so far

So this is actually turning out to be quite fun. Python is a wonderful language, but sometimes it can be boring. JavaScript seems so pretty and exciting – there’s far too much going on for me at the moment, but I’m sure I’ll come around.

Anyway – I’m learning how to iterate over arrays at the moment, and I’m about to implement some sort of “top-3” system, hence I needed the fourth post 🙂


Well, after a bit more development and much less time than I had expected to spend on this, I’m finished, and it seems to work perfectly 🙂

I’ve put the finished code below.

var blog_show_count = 3;

function handle_array_element(item, index) {
    if (index <= blog_show_count) {
        $("#latest_posts").append(
            "<li><a href='"+item.link+"'>"+item.title.rendered+"</a></li>"
        );
        console.log(item.link);
    } else {
        // doing nothing :D
    }
}

$(document).ready(function() {
    var api = "https://elliotpotts.net/blog/wp-json/wp/v2/posts";

    fetch(api).then(response => response.json()).then(
        data => {
            data.forEach(handle_array_element);
        })
    }
);

That was quick, and it’s effective. I don’t think I’ll stop learning JavaScript, as it will definitely be a powerful and useful tool to combine with Python.

Have a great day :).

ElliotPotts.net API Project

My website homepage (https://elliotpotts.net/) is created with Bootstrap/HTML and some CSS/JS elements. It is not a CMS, like the blog. It’s incredibly static.

I’m a Python programmer – and I’ve never touched a JavaScript project before, and wouldn’t consider doing so with an eleven foot pole.

However I wanted a sidebar where the arrow points which listed my latest 3/5 blog posts.

The first approach I considered was using Flask and Python to retrieve the latest posts using some sort of web-scraping method, and then I could use Jinja to render the results in the template.

But then I did some research – and found WordPress has a native REST API with full CRUD capability… Which is great. However, I’m still a Python programmer – so I still considered using Flask.

But then again, I thought, if I use Flask I need a Python-supporting server to handle the page, which means I have the whole nightmare of Flask deployment to deal with.

So, I thought this might be a good time for me to start picking up another language, JavaScript. Well, jQuery.

So in the end – I’m now using my blog’s API endpoints to return posts to a jQuery document which will modify an unordered list on the page.

Part of the reason I’m making this post is so that I have 2 posts to test with 🙂

Hello!

So, the CMS is behaving finally.

For a revolutionary blogging system, it sure did throw a fit… No wonder wordpress.com gets away with extortionate hosting prices 🙂

Anyway, this is an introductory post just to make sure WordPress is behaving appropriately.

Feel free to take a look around,
Thanks.