Even Waterstones …
Posted in JavaScript, Rambles on Nov 18th, 2008 No Comments »
This, from the UK’s leading high street bookseller. You’d expect them to get it right, wouldn’t you? It should be “Waterstones.com has shipped your order.”
Posted in JavaScript, Rambles on Nov 18th, 2008 No Comments »
This, from the UK’s leading high street bookseller. You’d expect them to get it right, wouldn’t you? It should be “Waterstones.com has shipped your order.”
Posted in JavaScript, Rambles on Jul 21st, 2008 No Comments »
This movie has had rave reviews all over the place, but the one thing all those reviews fail to mention is that the film is bloody awful. It’s a disappointing triumph of style over substance. The visuals are nothing short of stunning - almost real in their detail - but the plot is [...]
Posted in JavaScript, Rambles on Jun 27th, 2008 No Comments »
The wine is good but, like all fast food, the KFC never lives up to the picture. Zinger Tower Burger. “Tower”, my arse. It’s crap, but after watching a bunch of grown-ups playing rounders for a couple of hours, it’s just about tolerable.
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>