Wednesday, December 30, 2009

Counting word frequencies

My code segments in my comment on http://blogs.sourceallies.com/2009/12/word-counts-example-in-ruby-and-scala/comment-page-1/#comment-255 were eaten. Here it is




This is a favorite question of mine as well, but I expect the developer to be pragmatic and provide me a scripting solution that can be written and run in less than 5 minutes.

// cat individual files into all.txt
// and do the rest in awk one liner

awk '{for(i=1;i<=NF;i++) c[tolower($1)]++} END {for(w in c) print w, c[w]}'

// output can be sorted in both ways in the same statement as well

... | sort | tee alpha_sorted.txt | sort -k 2 -nr > freq_sorted.txt

Tuesday, December 29, 2009

Weird nature.

Toxoplasma gondii infections have the ability to change the behavior of rats and mice, making them drawn to rather than fearful of the scent of cats. This effect is advantageous to the parasite, which will be able to sexually reproduce if its host is eaten by a cat. The infection is highly precise, as it does not affect a rat's other fears such as the fear of open spaces or of unfamiliar smelling food.

Studies have also shown behavioral changes in humans, including slower reaction times and a sixfold increased risk of traffic accidents among infected males, as well as links to schizophrenia including hallucinations and reckless behavior. Infected men were more likely to be aggressive, jealous and suspicious, while women became more outgoing and showed signs of higher intelligence.

http://en.wikipedia.org/wiki/Toxoplasma_gondii

Thursday, December 24, 2009

Week in review

22 miles in this short week. Aside from a blister no injuries so far. Next week will be even shorter, the gym will be open only on Thursday. Good excuse to take a break and focus on other stuff. One big project is refinancing the mortgage. Almost done with the docs. The rate will go down from 5.25% to 3.875%.

Friday, December 18, 2009

Week in review

28 miles this week. Above the goal but will be resting mostly the last week of the year so the monthly total will be aligned with the average. No injuries so far and feeling stronger. Started doing the dips and pull ups without support.

Friday, December 11, 2009

Week in review


Little behind on miles but OK. What concerns me is I feel tired and guess coming down with cold. Also gym will be closed for most of the following week to complete enough miles for December. It's too cold to go out!

On Religion

Religion is good. It's like the homeless shelter. Comforts you when there is nowhere else to go. The problem is why there are so many people who needs it?

Thursday, December 10, 2009

Lost in translation

There was once a Sioux chief, he was so feared that even the sight of his horse would cause fear. His name in English: Man-Afraid-Of-His-Horse.

http://en.wikipedia.org/wiki/Young_Man_Afraid_Of_His_Horses

Friday, December 4, 2009

Week in review


Total 23 miles for this week. So far on target without any injuries.