Monthly Archives: June 2011

Formatted numbers in Ruby

In C or C++, it’s can be a pain to get thousands separators in printf. In ruby, it can be trivial, as long as you use the right libraries. If you have ActiveSupport installed (which I believe comes with Rails), … Continue reading

Posted in Programming, Programming Languages Suck, Ruby | Leave a comment

Finding the sort order of an array in R or Ruby

Suppose you have an array that you’d like to sort by another array. A common use case might be a set of arrays of somethings and for each something you generate a score in say [0,1]. Now you’d like to … Continue reading

Posted in Programming, Programming Languages Suck, R, R Tip | Leave a comment

Getting the value of a variable from a string in R

It’s often convenient to use reflection to get the value of a variable from the name as a string. In R, you can use the get function to do this. In R : blog $ R > x = 3 … Continue reading

Posted in R, R Tip | Leave a comment

Windows still sucks, can’t read exfat formatted on a mac

Now that OS X Snow Leopard supports exfat / fat64 and Microsoft Windows theoretically does, you might naively assume that you can share external drives between Vista and Snow Leopard. This is true with one giant caveat: you can’t format … Continue reading

Posted in Suck | Leave a comment

Prepping the Reuters 21578 classification sample dataset

I’ve been playing around with some topic models and decided to look at the Reuters 21578 dataset. For your convenience, this dataset is stored as xml split between 20 files or so. And invalid xml at that. I prefer to … Continue reading

Posted in Classifiers, Programming, Programming Languages Suck | Leave a comment

Thousands Separator in printf in C++

I’ve unfortunately been writing some C++. It’s the crappiest language in the world. I just wasted 90 perfectly good minutes attempting to put thousands separators in numbers that I’m printf ing. If you naively read the man pages, it looks … Continue reading

Posted in Programming, Programming Languages Suck | Leave a comment