Friday, 27 December 2013

Zend Framework 2.2.5 installation on WAMP

I am newbie to Zend Framework, was trying to install Zend Framework 2.2.5 on WAMP 2.4 but struggled a lot. After couple of hours I got a link which helped me to install ZF2 just in minutes, so sharing the same. Hopefully it will help someone like me in future. 

Thanks!!!!!!! Enjoy Programming J

Sunday, 1 December 2013

How to configure a static ip in Linux using Console?

Configuring your Linux machine to run on a static IP is easy. You can do that both from Console and GUI.

This tutorial is to configure a static ip in Linux using Console. Follow following steps : 

  a)  Go to 

    # cd /etc/sysconfig/network-scripts/

    Every network interface will have it’s own interface script files. 
    For Ex - eth0,eth1,eth2 etc. 

 b) Edit ifcfg-eth1 interface script file for interface eth1.  

    Replace the contents of the ifcfg-eth1 file with the parameters below.

    # vi ifcfg-eth1

    # If you're having problems with gated making 
    #  a martian, you can change this to something else 
    #  (, for example)

 c) Save the file and restart your interface to apply changes.

# ifdown eth1

    # ifup eth1

    # service network restart

 d) That's it :)

Thanks!!!!!!! Enjoy Programming :)

Sunday, 2 June 2013

Github : ignore files

Recently I have started working with git version control system and I’m loving it, especially the Git bash. 

Usually in each and every project there are some files which we don’t want to commit and push on live again and again. For example configuration files and db files once committed don’t need to be modify again for live site. In such cases to stop manual intervention git provide us the facility to ignore files.

Let’s discuss:  

We can ignore files in two ways.

1) Using .gitignore file : 

If you don’t want some files to be added and want to ignore them while uploading on 
server, then you can use .gitignore file. For example you have a file named
bkp_config.php and while pushing you code live you don’t want to push that file.
In such cases you can use .gitignore file.  

There are again two scenarios.

a)     Files have already been tracked.

Means first you have added the files, committed them and then pushed them on master repository. 

Like :

$ git add .

$ git commit -m 'Pushed Code live' 

$ git push origin master
After some time you realized that you shouldn’t have done that. Then you added .gitignore file so that in future git can ignore this file to be committed. 

.gitignore file

//content of .gitignore file 

It will use its rules when looking at files to commit. Note that git will not ignore a file that was already tracked before a rule was added to this file to ignore it. In such a case the file must be un-tracked, usually with 

git rm --cached < filename >

So in this case we have to un-track the file first.


$ git rm --cached 'bkp_config.php'

$ git add .

$ git commit –m ‘message’

$ git push origin master

(when you will commit changes and will push on server and other users have pulled the data then the file will get deleted from their clones request as well.)

Now your files are in un-tracked stage. Now go to point (b).

This file(.gitignore) can be committed into the repository, thus sharing the rule list with any other users that clone the repository.

Note that you can create a .gitignore in any subpath to have its rules applied at that path. Sometimes an empty .gitignore file is used as a placeholder for an empty path, for example to force git to generate a log/ path for your development environment to use.

b)     Files are un-tracked. 

In this case just add the rule in .gitignore file and commit the file. Push it.

If you want to even stop adding .gitignore file then use 

$ echo .gitignore >> .gitignore.

So .gitignore  file will also become un-tracked.

Next time when you will run git add . command ignored files will not get added.

2) Ignore Versioned Files :

There are some files like db.config or config.php which includes different data for local and live server. So such files are once added to the live server and after that we rarely need those to be changed and they would have different data on both local and live files. In that case we can use following command so that whenever we make any changes in local config files we should’t commit it knowingly or mistakenly.  Use

$ git update-index --assume-unchanged <file> 

If you will make any changes in a file then it would not appear in git status list. So will not get added and committed. 

List all files marked as --assume-unchanged

$ git ls-files -v | grep ^[a-z]

If you want to start tracking changes again run the following command:

$ git update-index --no-assume-unchanged <file>  

That's it. Please send me your valuable feedback through comments. All type of suggestions are welcome.

Thanks!!!!!!!!! Enjoy Programming :)