Monthly Archives: November 2010

I have to look up how to implement a 301 redirect in ASP every few months, so I’m putting this up as a personal reference.

<%@ Language="VBScript" %>
<% 
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "http://domain.com/page.asp" 
Response.End 
%> 

It seems that the value of Location can be a relative path and the redirect will still function.

I replaced the shattered color wheel on my 61″ Samsung HLN617W DLP television using the excellent instructions at http://www.jangro.com/items/samsung-dlp-replace-color-wheel/.

A shattered Samsung HLN617W DLP color wheel

A shattered Samsung HLN617W DLP color wheel

A color wheel is six separate pieces of glass attached to a hub through which the light from the lamp is cast. The wheel spins insanely fast, and over time the bearings wore and it developed a wobble. Once the wobble became pronounced enough, the wheel tore itself apart. I should have known something was up, because the TV had been making a sound like a vacuum cleaner for a few months.

A shattered Samsung HLN617W DLP color wheel (closeup)

A shattered Samsung HLN617W DLP color wheel (closeup)

While the lamps on DLP sets are easily accessed, replacing the color wheel requires tearing the guts out of the thing. Still, if you’re comfortable with electronics, you shouldn’t have too much trouble with it.

I like DLP, even though the components are subject to wear and replacement, because you don’t get much more analog than using a high-pressure mercury-vapor metal halide arc lamp to generate a pretty intense beam of light, sending that beam of light through a mechanical spinning color wheel and then scattering it with a reflective micromirror chip against a surface.

Actually, my method of toggling the read-only attribute of Word.qat requires two macros. One switches on the read-only attribute of Word.qat to prevent it from being changed. The other clears the read-only attribute so buttons can be added or removed.

Just add these macros as buttons to the QAT to quickly protect and unprotect it. I prefer two buttons to a single button because I don’t know of a way of telling, visually, the current state of the read-only attribute of a file. I’d love to change the appearance of the button to indicate the state, but I haven’t found a way to do this. So for now, two buttons allow the user to take exactly the action desired.

Why would you ever need to do this?

Buttons disappearing from the QAT is a pretty common occurrence.

If your Quick Access Toolbar contains buttons from templates or COM add-ins, these custom buttons can be lost when Word is closed and reopened. To demonstrate this, add such a button to the QAT, then close Word and reopen it from the command line with winword.exe /a (the /n switch may also demonstrate this). Word will open, but without any add-ins. Instead of creating a temporary Word.qat with the default buttons, the working Word.qat file is edited to remove all the non-native Word buttons. The appearance to the user is that Word loses the custom buttons. Once the buttons disappear, they do not return when Word is opened normally.

From what I can tell, the QAT buttons disappearing isn’t a random event or a bug, but an intentional consequence of initiating a Word instance without any add-ins or a result of a badly written function in a template or add-in.

The LockQAT Macro

Sub LockQAT()
'
' LockQAT Macro
'
'

    Dim appdata, thepath, objFSO, objFile

    Set oShell = CreateObject("WScript.Shell")
    appdata = oShell.ExpandEnvironmentStrings("%APPDATA%")
    thepath = appdata & "\Microsoft\Office\Word.qat"

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.GetFile(thepath)
    
    'Determine if the file is ALREADY Read-Only
    If objFile.Attributes And 1 Then
        MsgBox "The Word.QAT file is already Read-only."
    Else
        MsgBox "Locking the QAT from further editing."
        objFile.Attributes = objFile.Attributes + 1
    End If
    
' Resources
' http://www.4guysfromrolla.com/webtech/112600-1.shtml

End Sub

The UnlockQAT Macro

Sub UnlockQAT()
'
' UnlockQAT Macro
'
'

    Dim appdata, thepath, objFSO, objFile
    
    Set oShell = CreateObject("WScript.Shell")
    appdata = oShell.ExpandEnvironmentStrings("%APPDATA%")
    thepath = appdata & "\Microsoft\Office\Word.qat"

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.GetFile(thepath)

    'Determine if the file is ALREADY Read-Only
    If objFile.Attributes And 1 Then
        MsgBox "Unlocking the QAT for editing."
        objFile.Attributes = objFile.Attributes - 1
    Else
        MsgBox "The Word.QAT file is already writeable."
    End If

' Resources
' http://www.4guysfromrolla.com/webtech/112600-1.shtml
    
End Sub