PHP PHP - 注意旧的PHP版本

#Simple
if (isset($HTTP_GET_VARS) and ! empty ( $HTTP_GET_VARS ) ) {
    $_GET = $HTTP_GET_VARS;
} 

if ( isset( $HTTP_SERVER_VARS ) and ! empty( $HTTP_SERVER_VARS ) ) {
    $_SERVER = $HTTP_SERVER_VARS;
}

ASP openDB

function openDB()
	dim conn
	set conn = server.createobject("ADODB.Connection")
	conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=;UID=;PWD=;DATABASE="
	openDB = conn
end function

Java 通过通用列表进行迭代(Java 5版本)

List<String> listOfStrings = new LinkedList<String>( );

listOfStrings.add("Why");
listOfStrings.add("Iterate");
listOfStrings.add("When");
listOfStrings.add("You");
listOfStrings.add("Can");
listOfStrings.add("Avoid");
listOfStrings.add("It!");

for (String s: listOfStrings) {
    System.out.println(s);
}

Bash 检查cygwin应用程序是否存在基本冲突

#! /bin/bash

# Checks for conflicts between all dll's that are loaded by the programs or dlls given as arguments.
# cygcheck searches PATH to find arguments that are not absolute pathnames.
 
final_dec=0
final_guard_dec=0
guard=0x10000

#set -x

cygcheck "$@" |
while read -r file
do
 [ -n "$file" ] && [ "$file" = "${file#Found:}" ] && objdump -p "$file" | 
   sed -n -e '2 {s:\\:/:g; s/^/ /; s/: .*$//; h}' -e '/ImageBase/ {s/ImageBase/ /; G; h}' -e '/SizeOfImage/ {s/SizeOfImage//; G; s/[\t\n]//gp; Q}'
done |
sort -f -u -k 2 |
while read size base name
do
  conflict=""
  base_dec=$(( 0x$base ))
  if [ "$final_dec" -ge "$base_dec" ] 
  then
    conflict="CONFLICT End: $final_dec Start:$base_dec"
  else
    [ "$final_guard_dec" -ge "$base_dec" ] && conflict="GUARD CONFLICT End: $final_dec Start:$base_dec"
  fi
  echo $name $base $size $conflict
  final_dec=$(( 0x$base + 0x$size  ))
  final_guard_dec=$(( $final_dec + $guard ))
done

ASP 交替的行颜色

Dim sBgcolor
        
        if (i mod 2 = 0) then
            sBgcolor = "#eee"
        else    
            sBgcolor = "#fff"
        end if
	
        <tr style="background-color:<%=sBgcolor%>;" onMouseOver="this.style.background='#ddd;'" onMouseOut="this.style.background='<%=sBgcolor%>;'">

ASP breadCrumbs(递归)

sub getChildren(rowId)
    Dim sSQL,oRS,itemArray,i
    sSQL = "SELECT rowId,rowName,parent_id from table WHERE parent_id = " & rowId
    set oRS = cn.execute(sSQL)
    itemArray = oRS.getRows()
    
    if isArray(itemArray) then
        dim rowId,rowName,parent_id
    	for i = 0 to ubound(itemArray,2)
            rowId = itemArray(0,i)
            rowName = itemArray(1,i)
            parent_id = itemArray(2,i)
            
            call getChildren(parent_id) 'pass in parent id here
            
            response.write " >> <a href=""page.asp?p="&rowId&""">"&rowName&"</a>"

         next
    end if
end sub

ASP CDONTS

Dim oMail,sBody
    
    sBody = ""
    
    Set oMail = Server.CreateObject("CDONTS.NewMail")
    oMail.Subject = ""
    oMail.to = "kris@peerlis.com"
    oMail.From = ""
    
    oMail.mailFormat = 0
    oMail.bodyFormat = 0
    oMail.Body = sBody
    oMail.Send
    Set oMail = nothing

ASP 获取文件扩展名

'accepts: file name string
'returns: 3 letter file extension
function getFileExt(fileName)
    getFileExt = Mid(fileName, InstrRev(fileName, ".") + 1)
end function

ASP 分页

Dim iContentPerPage: iContentPerPage = 10
    Dim iRowCutoff: iRowCutoff = 3 'number of columns

    Dim iTotal: iTotal = Ubound(itemArray,2) 'total number of results
    
    Dim iStart: iStart = request.querystring("start")
     
    'set the starting position, either zero or from the query string
    if (len(iStart) = 0) then
        iStart = 0
    else
        iStart = Cint(iStart)
    end if

    'set the end position
    'if the number of items per page plus the starting position is less than the total, 
    'then show the number of items added to the starting position
    'otherwise we are at the end
    If (iTotal >= (iContentPerPage + iStart)) Then
        iEnd = iContentPerPage + iStart - 1
    Else
        iEnd = iTotal
    End If

    response.write "<table width=""99%"" border=""0"" cellspacing=""0"" cellpadding=""2""><TR>"
    
    'loop through the results
    For introw = iStart to iEnd
        iID = arrArray(0,i)
        
        'start a new row every 3 pictures
        if (k mod iRowCutoff = 0) then _
            response.write "</tr><tr>"

        response.write "<td>Content</td>"
            
    Next
    response.write "</table>"

    response.write "<br /><table border=""0"" width=""95%"" cellpadding=""2"" cellspacing=""0"" align=""center""><tr>"

    'check whether to show the previous link or not
    if (iStart > 0) then
        response.write "<td style=""width:33%;"" align=""left""><a href="""&scriptName&"?start="&iStart-iContentPerPage&"&id="&id&""" style=""text-decoration:none;""><< PREVIOUS PAGE</a></td>"
    else
        response.write "<td style=""width:33%;""> </td>"
    end if
        
    response.write "<td style=""width:33%;"" align=""center"">" & (iEnd+1) & " of " & (iTotal+ 1) & "</td>"
    
        
    'check whether to show the next link or not
    if (iEnd < iTotal) then
        response.write "<td style=""width:33%;"" align=""right""><a href="""&scriptName&"?start="&iStart+iContentPerPage&"&id="&id&""" style=""text-decoration:none;"">NEXT PAGE >></a></td>"
    else
        response.write "<td style=""width:33%;""> </td>"
    end if

ASP 动态调整大小弹出窗口

<%
Dim fullImg: fullImg = request.querystring("file")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Adoption Network</title>
    <script type="text/JavaScript">
      function resizeImg(img) {
        var oImg = new Image();
        oImg.src = img;
    
        if (oImg.complete) {
                window.resizeTo(oImg.width+8,oImg.height+51)
            }
        }  
    </script>
</head>

<body onLoad="resizeImg('<%=fullImg%>');" style="margin:0px;">

<img src="<%=fullImg%>" border="0" id="ShowImg" onClick="window.close();" style="cursor:pointer;" alt="close window"  title="close window">

</body>
</html>