Pages

Wednesday 21 December 2011

Upgrade of Moodle 1.9.10

Because this time of year is so quiet, I thought that I would do a small point release upgrade of my standard Moodle 1.9.10 install to the current latest version of 1.9.15 as of today.
There are a few reasons that I wanted to get this done and out of the way before January.  Some of my reasons were:
  • General bug fixing;
  • Performance upgrades;
  • Module enhancements;
  • Preparation for Moodle 2.x upgrade;
Even though I know that none of these reasons were particularly urgent, my main reason for doing so is in for the preparation for our imminent update to version 2.x quite shortly.  I've used x because from what I have read, version 2.3 will be out around June 2012 and so that will most likely be the one that I'll be going for.  My work so far to upgrade our version 1.9.10 to version 2.0.6 didn't go so well as I ended up finding lots of small errors that hindered the installation, but upon upgrading to 1.9.15 prior to upgrading to version 2.0.6 many of these errors (mostly relating to blocks and modules) went away.

Anyway, as for the update.  It actually went very smoothly and quickly.  The entire update was done within a few minutes.  This is what I did in preparation:
  • Backup the database and file structure;
  • Copy over the top of the existing files with the new files;
  • Run the update;
There was one new setting that was asked for which related to the automatic storing of passwords in browsers, but other than that nothing.  Point releases generally should only be done if you have problems but in my case it was more about preventing future problems than fixing any major current problems.

Note to all those upgrading from 1.9.x to version > 2.0.x, make sure that you upgrade to version 2.0.x first before attempting to upgrade to either 2.1.x or 2.2.x. The changes made in version 2.0 were large and so it is recommended within the Moodle documentation that you do this first.

Monday 19 December 2011

IE6: The End Nudges Closer

Microsoft has today announced that from January 2012, Internet Explorer updates will automatically be downloaded and installed in the background whilst retaining all of your custom settings like addons and search providers.

The new feature will work for those who have automatic updates enabled on their machine and this means for anybody using Windows XP you will be jumped up to version 8, whilst if you are on Vista or Windows 7 you will be pushed to IE9 whether you like it or not.  This is definitely a good thing for Microsoft as it means that the death of IE6 just moves that little bit closer.

In the past I have criticised Google and Mozilla for pushing out these updates on the stealth as it means that developers are constantly having to make changes - especially when they both at the moment are doing a new release every eight weeks.  In terms of security, this is most definitely a good thing for the Internet as a whole.  I myself as of earlier this year completely dropped support for Internet Explorer 6 as it was simply becoming too difficult to maintain.

Ie6countdown.com has the world usage for IE6 pegged at 8.3% as of today, with certain countries faring better than others.  For example, the UK has 1.8% and the US has 1.0% - fairly impressive, however China is massively behind here at a massive 27.9%.  I can only put this down to counterfeit software but whatever happens, the Internet will go on with and without it.

As a final note to those of you out there still using IE6, please, please, please update!

Thursday 15 December 2011

Manage Memory Limits SQL Server Enterprise 2008

Currently on our network is a server that's running SQL Server Enterprise 2008 running on our Hyper-V cluster.  On the cluster, dynamic memory is enabled.  Now, normally this isn't a problem, but when configured incorrectly SQL Server Enterprise will eat up as much data as it needs and so you suddenly have a server (low usage) that is eating up 14gb of memory.

The solution is to go to SQL Server Management Studio and right click on the server in the task pane on the left and go to properties.  Under memory on the left is an option to set max server memory in megabytes.  By default this is set to 2147483647mb (maaaaaaaassive).  The minimum you can set this to is 4mb but that would be silly now and so after a bit of a debate we decided that 6144mb (6gb) would be a nice number.  It now means we can continue to use dynamic memory on the VM without having to set static amounts of memory for the server itself.

Wednesday 14 December 2011

Chrome 16 Out Now

Today sees Chrome 16 released as part of the Google rapid release cycle.  With it comes the ability to sync your life, for example when you upgrade to version 16 your home machine with Chrome and your work machine with Chrome will share everything like your extensions, settings, history, bookmarks and other things between each other.

Obviously, in able to do this you will need to pair your Chrome with your Google account which also has other benefits including being automatically logged in to any Google based sites.  Is this potentially dangerous though especially with Google + (Plus)?  The jury is out on that one for now I think.

Personally for me, this is where Mozilla is going wrong with Firefox.  These features simply don't exist and once upon a time it would have been Firefox with all of the new bells and whistles so for me this deserves a pat on the back.  Well done Google!  Now that Mozilla are following Google with their rapid release cycle, I think it will be even harder for Mozilla to keep up.

Chrome 16 is available to download now, or if you already have Chrome installed then just sit back and wait patiently for Chrome to update the next time you load up your browser.

Moodle 2.2: Coming to a Webserver Near You

Last week saw the release of Moodle 2.2, which actually wasn't a long time since we saw the release of version 2.1, and again wasn't long before we saw the release of the rather buggy version 2.0.  Me?  I'm still sat here on version 1.9.10 because of this rapid release cycle.


See, the problem is, during the year it is very difficult to suddenly make changes that users aren't used to and for that reason I usually do my system upgrades at the start or end of the academic year.  I hope for the sake of Moodle and its massive following is that this isn't a sign of things to come.  They really need to focus on quality at this point as once upon a time, I had originally planned to jump on the Moodle 2.0 bandwagon and am I glad that I didn't.  After I installed it on my test web server, I soon found that I had made the right decision.  Simple things didn't behave as expected and so I actively discouraged those who asked me about version 2.0 to not go ahead with the upgrade.

