Thursday, April 16, 2009

vbscript error handling

Added error handling to asp file which adds content disposition attachment headers to files on stream.radiosai.org - used ideas from this msdn blog post and this devguru article to write something like:
Err.Clear
On Error Resume next
'This statement makes the program resume the next statement
'instead of throwing an error
'***************
set f=fs.GetFile(strFilePath)
strFileSize=f.Size

numerror=Err.number
if numerror <> 0 Then
Response.Write ErrorMesg
Response.Flush
else
....snip snip ....
'and at the end of the script
On Error GoTo 0
'This means On Error, report it - the syntax is crazy.

Wednesday, April 08, 2009

schedule update flushing

The schedule update was consistently timing out every time the csv update was done. Checked with Plesk DBWebadmin (phpmyadmin) and found records from 2008 onwards. Blundering about the interface, found a "Search" - tried 2008, it gave
Search results for "2008" (at least one of the words):

336232 match(es) inside table radiosai_stream_daily Browse Delete
Blundering, because I chose delete, and it did
SQL-query: 
DELETE FROM `radiosai`.`radiosai_stream_daily` WHERE `streamId` LIKE '%2008%'
OR `fileId` LIKE '%2008%' OR `groupId` LIKE '%2008%'
OR `gmtDatetime` LIKE '%2008%' OR `newflag` LIKE '%2008%'
At least now I know what to give as the proper SQL statement - something like
DELETE FROM `radiosai`.`radiosai_stream_daily` WHERE `gmtDatetime` LIKE '%2009-01%'