1. Democracy AJAX Poll

By | June 29th, 2005 | Code | Internet | 480 Comments

Extremely Important:

This page is for Democracy 1.2 and has been preserved for archival reasons. Democracy 2.x has been released and fixes security problems, allows in-post polling, and a much better interface.

I’m announcing my second ever WordPress plugin, Democracy. Democracy adds polling functionality to your WordPress blog. It grew out of frustration with the only other WordPress polling option, WP-poll. It didn’t have valid markup, it was clunky, and it required one heck of an installation process. So I decided to create my own, using WP-poll as a reference. This plugin uses AJAX for quick sending and loading of poll data, although it doesn’t depend on javascript to function, like my other plugin. It is fully functional in non-javascript environments, meaning it will work in ALL browsers. The AJAX part is tested to work in Safari, Opera, Firefox, and IE6/Win. The poll is in my sidebar, so go ahead and see for yourself.

It also has a full-featured admin panel, which allows one to manage their polls. You can activate, edit, delete, and add new polls from the admin panel. It is also harder to ballot-stuff than WP-poll. It uses cookies as well as IP logging to prevent users from working spamming the ballot box.

And Installation is a piece of cake. Just upload it to your server, activate it, and place a template tag in your theme where you want the poll to appear.

Download: Version 1.2. It is released under the CC GPL 2.0. If you are upgrading, read the upgrade instructions in readme.txt

NOTICE: Democracy 2.0 is in development. It is being rebuilt from scratch to be more flexible. Make your feature suggestions on my democracy 2.0 post.

ESPAƑOL: Download version 1.0 RC 2. Many thanks to Javier Albert for providing a translation

  • Uses AJAX for sending and loading the results, but is fully accessible in non-js environments
  • Complete admin panel
  • When someone votes, they receive a cookie with what poll they voted in and what their vote was. It also logs their IP, so the same person can’t vote twice even if they delete the cookie
  • Allows users to see current results without voting. Also, detects if there are no votes and announces it…
  • After voting, the choice you made is highlighted.
  • Automatic database table installation.
  • Displays winners of each poll in the admin panel.
  • Delete old polls in the admin panel.
  • Edit existing polls.
  • Graphs the results of the poll beautifully and without images.
  • AJAX is compatible with IE 6, Safari, Firefox, and Opera. All the other browsers, and those with javascript turned off, are supported as well.
  • Select an active poll.
  • jal_democracy() takes poll ID arguments. Use < ?php jal_democracy(10); ?> to display poll 10. However, I recommend you use the ‘activate’ feature instead.
  • Allow your users to add their own choices.
  • Uses the date format you set in the Options panel for the Date Added column.
  • Support for rich HTML. Make your polling options be images!

Please report any errors you encounter with it in the comments below. If you like it, saying thank you is all I ask.

Update July 11

Just updated to Alpha3. It’s lot more robust, and there are plenty of new features. Check out the democracy.php Diff and the js.php Diff. The javascript file no longer conflicts with my other plugin, WordSpew. It also allows you to allow users to add their own answers if they don’t like yours.

New in Democracy Alpha 4 (plugin diff):

  • Added a few options to the head of the plugin file.
  • Added CSS file and id / class hooks that allow for easy manipulation of the design. At the top of the plugin file, you can set the HTML that the question will be wrappd in.
  • New graphing feature makes everything look much nicer when viewing results
  • Fixed HTML validity bug.
  • Cleaned up the checkIP() function for better performance.
  • Cleaned up some if...else statements to use ternary operators
  • Added deactivation feature, so if you want no poll to display, you may. Also, the default poll is no longer active.
  • Archiving function to view past polls.

Update: Releasing Beta 1, very small update. Allows users to set if they want to order the results by votes or by id. Gets rid of big bug that creates errors in wordpress if javascript is off/not running. It should work with and without javascript now. Also tweaked the CSS for Explorer.

