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
ruby strip vs strip!
Thursday 11/27/2008 – Category: Uncategorized – No Comments
Sorry to disappoint, but this entry isn't about strippers.
str.strip returns a copy of string str with with whitespace chopped off, while str.strip! returns the same string str or nil if the string wasn't altered.
I didn't realize str.strip! would return nil until I was getting a lot of empty strings back...
Recent Posts
- Solve Something – The Best Helper App for Draw Something
(Tuesday 04/17/2012 – Uncategorized – No Comments) - Marble Paint
(Friday 02/4/2011 – Uncategorized – 1 Comment) - More Flickr Original Updates
(Sunday 01/23/2011 – Uncategorized – 14 Comments) - Flickr Original updates
(Saturday 08/7/2010 – Uncategorized – 19 Comments)
