It’s been a while since I’ve updated my website at all as I’ve been looking for work but there are a couple of new items in the portfolio!

I’ve spent a really long time getting to grips with React. Learning is an odd thing because people so often talk of doing a course and that’s it! You’re in! That’s the impression I get anyway. It’s similarly true when giving the number of years experience in a technology when talking to a recruiter; it’s hard. I find it hard because a) I don’t measure every moment I use a specific technology, b) you might have only scratched the surface, but you might have been scratching at that surface for eight years. What really does it tell anyone? I have no commercial experience as of yet in React, but I think I know it well enough.

Speaking of which there’s a new portfolio item added which uses both React and Sanctum. Sanctum is a piece of Laravel that allows you to get up and running with an API. I’ve always liked the idea of making my own API and simple though this one is, it works. It has a login and you can register a new user. There are different varieties of authentication with Sanctum, I’m using the SPA variety. For this both your frontend and backend are served up on the same domain which gives you some added security. It doesn’t use API tokens at all since these usually have to be stored somewhere on the client side which is a security issue. Sanctum does allow you to use API keys, but you’d use these more for authenticating mobile apps instead since the user can’t get hold of any of the keys used from a mobile app and the security risk is smaller. It is a small, simple app, and it records the number of times a user can change chords within a minute, actually the timer runs a little faster than it should at the moment but that’s as people are looking at it and I wanted testing to be as simple as possible. I tell a lie; somebody may look at it to check out my code if I apply for a job or contract with them.

For deployment I have used CloudWays. This was simple enough besides a few gripes, but those gripes were with me. My .htaccess file appeared to have no effect but I kept forgetting I had a build folder as all of my development was done without one, but I’m a bit more comfortable with the whole process now. You get given a server, I’m on the cheapest plan, and you can SSH into it through the browser. There must be a way in locally, come to think of it, but that’s for another deployment. I’ve also, I think, nailed down the .htaccess file needed for an SPA and it looks like this:

RewriteEngine on

RewriteCond ${REQUEST_FILENAME} !-f

RewriteCond ${REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ / [L,QSA]

I don’t actually know how to format code in here yet, much less what the above means. I can’t tell you what the RewriteCond lines do, but the RewriteRule line I have a better handle on; you are rewriting a URL. Regex starts with a ^ and ends with a $ and the . means any character. The brackets allow for multiples of that any character and then after this there’s a space and a slash which means home. So it’s ultimately saying redirect all URLs to home, which is what I wanted for an SPA since the JavaScript does any page changes and the root page is all you should need.

There’s a new website which has been added to the portfolio. JCB Windows & Doors. This was another WordPress site, like this one where I’ve put together a new WordPress theme. I’m really not a WordPress expert but putting the pages together as you would any site without WordPress, linking them together and making use of Advanced Custom Fields really isn’t too harrowing.

There is actually another website on the way too; it’s for a lovely lady who offers just about any kind of therapy you can think of and it’ll be on its way soon.

Besides this I’ve been thinking more and more about games programming. When I was at university I did a course and previous to that I’d spent a long time learning about C++ and DirectDraw. I liked playing with DirectDraw. It allows you to plot pixels, but to do it incredibly quickly. So I had an entire teapot getting rendered for one of my projects. You write your function to draw a pixel at a specific coordinate, simple enough, then you use that function to draw a line, Bresenham’s Algorith(?) and then you can use that to draw polygons with another function. There was also something going on called the painter’s algorithm to fill the polygons but it wasn’t very popular in Uni. The reason for this is that filling in a polygon or not depends on its z index, and the decision of whether or not a polygon is in front or behind of another is done purely based on the average z indices of all of the vertices of a polygon. It doesn’t work very well, and it’s what the Playstation One used I think.