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

I have been focusing on improving the search algorithm used by BalfBlog. What happens now is this:

  • A search is sent to the database to search for items containing any of the words searched for
  • The results are then traversed and any results that do not contain all of the search words are removed

Another important step was removing the double query design. This was a pathetic idea in the first place and I never meant for it to be in the release version but only in a test version. I apologise to anyone who has since downloaded but the latest update is marked as CRUCIAL. Please make sure to download it as soon as possible.

BalfBlog now has a more flexible refinement of queries function that will ensure that the information coming out is suitable.

More importantly, the HTAccess directive file is much better now and it works more efficiently.

Posted in BalfBlog
search
update
fixed
issues

I would go as far as to say that over the few months I have learned so much and am aiming to become an Apache master soon! 

In the last year or two, I have also been using regular expressions (regexps) to do everything and I think it's fair to say I am a master of them. I find them to be the most useful thing you can know for using your computer on a day to day basis. I now use them to search my computer or a text editor, I have made my own programming language which uses them for matching in the compiler, and very recently to match things on my website. I recently mastered htaccess files on Apache and nginx servers. As part of this I have made my site much more SEO friendly and developed BalfBlog considerably. I have been using regexps for about five or six years, but I was not exactly using them often enough and skillfully enough. Back in my C# programming days (I haven't worked on my C# projects since 2013, but I am talking about when it was my main language in about 2008 - 2010) I used regexps in Wonderword for the search and replace features, in BlackRabbit Script it was pretty much the basis of the language and in other programs I used it for text replacement tools (also included in Wonderword, but also found in my BBCL library).

Recently I brought both of these masteries together and have done so much with my website to make it better. I improved my hotlink protection due to these regexps and, to be honest, I think I did a great job since I cut ninety lines down to three with some simple regexps. 

So today I'm going to share this with you.

cPanel, by default, allows you to add URLs that will not be affected by hotlink protection. As such you enter them in (or if you add a new subdomain it adds them automatically). Except as great as this is, my URLs looked like this:

HTAccess
RewriteCond %{HTTP_REFERER} !^http://2010.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://2010.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://2012.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://2012.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://airdisplays.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://airdisplays.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://alpha.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://alpha.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://ashes-scattered.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://ashes-scattered.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://be.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://be.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://castleinn.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://castleinn.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://clickit.education/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://clickit.education$      [NC]
RewriteCond %{HTTP_REFERER} !^http://developer.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://developer.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://doodle.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://doodle.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://doodle.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://doodle.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://edustream.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://edustream.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://flitter.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://flitter.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://firestarter.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://firestarter.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://jamiebalfour.co.uk/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://jamiebalfour.co.uk$      [NC]
RewriteCond %{HTTP_REFERER} !^http://jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://jbtest.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://jbtest.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://wonderword.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://wonderword.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.2010.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.2010.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.2012.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.2012.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.airdisplays.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.airdisplays.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.alpha.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.alpha.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.archive.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.archive.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.ashes-scattered.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.ashes-scattered.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.be.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.be.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.castleinn.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.castleinn.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.clickit.education/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.clickit.education$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.developer.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.developer.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.doodle.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.doodle.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.doodle.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.doodle.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.edustream.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.edustream.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.flitter.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.flitter.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.firestarter.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.firestarter.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.jamiebalfour.co.uk/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.jamiebalfour.co.uk$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.jbtest.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.jbtest.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.projects.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.projects.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.wonderword.sites.jamiebalfour.scot/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.wonderword.sites.jamiebalfour.scot$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.zenlang.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.zenlang.net$      [NC]
RewriteCond %{HTTP_REFERER} !^http://zenlang.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://zenlang.net$      [NC]

I was looking at what it generated tonight since I've been fixing a lot of htaccess directive files across my site and subdomains and my other domains. I realised that I can put these down to just three lines of code and make it easier for me to maintain in the future. So this is what I've got:

HTAccess
RewriteCond %{HTTP_REFERER} !^https?://(www.)?(.*.)?(.*.)?jamiebalfour.co(m|.uk)(.*)      [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www.)?clickit.education(.*)      [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www.)?zenlang.net$      [NC]

 So there you have a simple solution to a big problem. Learning regexps is like learning to use a calculator, it just saves so much time!

