Monday, August 31, 2009

Second argument in javascript's link method (CakePHP)

To create a link to javascript files, we can use 'link' method.
For example, if I type echo $javascript->link('tiny_mce/tiny_mce.js',false);

The second argument is 'false'. It means the script link will be displayed in the html's head section.
If it is 'true', the link will be displayed in html's body section.

Well, there's actually more story to how CakePHP choose where to put the link.
Actually, if second argument is 'false', the link will be displayed in $scripts_for_layout section, and if it's 'true', it will be displayed in $content_for_layout.

Both $scripts_for_layout and $content_for_layout is written inside the layout file.
If you create your own layout, you should find the file inside app/views/layouts folder.
If you use the default layout, the file is cake/libs/view/layouts/default.ctp

You will see that the $scripts_for_layout is written inside the head section, and $content_for_layout is written inside the body section.

Remove sql statement at the bottom of the page (CakePHP)

By default, CakePHP display a list of sql statements at the bottom of the page.
This is the result of CakePHP debug level.

To remove the sql statements, we need to change the debug level to 0.

Open the app/config/core.php, search for this line
Configure::write('debug', 2);

Then change it to 0
Configure::write('debug', 0);

Done.

Wednesday, August 19, 2009

Activate Backspace to go to previous page in Firefox

I often use Backspace to go to the previous page. However, it didn't work in my newly installed Ubuntu machine (Ubuntu 9.04, Firefox 3.0.8).

To fix this, type 'about:config' in the address bar, then type 'browser.backspace_action' in the filter box. The value was 2, so I need to change it to 0. Done!

Monday, August 17, 2009

Watching TPG IPTV on Firefox (Ubuntu 9.04)

By default, we can't watch TPG IPTV on firefox. We'll get error saying that your VLC player is too old.

To fix this problem, we have to install vlc,vlc-plugin-esd, mozilla-plugin-vlc. Use Synaptic to install those packages.

Source: http://www.videolan.org/vlc/download-ubuntu.html

Playing DVD on Ubuntu 9.04

By default, DVD can't be played on Ubuntu.
We have to add some libraries.

The installation details can be found here:
http://ubuntuforums.org/showthread.php?t=766683

These are the steps that I did based on information from that forum.
Run below command to add medibuntu to the repository.
sudo wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list; sudo apt-get -q update; sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring; sudo apt-get -q update

Then run:
sudo apt-get install libdvdcss2 libdvdread4 libdvdnav4 vlc

Until this point, I still can't play DVD.
Well, it seems I have to run this command:
sudo apt-get remove gnash gnash-common libflashsupport mozilla-plugin-gnash swfdec-mozilla && sudo apt-get install alsa-oss faac faad flashplugin-nonfree gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-pitfdll libmp3lame0 non-free-codecs sun-java6-fonts sun-java6-jre sun-java6-plugin unrar

Perfect..I can play DVD now.

Install Flash Player

By default, Flash Player is not installed on Ubuntu 9.04. An easy way to install it is to use Firefox to open a website with flash content, then click the 'Install Missing Plugins' button, choose the Adobe's one, and just follow the instructions.