XHTML Youtube / Google视频转换为有效的XHTML

********** YOUTUBE VIDEO **********

<object type="application/x-shockwave-flash" width="425" height="355" data="http://www.youtube.com/v/qdeMqqghXRI&rel=0">
<param name="movie" value="http://www.youtube.com/v/qdeMqqghXRI&rel=0"></param>
<param name="wmode" value="transparent"></param>
</object>

********** GOOGLE VIDEO **********
<object width="400" height="326" type="application/x-shockwave-flash" data="http://video.google.com/googleplayer.swf?docId=xxxxxxxxxx" ><param name="wmode" value="transparent" /></object>

JavaScript 运行时Javascript加载

function loadHeadScript(url) {
        var script = document.createElement("script");
        script.setAttribute("type", "text/javascript");
        script.setAttribute("src", url);
        var head = document.getElementsByTagName("head")[0];
        head.appendChild(script);
    }

function loadBodyScript(url) {
        var script = document.createElement("script");
        script.setAttribute("type", "text/javascript");
        script.setAttribute("src", url);
        var body = document.getElementsByTagName("body")[0];
        body.appendChild(script);
    }

Java 合并排序功能

public static void MergeSort(int[] array) {
		if(array.length>1){
			int elementsInA1=array.length/2;
			int elementsInA2=elementsInA1;
			if((array.length%2)==1)
				elementsInA2+=1;
				
			int arr1[]=new int[elementsInA1];
			int arr2[]=new int[elementsInA2];
			
			for(int i=0; i<elementsInA1; i++)
				arr1[i]=array[i];
				
			for(int i=elementsInA1; i<elementsInA1+elementsInA2; i++)
				arr2[i-elementsInA1]=array[i];
				
			MergeSort(arr1);
			
			MergeSort(arr2);
			
			
			int i=0, j=0, k=0;
			
			while(arr1.length!=j && arr2.length!=k){
				if(arr1[j]<=arr2[k]) {
					array[i]=arr1[j];
					j++;
				}else{
					array[i]=arr2[k];
					k++;
				}
				i++;
			}
			
			while(arr1.length!=j){
				array[i]=arr1[j];
				i++;
				j++;
			}
			while(arr2.length!=k){
				array[i]=arr2[k];
				i++;
				k++;
			}
		}
	}

PHP 打印HTML头

function printHeader($title = NULL)
{
	$title = $title === NULL ? 'SiteName' : "SiteName - {$title}";
	print "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
<html xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
	<meta name='Description' content='CONTENT' />
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
	<meta http-equiv='Content-Style-Type' content='text/css' />
	<link rel='StyleSheet' href='library/styles/root.css' type='text/css' media='screen' />
	<link rel='StyleSheet' href='library/styles/html.css' type='text/css' media='screen' />
	<link rel='stylesheet' href='library/styles/menu.css' type='text/css' />";
	print "<title>{$title}</title>
</head>
<body>\n";
}

C# 通用转换

public class LendingRates
{
    public List<BLRate> GetLendingRates()
    {        
         
        . . . 
         
        List<DLRate> ldlr = dlObject.GetLendingRates(date);

        List<BLRate> lblr = ldar.ConvertAll(new Converter<DLRate, BLRate>(RateToRateConverterMethod)); 
        return lblr
    }       
 
    . . .         
 
    public static BLRate RateToRateConverterMethod(DLRate dr)
    {
        return new BLRate(dr.Name, dr.Value);
     
    }
}

ASP 在ASP中是第一个

function ucfirst(tname)
	ucfirst = ""
	tname = tname & " "
	do while instr(tname, " ")
		temp_string = left(tname, instr(tname," " ) -1)
		' ucase the first letter
		ucfirst = ucfirst & ucase(mid(temp_string, 1,1))
		' lcase for rest of word
		ucfirst = ucfirst & lcase(mid(temp_string,2)) & " "
		tname = right(tname, len(tname) - instr(tname," " ))
	loop
	'show me what i get
	ucfirst = ucfirst & ucase(mid(tname, 1,1))
	ucfirst = ucfirst & mid(tname,2)
	ucfirst = Trim(ucfirst)
end Function

PHP 强制下载文件

header("Content-type: application/octet-stream");
 
// displays progress bar when downloading (credits to Felix ;-))
header("Content-Length: " . filesize('myImage.jpg'));
 
// file name of download file
header('Content-Disposition: attachment; filename="myImage.jpg"');
 
// reads the file on the server
readfile('myImage.jpg');

PHP 上传文件

$uploadedImage = new Upload($_FILES['uploadImage']);
 
if ($uploadedImage->uploaded) {
	$uploadedImage->Process('myuploads');
	if ($uploadedImage->processed) {
		echo 'file has been uploaded';
	}
}

Ruby 文件列表和目录之间的复制

desc "Lists all files in a directory"
task :list do
  Dir.chdir(C_DIR)
  fs = Dir.glob('**/*.JPG')
  count, similar_files = 0
  initial = 50
  fs.each do |f|
    if File.file? f
      puts "#{count += 1} -> Copying #{f} to #{REMOTE_DIR}"
      unless File.exist?("#{REMOTE_DIR}#{f.to_s}")
        File.copy(old_file, new_file, verbose => true)
      else
        similar_files += 1
      end
      if count == initial
        initial += 50
        sleep(15)
      end
    end
  end
  puts "Number of Similar files: #{similar_files}"
end

TYPO3 Bild-ObjektfüreigeneTypo3-Frontend-Plugins

# Bild-Objekt für eigene Typo3-Frontend-Plugins:
#
# Hinzufügen zu setup.txt (ext/ext_key/static/.../setup.txt)
#
# Wichtig ist das der ext_key ohne Unterstrichen angegeben wird:
# Beispiel: tx_ueupoverlackce_pi1

# Bild fuer p1
plugin.tx_EXTKEY_pi1 {
	bild = IMAGE
	bild {
		file = 
	}
}

# PHP
# $this->conf=$conf;
# ./.
# $conf["bild."]["file"] = 'uploads/pics/'.$image;
# $conf["bild."]["file."]["width"] = '100';
# $conf["bild."]["file."]["quality"] = '80';
# $conf["bild."]["file."]["format"] = 'png';
# $content .= $this->cObj->cObjGetSingle($conf["bild"], $conf["bild."]);