02 May 2007

microsoft knows drm.

I've been hearing a lot about this string of hexadecimal numbers. It starts with 09, ends with c0, and I think it has f9 and 88 somewhere inside.

Let's ask Microsoft search what it is!

require('open-uri') && puts(open('http://search.msn.com/results.aspx?q=09+f9+88+c0') {|f| f.read}.downcase.gsub(/<[^>]+>/,'').tr('^0-9a-f','').scan(/09.+?c0/).inject(Hash.new(0)) {|h,nu| h[nu]+=1;h}.sort_by {|str,freq| freq}.last.first)

Whew!

For non-Rubyists:
require we can open urls like files, and put this string: open the msn search page for all pages that have 09, f9, 88, and c0, read it in one gulp into lowercase, regexp out all html tags, translate out any character that's not a hex digit, scan for all substrings that start with 09 and end with c0, make a histogram* of the array, sort by most popular, and take the most popular string.
(* Inject a hash table through the array of scanned substrings; the strings are the keys, the frequencies are the values; add one to the value every time you see any string, starting at zero.)

Remember folks, this is Microsoft's suggested answer to the 128-bit programming challenge
posed earlier today, so like love, and Cambridge weather, it's just temporary.

No comments: