• missing xbfish.com image
Programming
missing xbfish.com image
Posted on

[CakePHP 2.0] Authenticating user with email

By default in CakePHP 2.0, the authentication component make use of 2 fields to authenticate a user: username & password

If your web application requires user to login using email instead of a username, you can add in the following code snippet in the respective controller:

1
2
3
4
5
6
7
8
public $components = array(
        'authenticate' => array(
            'Form' => array(
                'fields' => array('username' => 'email')
            )
        )
    )
);

Take note that $components is a variable instead of a function under a controller.

Explanation: In the above code snippet, the email posted by the form will be taken as the username for the authentication component. The authentication component will then authenticate the user using email when $this->Auth->login() is called.

For more info, please refer to CakePHP 2.0 authentication component.

Automotive
missing xbfish.com image
Posted on

White headlight on my Yamaha T135

Previously, I was using a non-OEM normal bulb (35W ratings):

missing xbfish.com image

Currently, I am using this white bulb that I posted last month, (25W ratings):

Video
missing xbfish.com image
Posted on

My Heart Will Go On (in Cantonese)

Singer: Sally Yeh

Software
missing xbfish.com image
Posted on

Installing Ruby on Rails on Windows

Firstly, download the latest Ruby Installer for Windows.

Next, install Ruby using the installer. Check the following 2 boxes during the installation:

missing xbfish.com images

At the same Ruby Installer download page, download Ruby development kit and install it.

By default, Ruby Installer for Windows includes RubyGems. However, it is not the latest version. Go to RubyGems download page to get the latest RubyGems.

Extract the RubyGem package. Open up Windows command prompt and navigate to the extracted directory. Enter the following command:

ruby setup.rb

To check for gem version, enter the following command in the command prompt:

gem -v

After that, enter the following command to install Ruby on Rails:

gem install rails

To check for rails version, enter the following command in the command prompt:

rails -v
Programming
missing xbfish.com image
Posted on

Checking JDK / JRE bit version on Windows

To check Java Development Kit (JDK) or Java Runtime Environment (JRE) bit version on Windows, open up command prompt and enter the following command:

java -version

If it is 32-bit, you should see something embedded in the version info: Java HotSpot(TM) Client VM

If it is 64-bit, you should see something embedded in the version info: Java HotSpot(TM) 64-bit Server VM

This information is gathered from Java 6. I am not sure this is applicable to Java 7. If anyone knows, please comment. :)

Video
missing xbfish.com image
Posted on

张学友 – 李香兰

Classic and nice Cantonese song:

Automotive
missing xbfish.com image
Posted on

Yamaha Genuine Parts in Singapore

Below are some dealers selling Yamaha Genuine Motorcycle Parts in Singapore:

Yamaha Hong Leong Corporation
Add: 178 Paya Lebar Road, #01-01/02, Singapore 409030
Tel: +65 6746 0415
Fax: +65 6748 9238
Web: http://www.hlcorp.com.sg/motorcycles/index.asp

Chong Aik International Pte Ltd
Add: 50 Desker Road, Singapore 209581
Tel: +65 6291 2532
Fax: +65 6392 1903
Web: http://www.chongaik.com.sg/outlets

Auto Machinery Supply Pte Ltd
Add: 41 Rowell Road, Singapore 207992
Tel: +65 6292 9452
FaxL +65 6296 9944

Autocycle Centre Pte Ltd
Add: 1070 Serangoon Road, Singapore 328177
Tel: +65 6291 2515
FaxL +65 6291 7823

Programming
missing xbfish.com image
Posted on

Create new Rails application with MySQL as default db driver

To create a new Ruby on Rails application with MySQL as the default db driver in database.yaml:

rails new app -d mysql

Add -d mysql at the end of the command.

Hardware
missing xbfish.com image
Posted on

Razer Deathadder (Transformer Edition)

Got this yesterday @ Sim Lim Square for a very good price:

missing xbfish.com image

missing xbfish.com image

Sorry for the poor images. :(

This is one of the four Deathadder (Transformer edition). Mine is the Decepticons Shockwave!

Automotive
missing xbfish.com image
Posted on

HS white bulb for motorcycles

If you are looking for a white bulb that won’t melt your motorcycle headlight socket (particularly small bikes), you can take a look at this bulb:

missing xbfish.com image

missing xbfish.com image

Instruction of use:
missing xbfish.com image

High quality, made in Korea:
missing xbfish.com image

12V, 25/25W ratings:
missing xbfish.com image

missing xbfish.com image

missing xbfish.com image

I bought this bulb from Lim Battery Pte Ltd. If you are interested, do visit his website.