Wednesday, May 16, 2007

FTP a file and rename it to today's date.

This isn't difficult, but it can be useful. This routine will grab a file (one or more actually but be careful) and rename the received file to today's date. You could go further and exercise the %TIME% variable, but that's up to you.

getfile.cmd:
@echo off
if exist dlfilespec del /f /q dlfilespec
ftp -s:getfile.ftp -v
if exist destfilespec_%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%.zip ~SPLIT~
del /f /q destfilespec_%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%.zip
ren dlfilespec ~SPLIT~
destfilespec_%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%.zip
getfile.ftp:
open host
username
password
binary
prompt
mget dlfilespec
ls
close
bye

Friday, May 04, 2007

Alerting when a process is a memory pig...

Now this example uses putty.exe right now, but the original purpose was to alert when a jrun.exe was getting too big for it's britches. Run as a scheduled task (AT job) and customize to suit:
@echo off
for /F "usebackq tokens=1,2,3,4,5,6 delims=, " %%a IN (`tasklist /NH /FI "imagename eq putty.exe"`) do CALL :CHECKMU %%e%%f
goto :eof

:CHECKMU
SET /A MEMUSAGE=0+%~1
IF /I %MEMUSAGE% GTR 1400 echo Memory Usage Warning: %MEMUSAGE%

GOTO :eof
The echo for 'Memory Usage Warning' will only execute if the memory usage exceeds 1400 (in this example) This could be a call, note the use of subroutines in the batch file (CHECKMU). If there are many processes running the PID could be passed using other variables (%%a, %%b, etc.) but it will execute for each instance that meets the criteria.

Friday, January 19, 2007

Running into The Man in Blue

I recently went hunting for information on detecting browser information using JavaScript and through no random chance, found myself reading the blog of The Man in Blue.

While the information was valuable, what impressed me, and inspires me, is the design of his portfolio site. It's clean, usable, and incredibly simple. The interface is poetically enjoyable and intuitive. I would hope no one would copy this site, that would be wrong, but instead find inspiration in his design.

Please have a look: The Man In Blue

There is no individual ownership when you are part of a team, it's the sum of the parts that makes you the RESILIENT team you need to be.