msvc9 compatibility

- sqrt in msvc9 needs explicit cast from int
- freak error with cuda & msvc9 when using modulus operator(%)
extra explanation in code
Merge pull request #460 from bbudescu/msvc9-compat

msvc9 compatibility
made a check less sensible
fixed bug in convert_to_one_hot (thanks Alexandre Lacoste)
added test for convert_to_one_hot
Merge pull request #461 from goodfeli/master

Fix convert_to_one_hot and add a test