I have just upgraded my WordPress install to the lastest release, luckily with SubVersion the whole process can be achieved with minimum time and effort.
Paul went through the upgrade steps on his blog, but thought I would go through them here as I went along.
Unfortunately when I initially installed WordPress I committed it directly to the root directory unlike the more popular location of the subdirectory /blog, but not to worry.
Here are the steps I followed to complete the update:
# Backup the current directory...
cp -Rp http httpBACKUP
# Create a new location for the update...
# Checkout the latest release from the repository...
svn co http://svn.automattic.com/wordpress/tags/2.5/ httpNEW/
# Copy across any custom changes/themes and config file...
cp -Rp http/wp-con* httpNEW/
# Copy over the .htaccess file..
cp -Rp http/.htaccess httpNEW/
# Delete the old directory...
rm -rf http
# Rename/move the update to the original location...
mv httpNEW/ http
# Switch the SubVersion Repository...
svn switch http://svn.automattic.com/wordpress/tags/2.5/
# Finally, run the browser based update script...
And that’s all there is to it really, now every time I need to update WordPress I can simply copy and paste the above commands.
Today I was asked by a colleague to aid them with adding functionality to a form that would allow it to be submitted by pressing ‘ctr + s’ keys.
As a group of web developers this key combination is something that comes almost naturally to us when editing and constantly saving code, so should prove a useful addition to the form that is not too difficult to implement.
I began by setting up the event observers to watch for the two required keys to be pressed.
Once the required key codes ( 17 and 83 ) were captured it should have been a case of simply referencing the form and applying the submit method.
To see if what was written so far would actually perform the desired action we tested the page using our default browser Firefox, only to discover we were receiving the following error:
document.forms.form_id.submit is not a function
This was all very puzzling but eventually resorting to a search on Google provided a number of answers.
I wanted to split the lines of code displayed into a series of words with any spacing preserved, so started off by splitting each line on any none word “W”.
var words = line.split(/W/g);
This worked fine in Firefox, but when it came to IE the results were not quite what I was expecting. All the words were matched but all white space had been completely ignored, so instead I turned to using “b” as the delimiter.
var words = line.split(/b/g);
This took me a step closer to what was required but it was still not the desired result as I didn’t want any non-word characters to be grouped with alpha-numeric values, such as “123”.
I spent a little – in fact too much -time browsing the web for some pointers and came across an article posted on the SitePoint blog outlining the inconstancies of the String.prototype.split method across different browsers, which seemed explained the problem I was getting earlier but unfortunately offered no resolution.
Now to try and find a solution to all this.
Because splitting on “W” was almost correct I reverted back to using that and now knowing what I had read over at SitePoint I somehow needed to prevent any non-word character sets from being ignored but without affecting the output in any way.
One possibility that arose was to wrap use the special character of null “