J F I L I P . C A2015-12-28T20:26:28-05:00https://jfilip.caJustin FilipShocktober 2013: C.H.U.D.2013-10-05T19:19:30-04:00https://jfilip.ca/2013/10/05/shocktober-2013-c-h-u-d<blockquote class="twitter-tweet" lang="en"><p><a href="https://twitter.com/saraherron">@saraherron</a> Nope. Another on the "never watched this, hope it lives up to the decades of hype" pile. =)</p>— Justin Filip (@jfilip) <a href="https://twitter.com/jfilip/status/386266370096517121">October 4, 2013</a></blockquote>
<script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>Last night Robin and I watched the 1985 movie C.H.U.D. It was definitely one of those movies I remember seeing in the video rental stores as a kid, when I would be ogling the covers of the VHS rentals in the horror section—much too afraid to watch any of them—my brain making up content based on the artwork that I have and still am discovering was much worse than what was really contained on the magnetic tape inside the plastic cassettes.</p>
<p><img src="http://farm5.static.flickr.com/4081/5438262194_db11d3e937_z.jpg width="600" height="471"" alt="C.H.U.D. (VHS Box Art)" /></p>
<p>C.H.U.D. is definitely one of those movies for me. Most of the movie can best be described as “awesomely awful”. From the music and the effects to the story and pacing, it’s just kind of all over the place. The, seemingly, unintentional comedy throughout the thing is pretty great. At times you have to wonder whether the cast and crew realised they were making something truly terrible and was just having fun with it or if everyone was truly committed to making a quality cinematic experience. The government conspiracy theory “us vs. The Man”.</p>
<p>The cameos of, most likely then very unknown actors, got me really excited, too. <a href="http://www.imdb.com/name/nm0573481" title="Sam McMurry - IMDb">Sam McMurray</a> (a.k.a. Dr. Vic Schweiber from <a href="http://www.imdb.com/title/tt0193676">Freaks and Geeks</a>) and a super young <a href="http://www.imdb.com/name/nm0000422">John Goodman</a> both make an appearance here.</p>
<p>I think that overall this was better than I expected.</p>
<p>I’ll just leave this here.</p>
<div class="embed video YouTube"><iframe width="459" height="344" src="https://www.youtube.com/embed/8blGwrG1WZs?feature=oembed" frameborder="0" allowfullscreen=""></iframe></div>
Shocktober 2013: Creature from the Black Lagoon2013-10-01T22:18:26-04:00https://jfilip.ca/2013/10/01/shocktober-2013-creature-from-the-black-lagoon<p>Two years ago Robin and I tried to pull off <strong>Shocktober</strong>. The goal: 31 horror–or, at least, somewhat related to the genre–films for the 31 days in October. We only made it through 29 last time but we’re planning on trying to do it again this year. This is specifically a throw-back to the Shocktober that used to run on Channel 50 out of Detroit when we were both kids, growing on the Ontario / Michigan border.</p>
<p>We have started off Shocktober 2013 this year with the 1954 film <a href="http://www.imdb.com/title/tt0046876" title="Creature from the Black Lagoon (1954) - IMDb">Creature from the Black Lagoon</a>.</p>
<p>Check out below the videos for the list of films that we watched in 2011.</p>
<p><div class="embed video YouTube"><iframe width="459" height="344" src="https://www.youtube.com/embed/h6C5I9w-Ldk?feature=oembed" frameborder="0" allowfullscreen=""></iframe></div></p>
<p><div class="embed video YouTube"><iframe width="459" height="344" src="https://www.youtube.com/embed/seNElUWzEW4?feature=oembed" frameborder="0" allowfullscreen=""></iframe></div></p>
<p>The <em>Shocktober 2011</em> list, in order, is as follows:</p>
<ul>
<li><a href="http://www.imdb.com/title/tt0063350" title="Night of the Living Dead (1968)">The Amityville Horror (1979)</a></li>
<li><a href="http://www.imdb.com/title/tt0063350" title="Night of the Living Dead (1968)">Night of the Living Dead (1968)</a></li>
<li><a href="http://www.imdb.com/title/tt0083722" title="Cat People (1982)">Cat People (1982)</a></li>
<li><a href="http://www.imdb.com/title/tt0110148" title="Interview with the Vampire (1994)">Interview with the Vampire (1994)</a></li>
<li><a href="http://www.imdb.com/title/tt0077402" title="Dawn of the Dead (1978)">Dawn of the Dead (1978)</a></li>
<li><a href="http://www.imdb.com/title/tt0084787" title="The Thing (1982)">The Thing (1982)</a></li>
<li><a href="www.imdb.com/title/tt0069050" title="The Other (1972)">The Other (1972)</a></li>
<li><a href="http://www.imdb.com/title/tt0045888" title="House of Wax (1953)">House of Wax (1953)</a></li>
<li><a href="http://www.imdb.com/title/tt0074285" title="Carrie (1976)">Carrie (1976)</a></li>
<li><a href="http://www.imdb.com/title/tt0298130" title="The Ring (2002)">The Ring (2002)</a></li>
<li><a href="http://www.imdb.com/title/tt0293113" title="Dracula: Pages from a Virgin’s Diary (2002)">Dracula: Pages from a Virgin’s Diary (2002)</a></li>
<li><a href="http://www.imdb.com/title/tt0094721" title="Beetlejuice (1988)">Beetlejuice (1988)</a></li>
<li><a href="http://www.imdb.com/title/tt0063522" title="Rosemary’s Baby (1968)">Rosemary’s Baby (1968)</a></li>
<li><a href="http://www.imdb.com/title/tt0087050" title="Children of the Corn (1984)">Children of the Corn (1984)</a></li>
<li><a href="http://www.imdb.com/title/tt0078748" title="Alien (1979)">Alien (1979)</a></li>
<li><a href="http://www.imdb.com/title/tt0103874" title="Bram Stoker’s Dracula (1992)">Bram Stoker’s Dracula (1992)</a></li>
<li><a href="http://www.imdb.com/title/tt0185937" title="The Blair Witch Project (1999)">The Blair Witch Project (1999)</a></li>
<li><a href="http://www.imdb.com/title/tt0054215" title="Psycho (1960)">Psycho (1960)</a></li>
<li><a href="http://www.imdb.com/title/tt0363547" title="Dawn of the Dead (2004)">Dawn of the Dead (2004)</a></li>
<li><a href="http://www.imdb.com/title/tt0090142" title="Teen Wolf (1985)">Teen Wolf (1985)</a></li>
<li><a href="http://www.imdb.com/title/tt1470827" title="Monsters (2010)">Monsters (2010)</a></li>
<li><a href="http://www.imdb.com/title/tt0079844" title="Salem’s Lot (1979)">Salem’s Lot (1979)</a></li>
<li><a href="http://www.imdb.com/title/tt0089200" title="Ghoulies (1985)">Ghoulies (1985)</a></li>
<li><a href="http://www.imdb.com/title/tt0072271" title="The Texas Chainsaw Massacre (1974)">The Texas Chainsaw Massacre (1974)</a></li>
<li><a href="http://www.imdb.com/title/tt0080761" title="Friday the 13th (1980)">Friday the 13th (1980)</a></li>
<li><a href="http://www.imdb.com/title/tt0094862" title="Child’s Play (1988)">Child’s Play (1988)</a></li>
<li><a href="http://www.imdb.com/title/tt0026138" title="Bride of Frankenstein (1935)">Bride of Frankenstein (1935)</a></li>
<li><a href="http://www.imdb.com/title/tt0075005" title="The Omen (1976)">The Omen (1976)</a></li>
<li><a href="http://www.imdb.com/title/tt0077651" title="Halloween (1978)">Halloween (1978)</a></li>
</ul>
Moodle performance testing -- 2.4.6 vs. 2.5.2 vs. 2.6dev2013-09-25T16:35:02-04:00https://jfilip.ca/2013/09/25/moodle-performance-testing-2-4-6-vs-2-5-2-vs-2-6dev<p>Yesterday I posted <a href="/2013/09/24/moodle-performance-analysis-revisted-now-with-mariadb/" title="Moodle performance analysis revisted (now with MariaDB)">some updated performance information</a> about currently released versions of Moodle and <a href="http://tjhunt.blogspot.ca/">Tim Hunt</a> from <a href="http://www.open.ac.uk/" title="Distance Learning Courses and Adult Education - The Open University">The Open University</a> asked me if I could run the same tests on the latest in-development Moodle 2.6 code.</p>
<p>So I went ahead and re-ran my automated tests using the same setup as I had previously. In this case, as it was meant to be a straight comparison of the various releases of Moodle, I kept the database backend consistent across the tests. This time I also changed the methodology slightly by restarting the web server before each initial page load to clear out the PHP APC opcode cache to get the first page to be indicative of a <em>worst case</em> scenario where someone is loading a page without anything being cached neither in Moodle nor within your opcode cache. In previous tests the web server was not restarted between tests and those opcode caches were attempted to be pre-warmed before the initial testing started.</p>
<p>The Moodle versions compared here are:</p>
<ul>
<li><a href="http://docs.moodle.org/dev/Moodle_2.4.6_release_notes" title="Moodle 2.4.6 release notes - MoodleDocs">2.4.6</a></li>
<li><a href="http://docs.moodle.org/dev/Moodle_2.5.2_release_notes" title="Moodle 2.5.2 release notes - MoodleDocs">2.5.2</a></li>
<li>2.6dev (<a href="https://github.com/moodle/moodle/tree/7f3836d15aa5ddc33831310b65d38d625a79ca99" title="Commits - moodle/moodle">build: 20130920</a>)</li>
</ul>
<p>This is meant to be a preview of the performance for Moodle 2.6 as it is is currently in a pre-alpha state. The code freeze is scheduled for Monday Oct. 7 2013 after which the QA testing phase will begin. For more details refer to the <a href="http://docs.moodle.org/dev/Roadmap">Moodle Roadmap</a>.</p>
<p>For details on the testing environment, please refer to my original post – <a href="/2013/08/20/moodle-2-4-5-vs-2-5-1-performance-and-muc-apc-cache-store/#testing_environment" title="Moodle 2.4.5 vs. 2.5.1 performance and MUC APC cache store">Testing environment</a>. The only difference between that original listing and the setup I used for these tests is that I was exclusively using MariaDB 5.5.33a_0 and PHP 5.4.20_0 as installed from MacPorts.</p>
<p>You can use the code I created for these tests as it’s publicly available on my Github account – <a href="https://github.com/jfilip/moodle_perf_scripts" title="jfilip/moodle_perf_scripts">moodle_perf_scripts</a>.</p>
<h1 id="testing-results">Testing results</h1>
<h2 id="unauthenticated-user-site-index-page">1. Unauthenticated user site index page</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=2&zx=u9s816tcmiuy" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=3&zx=xe7ae3sfegwm" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=4&zx=xgmlwhto8odx" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=5&zx=anoisghan077" alt="" /></p>
<h2 id="login-process-for-a-site-administrator">2. Login process for a site administrator</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=6&zx=v1ee79kaksr8" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=7&zx=9s0z843bweht" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=8&zx=n5pgnzby50k1" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=9&zx=1d64gklgq3di" alt="" /></p>
<h2 id="authenticated-site-administrator-sitenbspindex-page">3. Authenticated site administrator site index page</h2>
<p>NOTE: the numbers for this test might be slightly deceiving. The settings used for the display on the site index page when logged in produce different results in 2.4.x and 2.5.x. In Moodle 2.4, a count of the number of courses was displayed along with a search box. In 2.5.1 a large number of the courses are listed on that page which produces much more database access. This is why the numbers for 2.5.2 and 2.6dev are much worse than 2.4.6.</p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=10&zx=t6dhdomnyfyb" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=11&zx=be14hegnqmam" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=12&zx=i7sjnseh3kqd" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=13&zx=jbjhjndwgqa0" alt="" /></p>
<h2 id="authenticated-student-site-index-page">4. Authenticated student site index page</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=14&zx=68mjng4psr8r" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=15&zx=5kwjhx8y3rdu" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=16&zx=vmhu0cjsikcj" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=17&zx=6dpox81vgpz1" alt="" /></p>
<h2 id="authenticated-site-administrator-course-view">5. Authenticated site administrator course view</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=18&zx=rs8izh6shzv2" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=19&zx=2x41adb7qbh3" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=20&zx=fus2yqkppk2d" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=21&zx=9yjtzmcnowu9" alt="" /></p>
<h2 id="authenticated-site-administrator-gradebook-view">6. Authenticated site administrator gradebook view</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=22&zx=fysw2a34fpu6" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=23&zx=f25erv1uqxnf" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=24&zx=r99q39xf1h4w" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndHN6MExoMjliU3NEZzRXSVd2RndPWFE&oid=25&zx=wdy1ckrm9t04" alt="" /></p>
<h1 id="analysis">Analysis</h1>
<p>Moodle 2.6 (as of this writing) in general seems to be slightly faster than 2.5 and use slightly more memory but remains worse than 2.4. For the <em>big</em> pages being tested the performance is much closer to 2.5 than it is to 2.4 so the improvements have been relatively small but still moving in the right direction.</p>
Moodle performance analysis revisted (now with MariaDB)2013-09-24T09:11:25-04:00https://jfilip.ca/2013/09/24/moodle-performance-analysis-revisted-now-with-mariadb<p>This is a follow-up to <a href="/2013/08/20/moodle-2-4-5-vs-2-5-1-performance-and-muc-apc-cache-store.html" title="Moodle 2.4.5 vs. 2.5.1 performance and MUC APC cache store">my previous post on this subject</a>. Pleases refer to that post for the testing environment setup and also the scenarios that were tested. Below I will outline what has changed since those results were gathered and the problems I was addressing with these changes.</p>
<p>I also ran the original tests with MariaDB 5.5.31 and the graphs on this post are comparing 2.4.5 and 2.5.1 with Percona MySQL and MariaDB on each version of Moodle using only the default filesystem MUC caching implementation.</p>
<h1 id="reducing-manual-work">Reducing manual work</h1>
<p>Previously I was running each test manually in my browser and then copying the web server error log file into a named file (for later running an analysis script against). This had two problems:</p>
<ol>
<li>The time between each request in my web browser was not consistent. Sometimes I was refreshing pages immediately after the previous page had loaded and sometimes I was waiting up to over five minutes between each subsequent page request.</li>
<li>I had to manage a lot of separate log files which meant a lot of possibilities for mistakes and also running the same script over and over again on each file.</li>
</ol>
<p>I solved these problems by creating some automated Selenium test scripts (using the Firefox IDE extension) and adding a URL parameter to each individual page request so that I could gather the statistics for the requests generated for each page within an error log file that contains the requests for all of the page requests.</p>
<p>This gave me the following improvements:</p>
<ul>
<li>allowed me to put an exactly five second delay between each subsequent page load for the individual tests</li>
<li>meant that I would never skip a test or forget one of the steps (i.e. clearing Moodle caches before the first page load in a test)</li>
<li>meant that my performance analysis script could examine a log file with all of the requests and output a single file containing all of the processed results</li>
<li>the single CSV file meant that generating graphs no longer required manually copying / entering the results into a spreadsheet</li>
<li>less (zero?) chance of an error during the entire process</li>
<li>the login test is only including results</li>
</ul>
<p>You can use the code I created for these tests as it’s publicly available on my Github account – <a href="https://github.com/jfilip/moodle_perf_scripts">moodle_perf_scripts</a>.</p>
<h1 id="testing-results">Testing results</h1>
<h2 id="unauthenticated-user-site-index-page">1. Unauthenticated user site index page</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=26&zx=je0mndbd364p" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=27&zx=jkki0vfnirg2"" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=28&zx=d7wpufveepjf" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=29&zx=rp8ke18fltlq" alt="" /></p>
<h2 id="login-process-for-a-site-administrator">2. Login process for a site administrator</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=30&zx=iv1lnm9r5q8f" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=31&zx=1kbjkvj5w0gr" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=32&zx=ykroinfnexvf" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=33&zx=n89hvx9ct7ig" alt="" /></p>
<h2 id="authenticated-site-administrator-sitenbspindex-page">3. Authenticated site administrator site index page</h2>
<p>NOTE: the numbers for this test might be slightly deceiving. The settings used for the display on the site index page when logged in produce different results in 2.4.5 and 2.5.1. In Moodle 2.4, a count of the number of courses was displayed along with a search box. In 2.5.1 a large number of the courses are listed on that page which produces much more database access. This is why the numbers for 2.5.1 are much worse than 2.4.</p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=34&zx=j0qyzwknsqn" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=35&zx=b8plgvgq1qqn" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=36&zx=u7870r3wmefi" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=37&zx=p6q1cu2g1vpq" alt="" /></p>
<h2 id="authenticated-student-site-index-page">4. Authenticated student site index page</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=38&zx=6i3n2wv572a8" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=39&zx=jptnhqiw7129" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=40&zx=jfpi3xyq86lf" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=41&zx=m1wy8v2y5wez" alt="" /></p>
<h2 id="authenticated-site-administrator-course-view">5. Authenticated site administrator course view</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=42&zx=g7hryc7ptirz" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=43&zx=7k1hlwxg632r" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=44&zx=jzmcijb26wz0" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=45&zx=clwgr42xfol3" alt="" /></p>
<h2 id="authenticated-site-administrator-gradebook-view">6. Authenticated site administrator gradebook view</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=46&zx=73yqil1nux8p" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=47&zx=87kq5vpags7b" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=48&zx=7e4ac0dqpm77" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=49&zx=lbb6ju938uej" alt="" /></p>
<h1 id="analysis">Analysis</h1>
<p>MariaDB is based off the MySQL codebase but the team there has included <a href="https://mariadb.com/kb/en/optimizer-feature-comparison-matrix/">a number of optmisations on that codebase</a>, some of which greatly impact Moodle performance. The one page which greatly shows this is the gradebook. With Percona MySQL the average load time for a single page in the gradebook was greater than 90 seconds. But the average page load time for MariaDB <em>was less than 4 seconds!</em></p>
<p>With the MariaDB binary compatability with MySQL files (i.e. you can switch between which server you are running with the same database files without any issue) it makes sense that anyone hosting a large Moodle site using MySQL should be looking at switching to MariaDB.</p>
<ul>
<li><a href="https://mariadb.com/kb/en/mariadb-vs-mysql-features/">MariaDB versus MySQL - Features</a></li>
<li><a href="https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/">MariaDB vs MySQL - Compatibility</a></li>
</ul>
Moodle 2.4.5 vs. 2.5.1 performance and MUC APC cache store2013-08-20T09:06:56-04:00https://jfilip.ca/2013/08/20/moodle-2-4-5-vs-2-5-1-performance-and-muc-apc-cache-store<p><strong>NOTE:</strong> The graphs within this post have been updated based on the automated testing I created. The new work is explained in my new post, <a href="/2013/09/24/moodle-performance-analysis-revisted-now-with-mariadb.html" title="Moodle performance analysis revisted (now with MariaDB)">Moodle performance analysis revisted (now with MariaDB)</a>.</p>
<p>As of this writing, <a href="http://moodle.com/hq/team/">the team at Moodle HQ</a> (along with lots of volunteers from around the world) is currently hard at work on <a href="http://docs.moodle.org/dev/Moodle_2.6_release_notes">Moodle 2.6</a> and 2.5 has already seen it’s first maintenance release (2.5.1). At <a href="http://www.remote-learner.net/">Remote-Learner</a> we are just about to roll out Moodle 2.5.1 for our clients and we wanted to do some performance testing. Given how much more of Moodle is using the <a href="http://docs.moodle.org/dev/The_Moodle_Universal_Cache_(MUC)">Moodle Universal Cache (MUC)</a> we also wanted to test what kind of performance benefits using Sam Hemelryk’s <a href="https://moodle.org/plugins/view.php?plugin=cachestore_apc">moodle-cachestore_apc</a> plugin might afford us.</p>
<p>In this case, <em>performance</em> is specifically limited to the server / hosting environment load. We were less interested in the effects of Javascript and end user browser page load speeds at this time.</p>
<h1 id="a-nametestingenvironmentatesting-environment"><a name="testing_environment"></a>Testing environment</h1>
<h2 id="hardware">Hardware</h2>
<p>Moodle was being run via a LAMP stack on a mid-2010 MacBook Pro with 8GB of RAM and a 512GB Seagate Momentus XT hybrid HDD. The web browser was being run from a separate machine on the local network.</p>
<h2 id="software">Software</h2>
<p>Web stack (all versions were installed via <a href="http://www.macports.org/">MacPorts</a>):</p>
<ul>
<li>Apache 2.2.25_0</li>
<li>PHP 5.4.18_0 w/ APC 3.1.13_0</li>
<li>Percona MySQL 5.5.32-31.0_0</li>
<li>Mozilla Firefox 23.0 (with browser caching disabled – <code>network.http.use-cache</code> set to <strong>false</strong>)</li>
</ul>
<h2 id="configuration">Configuration</h2>
<p>The Moodle site was setup using a copy of a large production database (2000 courses, 90,000+ course module instances and nearly 28,000 users) running Moodle 2.4.4. For the purposes of this test that database was upgraded to Moodle 2.4.5 and, for the second and third round of testing, upgraded to 2.5.1. DB Sessions were disabled (so that session data was being written to the filesystem) and the MUC configuration was all default settings (except when switching to the APC store for the third round of testing).</p>
<p>PHP APC was using default settings aside from allowing the use of 256MB of memory for the cache store.</p>
<p>Moodle had the <code>MDL_PERFTOLOG</code> constant set to true in the config.php file to that performance data was written out to the web server error log for each PHP script that was executed.</p>
<h2 id="testing-methodology">Testing methodology</h2>
<p>The idea was to identify some common pages should help give a good indication of performance across the three setups we are testing. I identified six specific pages / actions in Moodle to use as comparison points:</p>
<ol>
<li>Viewing the site index page as an unathenticated user</li>
<li>Logging into the system as a site administrator (from submitting the login form data to the site index page finishin rendering)</li>
<li>Viewing the site index page as a site administrator</li>
<li>Viewing the site index page as a student that is enrolled in 32 courses</li>
<li>Viewing a very large course page (2696 course module instances) as a site administrator</li>
<li>Viewing the first page of the Moodle gradebook in a course with a very large number of enrolled users (over 131,000 enrolled users)</li>
</ol>
<p>Each page was loaded four times for for each site configuration. Those site configurations:</p>
<ol>
<li>Moodle 2.4.5 with the default MUC configuration</li>
<li>Moodle 2.5.1 with the default MUC configuration</li>
<li>Moodle 2.5.1 with the default applicaiton store set to use <code>apc</code> as the plugin in the <code>/moodledata/muc/config.php</code> file</li>
</ol>
<p>Before the first page load all of the Moodle caches were purged by running the Moodle CLI script <code>/admin/cli/purge_caches.php</code>. The three subsequent page loads were performed with the caches <em>warmed up</em>. The idea here was to simulate a worst-case performance scenario and then more of a real world scenario where the caches are warmed up.</p>
<p><strong>NOTE: the web server was never restarted so the APC opcode caches were never purged during testing.</strong></p>
<p>After each test the Apache error_log file was copied into a named file and them emptied for the next page request to be made. This allowed us to capture all of the requests that were generated by a single <em>page load</em> within Moodle (i.e. images, CSS, JS, etc.) and then total the performance numbers across all of the PHP scripts executed on the web server for a given page load. The numbers below reflect those totals for each configuration.</p>
<p>In each case there were four key metrics I was interested in:</p>
<ol>
<li>Execution time</li>
<li>Memory usage (peak memory)</li>
<li>DB reads</li>
<li>DB writes</li>
</ol>
<h1 id="testing-results">Testing results</h1>
<h2 id="unauthenticated-user-site-index-page">1. Unauthenticated user site index page</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=2&zx=aibh2j89e0w9" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=3&zx=jn674lf1hcfe" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=4&zx=skyz8ic5jkq9" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=5&zx=zij9uj4t06br" alt="" /></p>
<h2 id="login-process-for-a-site-administrator">2. Login process for a site administrator</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=6&zx=is4okmumcxgf" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=7&zx=md3o5cmrtjjp" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=8&zx=2gtmy6t6qr7m" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=9&zx=d1dtgnhzawws" alt="" /></p>
<h2 id="authenticated-site-administrator-sitepindex-page">3. Authenticated site administrator site/p;index page</h2>
<p>NOTE: the numbers for this test might be slightly deceiving. The settings used for the display on the site index page when logged in produce different results in 2.4.5 and 2.5.1. In Moodle 2.4, a count of the number of courses was displayed along with a search box. In 2.5.1 a large number of the courses are listed on that page which produces much more database access. This is why the numbers for 2.5.1 are much worse than 2.4.</p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=10&zx=hltdyc2lmsld" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=11&zx=km2k37ubze9i" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=12&zx=2x39vs8wlp6w" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=13&zx=jaow9txdmnbm" alt="" /></p>
<h2 id="authenticated-student-site-index-page">4. Authenticated student site index page</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=14&zx=fl3y4lhyb0dx" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=15&zx=jndynx1q6nsl" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=16&zx=upqeu62amu87" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=17&zx=2t4o0noz42ek" alt="" /></p>
<h2 id="authenticated-site-administrator-course-view">5. Authenticated site administrator course view</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=18&zx=b4r9ghunsc2" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=19&zx=9b1g7ctxy65t" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=20&zx=z3cbdhdv9fgs" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=21&zx=3yms2xpw0j5c" alt="" /></p>
<h2 id="authenticated-site-administrator-gradebook-view">6. Authenticated site administrator gradebook view</h2>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=22&zx=89byx5dpid64" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=23&zx=j9jbsfxdt8ts" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=24&zx=lv4yn0yyhoyf" alt="" /></p>
<p><img src="https://docs.google.com/a/remote-learner.net/spreadsheet/oimg?key=0ArP3qBBnh83ndFFKS1JWZHFWdHZONGFBRWpfYjdIa0E&oid=25&zx=ttwoomnb8lpg" alt="" /></p>
<h1 id="analysis">Analysis</h1>
<p>Aside from from a few small instances of strange numbers, in general Moodle 2.5 seems to run slightly slower and use more system resources than Moodle 2.4. One notable exception is that the gradebook actually seems to load a little faster and hit the database less in 2.5 when compared to 2.4.</p>
<p>Enabling the cachestore_apc plugin in Moodle /p;allows Moodle 2.5.1 to run faster and use less system resources. In most cases this improvement is near or better than 2.4.5.</p>
<p>Some extra notes:</p>
<ul>
<li>Strain on the database was not measured in these tests. In the cases where Moodle 2.5 performs fewer operations on the DB it could be a case where those operations are actually more intensive and strain the DB more than the case where fewer / simpler operations were made.</li>
<li>The cache that APC uses can become highly fragmented (and thus ineffective) or it can also run out of memory if not configured properly. There are <a href="http://php.net/manual/en/apc.configuration.php">a lot of settings for this PHP extension</a> and if you are going to employ this plugin on your Moodle site with MUC, you should pay attention to those settings, especially things like TTL and size of cache.</li>
<li>If trying to dig deep into why certain pages in Moodle are running slow you should look at using the XHProf PHP profiling tool that is built into Moodle. If you are unfamiliar with this tool, fortunately Tim Hunt has written a nice guide to how the Open University has used it to track down and fix Moodle 2.4 performance problems
<ul>
<li><a href="http://tjhunt.blogspot.ca/2013/05/performance-testing-moodle.html">Performance-testing Moodle</a></li>
</ul>
</li>
<li>As with all performance tuning / analysis, the only way to be sure of changes is repeated testing while making small changes. Testing at load with tools like <a href="http://jmeter.apache.org/">JMeter</a> or <a href="http://docs.seleniumhq.org/">Selenium</a> can be useful but should probably be reserved until you have a configuration that you are fairly certain is well tuned.</li>
</ul>
Gears of My Childhood - Lego2013-02-24T17:33:13-05:00https://jfilip.ca/2013/02/24/gears-of-my-childhood-lego<p>I am currently enrolled in the <a href="http://learn.media.mit.edu/">Learning Creative Learning</a> course offered by the MIT Media Lab and P2PU. The assignment for the second week was to read the foreword to Seymour Papert’s 1980 book <a href="http://www.amazon.ca/Mindstorms-Children-Computers-Powerful-Ideas/dp/0465046746">Mindstorms: Children, Computers, and Powerful Ideas</a>. The foreword is titled <a href="http://llk.media.mit.edu/courses/readings/gears-v1.pdf">The Gears of My Childhood</a> and is about how, as a very young child, the author learned how gears worked and used it as a framework for learning new and ever more complex ideas by relating them back to gears. The main point of this is the fact that his passion and love for gears meant he was able to make this leap of connecting them to other concepts such as linear mathematical functions.</p>
<p>Our task for this assignment is to write about what was our own <em>gears</em> from when we were a child. In my case that would be <a href="http://www.lego.com/">Lego</a>.</p>
<p>I believe I was four when I first received a rather large collection of Lego. A friend of my parents had been buying me sets as presents since I was born with the idea that when I was old enough to actually play with them I would have a very good set to use. I believe that my initial collection was just sets of blocks and not the more specific kits that were intended to build a few projects. Though I did enjoy getting those kits I would always end up mixing the pieces from those kits back into the larger pool to build my own creations.</p>
<p>I would come up with ideas for building things like space ships, moon bases, a monorail system or things from movies and TV shows I liked. I remember building a fairly large version of the helicopter from the TV show <a href="http://en.wikipedia.org/wiki/Airwolf">Airwolf</a> that I could get my <a href="http://en.wikipedia.org/wiki/G.I._Joe">G.I. Joe</a> action figures inside of. The fact that I had pieces which did not include highly specialised parts–like a lot of the sets made in recent years–meant that I had to work within the constraints of the blocks I had available to me in order to make something look like what I envisioned.</p>
<p>I also learned about symmetry and consistency. I always wanted the colours of blocks to match up. If I was building a house with four walls and I did not have enough of a certain colour block to make all the walls the same colour, I would try to match each level, or at least use the same pattern, all the way around the walls so that things were symmetrical and equal.</p>
<p>Later in school when I started to get projects to work on, if the project involved making something, I would always try and incorporate Lego into what I was building.</p>
<p>In fact, Lego is somewhat relevant to why I choose my career path. Douglas Coupland’s 1995 novel <a href="http://en.wikipedia.org/wiki/Microserfs">Microserfs</a> features a group of characters who leave their jobs at Microsoft to start up their own company creating a PC game that is essentially a virtual Lego set. At one point in the story the characters are playing with the gigantic pile of Lego in their office and talking about it’s influence on their childhood. Things like the binary nature of how the blocks fit together and what kind of computer code would be produced by someone who selected random block colours when building structures as opposed to the more logical and programming-centric approach of symmetry. This novel is one of the primary motivators in my wanting to study Computer Science at university.</p>
<p>While I don’t believe I can use Lego in a similar manner to Papert in the sense of Lego being a framework to make it easier to relate to new concepts, it still applies as something which was important to my learning as a child and which I had great passion for. In fact, if anyone is ever looking for a gift for me, I would love one of those $500 3800 piece <a href="http://shop.lego.com/en-CA/Death-Star-10188">Lego Death Star</a> kits. =)</p>
Moodle Add-on Evaluations2013-02-18T13:09:33-05:00https://jfilip.ca/2013/02/18/moodle-add-on-evaluations<p>During my second talk at the 2013 Canadian Moodle Moot in Vancouver, someone in the audience asked me about how my team at Remote-Learner evaluates Moodle plug-ins. We have a checklist that a developer must go through when trying to make a determination as to whether an add-on is suitable for installation on a Moodle site for one of our clients.</p>
<p>In general we will only disapprove a Moodle add-on if it fails for security reasons or it completely breaks some part of core Moodle functionality.</p>
<hr />
<h2 id="general">General</h2>
<ul>
<li>Search forums and tracker for issues with the module.</li>
<li>Check for recent updates or other indications of continuing maintenance.</li>
</ul>
<h2 id="security">Security</h2>
<ul>
<li>Ensure that scripts call <code>require_login()</code> or <code>require_course_login()</code> somewhere near the top of user-accessible file.</li>
<li>Ensure that capabilities are checked against the proper contexts using <code>require_capability()</code> or <code>has_capability()</code>.</li>
<li>Look in all scripts that have directly executable code - that is not just functions or class definitions.
<ul>
<li>Technique - use an IDE (Eclipse, Netbeans, Sublime Text, etc.) and open all files with <em>folding</em> enabled and “collapse all”.</li>
</ul>
</li>
<li>Ensure that all html parameters are retrieved using <code>required_param()</code> or <code>optional_param()</code> and never from globals.</li>
<li>Ensure that the proper Moodle database calls (<code>get_records()</code>, <code>get_records_sql()</code>) are being used and that hard coded table prefixes aren’t.</li>
<li>Search all code for occurrences of <code>$_</code> and <code>$HTTP</code> for potential abuses.</li>
<li>Ensure that the data type given to <code>required_param()</code> and <code>optional_param()</code> is appropriate for the data expected. If <code>PARAM_RAW</code> is used, ensure this does not get used in a db call.</li>
</ul>
<h2 id="structure">Structure</h2>
<ul>
<li>Ensure that proper plug-in structure is provided (i.e. <code>/db/ and</code>/lang/``` directories are used).</li>
</ul>
<h2 id="moodle-activity-modules">Moodle activity modules</h2>
<ul>
<li>Ensure that the module includes the required files, API hooks, and database table as defined in the <a href="http://docs.moodle.org/dev/Modules">official Moodle documentation</a>.
<ul>
<li>All of the above that are not met must be documented as some requirements are more important than others.</li>
</ul>
</li>
<li>Does the code require modification of any core files?
<ul>
<li>If so does it just contain the modified core files or does it contain patches or unmodified copies of the source files?</li>
</ul>
</li>
<li>Test the module on a local development site:
<ol>
<li>Install the module on the site (record any warnings or errors).</li>
<li>Add an instance of the activity module to a sample course.</li>
<li>Backup and restore the test course to make sure that the module does not cause any errors during either part of the process and that the restored course contains the data from the module instance.</li>
</ol>
</li>
</ul>
<h2 id="moodle-blocks">Moodle blocks</h2>
<ul>
<li>Ensure that if the block is installing database tables that it is using the correct naming format for the database tables:
<ul>
<li>All of the block database tables must be prefixed with the block class name. So if the block class is called <code>block_my_block</code> then all of the database table names must start with <code>block_my_block</code> eg.:</li>
<li><code>block_my_block</code></li>
<li><code>block_my_block_table1</code></li>
<li><code><code>block_my_block_table2</code></li>
<li>etc.</li>
</ul>
</li>
</ul>
<h2 id="special-considerations">Special considerations</h2>
<ul>
<li>If something modifies core code we need to evaluate the impact this will have, especially for ELIS clients.</li>
<li>If there is cron code included, perform a test cron run to make sure it doesn’t break anything.</li>
</ul>
Canadian Moodle Moot 2013 Presentation2013-02-17T11:56:28-05:00https://jfilip.ca/2013/02/17/canadian-moodle-moot-2013-presentation<p>These are my slides from the presentation I gave at the <a href="http://moodlemoot.ca">2013 Canadian Moodle Moot</a> in Vancouver, BC.</p>
<div class="embed rich SlideShare"><iframe src="https://www.slideshare.net/slideshow/embed_code/key/KOp5glURTfa20z" width="427" height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen=""> </iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.slideshare.net/justinfilip/moodle-development-best-pracitces" title="Moodle Development Best Pracitces" target="_blank">Moodle Development Best Pracitces</a> </strong> from <strong><a href="http://www.slideshare.net/justinfilip" target="_blank">Justin Filip</a></strong> </div>
</div>
Using Git to fix a typo in every commit of a branch2013-02-09T12:16:03-05:00https://jfilip.ca/2013/02/09/using-git-to-fix-a-typo-in-every-commit-of-a-branch<p><em>Full disclosure: how I got into this situation is bad practice on my part but how I got out of it was interesting and I thought it would be worth sharing and potentially helpful to others.</em></p>
<h1 id="background">Background</h1>
<p>First, some background. I was creating a Moodle plugin to contain both a minified and uncompressed version of <a href="http://jquery.com/">jQuery</a>. There already exists a plugin in the community that fills this role–<a href="https://github.com/bumoodle/moodle-local_jquery">moodle-local_jquery</a>but it contains more than just jQuery and is meant to work as part of a larger component. It wasn’t exactly what I needed.</p>
<p>For my needs, I wanted a Moodle plugin which only contained jQuery and had the version property set to the specific release date of that version of jQuery. This allows another plugin to require a minimum version of my plugin in order to specify the minimum version of jQuery that it is compatible with. I needed this plugin to work with Moodle versions 2.2 through 2.4. So I went ahead and created a commit in a <strong>MOODLE_22_STABLE</strong>, <strong>MOODLE_23_STABLE</strong> and <strong>MOODLE_24_STABLE</strong> branch for each release of jQuery since 1.6.3 (everything listed on the <a href="http://jquery.com/download/">jQuery download page</a>).</p>
<p>After I had finished going through and creating all the branches I wanted to test my plugin on a local Moodle 2.2 install. I cloned the <strong>MOODLE_22_STABLE</strong> branch of the repository into <code>/local/rljquery/</code> and ran through the installation process The process stopped before it had finished installing all the plugins with no error output. I looked through my web server error log file and saw this message:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">2013-02-08 11:51:48: <span class="o">(</span>mod_fastcgi.c.2676<span class="o">)</span> FastCGI-stderr: PHP Parse error: syntax error, unexpected end of file in /Users/jfilip/code/moodle22/local/rljquery/version.php on line 33
PHP Stack trace:
PHP 1. <span class="o">{</span>main<span class="o">}()</span> /Users/jfilip/code/moodle22/admin/index.php:0
PHP 2. moodle_needs_upgrading<span class="o">()</span> /Users/jfilip/code/moodle22/admin/index.php:248</code></pre></div>
<p>Uh-oh.</p>
<p>I opened up the <code>version.php</code> file in my plugin and noticed the following:</p>
<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">$plugin->version = 201302040; // Release date of this version of jQuery.</span>
<span class="x">$plugin_requires = 2011120500.00;</span>
<span class="x">$plugin->component = 'local_rljquery';</span>
<span class="x">$plugin->maturity = MATURITY_BETA;</span>
<span class="x">$plugin->release = '1.9.1 (2.2)' // The jQuery release version with the Moodle release in parentheses.</span></code></pre></div>
<p>So, I made two very simple syntax errors that I should have caught when first writing the code. The second line has <code>$plugin_requires</code> instead of <code>$plugin->requires</code> and the last line is missing a semi-colon at the end of the string and before the comment starts. In most cases this is a simple fix but in my case I had already spread this problem across 30 individual commits.</p>
<p>At that moment you would normally have to just throw everything away and re-do every single commit. But I was able to recall one time when I had done some digging into a way to perform changes to a Git repository across the entire history. So I did some Google digging.</p>
<h1 id="the-nuclear-option-filter-branch">The Nuclear Option: filter-branch</h1>
<p><cite>There is another history-rewriting option that you can use if you need to rewrite a larger number of commits in some scriptable way — for instance, changing your e-mail address globally or removing a file from every commit. The command is <code>filter-branch</code>, and it can rewrite huge swaths of your history, so you probably shouldn’t use it unless your project isn’t yet public and other people haven’t based work off the commits you’re about to rewrite. However, it can be very useful.<br /><br /> - <a href="http://git-scm.com/book/ch6-4.html#The-Nuclear-Option:-filter-branch">http://git-scm.com/book/ch6-4.html#The-Nuclear-Option:-filter-branch</a>
</cite></p>
<p>The <strong>filter-branch</strong> command in Git was what I had remembered. The documentation for the command has an example of using it to execute a shell script to re-write information about the user who performed a commit. I thought I could try this same approach to edit the contents of a file in every commit within a branch.</p>
<p>Eventually I came up with the following two commands which would fix each problem. It uses a perl command to do a search and replace within the <code>version.php</code> file for each commit within the current branch. Because <code>git filter-branch</code> creates a backup so you can revert the changes it has made if the results are not what you expected, I had to use the <code>-f</code> option in order to force the second command to overwrite the backup.</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git filter-branch --tree-filter <span class="s2">"perl -pi -e 's/plugin\_requires =/plugin\->requires =/g' version.php"</span> HEAD
git filter-branch -f --tree-filter <span class="s2">"perl -pi -e 's/ \/\/ The jQuery/; \/\/ The jQuery/g' version.php"</span> HEAD</code></pre></div>
<p>Next I had to check to make sure that the changes actually did get applied through the commits in the current branch. So I wanted to check the first commit in this branch to make sure it was modified correctly. I found the first commit using the following command:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git log --oneline <span class="p">|</span> tail -n 1
bcbd130 Initial commit of jQuery 1.6.3 <span class="k">for</span> Moodle 2.2</code></pre></div>
<p>And then I wanted to look at just the relevant lines of that file to make sure the changes were made:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash">git blame bcbd130 -- version.php <span class="p">|</span> tail -n 5
bcbd130 <span class="o">(</span>Justin Filip 2013-01-23 11:25:26 -0500 28<span class="o">)</span> <span class="nv">$plugin</span>->version <span class="o">=</span> 2011090100<span class="p">;</span> // Release date of this version of jQuery.
bcbd130 <span class="o">(</span>Justin Filip 2013-01-23 11:25:26 -0500 29<span class="o">)</span> <span class="nv">$plugin</span>->requires <span class="o">=</span> 2011120500.00<span class="p">;</span>
bcbd130 <span class="o">(</span>Justin Filip 2013-01-23 11:25:26 -0500 30<span class="o">)</span> <span class="nv">$plugin</span>->component <span class="o">=</span> <span class="s1">'local_rljquery'</span><span class="p">;</span>
bcbd130 <span class="o">(</span>Justin Filip 2013-01-23 11:25:26 -0500 31<span class="o">)</span> <span class="nv">$plugin</span>->maturity <span class="o">=</span> MATURITY_BETA<span class="p">;</span>
bcbd130 <span class="o">(</span>Justin Filip 2013-01-23 11:25:26 -0500 32<span class="o">)</span> <span class="nv">$plugin</span>->release <span class="o">=</span> <span class="s1">'1.6.3 (2.2)'</span><span class="p">;</span> // The jQuery release version with the Moodle release in parentheses</code></pre></div>
<p>After verifying that this worked correctly, I then applied the same commands to the <strong>MOODLE_23_STABLE</strong> and <strong>MOODLE_24_STABLE</strong> branches of my plugin repository, repeating the same check to make sure the earliest commit had been updated as well.</p>
<p>One thing I thought was interesting is that even though I had just modified this commit, it didn’t update the commit timestamp with the current date. For more information about how the <code>filter-branch</code> command works, refer to <a href="http://git-scm.com/docs/git-filter-branch">the documentation page for it</a>.</p>
<h1 id="conclusion">Conclusion</h1>
<p>In the end I was able to fix the problems I had introduced, learn something new about Git and get my code into a state where it installed correctly and could be peer reviewed and tested within our internal process at <a href="http://remote-learner.net/">Remote-Learner</a>. I also re-learned that I should validate even very simple code before assuming it works and spreading it around to lots of places.</p>
Hello2013-02-08T03:19:24-05:00https://jfilip.ca/2013/02/08/hello-world<p>Hi,</p>
<p>I’m starting up this site which I hope to use to share information about things that interest me. Those things will probably be related to my day job and personal projects that I am working on in my spare time.</p>
<p>Thanks for stopping by!</p>