

>> local_variables # => ["_"] >> a = "Chardy" # => "Chardy" >> local_variables # => ["_", "a"]
| Action/Explanation | Keystroke |
| Eject CD on boot | Hold Mouse button down immediately after powering on |
| OS X Safe boot | Press Shift during startup |
| Start up in FireWire Target Disk mode | Press T during startup |
| Startup from a CD | Press C during startup |
| By passing primary startup volume and seek a different startup volume (CD, etc.) | Press Cmd-Opt-Shift-Delete during startup |
| Choose Startup disk before booting | Press Option during startup |
| Start up in Verbose mode | Press Cmd-V during startup |
| Start up in Single-User mode (command line) | Press Cmd-S during startup |
| Force Macbook screen reset | Press R during startup |
| Force OS X startup | Press X during startup |

sudo is su -c
su is sudo -s
I can say its about preference. Some linux like Fedora, and Centos activate su command by default, hence ubuntu, debian and Mac OS X default to sudo command. For me if I need to execute 1 time command as root, I will use sudo, and if I need to perform many commands as root (admin) then i will use sudo -s (in this case I am a mac user).
How to activate su command on mac? Use your finder and point to Applications→Utilities→NetInfo Manager→Security→Authenticate...→Enable root user. Thats all. But its advisable to use sudo command on mac os x.
I really miss tortoise svn on Windows XP. Since i use Mac, i gotta get used to it with terminal. I source out some subversion client and plugin, no luck for it. Ok, lets run through what i found out. First of all to get subversion running on your mac, you need to install it first. Get the installation from Subversion Mac OS X or get the latest version of the source code and then compile it yourself (this link). Set the path in your .profile or .bash_profile:
# svn command located at /usr/local/bin/svn, so set the path in your profile: $ vi ~/.profile $ export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
Next, if you not comfortable with command line, below is the subversion clients availabe for mac:
Assemble of tortoise svn but it sometime crash my Finder. Not recommended for Intel Mac. Just refer to this link for the binary and source (not the official site, but it work). After getting the binary, copy SCFinderPlugin.plugin to ~/Library/Contextual Menu Items/ and relauch your finder by ⌘⌥⎋ choose Finder and relaunch. The subversion contextual menu (with right click) will show up.
A cool GUI client for Mac OS X. Even work with Tiger and Mac Intel. You need to put a little effort to understand how it work to foster your coding. I am using this, in fact.
Similarly to svnX with a simple interface and tree directory structure.
Site which help you to understand more about subversion in mac os x? Click here.
Note for rails developer: Assume you have read above article link, and have set up your own svn for your rails application. Few things you need to note down for rails application below: (do these!)
$ cd ~ $ svn checkout svn://(your svn server)/(your rails application directory) $ cd ~/(your rails application directory) $ svn remove log/* $ svn commit -m 'remove logs directory in the version control' $ svn propset svn:ignore "*.log" log/ $ svn update log/ $ svn commit -m 'in the repository also log files either' $ svn move config/database.yml config/database.example $ svn commit -m 'rename database.yml to database.example' $ svn propset svn:ignore "database.yml" config/ $ svn update config/ $ svn commit -m 'ignoring any commit to database.yml'
In the case of you need to get the source from svn without .svn folder (without svn linkage), do:
$ cd ~/(your svn working directory)
$ find . -name .svn -exec rm -rf {} \;
# OR #
$ cd ~/(your svn working directory)
$ svn export svn://(your svn server location)/(your application directory)
Both way serve some purpose. Try to find out yourself whats the hidden purpose.
Cheer!
Reference:
I encountered a problem when i want to make new repository from earlier svn directory. I wanted to delete all .svn folderon my mac. Previously when i was using Windoze, i was pampered by Tortoise SVN. On mac (UNIX) everything is using command line. Use the following code to solve this problem:
$ find . -name .svn -exec rm -rf {} \;
Above script need to be executed inside the root working directory of svn coding. And tested on other platform of UNIX/Linux, it works. Also refer to this article, but its only work on linux (ubuntu), not mac. Strange. Maybe my way is better one ;p
Installing Ruby on Rails development platform, its a long process, which we need to do with our terminal, from download the source files itself to the installation part. Make it simple. Here, I just provided the installation script for Mac Intel platform since i am using it ;p and it proven. Just run a shell script file and run the whole installation. Download the file below:
Download Mac Intel Script Here
The Installation including:
Those are the basic installation of so-called rails ready platform. For some cases you need to install your own gem by yourself.
After download rails-intel.tar.gz, just run the command:
$ tar zxf rails-intel.tar.gz
Then open up the script file to get better understanding how it work and all the installation pointing to /usr/local (you can change it, just change the PREFIX), Next, its better to set the path correctly for your sheel environment, normally the file to set will be .profile or .bash_login under your home folder:
export PATH="$PATH:$HOME/bin" export PATH="/usr/local/bin:/usr/local/sbin:$PATH" export MANPATH="/usr/local/man:$MANPATH"
Before you run the script, just better create a directory 'src' inside your home folder and run the script from '~/src/' as the starting point. Next, run the script:
$ sudo ./rails-intel.sh
Wait for the installation finishing, the last piece of installation process running is mysql installation. After mysql installation done, viola.. run the script below for mysql gem
# TODO Do this after MySQL is installed # NOTE: You may have to do "sudo gcc_select 3.3" first. sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Done!
Today i will discuss about Lighttpd installation. I am making few assumptions:
Below are the step by step installation:
Run your terminal, through ssh or desktop also applicable ;p Firstly, get the distribution first.
cd /usr/local/src wget http://www.lighttpd.net/download/lighttpd-1.4.8.tar.gz tar zxvf lighttpd-1.4.8.tar.gz cd lighttpd-1.4.8
Make sure you put all your installation in "/usr/local/src", no doubt, just for tidy file management purposes. If you running on Mac OS X, there is no "wget" command, use below:
curl -O http://www.lighttpd.net/download/lighttpd-1.4.8.tar.gz tar zxvf lighttpd-1.4.8.tar.gz cd lighttpd-1.4.8
Next, start to configure:
./configure make sudo make install
Assume lighttpd already successful installed here.
Start configure the config file for running rails application and php. Below just the location where i put my setting file.
In Linux, home_dir = /home and Mac OS X, home_dir = /Users
We will use virtual host for every application deployed. Before, i have created user chardy with configuration as apache group (just let it be under apache group, there is a purpose on that)
su - useradd -g apache -G apache chardy passwd chardy su - chardy mkdir public_html rails depot
We need to install PHP first in order to run PHP application. Just follow the steps:
su - cd /usr/local/src/ wget http://sg2.php.net/get/php-5.1.1.tar.gz/from/sg.php.net/mirror tar zxvf php-5.1.1.tar.gz cd php-5.1.1 ./configure --enable-fastcgi \ --enable-force-cgi-redirect make make install
Tips: for most common support php module, do below configuration.
./configure --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-libdir=lib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-expat-dir=/usr --with-pcre-regex --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --disable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-pear=/usr/share/pear --with-kerberos --enable-ucd-snmp-hack --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --enable-soap --with-mime-magic=/etc/httpd/conf/magic --without-sqlite --with-libxml-dir=/usr --with-xml --with-mysql --with-gd --with-dom --with-dom-exslt --enable-fastcgi --enable-force-cgi-redirect
To test PHP5 whether is running correctly:
php -v PHP 5.1.1 (cgi-fcgi) (built: Jan 3 2006 23:48:02) Copyright (c) 1997-2005 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2005 Zend Technologies
It will show up PHP 5.1.1 (cgi-fcgi). Next, configure your lighttpd.conf
su - mkdir /etc/lighttpd/ cd /usr/local/src/lighttpd-1.4.8 cp doc/lighttpd.conf /etc/lighttpd/ vi /etc/lighttpd/lighttpd.conf
Edit the lighttpd.conf to satisfy few lines below first:
server.modules = ("mod_rewrite", "mod_accesslog", "mod_fastcgi")
server.port = 80
server.bind = "localhost"
# server.username = "apache"
# server.groupname = "apache"
# server username and groupname is not necessary, if not set, all will ignored
server.pid-file = "/var/run/lighttpd.pid"
accesslog.filename = "/var/log/lighttpd/access_log"
server.errorlog = "/var/log/lighttpd/error_log"
server.indexfiles = ( "index.html" )
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
server.document-root = "/Library/Rails/" + var.appname + "/current/public"
server.error-handler-404 = "/dispatch.fcgi"
Below is the sample configuration to be added for rails configuration:
#### depot.spiragram.com ####
$HTTP["host"] =~ "depot.spiragram.com" {
server.document-root = "/home/chardy/depot/public/"
server.errorlog = "/home/chardy/log/lighttpd_error.log"
accesslog.filename = "/home/chardy/log/lighttpd_access.log"
server.error-handler-404 = "/dispatch.fcgi"
server.error-handler-500 = "/500.html"
fastcgi.server = ( ".fcgi" =>
("depot.spiragram.com" =>
( "socket" => "/tmp/lighttpd-fcgi.socket",
"bin-path" => "/home/chardy/depot/public/dispatch.fcgi",
"bin-environment" => ("RAILS_ENV" => "production"),
"min-procs" => 1,
"max-procs" => 5,
"idle-timeout" => 120
)
)
)
}
## end subdomain entries
For PHP configuration below:
$HTTP["host"] =~ "phpsite.spiragram.com" {
server.document-root = "/home/chardy/public_html/"
server.errorlog = "/home/chardy/log/lighttpd_error.log"
accesslog.filename = "/home/chardy/log/lighttpd_access.log"
server.indexfiles = ( "index.php", "index.html" )
fastcgi.server = (".php" => (("bin-path" => "/usr/bin/php",
"socket" => "/tmp/phpsite.socket",
"max-procs" => 1,
"bin-environment" => ("PHP_FCGI_CHILDREN" => "1",
"PHP_FCGI_MAX_REQUESTS" => "5000"
),
"bin-copy-environment" => ("PATH", "SHELL", "USER" ),
"broken-scriptfilename" => "enable"
))
)
}
Run lighttpd server by typing
lighttpd -f /etc/lighttpd/lighttpd.conf
To stop lighttpd server
killall lighttpd
lazy way ;p
To check your installation is running or not, just point it to below url (example):
http://depot.spiragram.com - rails application
http://phpsite.spiragram.com/index.php - php application. To test php application, just create th index.php
su - chardy cd public_html echo '' > index.php
You can see rails page and php info page after you access site provided according to your configuration of v-host.
Moving towards New Year, I finally updated my blog with mephisto. My blog was down last few days, some errors happen to my typo engine, don't be bothered to fix it, i just moved it to mephisto engine. Now porting my existing article over and thinking for New Year Resolution. Happy Holiday!