Update August 2: Version RC 1 is here. I believe this one to be stable and ready for consumption. Here are some notes:

  • Fixed glaring bug that made IP checking completely not work.
  • Added a field for ‘added by user’, for answers added by users. This helps differentiate any ‘silly’ answers from your ‘official’ answers.
  • Bugfixes and code cleanups everywhere
  • Support for Blix theme. The Blix CSS is poorly written to make all inputs and labels be for table-like forms.
  • Got rid of a couple of IE Bugs that gave console errors.
  • Fixed or improved the flash between voting and receiving new poll data.
  • More FAQs and readme goodness.

Update August 15: Releasing RC 2. Bugfix release

  • HTML validity fixed
  • Rich (HTML) poll answers and questions re-allowed
  • i18n improvements.
  • Cookies now operate on local level instead of domain level. Useful if you have more than one blog in a domain.
  • More code beautification

If you’re updating from a version before RC 1, you’ll need to deactivate the plugin and reactivate it again.

Update August 27: Releasing 1.1. Feature release

  • Adds archiving functionality. Use the jal_democracy_archives() function. Documented in the readme.
  • Changed the graphs to use percentages instead of pixels.
  • Changeset 3215
  • Shaved a query for total votes

Update September 26: Releasing 1.2 Feature release

  • Shaved quite a few queries in admin panel and elsewhere.
  • Now uses correct charset header().
  • Code restructuring and optimization
  • No maximum for the number of answers. Cleaner editing and adding screens
  • Fixed CSS comments
  • Corrected link to my blog from the plugin page
  • htmlspecialchars() on unencoded links
  • Added 2 new FAQs to the readme

German users, you can grab a localized version of Democracy at http://www.bueltge.de/wp-plugin-ajax-umfrage-plugin/32/ . I would like to offer a localizable .pot file so that other languages can easily be done, but I have yet to find a tool for Mac that can do this. If you know of any please let me know!

2. Girls and boys

By | June 23rd, 2005 | General | 65 Comments

I was wandering around Barnes and Nobles this morning by myself, in the sexuality section. I started flipping through this book and i saw that one in three men cheat on his partner and only one in four women do. It is interesting to me that men and women act so much differently than each other. Allegedly men, when they are working on something, use a lot of their brain to do one thing, but women use smaller parts but multitask. Weird. Is there some kind of primeval reason for this difference in the way that our minds work.

Another interesting fact that i have recently found out is that testosterone is what makes people horny. So a very easily aroused girl, in fact, just has a lot of testosterone. It makes sense in a strange way. Both mails and females have testosterone and estrogen, but what does estrogen do for males? Make them gossip?

Men lose their virginity at a younger age than females do. Is it because they reach the stage in their development where they want to become sexually active but don’t have the maturity and intelligence to keep themselves out of trouble, or is it because men get around to a lot of women (very unlikely, i think). It is mostly likely caused by mens single mindedness about sex. If you are always thinking about it and then an opportunity arises to shag what are you going to do? Make waist of all those hours alone? But what if you hardly ever think about it, then when someone proposes a toast, or such, to you you will be surprised and probably veto the idea.

Men and women will never understand each other, but if either of them ever figures out the other first i think would be women figuring out men, they read Cosmo (They know everything).

3. In Reality, How Much Farther Can They Go?

By | June 22nd, 2005 | Rant | 17 Comments

Three kids run around screaming while Mommy and Nanny go out of their minds figuring out what to do. Three high-school seniors stand sweating at podiums answering biology questions (which weren’t hard at all…) in a spelling bee style while about 10 others sit in the stands scrutinizing them. One hundred volunteers rush at a house towing wrenches and hammers while the owners ride away in a limo. And all this happens on the couple square foot LCD screen that we like to call the television. The other night I was busy at being the lazy bum on the couch, flipping the channels mindlessly, when I realized that on just about every channel there was another reality TV show. Maybe it wasn’t every single channel, but I don’t have cable, so when two or three channels play the same sort of show, every channel is playing that sort of show. My point is, REALITY TV IS TAKING OVER THE WORLD!!! Not quite, but I’m sure you can see what I’m getting at.