Posted in Web Development
apache
web
server
nginx
regex
regular
expression
matching

This is a difficult question since so much is new! I have added the following (not in order):

  • The number of posts has been added to the modular category list e.g. General [10].
  • The newly added mod_rewrite tools have been improved with more rewrites. This makes these URLs more SEO friendly
  • Adding a new post to a category is easier than ever, and the interface is no longer complicated by many input fields
  • The new settings panel allows you to maintain settings without needing to change the files
  • Pages, categories, posters and tags now all redirect to the newly implemented rewritten URLs. Instead of using ?poster=test BalfBlog uses /poster/test/
  • Security improvements
  • Prepared statements with MySQL and PHP
  • Search improvements to make the search work like Google's search engine
  • TinyMCE can be customised
  • The whole of BalfBlog has been developed to be widget-based/modular. Choose to use some of the built-in widgets including the BalfBlog sidebar widget and the categories widget and style them as you like. But of course you don't even have to bother with them, since that's what it's all about.

I'm finally done with my dissertation and whilst the last few months have been a disaster for my health (well, technically not, it's been more of a disaster for the NHS and messing up their own diagnosis), my dissertation is, in my eyes, one of the greatest things I have ever produced! I'm nearly finished my degree too so I can have a relaxing few weeks to recover from everything and get back to a bit of stress-free normal life.

Posted in Life
dissertation
clickit
finished
jamie
balfour

The new BalfBlog version 2.0.1 will be released next week. Currently the main features that have been added have been added for the ClickIt blog to improve it, since I am currently working on that at the moment as my main project.

The following have been added:

  • Security improvements
  • Better use of mod_rewrite to make URLs work better
  • Search improvements now mean that you can join words together using "" e.g. "windows 8" would search for the exact term windows 8 and not each word individually
  • Dashboard improvements
  • A new settings panel
  • Add your own items to the TinyMCE editor! You can now define your own items for the TinyMCE editor.
  • A new system to update your blog automatically (Linux and Mac based servers only)

This will be the last update of April so I'm trying to make it somewhat significant. April and the end of March have been the most significant months in the development of BalfBlog. I hope you enjoy the next update as much as I am!

Posted in BalfBlog
balfblog
updates
new
posts

The front end of BalfBlog is now using prepared statements for everything. This was absolutely crucial since most of the front end relied on users sending GET requests to the blog. These are now completely safe since the update. 

The dashboard has already featured prepared statements for sending information, but the front end was still lacking. I will point out however, as a result of this update you currently cannot combine queries. This means you cannot search for a user and a category at the same time. So this no longer works:

blog/?cat=General&poster=jamiebalfour04

This is coming back very soon however. As a matter of fact it is in the latest version, it's simply not tested thouroughly enough for me to be sure it can be released.

Posted in BalfBlog
balfblog
updates
blog
front
end
prepared

The big security update for BalfBlog is done! Now all statements are protected against SQL injection and use PHP's prepared statements. I'm hoping this will make BalfBlog much more secure for all users.

If you are interested in downloading a pre-release version, let me know by email.

Today I have decided I will no longer add support for Internet Explorer 8, 7, 6 and below to BalfBlog, BalfBar, BalfSlider, BalfRibbon and my own website.

Subsequently, users of these will see a very small reduction in file size. 

After many years of adding extra support to my website for older browsers, I have decided it is time to move on. I am officially ditching a percentage of users of these older browsers.

Posted in Website news
ie
internet
explorer
8
7
6

Hello everyone, I'm posting this comment about my Disqus comment system which I have recently had to update. Since Disqus currently does not offer the ability to move comments from an old URL to a new one, I had to delete older comments to prevent them going through to the error page. I have readded all these comments using the names of the original people (note the names, not their user accounts, thus these will not take you to their accounts). I have done this since some of these comments were useful and because there are still very few comments (despite hundreds of views a month). 

Posted in Website news
disqus
comments
removed
updated

BalfBlog will gain more success over the next few months when it moves away from being just a blogging system.

Plans for BalfBlog include the ability to create and modify pages on your website for you as well as be your CMS for your blog.

Currently, BalfBlog is also only available to request for download. This will change soon when I release it to my own Download Center.

Posted in BalfBlog
changes
updates
balfblog
Powered by DASH 2.0