2014年2月22日 星期六

Python - How to install mysql-python on ubuntu?

$> sudo apt-get install python-dev

$> sudo apt-get install libmysqlclient-dev

$> pip install mysql-python

Reference :

1. http://lucaswei.blogspot.tw/2012/02/pythonh-no-such-file-or-directory.html
2. http://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found

Python - How to install MySQL-python on MAC ?

1. Open console on mac.

2. Input cmd ...

$> pip install MySQL-python

$> sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Python/2.7/site-packages/_mysql.so

$> sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Directories/To/File/filereferencedinpython

3. Add setting ..

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

Reference :

1. http://moravec.net/2013/04/installing-mysql-python-on-mac-os-x/
2. http://coddswallop.wordpress.com/2012/08/23/solving-library-not-loaded-libmysqlclient-18-dylib-when-importing-mysqldb-on-lion/

Python - How to install pip on MAC ?

1. Open console on mac

2. input the cmd on console:


$> sudo easy_install

Reference : http://stackoverflow.com/questions/17271319/installing-pip-on-mac-os-x

MySQL - How to install MySQL on MAC ?

1. Download the install dmg file from MySQL web side :

http://dev.mysql.com/downloads/mysql/

PS. please download the "MySQL Community Server"  mac version.

2. After double click the dmg file, you must to install the 2 pkg and 1 prefPane.

3. Modify the default password of MySQL :

(1) Open mac console mode.

(2) cd /usr/local/mysql/bin

(3) ./mysqladmin -h localhost -u root password

4. Add path of bin into your environment parameter.

(1) sudo vim /etc/bashrc

(2) Add "export PATH=$PATH:/usr/local/mysql/bin"
Reference : 
1. http://f.pil.tw/thread-108370-1-1.html
2. http://dev.mysql.com/downloads/mysql/

2014年2月19日 星期三

MySQL - How to move the data base to other path ?

1. Modify the database path on "/etc/mysql/my.cnf ".

#datadir = /var/lib/mysql
datadir = /home/alleen/mysql

2. Copy the database folder to new path.

cp -Rp /var/lib/mysql /home/alleen/mysql

3. Modify the database path on "/etc/apparmor.d/usr.sbin.mysqld"

#  /var/lib/mysql/ r,
#  /var/lib/mysql/** rwk,
/home/alleen/mysql/ r,
/home/alleen/mysql/** rwk,

4. Restart the mysql.

/etc/init.d/mysql restart


C# - How to Add the Administrator permission in vs2008 project


1. Right click project -> Add .. -> Add new item -> Application Manifest File.

2. Open "app.manifest" and replace this ...



to 


3. Save ...

Reference : 

1. http://stackoverflow.com/questions/7666408/how-to-request-administrator-permissions-when-the-program-starts

2. http://social.msdn.microsoft.com/Forums/vstudio/en-US/f6cd003f-ba3b-44f3-817f-2d8b4e11a0eb/getting-the-admin-rights-in-c?forum=netfxbcl