shellsort using php

<?
// function shellsort($elements,$length)
//  {

$elements = array(2,3,4,5,1,8,11,0);
$length = count($elements);
     $k=0;
     $gap[0]=(int) ($length / 2);
     while($gap[$k]>1)
     {
         $k++;
         $gap[$k]=(int)($gap[$k-1]/2);
     }//end while

     for($i=0;$i<=$k;$i++)
     {
     $step=$gap[$i];
         for($j=$step;$j=0 && $temp<$elements[$p])
             {
                 $elements[$p+$step]=$elements[$p];
                 $p=$p-$step;
             }//end while
             $elements[$p+$step]=$temp;
         }//endfor j
     }//endfor i
//     return $elements;

print_r($elements);
//  }// end function

?>

http://www.go4expert.com/forums/showthread.php?t=1255

hashes.pl %(hash related)

A UNIX Command
$cat hashes.pl
# Simple hash constructs
$fred{"with"} = "without";
$fred{"this"} = "that";
$fred{"mountain"} = "valley";
$fred{"left"} = "right";
print qq/$fred{"this"}n/;
@keys = keys(%fred);
print "Keys are @keysn";

# Initializer for %yard.
%yard = ( red => 'brick',
          blue => 'sky',
          green => 'grass',
          yellow => 'dandelion' );
print "$yard{'blue'} $yard{'yellow'}n";

$perl hashes.pl
that
Keys are left mountain with this
sky dandelion
$


UNIX Explanation
Variables  whose   names  begin  with  %  are   hashes,  which  are
essentially arrays subscripted by  strings. As with arrays, %sue is
a hash, and it is a different variable from $sue, though members of
%sue are  selected by  $sue{$s}.  The built-in  function keys(%sue)
returns an array of all the keys (subscripts) of the hash %sue.

http://sandbox.mc.edu/~bennet/perl/leccode/var3_pl.html

songclip hazard cover oct 29 2011

[audio:http://www.beautifulwork.org/wp-content/uploads/2011/10/hazard.mp3]

Audio Recorder
: gnome-sound-recorder 2.91.2 Details : recorded as a wav file.
Play

$mplayer -nojoystick -nolirc hazard.mp3
MPlayer SVN-r33057 (C) 2000-2010 MPlayer Team

Playing hazard.mp3.
Audio only file format detected.
Clip info:
 Title:
 Artist:
 Album:
 Year:
 Comment:
 Genre: Unknown
Load subtitles in ./
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:  33.0 (33.0) of 33.0 (33.0)  2.0%


Exiting... (End of file)
$



MP3 Conversion
: pacpl Details : $pacpl hazard.wav -t mp3 Perl Audio Converter - 4.0.5 Converting: [hazard.wav] -> [mp3] ..done. Total files converted: 1, failed: 0 $
File Details

$file hazard.*
hazard.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, Monaural
hazard.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 32 bit, mono 22050 Hz
$


bubble sorting using php

<?php
/* bubble.php by detour@metalshell.com
 *
 * Generate random numbers then sort them.
 *
 * http://www.metalshell.com/
 *
 */


$array_size = 250;

// If you use v4.2.0 or lower uncomment this
// srand((double)microtime()*1000000);

// Generate $array_size random numbers to be sorted.
for($x = 0; $x < $array_size; $x++)
  $ran[$x] = rand(0, 500);

/* The bubble sort method.  If you don't know how it works it's very
 * simple, values are switched one at a time for each element. */
for($x = 0; $x < $array_size; $x++) {
  for($y = 0; $y < $array_size; $y++) {
    if($ran[$x] < $ran[$y]) {
      $hold = $ran[$x];
      $ran[$x] = $ran[$y];
      $ran[$y] = $hold;
    }
  }
}

for($x = 0; $x < $array_size; $x++)
  print $ran[$x] . "
"; ?>

songclip part time lover Oct 25 2011

[audio:http://www.beautifulwork.org/wp-content/uploads/2011/10/part-time-lover.mp3]

Audio Recorder
: gnome-sound-recorder 2.91.2 Details : recorded as a ogg file.
Play
$ogg123 part_time_lover.ogg

Audio Device:   Advanced Linux Sound Architecture (ALSA) output

Playing: part_time_lover.ogg
Ogg Vorbis stream: 2 channel, 44100 Hz

Done.
$


MP3 Conversion
: pacpl Details : $ffmpeg -i part_time_lover.ogg -ab 320k part-time-lover.mp3
File Details

$file part-time-lover.mp3
part-time-lover.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 320 kbps, 44.1 kHz, JntStereo
$file part_time_lover.ogg
part_time_lover.ogg: Ogg data, Vorbis audio, stereo, 44100 Hz, ~160000 bps, created by: Xiph.Org libVorbis I
$

strip_tags PHP API

A Programming API


<?php $string= strip_tags($row['post_content']); ?>

An Explanation
strip_tags — Strip HTML and PHP tags from a string

string strip_tags ( string $str [, string $allowable_tags ] )

This function tries to return a string with all NUL bytes, HTML and
PHP tags stripped from a given  str. It uses the same tag stripping
state machine as the fgetss() function.