Friday, September 25, 2009

html_QuickForm

First of all what is quick form

Introduction quick form..
Please download quikform2 from http://pear.php.net/package/HTML_QuickForm if the QuickForm is not available on C:\xampp\php\PEAR\HTML in my case the drive is C. something other can be in your case, for use that directory you should include that php file in your new script file
require_once 'HTML/QuickForm.php';
$form = new HTML_QuickForm();

I think it's kind of a code of library, in today's days it's important to validation for each kind of web application, like the input value(value submitted by user) should be only number or text, and the input value would be only in the format of email id..on html form.

How it works
In a simple html form there would be different element types like simple text input type, check box, radio button, select type element etc..if we create that html form manually then we should create all that html element by coding manually, but when we use the QuickForm then we don't need to create all that element by manually, we can just create them by calling a particular method(function) and passing relative arguments inside that function..eg:- $form->addElement('text', 'name', 'Item name:', array('size' => 30));
The argument of this function means...A input element item whose type is text, whose name is 'name' and label is 'Item name', and size is 20,
When you call that function it brings the html input box that user can see it on browser and can fill it.
So you don't need to write any html code for make that particular label and input item. You can create different type of element through passing the different values, for example you can pass that arguments for check box type element.
$form->addElement('checkbox', 'contact', 'Please contact me with special offers');

For check box item, these arguments are different than type text input item. so for each input item there would be different arguments, but the function name would be same.

addElement() through this method(function) you can add almost 23 elements,

now I'm telling about another method(function) addRule() through this function you can validate the particular input(eg:- the submitted value by user) example of that function is..
$form->addRule('qty', 'ERROR: Incorrect data type', 'numeric'); -> In these argument the first qty is name of the element and second is the message which can be read by user and third is validation type for example here's the checking if the qty is numeric, if yes then fine otherwise display the error message.

You can add your own validation through adding function like
$form->addRule('email', 'ERROR: Email address already in use on the system', 'callback', 'checkEmail');
as a last argument we are declaring checkEmail statement, now you can create own validation inside your function checkEmail(); Do set the return value is true if the validation is satisfied otherwise set return false

This all validation is happening on server..if you want to do that kind of validation on browser then you can use that arguments in that functions addRule() like...
$form->addRule('pass', 'ERROR: Password missing', 'required', null, 'client'); by this method we are validating the input item on client server(browser); if in your browser the javascript is available then the input validate would be by javascript otherwise in that case the input validate would be on server which is quite interesting I think


setDefaults() -> through that function we can set the default values for form by passing associative arrays, for example
$form->setDefaults(array(
'fname' => 'Enter first name',
'lname' => 'Enter last name',
'sex' => 'female',
'contact' => 1,
'dob' => array('d' => '2', 'M' => '4', 'Y' => '2007'),
'country' => 'zz',
'source' => 'web,ads'
))

In this array the index would be name of element and the value of that array would be the default value for html form.

exportValues()-> through this method(function) return the associative array on which the array of index would be name of particular element and value of array would be submitted value which is submitted by user. eg
$data[fname] => John
$data[lname] => Doe

Alternative way for exportValues() is getSubmitValues(), what is the different between them, getSubmitValues return the all submitted values submitted by user, and the exportValues() return those values only from the elements are exist in form indeed. It’s benefit is no one can hacking your data.

display() through this method you can display the form

Saturday, September 5, 2009

when does the file conflict on svn

When does the file conflict on svn?
If more than one person are changed the same line of particular file for same version, and one of them do commit that new version on svn and other will do update new version for commit then there will be conflict in file.

with example
The same version of project available for everyone, suppose version 5 is available for suman and sanjeev now suppose sanjeev changed line number 8 and 9 of file index.php, and commit that version on svn, now on svn the new version has been made which is 6, now suman also change line number 8 on index.php, now suman try to update new version from svn which is 6, in that time there will be conflict because suman change the same line(code) for version 6, which is already changed by sanjeev..

if suman will change the same line after update new version 6, there will be no conflict because in that time suman will be changing that line for version 7 not for 6 so there will not be any conflict on file.

Sunday, August 30, 2009

What is SVN

SVN is used to store subversion file such as source code of project. In today's days it's not easy to do work on same task with more than one people to complete some project. so basically employee have different work on a particular project and commit theirs own work on svn and, if there is any conflict on work, that will be resolve, and finally they will the make complete project. basically SVN contains the old version of project. Through the svn we can do the work on same project from different place.

How to work on SVN
For use svn, first of all, you have to install tortoisesvn.
Then we have to upload the project(on which we have to work) on svn(server), put the copy of that project on your local computer, do your task on that project and now do the following steps for commit your task on svn..

1) Add those folder you have just created through right click on your working folder and click on tortoisesvn->add
2) check your application running properly before update...
3) update the version
4) resolve conflicts if any
5) again check your application running properly
6) update again if there's new version on svn
7)Commit your folder by click on commit after right click on working folder, before commit, you have to write some message with ticket number for close ticket. Suppose your active ticket is 1 then you can write this number with message like that..

#1 export the offline quiz.. into the box of recent message. After filled message just click ok.
Now your work has been committed on svn and there's new version has been made of your project. And your ticket has been closed
Working folder:-> this is the folder on which you are working for complete some project

Monday, August 3, 2009

About Memory(RAM)

phyical memory(RAM):- we can see physical memory through the windows task manager(ctrl+alt+delete) -> Performance -> physical memory
Physical Memory indicates the status of RAM for example on my PC it's value 523760
commit charge indicates the memory is using by CPU on my PC it's value 648180
if your commit charge is less than physical memory then your pc is working good and fast, otherwise it will be little slow, how slow.. it's depend on how the commit charge is more than physical memory
underneath the commit chage, the limit and peak are displaying, limit's value should be more than peak's value otherwise your computer will be very slow.
whenever the physical memory is less than commit charge it means the RAM is getting more space from hard disk through the Virtual Memory.

Thursday, May 28, 2009

First View

Hi..

This is my first view in my own blog.