Programming
Opensim/Drupal integration for education - proposal and call for help
June 24, 2008 – 11:05 pmWell… i’m finally getting my teeth back into opensim and finding that there are a couple of things i’d like to get built over the next couple of months. We’ve already gotten a good start on the automated installer for opensim, but what i’d really like to do now is attempt an integration with drupal. I’ll be keeping my running requirements list for that integration on the openhabitat project page and will hopefully pop a few updates into here from time to time.
What I need
I need two things.1. I need a good drupal/opensim programmer. Someone familiar with both platforms who can spearhead the drupal integration (or, if you like opensim integration).
2. I need some sense that there are other folks in the British Higher Education community who would find this integration compelling for an application to the emerge community for extra funding.
So it took me awhile to truly understand JavaScript closures. There is limited documentation of the subject on the web, but here is a list of the resources I used to finally grasp not only what specifically creates a closure, but also why we would want to use them.
- JavaScript: the Definitive Guide
- Douglas Crockford: Private Members in JavaScript
- JavaScript Closures for Dummies
- jibbering.com/faq/faq_notes/closures.html
First, let's define closures:
- A "closure" is an expression (typically a function) that can have free variables together with an environment that binds those variables (that "closes" the expression). - Jim Ley
- ...JavaScript has closures. What this means is that an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned. This is an extremely powerful property of the language. - Douglas Crockford
- Things are different if you save a reference to the nested function in the global scope. You do so by using the nested function as the return value of the outer function or by storing the nested function as a property of some other object. - JavaScript: the Definitive Guide
- Simply put, a closure is a variable, created inside a function, which continues to exist after the function has finished executing. - Patrick Hunlock
I should preface the more detailed explanation below with a few prerequisite concepts. If you don't truly grasp these concepts, then you may get hung up when trying to understand JavaScript closures. Fortunately, your quest to understand closures should force you to understand these concepts on a deeper level first.
- global object and global scope
- reference types and primitive types
- lexical scope and the scope chain
- the call object or the ECMA activation object
- idea of persistent data
- private variables
- using return
To begin, we want to create a reusable function containing data that persists across invocations.
We don't want to hard code variables into the reusable function, and a local variable will not persist.
From what we have learned by our 'Responsible JavaScript for the Enterprise' guidelines and through our understanding of the call object, lexical scope, and namespacing: we also know that we want to greatly limit global variables in our global scope.
So instead, we want the developer to make two calls: One, to set up or 'configure' the function, and two, to invoke this 'pre-configured' function.
The power is in the first call. I like to refer to it as the configuration call.
During the configuration call, we 'freeze' the inner function by setting a reference to it in the global scope.
So this data persists. Why?
We have an external reference to this inner function.
The inner nested function retains its reference to the call object of the outer function.
The outer function's local scope resolves and the reference to its inner function remains.
This is an example from a friend that helped me finally wrap my head around the power of the technique.
function configEquation(A,B,C){
//The equation: Ax^ex1 + Bx^ex2 + Cx^ex3
//The exponents are ex1, ex2, and ex3
//The coefficients are A, B, and C and are set
var ex1 = 2;
var ex2 = 1;
var ex3 = 0;
//The exponents constitute a quadratic equation.
function theEquation(x){
var result = A * Math.pow(x,ex1) + B * Math.pow(x,ex2) + C * Math.pow(x,ex3);
return result;
}
return theEquation; //notice we return the reference not the invocation of the function(no params)
}
var myEquation = configEquation(2,3,0); //the configuration call
alert('myEquation, x = 2: ' + myEquation(2));
alert('myEquation, x = 5: ' + myEquation(5));
var myEquation2 = configEquation(1,1,1); //a 2nd configuration call
alert('myEquation2, x = 2: ' + myEquation2(2));
alert('myEquation2, x = 5: ' + myEquation2(5));

I know it is fairly well documented around the web that some of the old 'ROR up and running' tutorials are a bit difficult to digest with the new features in in Rails 2.0. So, I wanted to document my findings. And provide links to the resources that have helped me.
Here's a couple of resources to get started:
akitaonrails.com
weblog.infoworld.com
Stay posted for more of my findings.
I'd like to promote a great resource for getting up to speed on JQuery syntax.
Your Virtual Ph.D. - Popular Science
Want to master a new computer language? Brush up on your calculus? Learn how to fix your car? No sweat. With the vast array of college courses and podcasts available online, the apple of knowledge is ripe for the clicking. Here, we've narrowed the options to our favorites—the best of the geeky best, from free podcasts and lectures to accredited distance-learning programs from major universities.
Powered by ScribeFire.
Is it really necessary to purchase text books for those computer classes anymore? Take a look at your content area on each of these sites. You be the judge.
- 1. freecomputerbooks.com
- 2. freetechbooks.com
- 3. techtoolblog.com
- 4. computer-books.us
- 5. onlinecomputerbooks.com
...as this list expands keep track here: del.icio.us/cravens/freebook
On Walkabout with Greenfoot » Microworlds
I've begun to examine Greenfoot as an environment to introduce my 9th grade computer programming students to Java. After running through the first tutorial, I have found it to be a great way to visually organize my presentation of OOP (object oriented programming) and also provide my students with a creative way to begin exploring basic game design with Java.
I've offered an incentive for the class to vote through the poll module in our moodle install for the best implementation of the WombatWorld scenario; I'll display the winner along side our iboerne.com presentation at the 2007 TCEA Convention Student Showcase.
Specifically, we will be using the WombatWorld scenario, but Ill also be interested in exploring the MBCS ('Marine Biology Case Study'). More on our progress later.
powered by performancing firefox
Congratulations to my students for their great work on iBoerne.com. Our submission for Student Showcase
has been accepted for the 2007 TCEA Convention !
iBoerne.com: an Interactive Online Game for Programming Students | jessecravens.com












