Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Jamie Balfour'sPersonal blog

Jamie Balfour'sPersonal blog

I spend a lot more of my time developing the front end than the back end of my website since the back end is pretty damn flawless as it is. I say this because I was originally more of a back end web developer - and I probably say this to many peoples' suprise but it's actually true that I still am. I prefer working on the front end sure, but the back end is really where I am more talented.

Effectively combining the front and back end is about ensuring that the back end stuff works with the front end stuff, but your front end needs may be quite high. For instance, iterating 1000 records on your local database is not going to be too demanding, but getting them from an external website and then generating the HTML for these then adds quite a bit more work. What if you are collecting the latest from your Twitter account (like I do) and placing it on the website and applying regexps all over the content? This is quite demanding. So I spent a lot of time reviewing literature on this exact problem and it seems it actually is a problem, albeit easy to fix.

Our PHP function may return us a HTML result when we get our Tweets back from Twitter's API, and we know that the Twitter feed is only going to update when we update it, so why don't we just throw the HTML result into a text or HTML file? This solution then means that we have to manually update (delete the file) the website when we update Twitter. Not ideal.

The solution, check the modification date of our cached file. If it is more than 24 hours old, delete it. The PHP function will no longer see the file and instead of getting a cached version it will refresh it with a new request to Twitter. Still not perfect though since we've got to delete the file.

The final solution, the PHP file checks if the file exists, if it does checks the modification date and if it's over 24 hours old it gets the latest data from Twitter and updates the file with that data and returns it.

There you have the description of a very simple PHP caching system. 

cache
php
script
js
website

In the last few days I've been focusing a lot of my time on software development rather than my usual web development. As a result ZPE has received more of my time than my website. This changed again today when I decided to work on it again.

Today I brought back the Facebook commenting system to my website, replacing my long lasted Disqus comment system. As a result of this, I am also including this in BalfBlog 2.1 instead of Disqus. The main benefit is now users no longer have to enter an individual post to comment on it (for the main blog mode, not introduction mode).

The DISQUS_SHORTNAME and the related settings are no longer required since Facebook does not need users to login. 

On my website side of things again, I have been focused on ensuring the OpenGraph content is up to date on my website. You should see that it is now pretty concise and works effectively every time and as a result sharing looks much better with Facebook.

website
update
july
2016
og
image
Powered by DASH 2.0