Saturday, December 1, 2012

MySQL PASSWORD() function in JavaScript

If you need to implement a MySQL PASSWORD() function in JavaScript - use with 2 encodings.

Here is an example:

var password = "TestPassword";
var result = ("*"+CryptoJS.SHA1(CryptoJS.SHA1(password))).toUpperCase();
console.log("result : " + result);

Result will be *0F437A73F4E4014091B7360F60CF81271FB73180. If you check it with MySQL password() it will be the same:

mysql> select password("TestPassword") as result;
| result                                    |
| *0F437A73F4E4014091B7360F60CF81271FB73180 |

Monday, June 11, 2012

Show hidden files on Mac

To show hidden files and folders in Finder - open terminal window and paste the following line:

defaults write AppleShowAllFiles YES

Then relaunch Finder application (Option + right button click on dock icon, then select relaunch).
To disable showing of hidden files - do the same procedure with other string:

defaults write AppleShowAllFiles NO