2.2 takes off where 2.1 finished and adds to many of the new features found in 2.0 onwards including many bug fixes.  In the release notes, Rubrics, external tools, common cartridge and Mymobile themes are all mentioned.  The notes also have a small mention about version 2.3 due in June 2012 and so I will most likely be hanging on for this release.

Friday 9 December 2011

Correct Silly HTML Mistakes

For those of you that have read my blog, you will know that I'm a little OCD about website performance - and so should you be.  If your website becomes the source of frustration for an end user, more often than not you will lose your viewer and since the choice on the web is now so vast, you may not ever get them back.
For every mistake that is made in your code, your browser has to interpret what it is that it should be doing.  Not a problem you think?  Well you might be right, but squeezing every ounce of performance should be your key goal.  Just using a handful of my favourite tools will highlight any problems that you have very quickly.  These include:
  • Firefox / Chrome Plugins: Google Page Speed, HTML Validator, Firebug, Web Developer Toolbar and YSlow
  • Smush.it
  • Jcompress.com
  • W3 HTML Validator (bit of a given really!)
These tools are brilliant, but if you can avoid making some mistakes in the first place you have less work to do later on making changes and refinements to your code.  For example, say you have inserted an image into your website and it displays correctly, but is missing the alt, width and height parameters, then your browser will identify three errors with that particular image element, which you then have potentially replicated elsewhere in your page.  One solution to partially get around this is to use some form of dynamic language to call a function that will display your images for you correctly each time.  Below is a quick image function to show you what I mean.

<?php
function show_image($url, $width, $height, $alt) {
     return '<img src="'.$url.'" width="'.$width.'" height="'.$height.'" alt="'.$alt.'" />';
}
?>
You could include this in your header or whatever and then call it each time you need an image on your page.  This way, you are forced to have each parameter so that your image will be displayed properly.  The function could also be expanded to include JavaScript, Class and ID parameters etc. but for a quick and easy solution there isn't much else better.  You could then apply this theory to other elements on your page and you will quickly then get the hang of things.

Always, always run a validate check to see if your code really does validate.  If you are confident in your code being very good, you could think about making your site XHTML 1.0 strict and while this sounds easy, it sometimes isn't and could mean that you have to redesign part of your site to compensate.

Other areas that will offer performance increase are:
  • CSS sprites;
  • Too much JavaScript;
  • Images that are too large for the job, i.e a 16x16 image shouldn't be 10kb;
  • Cache as much of your code that won't be changing, i.e. JavaScript;
  • Minify your HTML, CSS and JavaScript;
  • Avoid DNS lookups;
  • Too many HTTP requests within your page;
Revisit these steps often and you will be surprised about the difference that it makes!

Monday 5 December 2011

PHP: mysql_fetch_assoc Vs. mysql_fetch_array

Recently I've been doing a lot of work to optimise my work so that pages load more quickly and server load is reduced.  When I was looking through to my database calls, typically I've always used the mysql_fetch_assoc function because it always returned less data than the mysql_fetch array which actually returns two arrays - one which has a numeric index and the other which has an associative key index.
Having a play around and doing some benchmarking between 1,000 and 10,000 iterations of a fairly small amount of data, I found that the mysql_fetch_assoc function was between 24% and 31% faster than the mysql_fetch_array function.  Good news for me really as this is how I typically return data from my MySQL database and so I won't be doing any rewriting any time soon.  This is what I expected really as the size of the data processed and returned is half (well less than that really because it's numeric) so good news here.

Of course there are occasions when the mysql_fetch_array function is needed and I'm not questioning its existence at all, but purely as a benchmarking exercise I would pick mysql_fetch_assoc everyday.

As a side note, it's also important that I mention the mysql_fetch_object function as well which is for those of you who prefer the OO notation.  However, using the same benchmark against the mysql_fetch_assoc function, this is still on average between 8% and 14% slower.

I hope this helps anybody who is currently in the process of performance tuning.  Every little bit saved does help to improve the user experience.

Friday 2 December 2011

Browser Wars: Chrome Steps Up

In yet another bout of good news for Mozilla, Chrome has displaced Firefox as the second most popular browser according to research boffins at StatCounter.  Microsoft's Internet Explorer still holds the top spot by quite a large amount, but what is most surprising is the time that it has taken Chrome to establish itself in the number two slot.

Chrome has been around now for quite some time, but not nearly as long as Firefox.  The Chrome market share now stands at 25.7%, while Firefox has dipped to 25.2%.  Not a massive amount I agree, but this could be a sign of things to come.  StatCounter point out that just two years ago, the Chrome share stood at just 4.5% and so this is a massive achievement for Google.

Firefox seem to be trailing in strategy as well, as they now seem to be following Google with their own rapid release cycle methodology (albeit rather annoying at the same time).  I'm not entirely sure that Mozilla have been doing anything massively wrong as such as of late, but they don't seem to have the innovative touch that they once had.  Bugs crop up from time to time as they do with all browsers and I'm adamant that Firefox is the best browser for debugging as it has the widest range of addons available right now.  I think that it's time for Mozilla to regain that creative spark that it once had, rather than becoming the market follower.