Sunday 27 April 2014

php mcrypt so slow



If you don't specify argument for mcrypt_create_iv(), it will use /dev/random(on Linux) by default as a random number generator. The problem of /dev/random is that its random pool depends on the system interrupts, when there is not enough system interrupts, it cannot generate enough random numbers, then the process tries to get the random numbers will wait and hang. Let's look at a simple example.
$ dd if=/dev/random bs=1024k count=1
When your system is busy, you will find the output speed is very slow, sometimes there will be pause.
The solution is using /dev/urandom instead of /dev/random, /dev/urandom is also a random number generator, but it doesn't depends on system interrupts.

mcrypt_create_iv ($length, MCRYPT_DEV_URANDOM); 

Friday 18 April 2014

English Learning Links


http://www.englishclub.com/learn-english/learn-english-how.htm

watching short films
http://www.multimedia-english.com/videos/section/official-1/tag/short-film-88

LISTENING

Kid's Storybooks:
http://freekidsbooks.org/
http://www.magickeys.com/books/
http://www.techsupportalert.com/free-audio-books-children
http://www.workaudiobook.com/WorkAudioBook/Download--Audiobooks-with-Subtitles.aspx?tag=windows
http://www.ted.com/talks
https://librivox.org/


TOEIC
http://blog.eslexplorer.com/blog/a-list-of-the-best-toeic-preparation-resources

Friday 4 April 2014

Sites for first grade math worksheets

http://www.homeschoolmath.net/worksheets/grade_1.php

http://www.eduplace.com/math/mw/models/tm_1.html

http://www.worksheetfun.com/letter%20and%20numbers/cloud%20rain%20missing%20numbers%201-30%20-%201.pdf