It used to be that when one thought of reality TV, Survivor or Big Brother would come to mind, but now we’ve got new breeds such as Super Nanny and Extreme Makeover. Where reality shows used to just take a bunch of random people and stick them on some random island or in a single house, they are now taking on every aspect of US life and twisting it into something the we Americans somehow find amusing. We’ve now shows for singles, shows for those who want to improve their looks, shows for parents who can’t control their toddlers, shows for parents who can’t control their teenagers, shows for high schoolers who want to get a scholarship, shows for wannabe divas, shows for fixing up the house, and even a show (which I heard about in Chem class) that has to do with putting weird stuff on and in a car to make it …cool… NOT to mention all those that were already in existence, shows that test fears, shows that race around the world, and shows that stick you in a house or on an island to test your people and not-going-insane skills.

Why are we so attracted to this sort of entertainment? Why are these shows that pose as a representative of real life so successful? I’d say there are many reasons. One is something I’d like to call the point and laugh factor. Anyone who’s ever watched Survivor will know that the producers always stick a couple of wild characters together, and this inevitably leads to various upsets and havoc and downright stupidity at times. And when this happens, us viewers at home have nothing to do but laugh at them, or get mad at them, or feel sorry for them, or cry with them whatever the case may be. In this way, these shows create a mini-reality for the viewers. An artificial reality, but something the viewer can connect with yet remain distant from. Of course, other typical TV shows like comedies or soaps do the exact same thing, so how are the “reality” sort different? It has something to do with the unpredictability, the fact that these are actual people and not actors reciting lines. Maybe real people don’t come up with as funny lines all the time as our favorite characters, but real people just do the most random and crazy things sometimes that we are kept entertained anyway. There is also a certain appeal to the, “what would I do in that case…” scenario. It’s much easier to imagine yourself into arguing with your boyfriend while catching a train to Beijing (though it’s unlikely to happen) than into some pretty, well set scene from, say, Less Than Perfect or Friends. It’s a bit easier yelling at the screen at someone voting the wrong way on Survivor than at an actor spewing scripted lines.

I admit, I watch these reality shows from time to time and am amused by them. However, I am starting to also get really disgusted. A good example is a show that hasn’t gone on air yet but has been being promoted everywhere, Brat Camp. If your kid is horrible…forget military school, send them to Brat Camp, where instead of just being humiliated in front of their teachers and classmates they get to be humiliated in front of the entire nation. What I really want to know is what sort of parent would subject their kid, or themselves to this. Doesn’t the fact that their child is so out of hand shout out to the world what kind of parenting they’ve done? I’m sure it will be entertaining to watch these monsters turn into kind, loving members of a close community that will come home with hugs and kisses for Mommy and Daddy, but the whole concept still sets my eye twitching with the whole…hmmm…something is wrong here…feeling. The same concept goes for Super Nanny which I have watched and then wondered why I kept watching it. Parents send out a help cry and Super Nanny comes and saves the day. In the meantime we see all the parents faults and tribulations. It’s a bit perverted watching people in pain for amusement, but we do it anyways. Watching this particular show might even help some poor parent who was dealing with the same problems as the hour-long stars. However…to open up your life to anyone in the US or beyond who has a TV…igh…

Reality TV…not really reality, but we still flock like the ducks to the bread crumbs those cute little toddlers throw in the pond. Anything seems to do nowadays…wheat bread, white bread, pastries, rye… And it’s all out there. What will they think up next, a reality show for pets? (if that hasn’t been done yet…)

4. Wordspew 1.1a

on June 22nd, 2005 ( 2 )

Wordspew 1.1a has URL box capabilities and super easy installation. Enjoy!

5. Way too much!

on June 18th, 2005 ( 1 )

A photograph that just begs to be blogged about. Musta been a helluva party. Heh. Probably some delivery truck lost its payload. w00t!

6. Crimson Milk is now available!

By | June 16th, 2005 | Code | Internet | 2 Comments

My theme is now officially available for download. Check out the theme page for documentation and a download. Enjoy!