post

How to show hidden files and folders in mac

To enable hidden files/folders in finder windows:

1.Open Finder
2.Open the Utilities folder
3.Open a terminal window
4.Copy and paste the following line in:

defaults write com.apple.Finder AppleShowAllFiles YES

5.Press return
6.Now hold ‘alt’ on the keyboard and right click on the Finder icon
7.Click on Relaunch

You should find you will now be able to see any hidden files or folders. One you are done, perform the steps above however, replace the terminal command in step 4 with:

defaults write com.apple.Finder AppleShowAllFiles NO

Use hyphen in CodeIgniter URL

I normally like to use hyphens than underscores in URL. It looks more easier to read I think. But in CodeIgniter normally we can’t use hyphens in URL as hyphens isn’t allowed in function name or class name.

To solve this in CodeIgniter, so the correct function name is found from the uri segment, only one simple change needs to be made.

There are two easier way. First one is:
In system/libraries/Router.php find line 153 and change this line

$segments = $this->_validate_request($segments);

to

$segments = $this->_validate_request(str_replace(“-”, “_”, $segments));

Some people don’t want to edit core codes. In that case, we can use an alternative way.

A better solution is to create a MY_Router.php file in your /application/core directory. In that file you can have the following code:

This is a nicer solution, as it doesn’t alter any segments beyond the controller and method, which is generally what people are after.

post

Removing index.php in codeigniter

Hey Folks, most of the new CodeIgniter developers face a problem to remove index.php from the URL. It’s pretty simple.

Just write the following code in notepad and save as .htaccess. Put this file in the root folder where application, system folders are.

.htaccess code:

or in MAMP

And of course, make sure mod_rewrite is enabled in your server.

Cheers