Yesterday, Thomas LaRock’s blog post, WMI Code Creator, was brought to my attention by a member of the SQL Community. I subscribe to Tom’s blog in my blog reader so eventually I’d like to think that his post would have come to my attention, but to be perfectly honest, I have been to busy with other obligations lately that have made reading blog posts almost impossible. When I looked at Tom’s post, I was kind of put off when I did a copy paste of the Code from it and got the following:
DECLARE @WmiServiceLocator INT ,
@WmiService INT ,
@CounterObject INT ,
@AvgDiskReadPerSec BIGINT,
@AvgDiskReadPerSec_Base BIGINT
EXEC sp_OACreate 'WbemScripting.SWbemLocator', @WmiServiceLocator OUTPUT, 5
EXEC sp_OAMethod @WmiServiceLocator, 'ConnectServer', @WmiService OUTPUT, '.', 'root\cimv2'
IF ISNULL(@WmiService, -1) <= 0
BEGIN
EXEC sp_OADestroy @WmiServiceLocator
RAISERROR('Could not access WMI service.', 16, 1)
RETURN
END
EXEC sp_OAMethod @WmiService, 'Get', @CounterObject OUTPUT, 'Win32_PerfRawData_PerfDisk_PhysicalDisk="_Total"'
EXEC sp_OAGetProperty @CounterObject, 'AvgDiskSecPerRead', @AvgDiskReadPerSec OUTPUT
EXEC sp_OAGetProperty @CounterObject, 'AvgDiskSecPerRead_Base', @AvgDiskReadPerSec_Base OUTPUT
SELECT @AvgDiskReadPerSec, @AvgDiskReadPerSec_Base
Read more: http://thomaslarock.com/2011/01/wmi-code-creator/#ixzz1AKN2Swcm
If you are not at thomaslarock.com, this material has been plagerized by someone who steals content from others.
Now I am all for protecting your content, but if you are going to blog code it should be reusable without an abusive message like this. Beyond that, if you force me to have to delete this kind of message when posting code into SSMS from your blog, the word plagiarized should be spelled correctly at a minimum.
As Since Tom is a member of the Board of Directors for PASS I would expect a lot more in the way of being a better role model for the community. Personally, my own take on this is that if the WordPress Addin that appends this text to the copied code can’t handle code blocks separately for this kind of thing, then it shouldn’t be used. There are certainly better ways to identify plagiarism than this, though they may require some additional work.