<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webburners &#187; friend function</title>
	<atom:link href="http://www.webburners.com/tag/friend-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webburners.com</link>
	<description>We Burn the web with our expertise</description>
	<lastBuildDate>Thu, 08 Apr 2010 12:53:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Interview question &#8212; Part 5</title>
		<link>http://www.webburners.com/2009/04/interview-question-part-2/</link>
		<comments>http://www.webburners.com/2009/04/interview-question-part-2/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 16:02:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[differnence between get and post]]></category>
		<category><![CDATA[friend function]]></category>
		<category><![CDATA[get method]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[objects passed by value or by reference]]></category>
		<category><![CDATA[php interview question]]></category>
		<category><![CDATA[post method]]></category>
		<category><![CDATA[submit form without submit]]></category>
		<category><![CDATA[_sleep]]></category>
		<category><![CDATA[_wakeup]]></category>

		<guid isPermaLink="false">http://www.webburners.com/?p=123</guid>
		<description><![CDATA[1. What is the purpose of the following files having extensions 1) frm 2) MYD 3) MYI. What these files contains?
In MySql, the default table type is MyISAM.
Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file [...]]]></description>
			<content:encoded><![CDATA[<p>1. What is the purpose of the following files having extensions 1) frm 2) MYD 3) MYI. What these files contains?<br />
