CSV is flat file with the data separated by commas. If we needn’t have to establish a relationship in the data presented in the CSV file, then we can go with storing the data as CSV and manipulate the content for display in the web pages.
XML allows hierarchical representation of data. Data in XML is more readable when it comes to presenting the data. Data can easily be validated with XSD and can be accessed with a couple of lines of code. Huge advantage of XML is its flexibility to establish relationship in data.
To setup Rails on windows after Ruby and Rails setup,
i) Edit hosts file in windows environment and set the server name in the hosts file to
In this example, i have used “myrails” as the server name for the project.
ii) Edit httpd configuration setting on WAMP to make sure proxy and proxy_http module is turned on (check if it those lines are not commented out)
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
For this tutorial we will be using Ruby 1.9.3 and Rails 3.2.1
First thing update
$ sudo apt-get update
Next, we are going to install git, RVM which is essential for the build
$sudo apt-get install build-essential git-core curl
RVM stands for Ruby Version Manager that is used for installing and managing multiple versions of Ruby at one point of time.
# First step, download ruby from http://rubyinstaller.org/. Once downloaded click the installer to install Ruby into your desired folder (C:\Ruby). Make sure to add Ruby to your path.
# Once installed, check the version of Ruby installed by typing in
Add the following list of lines into .htaccess file or to vhost configuration file appropriate to the folder within the website
Deny from all
Same will be the case for denying files within directories
<Files ~ “\.ini$”>
Deny from all
The above lines of code will be helpful for us to prevent .svn files, .ini files, .htaccess files, include files from display within Apache
Whitelist validation refers to data validation techniques such as checking the data type, data length, input range, nature of data by its format (for e.g. phone number will be ten digits separated by hyphens satisfying the format nnn-nnn-nnnn). Regular expressions may be used for format validation in inputs.
Blacklist validation refers to rejecting data based on a know bad list filter. This is not a powerful solution as the list of possible exclusions will be many and it is difficult to implement all possible scenarios. Blacklist validation should be used in conjunction with whitelist validation but in cases where whitelist validation cannot be applied at least blacklist validation should be implemented.
Dynamic SQL (concatenated sql string) is a coding practice where by the queries are built in the program and sent to SQL Server for execution. This can allow the code to be injected into the dynamic queries causing a damage to the database.
A good alternative is to use parameterised queries where placeholders are set for the variables. The possibility of queries getting infected with injected code is completely removed with parameterized queries.
In addition to parameterized queries, it is alway a best practice to sanitize the input parameters before using them in queries.
Also the data input should be encoded appropriately especially in case of dynamic sql usage and to apply appropriate encoding when extracted from the database to avoid cross-site script execution.
Follow the simple steps given below to integrate Zend framework with other applications like WordPress, Joomla and other such open source or custom web applications.
i) Setup your Zend framework application as usual.
ii) Set the document root of the Zend application to the public folder within Zend install
iii) Now setup a folder for your wordpress or joomla or custom application. Let us assume that we want to create a custom blog application. Create a folder “blog” within “public” folder. Inside blog folder, create two files – .htaccess and index.php. Code for the two files are given below
XDebug provides a lot of useful information to a PHP programmer to debug code thus saving time and increasing efficiency.
As a first step, check the version of PHP you are running by creating phpinfo() in a file.
When the program is executed you will see a line of text showing the version of PHP you are using
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
Now that we know the version of PHP we are using, we can download the relevant xdebug version to to debug PHP programs with Notepad++
We will setup Notepad++ with xdebug and dbgp plugin.