Symfony 1.4 main console commands with propel

1) Build Schema from Database (Make sure config/database.yml is configure with the Database)
php symfony propel:build-schema
2) Build Models
php symfony propel:build –model
3) Build Forms
php symfony propel:build –forms
3) Build Filters
php symfony propel:build –filters
4) Cache Clear
php symfony cache:clear

For complete commands list vist

Funtion to security all Form Post Data


function securityOnPost($array){ //$array
    foreach ($array as $key => $value){
        if(is_array($value)){ //If $value is an array
        } else {
            $_POST[$key] = mysql_real_escape_string($_POST[$key]);

function securityOnPostKey($array, $key){ //$array
    foreach ($array as $keySub => $value){
        $_POST[$key][$keySub] = mysql_real_escape_string($_POST[$key][$keySub]);


Nginx Server configuration for rewrite

If you have domain or host for instance and you want to run codeigniter in sub folder like /{root}/subfolder1/subfolder2/codeigniter then add follow configuration in /etc/nginx/sites-available/default.

location /subfolder1/subfolder2/codeigniter/
if ($request_uri ~ “^system.*”){
rewrite ^/subfolder1/subfolder2/codeigniter/(.*)$ /subfolder1/subfolder2/codeigniter/index.php?/$1 last;
if (!-e $request_filename){
rewrite ^/subfolder1/subfolder2/codeigniter/(.*)$ /subfolder1/subfolder2/codeigniter/index.php?/$1 last;

Sudo commands are

sudo nano /etc/nginx/sites-available/default (To Edit default configuration file. Use shortcut ctrl+o to write and ctrl+x to save with Y and exit with enter)

sudo service nginx restart (To restart nginx after the changes)

Major GIT commands with examples

Here you will find a list with the major commands, their short descriptions and exemplary usage. For a detailed description of all the GIT commands please visit

Major GIT commands:

  • git configSets configuration values for your user name, email, gpg key, preferred diff algorithm, file formats and more. Example: git config –global “My Name” git config –global “” cat ~/.gitconfig [user] name = My Name email =
  • git initInitializes a git repository – creates the initial ‘.git’ directory in a new or in an existing project. Example: cd /home/user/my_new_git_folder/ git init
  • git cloneMakes a Git repository copy from a remote source. Also adds the original location as a remote so you can fetch from it again and push to it if you have permissions. Example: git clone
  • git addAdds files changes in your working directory to your index. Example: git add .
  • git rmRemoves files from your index and your working directory so they will not be tracked. Example: git rm filename
  • git commitTakes all of the changes written in the index, creates a new commit object pointing to it and sets the branch to point to that new commit. Examples: git commit -m ‘committing added changes’ git commit -a -m ‘committing all changes, equals to git add and git commit’
  • git statusShows you the status of files in the index versus the working directory. It will list out files that are untracked (only in your working directory), modified (tracked but not yet updated in your index), and staged (added to your index and ready for committing). Example: git status # On branch master # # Initial commit # # Untracked files: # (use “git add <file>…” to include in what will be committed) # # README nothing added to commit but untracked files present (use “git add” to track)
  • git branchLists existing branches, including remote branches if ‘-a’ is provided. Creates a new branch if a branch name is provided. Example: git branch -a * master remotes/origin/master
  • git checkoutChecks out a different branch – switches branches by updating the index, working tree, and HEAD to reflect the chosen branch. Example: git checkout newbranch
  • git mergeMerges one or more branches into your current branch and automatically creates a new commit if there are no conflicts. Example: git merge newbranchversion
  • git resetResets your index and working directory to the state of your last commit. Example: git reset –hard HEAD
  • git stashTemporarily saves changes that you don’t want to commit immediately. You can apply the changes later. Example: git stash Saved working directory and index state “WIP on master: 84f241e first commit” HEAD is now at 84f241e first commit (To restore them type “git stash apply”)
  • git tagTags a specific commit with a simple, human readable handle that never moves. Example: git tag -a v1.0 -m ‘this is version 1.0 tag’
  • git fetchFetches all the objects from the remote repository that are not present in the local one. Example: git fetch origin
  • git pullFetches the files from the remote repository and merges it with your local one. This command is equal to the git fetch and the git merge sequence. Example: git pull origin
  • git pushPushes all the modified local objects to the remote repository and advances its branches. Example: git push origin master
  • git remoteShows all the remote versions of your repository. Example: git remote origin
  • git logShows a listing of commits on a branch including the corresponding details. Example: git log commit 84f241e8a0d768fb37ff7ad40e294b61a99a0abe Author: User <> Date: Mon May 3 09:24:05 2010 +0300 first commit
  • git showShows information about a git object. Example: git show commit 84f241e8a0d768fb37ff7ad40e294b61a99a0abe Author: User <> Date: Mon May 3 09:24:05 2010 +0300 first commit diff –git a/README b/README new file mode 100644 index 0000000..e69de29
  • git ls-treeShows a tree object, including the mode and the name of each item and the SHA-1 value of the blob or the tree that it points to. Example: git ls-tree master^{tree} 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 README
  • git cat-fileUsed to view the type of an object through the SHA-1 value. Example: git cat-file -t e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 blob
  • git grepLets you search through your trees of content for words and phrases. Example: git grep “” — *.php
  • git diffGenerates patch files or statistics of differences between paths or files in your git repository, or your index or your working directory. Example: git diff
  • gitkGraphical Tcl/Tk based interface to a local Git repository. Example: gitk


  • git instawebRuns a web server with an interface into your local repository and automatically directs a web browser to it. Example: git instaweb –httpd=webrick git instaweb –stop


  • git archiveCreates a tar or zip file including the contents of a single tree from your repository. Example: git archive –format=zip master^ README >
  • git gcGarbage collector for your repository. Optimizes your repository. Should be run occasionally. Example: git gc Counting objects: 7, done. Delta compression using up to 2 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (7/7), done. Total 7 (delta 1), reused 0 (delta 0)
  • git fsckDoes an integrity check of the Git file system, identifying corrupted objects. Example: git fsck
  • git pruneRemoves objects that are no longer pointed to by any object in any reachable branch. Example: git prune

Installing Git on Windows

Installing Git on Windows

Installing Git on Windows is very easy. The msysGit project has one of the easier installation procedures. Simply download the installer exe file from the GitHub page, and run it:

After it’s installed, you have both a command-line version (including an SSH client that will come in handy later) and the standard GUI.

Note on Windows usage: you should use Git with the provided msysGit shell (Unix style), it allows to use the complex lines of command given in this book. If you need, for some reason, to use the native Windows shell / command line console, you have to use double quotes instead of single quotes (for parameters with spaces in them) and you must quote the parameters ending with the circumflex accent (^) if they are last on the line, as it is a continuation symbol in Windows.

Create an Example CRUD Module in Drupal 7

There are two basic files require to create a module i.e .info file (contains basic information of module like title, description, configuration link path, module version, Drupal version e.t.c) and .module file (contains functions which implement Drupal hooks to display menu and table e.t.c on admin panel or front site).

Five Mostly use PHP design patterns

Design patterns were introduced to the software community in Design Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (colloquially known as the “gang of four”). The core concept behind design patterns, presented in the introduction, was simple.

Creating Modules in Drupal 6

Following are the steps to create module in Drupal 6.

Step 1:

  • Goto sites/all/ in you drupal root folder and create a folder with the name modules.
  • Now select a name of the module you want to create and create a folder in sites/all/modules with the name you select.
  • For Example we select a name onthisdate. Now we created folder as sites/all/modules/onthisdate.

How To Setup Apache Virtual Host Configuration in Three Steps with wamp

Step 1:

Open file host in the path “C:\Windows\System32\drivers\etc\” and add following at the bottom,

  • mysite.local
  • localhost

make sure localhost at the bottom.