Pages

Monday, July 5, 2010

Registering Extensions for Windows Search

If you are a programmer who uses the Windows Search service to index documents on your local computer then this should be useful:

How to register Microsoft Filter Pack with SharePoint Server 2007 and with Search Server 2008
http://support.microsoft.com/?id=946336

By default, the Windows Search service only indexes content with certain file extensions.  Of course they leave out the extensions used in source code.  Step #3 from the KB article tells how to add registry keys that tell the Windows Search service to index additional file types.  I’ve done this for all of the common .Net file types:  cs, aspx, xml.  Now, whenever I do a search through Windows Explorer or the start menu, I’ll see my source code in the search results.

Friday, June 4, 2010

Access Denied when Running Site Locally

"Could not load file or assembly 'xxxxxx' or one of its dependencies.  Access is denied."

If you get this exception when running an ASP.Net site through the Visual Studio web server, make sure that McAfee isn't causing the problem.  Here's what I had to do to turn it off:

  1. Open the "VirusScan Console"
  2. Go to properties on "Access Protection"
  3. Click on "Common Maximum Protection"
  4. Make sure "Prevent creation of new executable files in Windows folder" is set to NOT block.
  5. Click "OK"
  6. Now restart the Visual Studio web server and it should work!

I’ve also had this problem when the Windows Search Service is trying to index the DLL’s in my “bin” folder every time I compiled.  You could try using the “Process Monitor” tool to see if there’s another program accessing your DLL causing the locking problem.

Wednesday, April 21, 2010

Space used by SQL tables

This SQL might be useful to you.  It will show you which tables in your SQL 2005+ database are taking up the most space.  Parts of the code were taken from the sp_dbsize system stored procedure.

DECLARE @TotalReserved AS INT
-- Get the database size...
SELECT @TotalReserved = sum(convert(dec(15),reserved)) * 8192 / 1024
FROM sysindexes
WHERE indid in (0, 1, 255)

SELECT *,
CASE WHEN Rows > 0 THEN Reserved * 1024 / Rows ELSE -1 END as 'AvgBytesPerRow',
Reserved * 100 / @TotalReserved as 'Percent',
replicate( 'X', Reserved * 100 / @TotalReserved ) 'Reserved Space Graph'
FROM (
select t.Table_Name,
(
SELECT CAST(CAST(SUM(Reserved) AS FLOAT) * 8192 / 1024 AS NUMERIC )
FROM sysindexes
WHERE id = OBJECT_ID( t.Table_Name ) and indid in (0, 1, 255)
) as 'Reserved',
(
SELECT i.rows
FROM sysindexes i
WHERE i.indid < 2
AND i.id = OBJECT_ID( t.Table_Name )
) as 'Rows'
FROM information_schema.tables t
) a
ORDER BY Reserved DESC

Monday, January 4, 2010

CSS Text-Overflow

Text-Overflow CSS property:
http://msdn.microsoft.com/en-us/library/ms531174(VS.85).aspx

Emulate text-overflow:ellipsis in Firefox with CSS
http://www.jide.fr/emulate-text-overflowellipsis-in-firefox-with-css

How to Reinstall F5 VPN

I often have to log in to an F5 VPN to do my work, but sometimes all of the F5 components just don’t want to work.  Here are the steps to uninstall the F5 components so that the login process will reinstall the latest version.

  1. Download https://firepass.fpfaq.com/sandbox/f5wininfo.exe
  2. Run the program as an administrator.
  3. Tools > Remove Components > Yes
  4. Close the program
  5. Log in to to your F5 VPN site.

Now the F5 components will be reinstalled and the “Network Access” will work.

Thursday, April 16, 2009

TreeView Bug with Bold Fonts

In a .Net 2.0 Windows forms app, if you can’t get the a TreeNode to be displayed as bold within a TreeView, take a look at this KB article:

The text of a node may be truncated when you programmatically set the Font property of the node to the Bold value in a Windows Forms-based application that uses the .NET Framework 2.0
http://support.microsoft.com/?scid=kb;en-us;937215&x=8&y=13

You have to modify the "Text" property of the Node after it has been added to the TreeView.

Thursday, February 12, 2009

Flickering ListView

If you have a ListView in a Windows Forms app, use the following code to stop it from flickering:

using System.Reflection;

// For some reason the "DoubleBuffered" property isn't exposed on the ListView class
// so we have to use reflection to set it even though it's a "protected" property...

PropertyInfo oDoubleBuffered = this.listView1.GetType().GetProperty(
"DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance );
if ( oDoubleBuffered != null )
oDoubleBuffered.SetValue( this.listView1, true, null );