In MySql, the default table type is MyISAM.<br />
Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type.<br />
The ‘.frm’ file stores the table definition.<br />
The data file has a ‘.MYD’ (MYData) extension.<br />
The index file has a ‘.MYI’ (MYIndex) extension,</p>
<p>2. What is maximum size of a database in mysql?<br />
If the operating system or filesystem places a limit on the number of files in a directory, MySQL is bound by that constraint.<br />
The efficiency of the operating system in handling large numbers of files in a directory can place a practical limit on the number of tables in a database. If the time required to open a file in the directory increases significantly as the number of files increases, database performance can be adversely affected.<br />
The amount of available disk space limits the number of tables.<br />
MySQL 3.22 had a 4GB (4 gigabyte) limit on table size. With the MyISAM storage engine in MySQL 3.23, the maximum table size was increased to 65536 terabytes (2567 â€“ 1 bytes). With this larger allowed table size, the maximum effective table size for MySQL databases is usually determined by operating system constraints on file sizes, not by MySQL internal limits.<br />
The InnoDB storage engine maintains InnoDB tables within a tablespace that can be created from several files. This allows a table to exceed the maximum individual file size. The tablespace can include raw disk partitions, which allows extremely large tables. The maximum tablespace size is 64TB.<br />
The following table lists some examples of operating system file-size limits. This is only a rough guide and is not intended to be definitive. For the most up-to-date information, be sure to check the documentation specific to your operating system.<br />
Operating System File-size Limit<br />
Linux 2.2-Intel 32-bit 2GB (LFS: 4GB)<br />
Linux 2.4+ (using ext3 filesystem) 4TB<br />
Solaris 9/10 16TB<br />
NetWare w/NSS filesystem 8TB<br />
Win32 w/ FAT/FAT32 2GB/4GB<br />
Win32 w/ NTFS 2TB (possibly larger)<br />
MacOS X w/ HFS+ 2TB<br />
3. Give the syntax of Grant and Revoke commands?<br />
The generic syntax for grant is as following<br />
&gt; GRANT [rights] on [database/s] TO [username@hostname] IDENTIFIED BY [password]<br />
now rights can be<br />
a) All privileges<br />
b) combination of create, drop, select, insert, update and delete etc.<br />
We can grant rights on all databse by using *.* or some specific database by database.* or a specific table by database.table_name<br />
username@hotsname can be either username@localhost, username@hostname and username@%<br />
where hostname is any valid hostname and % represents any name, the *.* any condition<br />
password is simply the password of user<br />
The generic syntax for revoke is as following<br />
&gt; REVOKE [rights] on [database/s] FROM [username@hostname]<br />
now rights can be as explained above<br />
a) All privileges<br />
b) combination of create, drop, select, insert, update and delete etc.<br />
username@hotsname can be either username@localhost, username@hostname and username@%<br />
where hostname is any valid hostname and % represents any name, the *.* any condition<br />
4. Explain Normalization concept?<br />
The normalization process involves getting our data to conform to three progressive normal forms, and a higher level of normalization cannot be achieved until the previous levels have been achieved (there are actually five normal forms, but the last two are mainly academic and will not be discussed).<br />
First Normal Form<br />
The First Normal Form (or 1NF) involves removal of redundant data from horizontal rows. We want to ensure that there is no duplication of data in a given row, and that every column stores the least amount of information possible (making the field atomic).<br />
Second Normal Form<br />
Where the First Normal Form deals with redundancy of data across a horizontal row, Second Normal Form (or 2NF) deals with redundancy of data in vertical columns. As stated earlier, the normal forms are progressive, so to achieve Second Normal Form, your tables must already be in First Normal Form.<br />
Third Normal Form<br />
I have a confession to make; I do not often use Third Normal Form. In Third Normal Form we are looking for data in our tables that is not fully dependant on the primary key, but dependant on another value in the table<br />
5. How can we find the number of rows in a table using mysql?<br />
Answer: Use this for mysql<br />
&gt;SELECT COUNT(*) FROM table_name;<br />
but if u r particular about no of rows with some special result<br />
do this<br />
&gt;SELECT [colms],COUNT(*) FROM table_name [where u put conditions];<br />
68. How can we find the number of rows in a result set using php?<br />
Answer: for PHP</p>
<p>$result = mysql_query($any_valid_sql, $database_link);<br />
$num_rows = mysql_num_rows($result);<br />
echo “$num_rows rows found”;<br />
6. How many ways we can we find the current date using mysql?<br />
SELECT CURDATE();<br />
CURRENT_DATE() = CURDATE()<br />
for time use<br />
SELECT CURTIME();<br />
CURRENT_TIME() = CURTIME()<br />
7. What are the advantages and disadvantages of CASCADE STYLE SHEETS?<br />
External Style Sheets<br />
Advantages<br />
Can control styles for multiple documents at once<br />
Classes can be created for use on multiple HTML element types in many documents<br />
Selector and grouping methods can be used to apply styles under complex contexts<br />
Disadvantages<br />
An extra download is required to import style information for each document<br />
The rendering of the document may be delayed until the external style sheet is loaded<br />
Becomes slightly unwieldy for small quantities of style definitions<br />
Embedded Style Sheets<br />
Advantages<br />
Classes can be created for use on multiple tag types in the document<br />
Selector and grouping methods can be used to apply styles under complex contexts<br />
No additional downloads necessary to receive style information<br />
Disadvantages<br />
This method can not control styles for multiple documents at once<br />
Inline Styles<br />
Advantages<br />
Useful for small quantities of style definitions<br />
Can override other style specification methods at the local level so only exceptions need to be listed in conjunction with other style methods<br />
Disadvantages<br />
Does not distance style information from content (a main goal of SGML/HTML)<br />
Can not control styles for multiple documents at once<br />
Author can not create or control classes of elements to control multiple element types within the document<br />
Selector grouping methods can not be used to create complex element addressing scenarios</p>
<p>8. What are the advantages/disadvantages of mysql and php?<br />
Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and JSP.<br />
9. What is the difference between GROUP BY and ORDER BY in Sql?<br />
To sort a result, use an ORDER BY clause.<br />
The most general way to satisfy a GROUP BY clause is to scan the whole table and create a new temporary table where all rows from each group are consecutive, and then use this temporary table to discover groups and apply aggregate functions (if any).<br />
ORDER BY [col1],[col2],[coln]; Tels DBMS according to what columns it should sort the result. If two rows will hawe the same value in col1 it will try to sort them according to col2 and so on.<br />
GROUP BY [col1],[col2],â€¦,[coln]; Tels DBMS to group results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average<br />
10. What is the difference between char and varchar data types?<br />
char(M) M bytes 0<br />
80. How can we change the name of a column of a table?<br />
MySQL query to rename table: RENAME TABLE tbl_name TO new_tbl_name<br />
[, tbl_name2 TO new_tbl_name2]<br />
or,<br />
ALTER TABLE tableName CHANGE OldName newName.<br />
11. How can we change the name and data type of a column of a table?<br />
ALTER [IGNORE] TABLE tbl_name<br />
alter_specification [, alter_specification] | CHANGE [COLUMN] old_col_name column_definition<br />
[FIRST|AFTER col_name]<br />
12. What are the differences between drop a table and truncate a table?<br />
Answer: Delete a Table or DatabaseTo delete a table (the table structure, attributes, and indexes will also be deleted).<br />
What if we only want to get rid of the data inside a table, and not the table itself? Use the TRUNCATE TABLE command (deletes only the data inside the table).<br />
13. When viewing an HTML page in a Browser, the Browser often keeps this page in its cache. What can be possible advantages/disadvantages of page caching? How can you prevent caching of a certain page (please give several alternate solutions)?<br />
When you use the metatag in the header section at the beginning of an HTML Web page, the Web page may still be cached in the Temporary Internet Files folder.<br />
A page that Internet Explorer is browsing is not cached until half of the 64 KB buffer is filled. Usually, metatags are inserted in the header section of an HTML document, which appears at the beginning of the document. When the HTML code is parsed, it is read from top to bottom. When the metatag is read, Internet Explorer looks for the existence of the page in cache at that exact moment. If it is there, it is removed. To properly prevent the Web page from appearing in the cache, place another header section at the end of the HTML ocument.<br />
14. What are the different ways to login to a remote server? Explain the means, advantages and disadvantages?<br />
There is at least 3 ways to logon to a remote server:<br />
Use ssh or telnet if you concern with security<br />
You can also use rlogin to logon to a remote server.</p>
<p>15. What is meant by MIME?<br />
Multipurpose Internet Mail Extensions.<br />
WWW’s ability to recognise and handle files of different types is largely dependent on the use of the MIME (Multipurpose Internet Mail Extensions) standard. The standard provides for a system of registration of file types with information about the applications needed to process them. This information is incorporated into Web server and browser software, and enables the automatic recognition and display of registered file types.<br />
16. What is meant by PEAR in php?<br />
PEAR is short for “PHP Extension and Application Repository” and is pronounced just like the fruit. The purpose of PEAR is to provide:<br />
A structured library of open-sourced code for PHP users<br />
A system for code distribution and package maintenance<br />
A standard style for code written in PHP<br />
The PHP Foundation Classes (PFC),<br />
The PHP Extension Community Library (PECL),<br />
A web site, mailing lists and download mirrors to support the PHP/PEAR community<br />
PEAR is a community-driven project with the PEAR Group as the governing body. The project has been founded by Stig S. Bakken in 1999 and quite a lot of people have joined the project since then.<br />
<a href="http://pear.php.net/manual/en/introduction.php">http://pear.php.net/manual/en/introduction.php</a><br />
96. How can I use the COM components in php?<br />
The COM class provides a framework to integrate (D)COM components into your PHP scripts.<br />
string COM::COM ( string module_name [, string server_name [, int codepage]])<br />
COM class constructor. Parameters:<br />
module_name<br />
name or class-id of the requested component.<br />
server_name<br />
name of the DCOM server from which the component should be fetched. If NULL, localhost is assumed. To allow DCOM com.allow_dcom has to be set to TRUE in php.ini.<br />
codepage<br />
specifies the codepage that is used to convert php-strings to unicode-strings and vice versa. Possible values are CP_ACP, CP_MACCP, CP_OEMCP, CP_SYMBOL, CP_THREAD_ACP, CP_UTF7 and CP_UTF8.<br />
Usage:<br />
Version}\n”; //bring it to front $word-&gt;Visible = 1; //open an empty document $word-&gt;Documents-&gt;Add(); //do some weird stuff $word-&gt;Selection-&gt;TypeText(”This is a testâ€¦”); $word-&gt;Documents[1]-&gt;SaveAs(”Useless test.doc”); //closing word $word-&gt;Quit(); //free the object $word-&gt;Release(); $word = null; ?&gt;<br />
17. How can we know that a session is started or not?<br />
a session starts by session_start()function.<br />
this session_start() is always declared in header portion.it always declares first.then we write session_register().<br />
18. What is the default session time in php and how can I change it?<br />
The default session time in php is until closing of browser or 24 mins which is earlier<br />
19. What changes I have to done in php.ini file for file uploading?<br />
Make the following Line uncomment like:<br />
; Whether to allow HTTP file uploads.<br />
file_uploads = On<br />
; Temporary directory for HTTP uploaded files (will use system default if not<br />
; specified).<br />
upload_tmp_dir = C:\apache2triad\temp<br />
; Maximum allowed size for uploaded files.<br />
upload_max_filesize = 2M</p>
<p>post_max_limit =8m</p>
<p>you have to increase those limits to increase the file size upload<br />
20. What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?<br />
mysql_fetch_array â€” Fetch a result row as an associative array, a numeric array, or both.<br />
mysql_fetch_object ( resource result )<br />
Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows<br />
mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.<br />
21. How can I set a cron and how can I execute it in Unix, Linux, and windows?<br />
Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. In Windows, itâ€™s called Scheduled Tasks. The name Cron is in fact derived from the same word from which we get the word chronology, which means order of time.<br />
The easiest way to use crontab is via the crontab command.<br />
# crontab â€“e<br />
This command â€˜editsâ€™ the crontab. Upon employing this command, you will be able to enter the commands that you wish to run. My version of Linux uses the text editor vi. You can find information on using vi here.<br />
The syntax of this file is very important â€“ if you get it wrong, your crontab will not function properly. The syntax of the file should be as follows:<br />
minutes hours day_of_month month day_of_week command<br />
All the variables, with the exception of the command itself, are numerical constants. In addition to an asterisk (*), which is a wildcard that allows any value, the ranges permitted for each field are as follows:<br />
Minutes: 0-59<br />
Hours: 0-23<br />
Day_of_month: 1-31<br />
Month: 1-12<br />
Weekday: 0-6<br />
We can also include multiple values for each entry, simply by separating each value with a comma.<br />
command can be any shell command and, as we will see momentarily, can also be used to execute a Web document such as a PHP file.<br />
So, if we want to run a script every Tuesday morning at 8:15 AM, our mycronjob file will contain the following content on a single line:<br />
15 8 * * 2 /path/to/scriptname<br />
This all seems simple enough, right? Not so fast! If you try to run a PHP script in this manner, nothing will happen (barring very special configurations that have PHP compiled as an executable, as opposed to an Apache module). The reason is that, in order for PHP to be parsed, it needs to be passed through Apache. In other words, the page needs to be called via a browser or other means of retrieving Web content.<br />
For our purposes, Iâ€™ll assume that your server configuration includes wget, as is the case with most default configurations. To test your configuration, log in to shell. If youâ€™re using an RPM-based system (e.g. Redhat or Mandrake), type the following:<br />
# wget â€“help<br />
If you are greeted with a wget package identification, it is installed in your system.<br />
You could execute the PHP by invoking wget on the URL to the page, like so:<br />
# wget <a href="http://www.example.com/file.php">http://www.example.com/file.php</a><br />
Now, letâ€™s go back to the mailstock.php file we created in the first part of this article. We saved it in our document root, so it should be accessible via the Internet. Remember that we wanted it to run at 4PM Eastern time, and send you your precious closing bell report? Since Iâ€™m located in the Eastern timezone, we can go ahead and set up our crontab to use 4:00, but if you live elsewhere, you might have to compensate for the time difference when setting this value.<br />
This is what my crontab will look like:<br />
0 4 * * 1,2,3,4,5 wget <a href="http://www.example.com/mailstock.php">http://www.example.com/mailstock.php</a></p>
<p>22. Steps for the payment gateway processing?<br />
An online payment gateway is the interface between your merchant account and your Web site. The online payment gateway allows you to immediately verify credit card transactions and authorize funds on a customerâ€™s credit card directly from your Web site. It then passes the transaction off to your merchant bank for processing, commonly referred to as transaction batching<br />
23. How many ways I can register the variables into session?<br />
session_register(); $_SESSION[]; $HTTP_SESSION_VARS[];</p>
<p>24. How many ways I can redirect a php page?<br />
Here are the possible ways of php page redirection.<br />
Using Java script:<br />
‘; echo ‘window.location.href=”‘.$filename.’”;’; echo ”; echo ”; echo ”; echo ”; } } redirect(’http://maosjb.com’); ?&gt;<br />
Using php function:<br />
Header(”Location:http://maosjb.com “);<br />
25. List out different arguments in php header function?<br />
void header ( string string [, bool replace [, int http_response_code]])<br />
26. What type of headers have to add in the mail function in which file a attached?</p>
<p>$boundary = ‘â€”â€“=’ . md5( uniqid ( rand() ) );<br />
$headers = “From: \”Me\”\n”;<br />
$headers .= “MIME-Version: 1.0\n”;<br />
$headers .= “Content-Type: multipart/mixed; boundary=\”$boundary\”&#8221;;<br />
27. What is the difference between and And which can be preferable?<br />
move_uploaded_file ( string filename, string destination)<br />
This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP’s HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.<br />
If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.<br />
If filename is a valid upload file, but cannot be moved for some reason, no action will occur, and move_uploaded_file() will return FALSE. Additionally, a warning will be issued.<br />
28. How can I embed a java programme in php file and what changeshave to be done in php.ini file?<br />
There are two possible ways to bridge PHP and Java: you can either integrate PHP into a Java Servlet environment, which is the more stable and efficient solution, or integrate Java support into PHP. The former is provided by a SAPI module that interfaces with the Servlet server, the latter by this Java extension.<br />
The Java extension provides a simple and effective means for creating and invoking methods on Java objects from PHP. The JVM is created using JNI, and everything runs in-process.<br />
Example Code:<br />
getProperty(’java.version’) . ”; echo ‘Java vendor=’ . $system-&gt;getProperty(’java.vendor’) . ”; echo ‘OS=’ . $system-&gt;getProperty(’os.name’) . ‘ ‘ . $system-&gt;getProperty(’os.version’) . ‘ on ‘ . $system-&gt;getProperty(’os.arch’) . ‘ ‘; // java.util.Date example $formatter = new Java(’java.text.SimpleDateFormat’, “EEEE, MMMM dd, yyyy ‘at’ h:mm:ss a zzzz”); echo $formatter-&gt;format(new Java(’java.util.Date’)); ?&gt;<br />
The behaviour of these functions is affected by settings in php.ini.<br />
Table 1. Java configuration options<br />
Name<br />
Default<br />
Changeable<br />
java.class.path<br />
NULL<br />
PHP_INI_ALL<br />
Name Default Changeable<br />
java.home<br />
NULL<br />
PHP_INI_ALL<br />
java.library.path<br />
NULL<br />
PHP_INI_ALL<br />
java.library<br />
JAVALIB<br />
PHP_INI_ALL<br />
29. How can I find what type of images that the php version supports?<br />
Using Imagetypes() function we can know</p>
<p>30. How can we send mail using JavaScript?<br />
No. You can’t send mail using Javascript. But you can execute a client side email client to send the email using mailto: code.<br />
Using clientside email client</p>
<p>function myfunction(form)<br />
{<br />
tdata=document.myform.tbox1.value;<br />
location=”mailto:mailid@domain.com?subject=”+tdata+”/MYFORM”;<br />
return true; }</p>
<ul>}</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.webburners.com/2009/04/interview-question-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
