AwareTek Mash-Up

Firedrop Plugins are Fun to Write!

I have written 2 simple plugins for Firedrop. One just adds a random saying from the "Zen of Python" to the end of a Firedrop blog entry. I am using the Zen plugin on this post so you will see a random saying from Tim Peter's Zen of Python at the end of this post. So this one is sort of like a "Hello World" plugin script to test things out, and anyone interested in looking into Firedrop plugins can look at Zen.py as a most simple example.

The other one is SmartPoll, which I used to make the blog entry immediately below this one. It is a little more ambitious, but the full functionality is not there yet.

This is a bare bones, weighted average sort of 'decider' to choose amongst 2 or more options, based an a user's scoring of each option on several criteria, and with the user putting numerical weights or relative importance's for each criteria used in making a decision or choice.

Now, the next step is to add in the ability of the firedrop sysop to pre-define the options (options to be chosen amongst) and the criteria on which to make the choice.

Then, when a the blog reader (user) inputs her scores and weights, and hits calc, she will see which choice scores highest (a javascript alert announces the winner) and also the scores for each option will be displayed in the text box.

Next, we need a way to store the results of each user's inputs so that we can have a Smart Poll (*tm) ;-))

I think I know how to do this with a cgi; but I'd much rather not have to make the Firedrop blogger sysop setup a cgi; I wonder could it be done with cookies?

Stewart Midwinter (or was it Davy Mitchell?) mentioned they had created some code to allow a Haloscan comments section to be added to each blog post. Michael Foord then pointed out that the comments were not permanent but only lasted a few months, and Stewart confirmed 4 months shelf life,or that you can pay $12 for a premium account for longer persistence.

But for purposes of a Smart Poll such as this, the results only need be stored for few weeks at most, one month would be more than enough. Polls are temporary and come and go, especially a poll on a discussion board on a blog entry ;-))

Concerning the SmartPoll plugin, in case it isn't obvious what I mean to do next, you could check out an example of what the script will do once a sysop pre-chooses the options to be decided amongst and the criteria for making the decision, such as an Election Poll between two or more candidates which can be found at Election Poll. A normal old PHP BBS poll for an election might ask users to choose between Bush and Kerry as Presidential candidates. A SmartPoll asks users to choose between Bush and Kerry by weighting which criteria they think are most important in making the decision, and also ranking each candidate for each criterion; and a "winner" is calculated for each participant. But once we store data, the weights and scores for each candidate on each criteria are tabulated across the electorate, so to speak. A picture is worth a thousand words, if you check out the link above you'll hopefully see what I mean. And of course the sysop can choose whichever criteria he wants as well as which Options are to be chosen amongst.

The general SmartPoll script works with up to 7 Options and up to 7 criteria, and automatically ignores any extra Option slots or extra Criteria slots (like if the sysop only enters 2 Options, the rest don't matter). Later, we could make it infinite I suppose and allow the Firedrop sysop to enter any amount of Options and Criteria and make the matrix "on the fly" so to speak.

Yet another possibility is illustrated by the "Chose Your GUI Toolkit" script found at Choose your GUI Toolkit, where the sysop has entered the scores for the various Options, as well as choosing Options and Criteria, leaving the blog user to only enter his weights for importance of each criterion, creating a mini-expert system so to speak, instead of a Poll. I don't envisage doing this yet, first I want to add a dialog to the SmartPoll plugin allowing the Sysop to pre-choose Options and Criteria to make SmartPolls for his user/readers.

Anyway, inserting Javascript into Firedrop entries allows a lot of functionality very easily!

Of course, we still need a way to store SmartPoll scores. Keep in mind the difference between a SmartPoll and regular (dumb?) poll, is the SmartPoll keeps track of users importance factors for various criteria, and also of the users scores for each option for each criteria.

Comments, suggestions and/or ideas are wanted.

All help is wanted and appreciated. I must go back to my day job tomorrow! ;-))

The code for the two plugins, should anyone want to play around with them, can be found here SmartPoll plugin and here Zen plugin

Cheers! ;-

Oh, P.S. I have only tested the SmartPoll plugin using Firedrop's HTML and/or Plain Text entry modes, I think more exotic entry modes may mangle the Javascript for SmartPoll. For this post, which uses the Zen plugin, I have used my more typical Sextile entry mode.

If the implementation is easy to explain, it may be a good idea.

Posted by Ron Stephens @ 2006-05-29 17:28:51 [permalink]
Categories: (unclassified)

Firedrop2 Plugins are Fun to Write

