Some wisdom for y’all

Stop what you’re doing, and look at the bottom of my site’s home page. Here’s a handy link so that you can be sure what I’m talking about. I wrote a small Python script to generate some random quotes, and there it’s integrated into the site’s hidden region1 for any and all too see. Click on ‘Refresh’ and you get a whole new quote! I tell you, no one has done anything like this ever! Flee, mortals! All right, I’ve had my fun. Seriously. Will start writing technical stuff after this paragraph. The ‘Wisdom’ widget uses some sort of AJAX-y stuff, which I don’t understand really, but was really easy thanks to Prototype.js. You can call the script a ‘web service’ if you feel like it… it even spews out JSON! The actual quotes are kept in another Python file, and just loaded up into a list on runtime. It’s much faster than a database for sure, and I’ve even ‘normalised’ the data—split the original list into a list and a separate dictionary, if that makes any sense to you. The source code will be forthcoming in some time, once I get the code section setup. Hmm… in a year’s time or so definitely. I’ve not coded for fun for a long time, this was fun. Will build myself up to building something read one of these days. Baby steps… Update: Now available in Javascript, as a blog widget for any and all to read. Just add these lines to your blog’s template: <script type="text/javascript" xsrc="http://simulacra.in/code/quotes/RandomQuote.py?widget=true" mce_src="http://simulacra.in/code/quotes/RandomQuote.py?widget=true"> </script> This will add a div with the id ‘quote-div’ to your page, and insert a quote there. No refresh functionality is present here yet. Update: I’ve made some more changes to the script. The options parameters no longer work as explained here. Go look at the script’s page for more. [1]: A site’s hidden region is anything that’s after the headline.

Comment (1)

  1. Selvi wrote::

    Impeccable!
    It's really cool…
    I had already seen it but couldn't help commenting on it here…….

    Sunday, December 24, 2006 at 22:50 #