Archive for November, 2011

Coursetree Bugfixes

Nov 30 2011 Published by under CourseTree

Most bugs in the system are now edge cases, while others are produced by aging.

  • External links to online courses from the OpenCourseWare initiative (mostly MIT) are once again available due to the search service being down for several months
  • Twitter social auth back to working after upgrading the package
  • Fixed bug where the splash had a z-index of 1, blocking interaction with the page. This only happened when loading or saving and the splash wasn’t played. Due to the splash being disabled for development, this bug could only be found in production.
  • Added exception catching when student doesn’t exist in model

No responses yet

AJAX Callbacks and Function Closures

Nov 30 2011 Published by under CourseTree

Working with JavaScript closures in an asynchronous context (callbacks) was a memorable experience when I first wrote the code for course links. Now I had a chance to look at it again after restoring the functionality during a recent bugfix.

A look under the hood of the fourth nested AJAX call:

  • postCORS is a function that provides cross browser cross origin POST requests. XDomain request is used for IE, while the usual is used for othe browsers.
  • because each callback needs to have an associated site dictionary from the previous callback, they need to have their own scope. Otherwise, a global variable would be overwritten each time through the loop in the parent closure.
  • g simply returns whatever is passed to it. This is one way of creating an independent scope. A related way is to call new¬†on a function that is a constructor.

No responses yet

PythonFiddle introduces Python scripting for the web

Nov 18 2011 Published by under Python Fiddle

The initial release of PythonFiddle attracted a lot of attention due to an article on SlashDot, one of the best places to post general technology news. Although the first version featured cutting edge technology that would run a Python interpreter in the browser, the general consensus is that it’s good for sharing Python code on the web, but not much else. With some afterthought (or maybe forethought, because this was the original intention), I made a new version for web development.

The new PythonFiddle aims to solve problems with JavaScript by offering Python as a replacement. Developers ¬†prefer class based inheritance to JavaScript’s prototypal inheritance, mostly because it’s mainstream. Writing applications with classes built into the language is helpful in large projects, along with the removal of global scope. For small projects, Python’s pseudo-code like syntax is preferable to the ancient C syntax.

The large collection of third-party tools in JavaScript is not overlooked, as in the case of Google’s Dart programming language. JavaScript libraries such as jQuery can be used directly, others can be added as external resources. With PythonFiddle, web developers who use Python server-side are now able to use the same language client-side. Besides the Python to JavaScript compiler, other advantages PythonFiddle offer include live reloading of the page, Less, and Zen Coding.

No responses yet