I have written 2 simple plugins for Firedrop. One just adds a random saying from the "Zen of Python" to the end of a Firedrop blog entry. I am using the Zen plugin on this post so you will see a random saying from Tim Peter's Zen of Python at the end of this post. So this one is sort of like a "Hello World" plugin script to test things out, and anyone interested in looking into Firedrop plugins can look at Zen.py as a most simple example. The other one is SmartPoll, which I used to make the blog entry immediately below this one. It is a little more ambitious, but the full functionality is not there yet. This is a bare bones, weighted average sort of 'decider' to choose amongst 2 or more options, based an a user's scoring of each option on several criteria, and with the user putting numerical weights or relative importance's for each criteria used in making a decision or choice. Now, the next step is to add in the ability of the firedrop sysop to pre-define the options (options to be chosen amongst) and the criteria on which to make the choice. Then, when a the blog reader (user) inputs her scores and weights, and hits calc, she will see which choice scores highest (a javascript alert announces the winner) and also the scores for each option will be displayed in the text box. Next, we need a way to store the results of each user's inputs so that we can have a Smart Poll (*tm) ;-)) I think I know how to do this with a cgi; but I'd much rather not have to make the Firedrop blogger sysop setup a cgi; I wonder could it be done with cookies? Stewart Midwinter (or was it Davy Mitchell?) mentioned they had created some code to allow a Haloscan comments section to be added to each blog post. Michael Foord then pointed out that the comments were not permanent but only lasted a few months, and Stewart confirmed 4 months shelf life,or that you can pay $12 for a premium account for longer persistence. But for purposes of a Smart Poll such as this, the results only need be stored for few weeks at most, one month would be more than enough. Polls are temporary and come and go, especially a poll on a discussion board on a blog entry ;-)) Concerning the SmartPoll plugin, in case it isn't obvious what I mean to do next, you could check out an example of what the script will do once a sysop pre-chooses the options to be decided amongst and the criteria for making the decision, such as an Election Poll between two or more candidates which can be found at Election Poll. A normal old PHP BBS poll for an election might ask users to choose between Bush and Kerry as Presidential candidates. A SmartPoll asks users to choose between Bush and Kerry by weighting which criteria they think are most important in making the decision, and also ranking each candidate for each criterion; and a "winner" is calculated for each participant. But once we store data, the weights and scores for each candidate on each criteria are tabulated across the electorate, so to speak. A picture is worth a thousand words, if you check out the link above you'll hopefully see what I mean. And of course the sysop can choose whichever criteria he wants as well as which Options are to be chosen amongst. The general SmartPoll script works with up to 7 Options and up to 7 criteria, and automatically ignores any extra Option slots or extra Criteria slots (like if the sysop only enters 2 Options, the rest don't matter). Later, we could make it infinite I suppose and allow the Firedrop sysop to enter any amount of Options and Criteria and make the matrix "on the fly" so to speak. Yet another possibility is illustrated by the "Chose Your GUI Toolkit" script found at Choose your GUI Toolkit, where the sysop has entered the scores for the various Options, as well as choosing Options and Criteria, leaving the blog user to only enter his weights for importance of each criterion, creating a mini-expert system so to speak, instead of a Poll. I don't envisage doing this yet, first I want to add a dialog to the SmartPoll plugin allowing the Sysop to pre-choose Options and Criteria to make SmartPolls for his user/readers. Anyway, inserting Javascript into Firedrop entries allows a lot of functionality very easily! Of course, we still need a way to store SmartPoll scores. Keep in mind the difference between a SmartPoll and regular (dumb?) poll, is the SmartPoll keeps track of users importance factors for various criteria, and also of the users scores for each option for each criteria. Comments, suggestions and/or ideas are wanted. All help is wanted and appreciated. I must go back to my day job tomorrow! ;-)) Cheers! ;- Oh, P.S. I have only tested these plugins using the Firedrop HTML and Plain Text entry modes, I think more exotic entry modes may mangel the javascript for SmartPoll unfortunately.

Posted by Ron Stephens @ 2006-05-29 17:24:45 [permalink]
Categories: (unclassified)

SmartPoll, a test run of a new Firedrop Plugin...

Additional functionality will be added later...
Enter Your Options in the top row, right hand side boxes. In the left hand column, enter your Criteria for making the decision; in the second column, enter the weight or importance level for each criterion; and in the next columns, enter the score or ranking for each Option for each Criterion. Then press the Decision Button to find out how to make up your mind! Scores, and weights, should each be entered in the appropriate box as a number between 1 and 100, with 1 being the lowest, and 100 being the highest. Options, and Criteria, should be entered as text.
Options>>>
CriteriaWeights

Decision Button: Click to find out which option to choose!

Scores: Higher is better. Do not write in here.

Reset to zeroes and try again?


Posted by Ron Stephens @ 2006-05-28 13:02:42 [permalink]
Categories: (unclassified)