Monday 25 March 2013

Windows 7 Performance Boosting

20 Amazing Windows 7 Performance Boosting Tips In Under 10 Minutes!

Note: If you use the search facility in MS outlook, then ignore the step about disabling windows search service...

http://www.pcmtechhelp.com/2011/07/16/20-amazing-windows-7-performance-boosting-tips-in-under-10-minutes/

Friday 15 March 2013

Logical fragmentation in SQL Server Indexes

My colleague Lawrence today discovered that a query we had that was taking over 2hrs to run (and still timing out), was due to a non clustered index being badly fragmented on the table in question.

To discover this fact he used the following queries, before rebuilding all indexes on the table, which then fixed the issue, and got the query coming back in 2 seconds.

--1. find index names
sp_helpindex 'dbo.MyTableName'

--2. show index logical fragmentation. Scan density should be above 97%
dbcc showcontig (MyTableName) WITH TABLERESULTS, ALL_INDEXES

--3. show when indexes were last rebuilt
Declare @dbid int
Select @dbid = db_id('Beacon')
Select objectname=object_name(i.object_id)
, indexname=i.name, i.index_id
, o.create_date, o.modify_date
from sys.indexes i, sys.objects o
where objectproperty(o.object_id,'IsUserTable') = 1
--and i.index_id NOT IN
--(select s.index_id
--from sys.dm_db_index_usage_stats s
--where s.object_id=i.object_id and
--i.index_id=s.index_id and
--database_id = @dbid )
and o.object_id = i.object_id
and object_name(i.object_id)= 'MyTableName'
order by o.modify_date desc

Wednesday 6 March 2013

WCF DataMember attribute issue

Got caught out by this issue today. Spent ages trying to find out why I was getting a WCF exception after adding the DataContract and DataMember attributes into my class, and it turned out I had a property that didn't have both a getter and a setter declared.

image

http://msdn.microsoft.com/en-gb/library/system.runtime.serialization.datamemberattribute.aspx

The error was simply reported as

System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...