The Infinite Genies Paradox
There’s not many people out there who haven’t heard the story of Aladdin–it’s a story with quite a bit of history and has got recognition in many forms, including a cartoon rendition created by Disney. It’s a creative and interesting story, but it’s also quite flawed and most people don’t even notice that.
After finding the genie, Aladdin is told he can wish for anything except “more wishes”. This is obviously an attempt to prevent infinite wishes, but a loophole surfaces later in the story that went largely unnoticed. Jafar wishes to be a genie himself, and the original genie grants that wish, thus genies can create other genies.
Herein lies the paradox; a genie offers me 3 wishes–first I wish for something ridiculous like a trillion dollars, then I wish for someone else to become a genie, and spend my last wish to free the original genie. I now have a second genie with no wishes spent. I make another extravagant wish, make a new genie and then free the old one. Wash, rinse repeat–we have our Infinite Genies Paradox.
Were there only two wishes, the infinite loop could still be done if you chose not free the genies after, but that would have fit better with the moral dilemma at the core of the story. So why three wishes, and not two?
Anyone else have any weird observations like this on popular media? Feel free to post whatever comes to mind. It’s always interesting to see what you might not have seen without someone else pointing it out.
Back online! ….mostly…
UPDATE: Everything works now. ![]()
So I decided to switch from Slicehost to Rackspace Cloud, since my server was overloaded and having all sorts of network issues. Unfortunately things kind of exploded. I managed to get the site back online, but the URL rewriting isn’t working at the moment and I’m at work right now, so I’ll have to look at it later.
JSGame – Game development in Javascript!
I’ve recently started work on my newest Github project; JSGame. It’s a fork of philogb’s V8-GL which, as you can likely assume by the name; is an implementation of OpenGL using Google Chrome’s V8 javascript runtime. At the moment, the only difference in JSGame is a mostly untested implementation of OpenAL. I also plan to add networking support and likely SDL. Once the various libraries I plan to implement have had Javascript interfaces made I’ll begin work on making helper classes for easier access to common actions.
jquery.flash is on github! (and updated)
I’ve recently starting committing changes made to jquery-flash to github. You can view the project page for it here.
I’ve also made a few updates, the most notable being; I moved the checking code to seperate functions called isie(), hasflash() and flashversion(). All of which can be used anywhere, with or without using $().flash(). I also did some minor optimizations to make execution a little speedier.
Node.js – I’m a fanboy already.
About a week ago I discovered a unique new programming technology called node.js. It’s an event-driven javascript system running on Google’s V8 engine and is primarily focused on functioning as a web server. I hesitate to call it a web server however–it’s much more than that!
Using this amazing new system I was able to integrate support for the new WebSockets specification that Google recently added support for in Chrome, and I used this to make a simple real-time chat application with emoticon support and translation of image links to inline images and youtube links to inline videos.
…and the best part? This only took me about an hour!
There are some simple architectural differences that make it vastly more powerful that most any other popular web programming languages. One of my favorite characteristics of it’s unique design is that variables assigned in a global scope can be accessed across all requests…that means regular database querying becomes completely unnecessary! You could create a json object where you store your data, then check it over every once in awhile, and apply any changes to the database. It’d work as a query queue of sorts that would greatly reduce database interaction overhead and it wouldn’t require setting up some other incredibly complex software to proxy the requests!
I’m also quite fond of the branching design. There is a module called ‘http’ for running web servers, but it’s really just routing everything through the tcp module, which essentially does the same thing. The ‘http’ module just simplifies the interface and makes common actions like sending headers more elegant. It’s a clever design really; supply varying levels of complexity in control to match varying levels of complexity in application–not everyone is going to want the ability to create a mail server, so why would they want to have to access tcp directly? Inversely; not everyone is only going to want a web server, so why would you only supply access to http-related code?
Have a look at this sample code I ripped-off from the homepage of node.js;
var sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
setTimeout(function () {
res.sendHeader(200, {'Content-Type': 'text/plain'});
res.sendBody('Hello World');
res.finish();
}, 2000);
}).listen(8000);
sys.puts('Server running at http://127.0.0.1:8000/');
Isn’t it so simple? You just include a few modules, run http.createServer() with a callback function passing in the request and response objects and tell the server to listen on whatever port you want and whatever domain you want. In the callback you can branch of by breaking apart request.url to find the user’s query and use that to redirect via a switch block or whatever other means you see fit. Best of all, it’s asynchronous, so you don’t need to halt execution for every little thing. It’s even compatible with many common Javascript utility libraries such as Underscore
OiNK admin found not guilty, pigs fly, hell freezes over.
Alan Ellis, creator of OiNK, the most renowned Bit Torrent based music sharing site has been unanimously declared not guilty in his recent court appearance. This is a massive success for freedom and a huge blow to the corruption of the current music industry. It will be most interesting to see what the response is to this in the coming days.
[Source]
Talker – Waves? Campfires? I just want to talk!
I, among many, jumped on the Google Wave Dev Preview bandwagon. The video demonstrations they had were so nice and polished looking, but after getting the chance to try it first hand it’s polished sheen quickly faded–it was buggy to the point of being unusable and collaboration was so awkward. As a Wave expanded it became more and more difficult to determine what was new and what you had read before. Conversations would branch all over the place and you would quickly lose track of what was actually being discussed. There was other alternatives for business communication, but they all had one thing in common; over complication. Integration is fine and all, but sometimes the users don’t need what it integrates with, so it shouldn’t be built around that.
In steps Talker, a deceptively flexible messaging system wrapped in a simple interface that anyone could understand. Who likes explaining to their coworkers how an app is supposed to work, show of hands. None? Yeah, I thought so.
I first stumbled across Talker through Marc-André Cournoyer’s LinkedIn profile and, to be honest, bookmarked it and forgot about it. It was in beta at the time and didn’t have much to see, so I overlooked it’s simple nature. Today though, I received word that Talker was ready for launch. I slipped into the demo room and made a few posts. Everything was quick and responsive and the functionality was so elegant; I posted a link to an image–it loaded the image itself in it’s place, I posted a youtube link–it embedded the video right there. The attention to detail down to things like the auto-completing / commands and @ usernames was a very nice touch.
What really blew me away though was the simplicity of the plugin interface. Many useful plugins like autocomplete are literally one-liners! You can’t get much simpler than that, unlike Wave’s monolithic Python plugins that need to load a million and one external libraries just to make a basic word filter. If you haven’t checked it out already I seriously recommend you give it a try, who knows, you might like it.
jquery.flash v1.3.1 – Squashing IE-related bugs.
If you downloaded v1.3 of jquery.flash I would recommend switching to this one. There has been no functionality changes, so it should just be drop-in. It fixes a minor bug I added when I switched to using indexOf() for iterating through attributes and parameters…apparently IE doesn’t support it. >.>
That’s fixed now and I did a few minor structural changes to reduce the character count a little and make things ever so slightly speedier. I also created a fancy tutorial page type thing for it, which you can check out here.
Downloads:
Minified – 2.03 KB
Non-Minified – 4.35 KB
jquery.flash v1.3 is ready!
There’s nothing major to change in such a minimal library, but such a difference the little things can make! New in version 1.3 is;
- Class inheritance
- Src inheritance from href for easy conversion of links
- Built-in support for allowfullscreen parameter
- Minor fix to dimensions inheritance
- Added availattrs and availparams to settings object allowing anyone to add support for any extra attributes or parameters they might need!
- Moved lots of code around to use as little characters as possible, allowing optimal minification. All this new functionality and it got even smaller! It’s now down to 1.91 KB.
Available options and their defaults:
$(this).flash({
// As always; all settings are entirely optional.
id : $(this).attr('id'), // ID
class : $(this).attr('class'), // class
width : $(this).attr('width'), // Width
height : $(this).attr('height'), // Height
src : $(this).attr('href'), // Path to swf
flashvars : null, // JSON structured flashvars data
bgcolor : null, // Background color
quality : null, // Quality
wmode : null, // Window mode
allowscriptaccess : null, // Set to "always" to allow script access across domains
allowfullscreen : null, // Allow fullscreen viewing.
classid : 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000', // For IE support.
codebase : 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=', // Ditto.
pluginspace : 'http://get.adobe.com/flashplayer', // Download Firefox plugin if missing.
// Custom attributes and parameters are added like this;
// ['someattributename','someotherattributename']
//
// Then add it to the settings just like the ones above were added.
availattrs : [], // These are the attributes we should attempt to add.
availparams : [], // These are the parameters we should attempt to add.
// Version is used for flash version detection in conjunction with the express install swf value below.
version : '9.0.24', // Minimum Flash version
express : null // Path to express install swf
});
jquery.flash.js – Uncompressed
jquery.flash.min.js – Minified