Posted by jay
on August 13, 2010
There are situations when we would like to launch an application but also hide the view once it has been launched. This can be achieved with simple AppleScript:
This sample code will first launch “Things” application and tells the “Finder” to hide the window. In order to run this script at login as well as hide the script icon on the dock at start, there are several steps required:
Prerequisite: download iBackground Scripts application. This small application will help us to hide the running script icon.
1. Open the script with apple script editor, and save as Application.

2. Drag the saved .app file on iBackground Scripts, and select “yes” in the pop up window.

3. Go to Accounts panel in System Preferences, drag the script into the ‘Login Items’ tab.

We are done. Try to logout and login again, see if this works.
Posted by jay
on March 04, 2010
Here is a short tip if someone would like to install SML Compiler on Ubuntu.
Standard ML of New Jersey interactive compiler
SML/NJ is an implementation of the Standard ML programming language.
Standard ML has many features, including type safety, polymorphism,
algebraic data types with pattern matching, higher-order functions,
and a sophisticated module system. It is especially well-suited for
writing compilers and other language processors.
This package includes the interactive compiler (sml), the compilation
manager (CM), and some essential libraries. It is a “working”
version, but believed to be stable.
Install this package if you want to program in SML.
Type in command line:
The sml will be installed under /usr/bin/sml
Posted by jay
on December 02, 2008
Rails use a UTC time stamp as migration version by default. Although most examples in books have simple number based system for managing migration versions, there isn’t much information about version type configuration. By default, a migration file(>=Rail 2.0) name look similar to:
We can turn this off and use numeric prefixes by adding this in config/environment.rb
New generated file name will look like:
But bare in mind, if the Rails project is getting large and a few developers are working on same project, it’s likely that two developers generate same version of migration (e.g. 003). Using time stamp is introduced since Rail 2.0 to avoid such problem. So… better keep the default setting!
Posted by jay
on November 27, 2008
I have a RubyGem version 1.2.0 installed on Leopard. If you would like to update RubyGems to a newer version, the RubyGem user guide suggests for modern versions( >0.8.5 ) can use the following command:
gem update --system
But, console told me the 1.2.0 is the latest version – Nothing to update! The work around is to use install rubygem-update:
gem install rubygems-update
update_rubygems
Check installed version:
MBP:~ Jay$ gem --version
1.3.1
So now, I’m able to pull the latest rSpec plugin into my Rails project.
Posted by jay
on August 16, 2008
If you get this error (in phpMyAdmin or other operation) after setting up a MySQL password:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
This might caused by phpMyAdmin’s configuration doesn’t have the new password. If using XAMPP, you need to update the /Applications/xampp/xamppfiles/phpmyadmin/config.inc.php for the phpMyAdmin:
$cfg['Servers'][$i]['password'] = 'YOURPASSWORD';
Change the YOURPASSWORD to the password you set before.
Also the /Applications/xampp/etc/my.cnf should be updated accordingly. The configration file specifies mysql’s setting. So dig in the file and update the settings:
# The following options will be passed to all MySQL clients
[client]
password = YOURPASSWORD
port = 3306
socket = /Applications/xampp/xamppfiles/var/mysql/mysql.sock
Same here update the password.
Although setting up securities for local development is a little hassle as you need to type in password etc etc, I still recommend to set it properly.
Posted by jay
on August 10, 2008
Setting up a virtual host on PC, Mac or Linux isn’t difficult, but the browser cache problem drives me crazy. Apart from editing the /etc/hosts mappings and httpd.conf, you need to restart both Apache and browser. Refreshing the browser(Firefox) doesn’t clean the cache, so the result will be always add /xampp/index.php at the end of the virtual host name.
Posted by jay
on August 09, 2008
Leopard PATH setting is quite different from Tiger. Configuring PATH on Tiger, we used to either modify the /etc/path or user path configuration. With Leopard, system-wide path configuration is managed by /etc/profile. The file loads a path_helper script. So what the script does?
The path_helper constructs the system environment PATH in this order:
- Reads the local user configuration first, under
~/.bash_login
- Appends default system paths
/usr/bin:/bin:/usr/sbin:/sbin
- Reads the paths line by line in
/etc/paths
- Retrieves all the files in
/etc/paths.d/ that contains other packages configurations. For example, I created a file /etc/paths.d/system and stuff in some user paths settings. They are appended after step 3.
In my case, I wanted my XAMPP packages overrides the default Leopard MySQL, PHP and Apache paths ( so I don’t have to type in /Application/xampp/xamppfile/bin to use the command every time, also the package is easier to manage ). So just put the paths in the ~/.bash_login, that will override the system default.
Close the Terminal and open it again, to check your path settings, type:
echo $PATH
There we go, it’s updated.