Those of you who know me are probably aware that I spend a lot of time performing with Barrel Of Monkeys. I could happily tell you why I think they’re important, but I’m going to let 15-year-old Sebby D, who attended our Loyola Park After School Program tell you in his own words:
When I was 7 years old my grandmother came to Chicago for a visit, and we looked for something to entertain us with. We came across a show titled “That’s Weird Grandma”. We decided to see it out of love for the name. The show made us laugh until we cried from the very beginning to the end of the performance. The performers called themselves “Barrel of Monkeys” and we were intrigued to find out more about the program. I was signed up as soon as we heard that Barrel of Monkeys had a creative writing/acting class for kids.
I went into the first class nervous not knowing what to expect. The Barrel of Monkeys instructors were nice and funny and they made me laugh right away. My fears went away and I had the opportunity to act and be as silly or weird as I had wanted. The teachers were very talented and welcoming to me which made me felt like I belonged there. I was so sad that the hour and a half was over and I couldn’t wait to go back the next week.
The teachers had us write in journals near the end of the class. They said that I was supposed to write a story and be as creative as I wanted. I had originally thought that it would be a boring routine journal entry, and that the idea of a class that wasn’t a little boring seemed to good to be true. I was wrong. I was able to allow my story to run off in any direction it decided to go, which is a concept that I had never heard before. I was confident in doing this because one of the rules they had that they had repeated over and over is that every idea is a good idea.
Barrel of Monkeys has helped me throughout grade school. I was able to speak in front of my class with confidence, and throughout my years in school there were a total of 3 plays for my class to be in. I was given the largest speaking role in all three of them and I had the best time making all my roles have an interesting personality, voice and look. It was the training that Barrel of Monkeys used that gave me the advantage over my classmates and the resources that I needed to nail the parts that were given to me. They taught me to love learning my lines, and they gave me the confidence to have the little character quirks that I used to spice up my performance.
I am nearly fifteen years old now and have reached the maximum age to be a Barrel of Monkeys student. This past year they gave me the privilege of returning as an assistant teacher for the youngest kids in the program. It helped me to learn how to teach and be a role model around little kids. But what most impressed me was seeing how dedicated the Barrel of Monkeys staff is to the students. They seem to give endlessly and never ask for anything in return. Being a part of that is something that will guide me for the rest of my life.
One of the greatest things that Barrel of Monkeys does for its students, is perform the stories that the kids have written in front of an audience. Every year Barrel of Monkeys has a celebration of authors where they invite all the students of the program to come and see the teachers perform a few of the stories that the kids have written. One year they picked one of my stories for the celebration show, and I was extremely excited to see what they were going to do with my story. When my story was being performed, the actors were being so dramatic and silly, my story truly came to life and everyone was laughing the entire time. After the performance was over and the actors came out they all congratulated me on a great story and they told me to continue writing.
Now that we have been in the program for a while, my two sisters had joined in too. All the teachers would say hi to us whenever they saw us and made sure that we knew that they loved having all three of us kids in their program. My sisters and I all loved coming to the class every week and laughing and writing/acting our hearts out. Any kid would be lucky to have the opportunity to work with these amazing people.
Dojo allows the simulation of class-based inheritance with the declare function. It even allows for multiple inheritance. However, this raises questions of how to figure out which Function to call, when a method of an instantiated Object is provided by a parent object. This article provides guidance on how to figure it out and a handy little function to determine MRO for certain.
Anyone who has spent time developing web-apps with Dojo will have found the need to associate their own functionality with the raising of events and calling of methods on other objects that may not be within their control. Dojo allows developers to attach Listeners (callback methods) to Actions (DOM events or object method calls) in order to allow such wiring.
Some of you may have stumbled across an issue whereby a Listener has been attached to an Action, but isn’t being called when that Action executes. This article explains what’s going on an how to avoid it.
I’m currently working on some Perl that processes memory dumps from a hardware appliance.
Frequently, within these dumps, I’m face with a buffer that wraps. That is to say, each entry in the buffer is filled and, once the buffer is full, the next entry to be filled is the first, again (overwriting the old value).
At the point in time that the dump is taken, there is an index value that points to the ‘start’ of this buffer (i.e. the point in the buffer that is the oldest). Unfortunately, when Perl gets hold of the buffer, it represents it as an array, with the first entry in the array being the buffer entry with the lowest memory address.
So… given an array representing a buffer and an index to the logical start of the buffer, what’s the simplest way to rejig it, so that the array represents the logical order of the buffer instead of the physical order?
splice @buffer, 0, 0, (splice @buffer, $start_index);
There are times when your web application needs to retain an arbitrary sort order for object. For example, you may have a slideshow of photographs and you want to be able to arrange them in any order you like. The simplest way to do this is to assign an attribute to each object that explicitly represents its sort position.
This raises the question, when you decide to move an object to a new position in the sort order, what is the simplest way to update the other objects to ensure that you maintain consecutive sort positions.
Imagine the following SQL table:
CREATE TABLE "projects" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" VARCHAR(255), "sort_order" INTEGER UNSIGNED );
The ’sort_order’ field contains a simple integer that indicates the position that the object should appear in. To get the ‘projects’ in the desired order, you’d execute:
SELECT * FROM projects ORDER BY sort_order DESC
To move an object from one position to another is a fairly simple operation. Each object has a unique (and immutable) “id”. An appropriate method signature would be something like this:
def change_sort_location(object_id, new_location)
The following steps should be followed:
- Identify the current location of the objects as
old_location < new_location
- Subtract 1 from
sort_orderfor all objects where
old_location < sort_order ≤ new_location
- Subtract 1 from
new_location < old_location
- Add 1 to
sort_orderfor all objects where
new_location < sort_order ≤ old_location
- Add 1 to
sort_orderfor the provided
The SQL for this is pretty straightforward:
UPDATE projects SET sort_order = sort_order-1 WHERE sort_order > @old_location AND sort_order <= @new_location
UPDATE projects SET sort_order = sort_order+1 WHERE sort_order > @new_location AND sort_order <= @old_location
UPDATE projects SET sort_order = @new_location WHERE id = @object_id
Clearly, in a full implementation, you’d probably not be using SQL variables, but the point stands.
One complaint might be that the object that is getting moved can get updated twice here, but that’s unlikely to be a major performance impact.
Currently, once object move requires 2 SQL queries. N object moves will require 2N SQL queries. I’m currently trying to figure out a method to reduce the number of SQL queries needed for multiple moves.
Many readers will already know this, but I’ve had call to walk people through this process a few times, recently, so I’m putting directions online for future reference.
Let’s say you have a website hosted somewhere, and you’ve bought the domain name from Go Daddy. How do you make that web address point to your website? Well, it’s pretty straightforward.
First, log on to your account. Once you have, you should see a page similar to this:
Select ‘Domain Manager’ and the next window will open up:
On this page, select the domain name that you’re interested in and then click on the Nameservers. The following window will pop up:
Choose ‘I have specific nameservers for my domain’ and insert the nameservers that your hosting solution provided.
Once you click OK, it may take some minutes for the change to propagate throughout the internet. Technically speaking, it can take many hours to get to every part of the Internet, but most people will see the change within a few minutes.
That’s it… easy, eh?
We all know, by now, that Twitter limits its tweets to 140 characters. We’ve all got pretty good at limiting ourselves to 140 characters, but many overlook a hidden limit. This post outlines what that is and how we can avoid it.
Many users of Twitters are hoping that their followers will retweet (RT) their tweets. Twitter recently made a change to how these work, but in general, the following pattern is followed:
UserXYZ tweets: Hey... here's something that's fascinating UserABC tweets: RT @UserXYZ: Hey... here's something that's fascinating
User XYZ’s tweet was 42 characters. UserABC’s RT was 52 characters, i.e. 10 characters were added in order to RT.
Put another way, if UserXYZ creates a tweet that was longer than 130 characters, nobody would be able to RT it with modifying the original tweet. If you’re trying to get a specific message out to the world, you might not be happy with lots of people fiddling with it.
I’ve created a new Greasemonkey script which will help you with this. I’ve written about Greasemonkey plugins before and this is another Twitter helper. If you install the script, you will see the following change:
You can now see, next to the normal character countdown, a bracketed countdown. This is the number of characters that you have left, before a tweet can no longer be RTed without modification. In this example, you would be able to send the tweet (as you have 6 characters left), but Twitter users would have to remove 8 characters before they could RT your Tweet.
To use this, it’s simple:
That’s it! As ever, your questions and comments are most welcome
- Google Analytics will not be able to track these external links (if, for instance, you’re using my Google Analytics for external links)
- Non-visual User Agents will not be able to access these links
- As a subset, Google will not be able to crawl these links and so associate your site with the sites those banners point to.
I was recently sent a script designed to take a series of advertising banners and rotate them on a page. By ‘rotate’, I mean display on banner in a designated position and then, after a certain period of time, replace it with another, and then another, and so on. To be fair to those who paid for the banners, each banner was chosen at random so that each new visitor to the site would see a different banner first, second, third, etc. After taking a look at it, I spotted some problems and decided to fix them.
Read the rest of this entry »
All of my websites are currently running on a VPS server provided by HostIcan. I recently discovered a little quirk involving VPS servers and RubyGems.
I’ve started learning Ruby on Rails and the Ruby part uses things called ‘Gems’ in a similar way to Perl using Modules. Where you read ‘gem’, thing ‘cpan’.
I wanted to install a new gem on my server to support some Paypal integration, but ‘gem’ kept segfaulting on me.
If you’re like me, you’ll see this behaviour:
root@server [~]# gem install rubygems-update Bulk updating Gem source index for: http://gems.rubyforge.org Terminated
It turns out that ‘Bulk updating…’ part gobbles up memory like it’s going spare and leads to a segfault.
The way to avoid this problem is to update RubyGems… but to do that, you need to use ‘gem’… and that leads to a segfault… and around we go again.
To break the cycle, you simply use:
gem update --system --no-update-sources
to prevent the updating of sources.
Once I’d done that, I found that I was still getting segmentation faults. Also, when I ran:
root@server [~]# gem install activemerchant --no-update-sources
I now got
ERROR: could not find activemerchant locally or in a repository
So the problem still wasn’t resolved!
The only solution was to force my system to the latest version of RubyGems. Unfortunately, this was not in my local repository. However, a manual update was pretty simple:
cd /tmp wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz tar -xvzf rubygems-1.3.5.tgz cd rubygems-1.3 ruby setup.rb