opbarnes.com

Mon, Jan 05 2009

Look what they sell at Bronner's

It's a good thing Bronner's only sells the real stuff.

Real Plastic Snow

posted at: 14:42 | path: /Humorous | Permanent link to this entry | Add/View comments (0 existing)

 

Mon, Nov 24 2008

New Software: "Christmas Hat"

Do you have an arrangement in your family where everyone picks the name out of a hat and the name you pick is the person you'll buy a Christmas gift for? My family does this, but it's always been a bit of a pain because not everyone involved can be at the same place at the same time in order to pull names out of a hat. Inevitably someone has a name pulled for them, which puts a damper on the whole surprise and suspense part of the fun.

To make things easier, I wrote a program that pulls a random name out of a hat for everyone and then provides a mechanism for each person to enter their password (provided to them by you, the administrator) to see who the program has chosen for them. It's smart enough not to pick a person twice. It's also smart enough to make sure that a person doesn't have someone in the same family picked for them*, which is even better than pulling names from a real hat, since when there are only two names left in the hat they could be members of the same family.

If you would like to give this script a try, you can download it from here**: http://www.opbarnes.com/downloads/xmashat.php.txt

You can also play around with a demo of the script here.

* The script will attempt to make sure it has been chosen someone from another family for each person by attempting the entire hat picking sequence up to 1000 times (the script default) before giving up and going with the best case (the "best" case is the one that had the fewest number of people whose pick was someone in the same family).

** I whipped this thing together pretty quick -- so beware!

UPDATE: This software can be used for your own secret Santa party, secret gift exchange, white elephant, etc.

posted at: 18:03 | path: /Programming/OPB/PHP | Permanent link to this entry | Add/View comments (5 existing)

 

Tue, Mar 04 2008

Backronym Generator

You provide the acronym, we'll make up the meaning!

I've written a PHP script I call a "Backronym Generator". The purpose of this script is for the user to enter a word that is intended to be the resulting abbreviation of an acronym, and upon submission the script will "make up" the acronym's constituent component words.

For instance, if you enter the word: TEST

The result might be:

Trident Earache Stabbed Twang

(This really was once generated by the script)

You can try out the script here:

http://www.opbarnes.com/revacron/revacron.php

And you can get your hands on the source code here:

http://www.opbarnes.com/downloads/revacron.zip

posted at: 22:15 | path: /Programming/OPB/PHP | Permanent link to this entry | Add/View comments (4 existing)

 

Fri, Nov 09 2007

GrowlMail and Leopard not getting along?! Here's a solution

Last weekend I upgraded to Mac OS X Leopard, and one thing that doesn't seem to work with Leopard is GrowlMail* (a Growl Extra). After missing Growl Notifications for Mail.app a lot, I decided to search for a solution. After some googling, I found this on Kevin Way's blog:

"I wanted a simple system that would notify me whenever I received an e-mail from somebody "important", but not for every new message that hit my inbox."

"I tried GrowlMail and Mail.Appetizer, but found them both unsatisfactory. I finally decided that what I really wanted was a growl message to appear for messages from selected recipients. Something with the name and the subject of the e-mail, like this..."

This seemed a lot like what I needed, with the exception of the only receiving notifications when email from "important" people arrived part. So, here are my slight changes to Kevin's instructions:

  • Open Main.app and add a rule named "GrowlMailScript":

If any of the conditions are met:
Every Message
Perform the following actions:
Run AppleScript: ~/AppleScripts/GrowlMailScript.scpt

Careful! When you're finished making your new rule, Mail.app asks you "Do you want to apply your rules to messages in selected mailboxes?" Be sure click the "Don't Apply" button! If you don't, you may be bombarded with a "new mail" notification for every email you've ever recieved all at one.

  • Open a finder window and create a folder called "AppleScripts" in your user folder (this new folder will be a sibling with "Documents").

  • Now, you'll need to create the "GrowlMailScript.scpt" script mentioned above. Fire up Script Editor and paste the following script into the edit window:

        on perform_mail_action(info)

            tell application "Mail" 

                set selectedMessages to |SelectedMessages| of info

                repeat with eachMessage in selectedMessages
                    set theSubject to subject of eachMessage
                    set theSender to sender of eachMessage

                    tell application "GrowlHelperApp" 

                        set the allNotificationsList to ¬
                            {"New Mail"}

                        set the enabledNotificationsList to ¬
                            {"New Mail"}

                        register as application ¬
                            "MailScript" all notifications allNotificationsList ¬
                            default notifications enabledNotificationsList ¬
                            icon of application "Mail" 

                        notify with name ¬
                            "New Mail" title ¬
                            "New Mail from " & theSender description ¬
                            theSubject application name "MailScript" 

                    end tell

                end repeat
            end tell
        end perform_mail_action
  • Save the script (using File->Save As... when the Script Editor is active in the menu bar) in your new "AppleScripts" folder with the name "GrowlMailScript.scpt".

You're done! Send yourself an email to test it out.

* Tested with GrowlMail 1.1.2

posted at: 18:37 | path: /Mac | Permanent link to this entry | Add/View comments (8 existing)

 

Older posts (archives)...