






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Various php code snippets and html documents, including code for preventing multiple form submissions, integrating functions using the trapezoidal rule, extracting numbers from arrays, and finding mutations in sequences. Each code snippet is accompanied by a brief explanation and instructions for use.
Typology: Assignments
1 / 12
This page cannot be seen from the preview
Don't miss anything!







";_ echo filesize ( $inFile ). "
" ; $in = fopen ( $inFile , 'r' ); // Read header. $c = array (); while ( $i < 14 ) { $c [ $i ]= ord ( fgetc ( $in )); echo $c [ $i ]. " " ; $i ++; } echo "
" ; // Calculate file size. $size = $c [ 4 ] 65536 + $c [ 3 ] 256 + $c [ 2 ]; echo "File size = ". $size. " bytes.
" ; $offset = $c [ 10 ]; echo "Offset to start of image = ". $offset. "
" ; $i = 0 ; while ( $i < 40 ) { $c [ $i ]= ord ( fgetc ( $in )); echo $c [ $i ]. " " ; $i ++; } echo "
Bits per pixel = ". $c [ 14 ]. "
" ; // Go back to beginning of file -- first close it... fclose ( $in ); // Get rows and columns. $cols = $c [ 5 ]* 256 + $c [ 4 ]; $rows = $c [ 9 ]* 256 + $c [ 8 ]; echo "This image has ". $rows. " rows and ". $cols. " columns.
" ; // Total number of pixels. $N = $rows * $cols ; // ... and then re-open it along with output file. $in = fopen ( $inFile , 'r' ); $out = fopen ( $outFile , 'w' ); // Skip to start of image data. for ( $i = 0 ; $i < $offset ; $i ++) { $ch = fgetc ( $in ); fwrite ( $out , $ch , 1 ); } // Now read image bytes. for ( $n = 1 ; $n <= $N ; $n ++) { // Read colors, blue, green, red.
for ( $i = 0 ; $i <= 2 ; $i ++) { $c [ $i ]= fgetc ( $in ); // Here is where you can modify pixel colors. This statement turns on // the red gun to maximum brightness for every pixel. if ( $i == 0 ) $c [ $i ]= chr ( 255 ); fwrite ( $out , $c [ $i ], 1 ); } } echo "Total number of pixels written (rows x columns) = ". $n. "
" ; echo "Here is the last set of three pixels:
" ; echo ord ( $c [ 0 ]). " ". ord ( $c [ 1 ]). " ". ord ( $c [ 2 ]). "
" ; fclose ( $in ); fclose ( $out ); ?>
**
** Transaction Amount: $
Deposit **** _ _ Withdrawal
Date (mm/dd/yyyy): **
**
for ( i = 0 ; i < n ; i ++) { if ( S. charAt ( i )!= "," ) s += S. charAt ( i ); else { // Save the number when you find a comma. A [ j ]= parseFloat ( s );; j ++; s = "" ; } }
**
**
** **
Untitled
Enter your mutation here:
Enter your sequence here:
** **
** ** A+ ** ** A- ** ** B+ ** ** B- ** ** AB+ ** ** AB- ** ** O+ ** ** O- **
** Blood type that you can donate to: **
** % of Population with that type of blood: **
** Blood type that you can recieve blood from:
% of Population with that type of blood: **
**
**
** Circle Stuff **
function circleStuff** ( r ) { var r = parseFloat ( r ); var circle =[]; circle [ 0 ]=( Math. PI * r * r ). toFixed ( 4 ); circle [ 1 ]=( 2 .* Math. PI * r ). toFixed ( 4 ); return circle ; } **
** Circle Stuff ** ** Enter radius, then press tab key or click on "area" box.
radius (cm):
area (cm **** 2 **** ):
circumference(cm): **
**
**
**
**** home **
**
**
1"> ** How this image was created. **
** This image was created in Windows' Paint program. **** Click here to return. **
**
**
** A simple frameset document **
**
**
** Gossip Column **
document**. write ( "This document last modified on " + document. lastModified + "." ) **
** This is where gossip goes!!! **
** Can you **** believe **** that...??? **
**
**
** Gossip Column ****
** document**. write ( "This document last modified on " + document. lastModified + "." ) **
** This is where gossip goes!!! **
** Can you **** believe **** that...??? **
**
**
** A picture gallery **
** Here is the picture gallery. **
**