Wednesday, January 14, 2009

Plone

Wow... I mean, wow. I went to a Utah Ruby Users Group tonight as I have been looking into Ruby/Rails, Groovy/Grails, and other CMS/frameworks. Ok... so one of the guys there (I thank him deeply) introduced me to Plone. He just said: "Go check it out". So I went and I actually hyperventilated durring the presentation (NEVER happened before). I was jumping up and down on the couch I was so excited. As you can probably tell, I LOVE python. Love it. I was not looking forward to learning grails and rails (I have ready read 400-500 page books on each, but to really learn them it takes a lot of practice and a good learning curve)... but now I DON'T HAVE TOO! I am buying a book tomorrow so I can digest as much as I can on Plone. Just watch the videos at http://www.plone.org. I will have much more to say about plone, I'm sure, in the near future. Development starts tomorrow!

Friday, January 2, 2009

Simple Motherboard Beep Script for Windows

Problem:
So you want to be notified by sound when something is triggered (process starts/stops, file accessed, etc). Well, you could just open a file and let it play, but what if you have headphones plugged in? Then you won't hear anything (unless the volume is extremely loud... but if you listen to it that loud I'm sure you wouldn't hear it anyways). So... how do you make your motherboard beep at the frequency, duration, spacing, and count you desire? Python.

Solution:
So Python has a wonderful module to do just this: winsound. I personally just wanted something that I could import or call from the command line to notify me of an event. So I wrote a little script to do this. I also wrote a script for py2exe.

The Script:
bell.py
So as you can see the script is only about 20 lines, but you can specify from the command line the number of beeps, duration, frequency, and spacing. I use this all the time for process monitoring, etc. It is dependable because unlike printing the \a character or chr(7) you have control over the beep AND it is dependable (doesn't depend on your terminal settings). To convert this python script to exe I use py2exe
bellexe.py

This simply creates an exe that can be called from any program within any language. I use it a lot in automated testing.

Just run:

from the command line to create the exe.