Monday, January 13, 2014

MySQL Command Line

sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart

Config MySQL (my.cnf) for OSX Mountain Lion

Mac load default MySQL setting, so there is no my.cnf file. To customize MySQL config:

1) Create you own my.cnf
sudo cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf

2) Update my.cnf

3) Restart MySQL
sudo /usr/local/mysql/support-files/mysql.server restart



Thursday, January 2, 2014

Add Virtual Host for OSX Mountain Lion

Update /etc/apache2/httpd.conf

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
DocumentRoot "website_root"
ServerName server_name
</VirtualHost>

<Directory "website_root">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Update /etc/hosts

127.0.0.1 server_name

Enable pdo_mysql for OSX Mountain Lion

Update /etc/php.ini

extension=php_pdo_mysql.dll
pdo_mysql.default_socket=/tmp/mysql.sock

Tuesday, April 30, 2013

Enable Apache for OSX Mountain Lion

To enable
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

To disable
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

Monday, December 10, 2012

[小技巧] Mac OS X 內建尋找輸入碼及聯想詞

尋找輸入碼
[shift] + [option] + [L]

聯想詞
[shift] + [option] + [U]

Wednesday, October 3, 2012

Create XCode Project

1. New a project from "Empty Application"

2. Update AppDelegate.h

    - update "window" property as IBOutlet

3. Create AppWindow

    - New a xib named "AppWindow.xib"
    - Change the class of "File's Owner" to UIApplication
    - Add an object to "Objects" and change its class to "App Delegate"
    - Point "File's Owner" outlet named "delegate" to "App Delegate"
    - Point "App Delegate" outlet named "window" to "Window"

4. Point "Main Interface" to AppWindow in target setting

5. Update AppDelegate.m

    - remove code to alloc/init window

6. Create MainViewController

    - New a class from UIViewController with xib named "MainViewController"
    - Do something in the xib, say add a button

7. Update AppDelegate.m

    - load MainViewController in AppDelegate
      MainViewController *vc = [[MainViewController alloc...
      [self.window setRootViewController:vc];