Installing mysql2 gem on Ruby 1.9.2 and Rails 3.0.5 on Windows

When running ‘rake db:create’, you may get the following error:

[codesyntax lang=”bash”]
>rake db:create
rake aborted!
126: The specified module could not be found. – d:/RailsInstaller/Ruby1.9.2/li
b/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so
[/codesyntax]

or may get these errors while installing mysql:

[codesyntax lang=”bash”]
rake aborted !
uninitialized constant mysql2
[/codesyntax]

Error ‘uninitialized constant mysql2’ comes when mysql2 installation is not done properly.

Continue reading

Working with regular expressions (preg_) and UTF-8 strings in PHP

Regular expression patterns \w, \d, \s will not work as expected for non-latin letters in a UTF-8 string when you use preg_ functions (like preg_match, preg_split, preg_replace).

First of all you must use modifier /u to work with UTF-8 strings correctly.

One of the best solutions to common tasks is to use the pattern escapes \P, \p, and \X, which refer to Unicode character properties.

Continue reading

SQL Server 2005/2008 Express free Profiler Tool

Microsoft SQL Server family includes free Express edition, that is fully functional, however has some limitations which prevent from using it in development process. SQL Server Profiler is not available in SQL Server Express edition.

There are a few free open source software that acts as Sql server profil. One of them is AnjLab.SqlProfiler available to download at http://sqlprofiler.googlepages.com/.
Continue reading