MySQL vs IIS7
Posted in ASP on Oct 1st, 2009 No Comments »
CONCATing strings with numeric fields may return a binary value, depending on the OPTION parameter given in the connection string.
Posted in ASP on Oct 1st, 2009 No Comments »
CONCATing strings with numeric fields may return a binary value, depending on the OPTION parameter given in the connection string.
Posted in VBA on May 18th, 2005 Comments Off
This macro for Outlook 2002 will traverse every folder in your “Inbox” and then save any attachments to a location you speficy, mirroring the structure of your Inbox. Once saved, the attachments are removed from the email message. A note is added to the top of affected messages to indicate where the attachment has been [...]
Posted in PHP on May 18th, 2005 Comments Off
Fairly self-explanatory. This example gets its input from a file called ‘filename’, strips the HTML markup and displays what’s left in the browser.
<?
$fp=fopen (”filename”,”r”);
$file=fread ($fp,filesize (”filename”));
$fclose($fp);
$pattern=”‘<[\/\!]*?[^<>]*?>’si”;
$replace=””;
$file = preg_replace ($pattern, $replace, $filev[$r]);
print “$file”;
?>
Posted in PHP on May 18th, 2005 Comments Off
To use this code, simply call the EnDeCrypt function with two parameters: the string you want to encrypt/decrypt; the encryption password.
<?
function EnDeCrypt($plaintext,$strPwd)
{
$intLength=strlen($strPwd);
$sbox=Array();
$key=Array();
$cipher=”;
$i=0;
$j=0;
for ($a=0; $a<256; $a++)
{
$key[$a]=ord(substr($strPwd,($a % $intLength),1));
$sbox[$a]=$a;
}
$b=0;
for ($a=0; $a<256; $a++)
{
$b=($b + $sbox[$a] + $key[$a]) % 256;
$tempSwap = $sbox[$a];
$sbox[$a] = $sbox[$b];
$sbox[$b] = $tempSwap;
}
for ($a=0; $a<strlen($plaintext); $a++)
{
$i=($i+1) % 256;
$j=($j + $sbox[$i]) % 256;
$temp=$sbox[$i];
$sbox[$i]=$sbox[$j];
$sbox[$j]=$temp;
$k=$sbox[($sbox[$i] + $sbox[$j]) % 256 [...]
Posted in ASP on May 18th, 2005 Comments Off
This VBScript ASP writes the structure of a MS Access database to the browser. Change the value of dbName accordingly.
<%
dbName=”c:\temp\temp.mdb”
Set DataConnection = _
Server.CreateObject(”ADODB.Connection”)
DataConnection.ConnectionString = _
“Provider=Microsoft.Jet.OLEDB.4.0; _
Data Source=” & dbName & “; _
Jet OLEDB:Database Password=dbpwd;”
DataConnection.Open
Set rs = DataConnection.OpenSchema(20)
While rs.EOF <> True
If Left(rs.Fields(”Table_Name”).Value, 4) <> “MSys” Then
Response.Write rs.Fields(”Table_Name”) & “<br>”
Set DataSet = DataConnection.Execute(”SELECT * FROM _
[" & [...]
Posted in ASP on May 18th, 2005 Comments Off
This VBScript ASP writes the contents of form fields from the previous page (submitted with the POST method) into hidden fields on the current page. I found this handy when I needed to spread a form over several pages - it’s far quicker than writing hidden fields by hand, and you don’t have to worry [...]
Posted in JavaScript on May 17th, 2005 Comments Off
To use these, just call LTrim(), RTrim(), or Trim() with the string you want trimmed.
<script type=”text/javascript”>
<!–
function LTrim(trimInputString)
{
while(trimInputString.charAt(0)==” “)
trimInputString=trimInputString.substring(1,trimInputString.length);
return (trimInputString);
}
function RTrim(trimInputString)
{
while(trimInputString.charAt(trimInputString.length-1)==” “)
trimInputString=trimInputString.substring(0,trimInputString.length-1);
return (trimInputString);
}
function Trim(trimInputString)
{
while(trimInputString.charAt(0)==” “)
trimInputString=trimInputString.substring(1,trimInputString.length);
while(trimInputString.charAt(trimInputString.length-1)==” “)
trimInputString=trimInputString.substring(0,trimInputString.length-1);
return (trimInputString);
}
//–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
To show the dates for Today - x days, set the value of x accordingly.
<script type=”text/javascript”>
<!–
DateToday = new Date();
x=7;
for (y=0; y<x; y++)
{
MyDate = new Date(Date.UTC(parseInt( _
DateToday.getYear()), _
parseInt(DateToday.getMonth()), _
parseInt(DateToday.getDate()))- _
(60*60*24*1000*y));
MyDateString=MyDate.getDate() + ‘.’ _
+ parseInt(MyDate.getMonth()+1) _
+ ‘.’ + MyDate.getYear();
document.write (MyDateString + “<br>”);
}
//–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
If you want to check whether a particular value is in an array, call this function with something like this.
if (isInArray(MyValue, MyArray))
<script type=”text/javascript”>
<!–
function isInArray(needle, arrayHaystack)
{
for (x=0; x < arrayHaystack.length; x++)
if (arrayHaystack[x] == needle)
return true;
return false;
}
–>
</script>
Posted in JavaScript on May 17th, 2005 Comments Off
To use this, call GetNVP(string NVPString, string NVPid) with the input NVP string and the name of the value you want to retrieve.
<script type=”text/javascript”>
<!–
function GetNVP(NVPString,NVPid)
{
var NVPFound=false;
var NVPArray=new Array();
var NVPList=NVPString.split(’&’);
for (x=0; x<NVPList.length; x++)
{
NVPData=NVPList[x].split(’=’);
NVPArray[NVPData[0>=NVPData[1];
}
for (var LocalID in NVPArray)
if(NVPid==LocalID)
NVPFound=true;
if (NVPFound)
return (NVPArray[NVPid]);
else
return (’Name not found’);
}
–>
</script>