Technical Learnings - CGI-PERL
Sl. No. Key words Learnings Descriptions Contributor
While sending HTML formatted mails with embedded image (.gif
or .jpeg), use MIME type as multipart/related which defines
different parts of the message that are made up of independent
MIME header, Inline image, multipart, data types (HTML and images). Specify the content id for images
1 content id Sending mails with inline image in MIME header which identifies individual parts of the message. Bharathi
To check, if browser accepts cookie, we should set and access
2 Cookie, Cookie enabled browser Checking For Cookie Enabled Browser the cookie in the separate screens. Shreenath
We allow users to download xls files through an hyper link on the
web page.
Ideally,on click of the hyper link ,user is prompted to open or
save the file (File dialog box).
But for some users,the xls file opened in the same browser
without showing File Dialog box.
In Order to get back File Dialog box pop up:
Go to
Windows Explorer->
Tools->folder->
options-> file types ->
select XLS(file type)-> advance-> select open -> check confirm open
3 File dialog box File Dialog box popup after download (check box). Bharathi
If query string contains special characters (%,$,space etc.) then
do the URL encoding.
URL-encoding of a character is done by taking that character's 8-
bit hexadecimal code
4 URL encoding, Query string URL Encoding and prefixing it with a percent sign ("%"). Shreenath
"Use CURL command.
Eg: If application named process.pl is on a remote server (URL:
www.wipro.com) and accepts parameter 'name'
then to get data from that application we can execute curl
command from client as follows.
$return_data = curl -d ""name=test""
http://www.wipro.com/process.pl?"
Execution of a process on a remote server We can get required data by parsing the HTTP response
5 Remote process execution, UNIX on UNIX platform. contained in $return_data. Shreenath
HTML record tables can be made scrollable (both horizontal and
vertical) by using CSS DIV tag
and javascript.
Put all headers in a table under <DIV ID="header_div"
style="width:300;height:25;overflow:hidden;"> tag.
Put all body (data) in a separate table under <DIV ID="table_div"
style="width:300;height:300;overflow:auto;"> tag, which provides
vertical scrolling of table body with fixed table headers.
The horizontal scrolling of table headers can be made relative to
that of table body by handling "onscroll" javascript event in
6 Scrollable tables, Javascript, CSS Scrollable HTML tables <DIV> tag of table body. Shreenath
Disable property doesnot work in Netscape.In order to make
disable property work across Netscape and IE, use this.blur( )
function for Netscape.
Check for the browser type,then include disable or blur function
accordingly.
Sample code :
print “<input type=’checkbox’ “;
if ($ENV{'HTTP_USER_AGENT'} =~ m/MSIE/i){
print " disabled ";
}else {
print " onFocus='this.blur();'";
}
7 Disable property , Netscape/IE Disable property for HTML TAGS print “value = ‘test’>”; Shreenath
Form objects such as text fields, select boxes and text areas will
display differently in IE and Netscape. This is because of the
proportional font used by each browser to render the "objects."
8 Netscape/IE , CSS Consistent display of form fields Redefine the form objects using CSS, to maintain consistency. Shreenath
In order to page through the recordset (i.e pagewise display of
records) ,see the following example:
To display records from 20 to 30,of the recordset,following is the
query:
select * from ( select a.*, rownum rnum from ( select
dept.deptno, emp.ename
from emp, dept where emp.deptno = dept.deptno order by
dept.deptno) a
where rownum <= 30 )
where rnum >= 20
Paging, display recordset, pagewise
9 navigation Getting rows N through M of a result set Refer : http://asktom.oracle.com/ Moinuddin