Monday, January 31, 2011

PHP - Source/Static code analysis tools

PHP - Source/Static code analysis tools

Source/Static code analysis tools are designed to analysis source code and identify security vulnerabilities in PHP/Other programming languages(Java,C,C++,etc). Ideally, such tools help to identify the coding standards and reverse engineering of source code.

Here is the list of static code analysis tools

Copy/Paste Detector (CPD) - It uses PMDs duplicate code detection for PHP. PHPUnit 3.2 supports Copy & Paste Detection.

Sonar - This tool used to do unit tests,complexity, duplication, design, comments, coding standards and potential problems.

Yasca - Yet Another Source Code Analyzer, a plugin-based framework for scanning arbitrary file types, with plugins for scanning PHP.

DMS Software Reengineering Toolkit - It supports custom,dead code analysis and style checking.

Fortify - It helps programmer to identify software security vulnerabilities in PHP and other web programming languages.

Syhunt Sandcat - Helps to deteact security flaws in PHP and other web programming languages

Understand - Reverse engineering of source, code navigation and metrics tool.

Veracode - This tool used to finds security flaws in application binaries and bytecode without requiring source code. Supported languages PHP,C,C++,JAVA,etc.

Friday, January 28, 2011

How to take MySQL Database dump

Everyday web application can generate a huge amount of blogs,articles,comments and lots of other different types of data.
All that data is stored in the database. To protect your business/information you should be doing daily/weekly backups.

MySQL dump is a backup solution.It create simple sql file with tables schema and entries(insert queries) of database. Using a MySQL dump you can
easily migrate your website.

Ways to take mysqldump

shell> mysqldump [options] db_name [tbl_name ...]
shell> mysqldump [options] --database db_name ...
shell> mysqldump [options] --all-databases

With --tab and --opt option

mysqldump --tab=/path/to/dump/dir --opt database_name


Shell> mysqldump -u mysql_user -p database_name > database_name.sql
Shell> mysqldump -u mysql_user -p database_name table_name > table_name.sql

Monday, January 24, 2011

How to update fields in CakePHP

Following ways we could update fields in cakePHP

1. For example, we will be updating "name" and "mail" fields in a "User" Model for id "1". We will construct array like that with set memeber method

$this->User->read(null, 1);
    'name' => 'New name',
    'mail' => ''

2. Here is another way

$data = array(
           'User' => array(
                        'id'          =>    1,
            'name' => 'New name',
            'mail' => ''

$this->User->save($data, false, array('name','mail'));

3. This way we could update single field

  $this->User->saveField('name', 'New name');

For more information click here

Friday, January 21, 2011


GitHub is a online project hosting service using Git revision control system.

Git has cool features compare to other open source revision control system. This book is good for beginners to understand and start their projects with Git.

SVN Issue - "local delete, incoming edit upon update"

SVN update shows this message and not able to commit any files.

$ svn update
  C app/model/User.php
      >   local delete, incoming edit upon update

$ svn commit

  svn: Commit failed (details follow):
  svn: Aborting commit: remains in conflict

We may reslove this issue by following steps.

  1. Take backup of the files which we modified and newly created file in SVN tree.

  2. $ touch app/model/User.php

  3. $ svn revert app/model/User.php

  4. $ svn status

    ? app/model/User.php
  5. Do your update on that file from backup

  6. Commit it with out conflict
  I hope above steps slove this issue