ict.ken.be

Delivering solid user friendly software solutions since the dawn of time.

C# Disposal Pattern 

Categories: .Net Patterns
class MyResourceWrapper : IDisposable
{
    // Used to determine if Dispose()
    // has already been called.
    private bool disposed = false;
    
    public void Dispose()
    {
        // Call our helper method.
        // Specifying "true" signifies that
        // the object user triggered the cleanup.
        CleanUp(true);
        // Now suppress finalization.
        GC.SuppressFinalize(this);
    }
    
    private void CleanUp(bool disposing)
    {
        // Be sure we have not already been disposed!
        if (!this.disposed)
        {
            // If disposing equals true, dispose all
            // managed resources.
            if (disposing)
            {
                // Dispose managed resources.
            }
            // Clean up unmanaged resources here.
        }
        disposed = true;
    }

    ~MyResourceWrapper()
    {
        // Call our helper method.
        // Specifying "false" signifies that
        // the GC triggered the cleanup.
        CleanUp(false);
    }
}

Rebuilding the WMI/WBEM repository 

Categories: Windows
  • net stop winmgmt
  • delete c:\windows\system32\wbem\repository\
  • net start winmgmt
  • re-stored/compiled all the .mof files with a batch file containing this one line:
    for %%i in (*.mof,*.mfl) do Mofcomp.exe %%i

LESS css 

Categories: CSS

LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions:

http://lesscss.org

Less for server-side compiler for .Net:

http://www.dotlesscss.org

Syntax highlighting of '.less" files in visual studio: 

http://visualstudiogallery.msdn.microsoft.com/e646c6ec-87a7-45ea-81e8-d655a3d3e73e

(do not use the same names for your .css and .less files cause the vs extention will compile the .less into .css)

Quick online testing:

http://winless.org/online-less-compiler

 

While LESS can be used together with bootstrap, you could also go for a Sass, Compass & Foundation combination.

Hiding the Q-drive from Office 

Categories: Windows

on Win7 - regedit

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer

new key NoDrives (32-bit DWORD) with decimal value 65536

bitmask:

Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1

Keep in mind that when Word Starter 2010 tries to update this might cause a 'Internet connection not found error'. I turned the drive back on until update was done.

Page 33 of 43 << < 20 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 > >>