Posts

Showing posts from April, 2012

Command-Line Warning D9040

I am going to hold this up as another example of why I dislike the Microsoft software model. Firstly its some random error number and a message which is misleading (my edition was Premium that architecture was 64bit), secondly it shows that the 64bit and 32bit compilers are not the same and clearly 64bit is inferior.

http://msdn.microsoft.com/en-us/library/aa983384%28v=vs.80%29.aspx

Command-Line Warning D9040

Error Message
ignoring option '/analyze'; Code Analysis warnings are not available in this edition of the compiler

The /analyze command line option is supported only on x86 versions of Visual Studio Team System. It is not available for x64 or Itanium compilers, or for other versions of Visual Studio besides Visual Studio Team System. To remedy this warning, either switch to the x86 version of Visual Studio Team System, or remove the command line option.

Replacing part of a filename using bash scripting

My brother has a dovecot mail server that every now and again the cache would corrupt on it. He would just go in, check the logs and rename the file affected. He just asked if I could script the process. So this little script will search through a log, extract the filename, alter its name and move the file to the new location:

#!/bin/bash

QFILE=test.log

grep "Error: Maildir filename has wrong W value:" $QFILE | while read line
do
fileNo=$(echo "$line" | awk '{split($0,a,","); for (idx in a) { split(a[idx], b, "="); if (b[1] == "W") print b[2]; }}')
fileName=$(echo "$line" | awk '{split($0,a," /"); print a[2]}')
echo "/$fileName"
echo "$fileNo"
fileNameFixed=${fileName//,W=$fileNo}
echo "/$fileNameFixed"
mv /$fileName /$fileNameFixed
done