This site is a self-contained low down on what's going on in my life, what I'm working on, what I'm thinking about, and how I'm feeling about life in general.
Thursday, 30 October 2008
Something I came up with yesterday was a pretty neat AJAX-based tagging system. It's pretty and easy to use, and uses efficient javascript to create the tag graphics on the page.

Friday, 11 April 2008
After spending some time today looking into ways to insert HTML tags into textareas on iPhone, I decided to knock up a quick editor for this site based around the insert at cursor position model as discussed in the previous article.
This post is the first real test of it's function. The biggest problem is scrolling up and down the textarea, it's extremely difficult.
To accentuate the positives however, it can insert the tags I mainly use, such as paragraph, bold, and code. Also it's better than typing it manually. I'm going to try using a two finger scroll to move the textarea.
Roll on firmware 2.0 and the copy and paste feature. For now though, here's how it's done.
function insertAtCursor(myField, myValue) {
if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
To call the function, I pass in a reference to my textarea object, followed by the text to insert.
<span onClick="insertAtCursor(document.getElementById('articleBody'), '<p></p>');">P</span>
Sunday, 10 February 2008
This blog software represents the first time I've tried to build and maintain static files.
Mod rewrite was an option but ultimately I think this will be better suited for this particular application.
Although quite simplistic at this stage there have still been a number of issues which may or may not be due to the configuration of my hosting provider 34sp but nonetheless was very frustrating.
The main issue was getting mkdir to work correctly. Although I'd set the permissions correctly, I was still having issues. This turned out to be because the example I was following (successfully on local development box) had the directory name ending in a forward slash.
Whatever config 34sp are using, it did not like this and eventually, when I removed this, I began to make progress. The next problem was that it wouldn't let me create folders in the httpdocs folder, so had to create a subfolder called content.
This resolved the issue and the pages are now building correctly.
The folder build / check code now looks like this:
//Check or create YEAR folder
$dirName = 'content/'.date('Y');
if(file_exists($dirName)){
//exists actions if any.
}else{
//doesn't exist actions if any
mkdir($dirName, 0777);
}
//Check / create MONTH folder
$dirName .= '/'.date('m');
if(file_exists($dirName)){
//exists actions if any.
}else{
//doesn't exist actions if any
mkdir($dirName, 0777);
}