Monday, February 23, 2009

Date and Time in Batch for Log File Name

Setting up a batch file and configuring a command line utility and identifying, for Windows servers, a process to execute the application and have unique log files recorded.


REM take the system date and convert it to YYYYMMDD format
set MyDate=%date:~10,4%%date:~7,2%%date:~4,2%

REM take the system time and convert to an HHMM format
set MyTime=%time:~0,2%%time:~3,2%
REM if earlier than 10 oclock then convert leading space to a 0:
REM note it is %MyTime:<space>=0%
set MyTime=%MyTime: =0%
REM if its after 10 then this has no effect so theres no need to test for the time

REM Next set the %logfile% configuration for daily retention

set logfile=%MyDate%%MyTime%.log

REM use the %logfile% variable in the command line e.g.
c:\bin\spwakeup.exe -log:c:\logs\spwakeup\%logfile%


Of course, the date and time editing could be to any sequence you prefer.

The idea is to break the system date into little strings and manipulate them to your needs.

set MyDate=%date:~10,4%%date:~7,2%%date:~4,2%

is really saying to the system

get the system date "%date"

do something with it ":"
edit it down "~"
from character position "10"
for a length of ",4" (the year including century YYYY format)
end this variable component "%"

repeat for the characters at position 7 for a length of 2 (the month in MM format)
and again for the day at position 4 for a length of 2 (the day in DD format)

and because all three instructions are strung together then the result is pushed into the variable named MyDate (without the %'s when setting, but with %MyDate% when you want to use the value) the output will be the date in YYYYMMDD format.

Likewise with the Time value and then setting the logfile name.



SharePoint Slow to Start

SharePoint is a current topic for me and I'd noted that the first call to any of my SharePoint sites was always slow first thing in the morning. A little research identified that the server defaults to restarting and doing some clean-up early every morning.

Also as a part of that research there are numerous pointers to Wake Up scripts but some are out of date. So if you are looking for a solution there is an excellent script available on CodePlex called SPWakeUp.

I set up a batch file for it and scheduled it twice - once for 0300 daily and again on server restart. This way my users will not have the 30 second wait the first time they hit on one of the sites.

I also configured the batch file to provide for spwakeup log files that have a date/time stamp in the file name so that the log is not overwritten. The batch file process for handling date and time in a file name is relatively simple for any Windows server.

Monday, February 2, 2009

Education Real World Skills

I was reading the Australian Financial Review Monday 2nd Feb here in downtown Adelaide (yes I am travelling again) and the Education section rang a bell with me. (in a past life I was a education sector IT boffin) and I noted a number of things in the article by Joanna Mather on Real World Skills worth funding.

It was not so much the sentiment or the goal, as the time frame being suggested and is it worth funding on that basis.

The outcome of 8 months of research in 2008 culminates in the winning of a grant... "The work-integrated learning study was funded by the Australian Learning and Teaching Council in partnership with the Australian Collaborative Education Network..." etc.

Based on a Canadian example (like we do not have enough ideas in this country?) is due to 'go live' in late 2010... ! What tha!

Its January 2009 (ok its really Feb 2 but..) given the current economic situation and the known issue with IT projects scheduled against Moore's Law timing, I would expect that this will be another dismal failure. 18 months in the unknown future against unknown external factors we will deliver a system to assist youth in the future with skills.

So what about today ? and todays youth who within 2 years will be implicitly 2/3rds of their way through todays general 3 year courses to attain their qualification. A late 2010 delivery does nothing for today and is potentially a wasted effort as a consequence.

Given that we can deliver prototype websites in 24 hours, have domain names created within minutes, and be pushing traffic to sites a week after they are first born, why on earth do we persist with the concept of delivery in 18 months for any project, much less one that is meant to be fixing issues now.

What will the project do for the next 18 months ? Discover that they have planned the last failing website? Confirm that any IT project scheduled over 12 months is doomed to failure? (a particular favourite opinion of mine!) or that if we wait long enough and spend $400k that we can appear to have done lots without really achieving much.

If we really want to address the issues for todays students we should have started in October last year, developed on an incremental basis, delivered at least a starting point and not be reporting about what we intend to do 2 years hence.

If they are really serious about doing this now, then the time line could be to deliver something in 2009 for real benefits in 2009, stealing a complete 2 year march on other influences.



End of my education rant for this week!