Adium Top Words (part 2)

Wednesday 12/3/2008  –  Category: Uncategorized  –  1 Comment


I decided to use Shoes (a Ruby graphics toolkit) to create a GUI to make it easier so you don't have to open terminal at all.

Try it!

Adium Top Words

Saturday 11/29/2008  –  Category: Uncategorized  –  7 Comments

I have a strange habit of periodically going through my chat logs and re-reading random conversations.  When I was doing this yesterday, I wondered what my most frequently used words were in IM land.

Since Adium log files are in nice XML format, I decided to write a Ruby script to process all my logs and spit out a display of my top words.

A chatlog haiku based on my top words:

i to a it ha
for and is yeah its have that
in be of so what

Beautifully mundane.

Get the script here.

Usage: ruby topwords.rb MAC_OS_USERNAME IM_USERNAME IM_PROTOCOL
Example: ruby topwords.rb jzting jzting@gmail.com GTalk
IM Protocols: Jabber, MSN, AIM, GTalk, etc...

It will output the topwords.html file in the same directory that you ran the script.

Apache and DirectoryIndex

Friday 11/28/2008  –  Category: Uncategorized  –  No Comments

If you're getting this error:

Request exceeded the limit of 10 subrequest nesting

make sure your conf file has the DirectoryIndex variable set correctly. I had accidentally copied a conf for a Rails app that had the line

DirectoryIndex /

which was making Apache not serve the index.html file like it usually does.  Once I got rid of DirectoryIndex everything worked fine.

:layout => false

Thursday 11/27/2008  –  Category: Merb  –  No Comments

I ran into a strange behavior when trying to use setInterval in JS to make an AJAX request every n seconds.  I had the timer in the $(document).ready(function() { } in the head of my application layout file.

There would be strange behavior with the timer--every interval would be twice as fast as the previous, and the browser would quickly become unresponsive and crash.

I initially thought it was a Firefox bug so I wasted sometime googling setInterval but it turns out the AJAX request was rendering the view with the layout, thus creating another timer on each request.  Stupid.

Setting :layout => false on the offending action made everything play nice.  Moral of the story: don't forget to exclude your layouts for AJAX actions.

Getting a random record using datamapper

Thursday 11/27/2008  –  Category: Uncategorized  –  1 Comment

Model.get(1+rand(Model.count))

You'll have to have dm-aggregates for Model.count to work correctly

 Page 11 of 15  « First  ... « 9  10  11  12  13 » ...  Last »