Archive

Archive for the ‘service-is-testing-troubleshooting-debugging’ Category

To retrieve a hidden Find Text window of MZ-Tools

  1. … close all your other undocked windows in VBE Editor.
  2. Must have been hidden during inadvertent docking and took me a while…

mztools-unhide-find-text

Try “Stop Collecting” with Office Clipboard for Runtime Error 1004 “Paste Method of Worksheet Failed”

There seem plenty potential sources of error for  method .Pastespecial, and  a vast amount of questions and good advice online.

But I did not find this one, and only this one managed to make Pastespecial into Excel work for me. image

How to prevent OneNote from crashing when hovering over search results

  1. Problem: In a strange new development, my OneNote crashes (multiple times, until things eventually become stable again) when I search my notebooks  from the upper right search box. Specifically, as soon as I hover my mouse over the search results display.
  2. My environment: OneNote 2013 32-bit on Windows 7 64-bit. These are notebooks on a network share, and they are updated from multiple machines. Not aware of any recent changes to my mouse settings or drivers.
  3. My Workaround: Navigate the search results using the keyboard. This seems to prevent those crashes.

How to define your own conditional content marker “Internal” for Doxygen

  1. Doxygen comes with a built-in conditional content marker \internal the outputting of which can be controlled with the switch INTERNAL_DOCS in Doxygen’s config file.
  2. However, I could not get this to work as advertised in Doxygen 1.8.8.
  3. In cases of similar feature breakage, users are commonly advised to fix the error in the Doxygen source. If you, like I did, lack the time for that, here is a simple workaround which uses another built-in feature that an be controlled via  Doxygen’s config file:
  4. Define as one of the:
    ALIASES = "myinternal=\if myinternal <HR><kbd><em>" \
              "endmyinternal= </em></kbd> \endif"
    # HTML is optional, intended to make internal information stand out clearly if outputted
  5. Switch this ALIAS on and off using ENABLED_SECTIONS       = # myinternal
  6. Example usage in a .dox file:
    -# A high-low-high-low beep sequence followed by a low-high beep
     sequence indicates successful pairing and connection to the remote
     device.
     @myinternal tested with barcode on lower-end of cradle: gives success
     beep sequence @endmyinternal
     -# A long low, long high beep sequence indicates unsuccessful pairing.

     

Alter embed URL letter case to fix your broken MS-Office-file embeds in WordPress

  1. Problem: I just notice that a lot of my WordPress OneDrive embeds are broken (not sure since when).
  2. Root cause:
    1. Upon comparing the embed URLS in WordPress posts with what embed URLS sharing with OneDrive results in, it appears that the letter case in the embed URLs has been changed to all uppercase, pointing to resources that do not exist (doh!).
    2. Not sure who is to blame for altering the case:
      1. WordPress,
      2. OneDrive (note there is also the transition from “skydrive” to “onedrive”),
      3. Windows Live Writer? The latter hardly, since I did not touch these posts.
  3. Solution:
    1. Given that, while “cid=” seems all uppercase, “resid=” all lowercase, but “authkey=” is mixed case , there is not easy case change operation you could do locally to restore the original try.
    2. So you have to find the original files you embedded (not trivial from the URL which does not contain even a hint of the file name or extension) and re-embed it through sharing with OneDrive.

How to fix primary screen on Linux laptop not coming out of sleep

  1. Problem: My Debian (Jessie) Linux laptop has issues with juggling a secondary screen and sleeping at the same time. More specifically, it seems:
    1. It seems if you come out of sleep with a secondary screen connected, even if you put the laptop to sleep with “it” (o.k., not the same “it”, just spec-wise the equivalent FULL HD LCD screen on VGA – being able to easily move the laptop to work in multiple places is kind of the point of having one in the first place), the primary laptop screen seems to remain asleep completely. FN keys to switch primary and secondary screen on laptop have no effect.
    2. If you disconnect the secondary screen, Linux does fall back onto the primary screen, however, “forgets” to turn the backlight on. FN keys to up brightness have no effect
    3.   have not found a reliable way avoiding the issue  – maybe always disconnecting secondary screen before putting laptop to sleep? If you don’t want to have to do this, or forget, try to use this:
  2. Workaround:
    1. While I could get to the tty shell on secondary screen using CTRL+ALT+F1, but using xrandr --auto gave can't open display.
    2. However, try installing this utility which I found recommended in a different context:
      1. aptitude search xbacklight
      2. xbacklight               - simple utility to set the backlight level
      3. aptitude install xbacklight
      4. Switch to a non-elevated user (or else you’ll get: No protocol specified" , "Primary laptop", "Can't open display :0", Why can't I run GUI apps from 'root': "No protocol specified"? : " In Debian $XAUTHORITY is usually not set explicitly.", "xauth list xauth:  file /root/.Xauthority does not exist" ).
      5. Then issue: xbacklight -set 50 OR issue xbacklight -inc 50.
      6. Viola: “Fiat lux”…
      7. Sleep takes out your primary screen and you are not good at blind starting, finding and typing into your Konsole? Right-click on the desktop of your secondary scree, “Run command”, and issue the same command line.
      8. Thank you, xbacklight.

