How to not Show WordPress Posts under Certain Category at Homepage?

Sometimes we do not like to show wordpress posts under certain category or categories at homepage? Here are some methods.
For example, you do not need to show post under category 29.

First method, placing this code in index.php file will cause the home page to display posts from all categories except category ID 29.

If you do not need to show posts under category 50, and 29, you can use:

Second method: Using plug-in: Front Page Excluded Categories

Install and activate the plug-in, edit front_page_excluded_cats.php, find $cats_to_exclude, and edit the category id there, add the category you do not need to show its posts at homepage.
I have used this method for, not show latest news on housing.