Posts

Showing posts from February, 2011

Returning the null value from a method

This example demonstrates the drawbacks of returning null from your methods. I allays preach to my colleagues that when something is wrong, your method should throw an exception instead of returning a null. But sometimes, especially if I'm writing some tools for myself, because of the laziness, I use the return null too. Few days ago I done that, and very soon I released that it was mistake which caused me unnecessary problems. Story goes like this: There is an initial list of ids and result of a process is a array of fully populated objects. I use that procedure on two places in my tool: for generating RSS file and for generating a view script. The tool is written in Zend Framework, it uses a log file, when exception occurs displays a customized error page and sends a email to me. Initially it was all flawless, but at some point, I released that I'm not able to read data for some of initial ids. So I modified a loading method in something like this: public function loadItem( $

LibreOffice installation with PPA on Ubuntu

I love to use LibreOffice on my linux desktop, so I always replace OpenOffice.org with LibreOffice when the desktop was newly installed. $ sudo add-apt-repository ppa:libreoffice/ppa $ sudo apt-get update && sudo apt-get install libreoffice Now I can use it!

equinox-theme installation on Ubuntu/Debian

Please follow steps below: Find equinox project on launchpad.net, then you can see the ppa path in the page. Install Ubuntu sudo add-apt-repository ppa:tiheum/equinox Debian sudo vim /etc/apt/sources.list Add a line: deb http://ppa.launchpad.net/tiheum/equinox/ubuntu lucid main sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4631BBEA sudo apt-get update sudo apt-get install equinox-theme faenza-icon-theme Open preference/appearence and change theme to Equinox Evolution Then, you can enjoy it!

UNetbootin installation on Ubuntu 9.10 (Karmic) and later

$ sudo add-apt-respository ppa:gezakovacs/ppa $ sudo apt-get update $ apt-cache search unetbootin --> To check if we can find unetbootin $ sudo apt-get install unetbootin

LaTeX installation with beamer class on Ubuntu

$ sudo apt-get install latex-cjk-chinese latex-beamer Then, you can create slide with LaTeX beamer class.

Rename folders from Chinese to English in Ubuntu/Debian

$ export LANG=en_US $ xdg-user-dirs-gtk-update A dialog will popup and change it. Non-empty folders will be keep. Move all files to new folders named in English from original folders. $ export LANG=zh_TW.UTF-8