VBA script to more easily examine the properties of your Content Control-based forms

  1. The routine loops through the Content Controls and outputs properties as text into the VBA-Editor immediate window,
  2. from where it can be easily converted into an Excel-table which makes it easy t o spot and mark inconsistencies and outright oversights, like so: image
Sub ccPropertiesPrint()
On Error Resume Next
Dim strHeadings, strProps As String
Dim count As Integer
Dim response

strHeadings = strHeadings & "~" & "count"
strHeadings = strHeadings & "~" & "Tag"
strHeadings = strHeadings & "~" & "Title"
strHeadings = strHeadings & "~" & "Type"
strHeadings = strHeadings & "~" & "DefaultTextStyle"
strHeadings = strHeadings & "~" & "Application"
strHeadings = strHeadings & "~" & "BuildingBlockCategory"
strHeadings = strHeadings & "~" & "BuildingBlockType"
'strHeadings = strHeadings & "~" & "Checked"
'strHeadings = strHeadings & "~" & "Creator"
'strHeadings = strHeadings & "~" & "DateCalendarType"
'strHeadings = strHeadings & "~" & "DateDisplayFormat"
'strHeadings = strHeadings & "~" & "DateDisplayLocale"
'strHeadings = strHeadings & "~" & "DateStorageFormat"
'strHeadings = strHeadings & "~" & "DropdownListEntries"
strHeadings = strHeadings & "~" & "ID"
strHeadings = strHeadings & "~" & "LockContentControl"
strHeadings = strHeadings & "~" & "LockContents"
strHeadings = strHeadings & "~" & "MultiLine"
'strHeadings = strHeadings & "~" & "Parent"
strHeadings = strHeadings & "~" & "ParentContentControl"
strHeadings = strHeadings & "~" & "PlaceholderText"
strHeadings = strHeadings & "~" & "Range"
strHeadings = strHeadings & "~" & "ShowingPlaceholderText"
strHeadings = strHeadings & "~" & "Temporary"
'strHeadings = strHeadings & "~" & "XMLMapping"
Debug.Print strHeadings
  If ActiveDocument.ContentControls.count > 0 Then
    For Each oCC In ActiveDocument.ContentControls
    'debug
    'If oCC.Type = 9 Then 'debug: repeating
count = count + 1
If count = 50 Then
'dim response = vbmsgboxresponse
    Exit For
End If
    
' useless cannot access immediate window If count = 15 Then response = MsgBox("paused", vbOKOnly) End If
strProps = "" 'start over
strProps = strProps & "~"
strProps = strProps & count 'CStr(count)
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.Tag, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.Title, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.Type, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.DefaultTextStyle, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.Application, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.BuildingBlockCategory, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.BuildingBlockType, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.Checked, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.Creator, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.DateCalendarType, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.DateDisplayFormat, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.DateDisplayLocale, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.DateStorageFormat, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.DropdownListEntries.count, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.ID, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.LockContentControl, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.LockContents, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.MultiLine, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.Parent, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.ParentContentControl, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.PlaceholderText, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.Range, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.ShowingPlaceholderText, Chr(13), "#"), Chr(10), "#"))
strProps = strProps & "~"
strProps = strProps & CStr(Replace(Replace(oCC.Temporary, Chr(13), "#"), Chr(10), "#"))
'strProps = strProps & "~"
'strProps = strProps & CStr(Replace(Replace(oCC.XMLMapping, Chr(13), "#"), Chr(10), "#"))
Debug.Print vbCrLf & strProps & vbCrLf
'End If 'oCC.Type=9  then 'debug: repeating
 Next
 End If
End Sub

Expanding the Review and Modify Content Control Properties to include Repeating Sections

  1. Greg Maxey provides a lot of useful information on MS-Word content Controls, including a VBA utility to more easily loop through the properties and placeholder text dialogue of Content Controls when building your MS-Word forms.
  2. Unfortunately, the latter bit fails with nested repeating (wdContentControlRepeatingSection):
  3. The debugger shows that it Errors on non placeholder text of repeating controls set to
  4. “.txtPHText = oCC.PlaceholderText” which it breaks into, and a watch put on oCC shows:
  5. The form 1 (display of inbuilt form ) works and is useful also for wdContentControlRepeatingSection, while form 2 has no use for wdContentControlRepeatingSection. So as a workaround, we just do not show form 2 if placeholder text isNothing:
  6. We have no pretension to redistribute, get the utility from Greg’s website, it is open and you can extend it with above, if you need to.
Sub CCPropertiesReviewModify()
    Dim oFrm As frmCC
    bCancel = False
    
    If ActiveDocument.ContentControls.Count > 0 Then
        For Each oCC In ActiveDocument.ContentControls
            oCC.Range.Select
            Dialogs(wdDialogContentControlProperties).Show
            Set oFrm = New frmCC
            
            If Not isNothing(oCC.PlaceholderText) Then 'trp
                With oFrm
                    .Caption = oCC.Title
                    .txtPHText = oCC.PlaceholderText
                    .Show
                End With
           End If
        If bCancel Then Exit For
        Next oCC
        
        Unload oFrm
        Set oFrm = Nothing
    Else
    MsgBox "This document does not contain any Content Controls.", vbInformation, "Review\Set Content Control Properties"
    End If
lbl_Exit:       Exit Sub
End Sub

Now what about wdContentControlGroup?