Archive

Archive for the ‘service-is-documenting’ Category

Bringing method documentation back into synch by using Textpad command line to jump to GrepWin matched line in file

  1. Objective: is checking, in one simple result window, multi-line matches of method signatures and their Doxygen comments from a multi-module, multi-directory C++ codebase, in order to spot  inconsistencies, i.e. where code and documentation  are out f synch: image
  2. image
  3. All this short of having to write a Parser or buying a tool like Atomineer Pro Documentation  (which does look like it is “right on the money”, but, as it turned out to my surprise, also far short of getting this to work in Eclipse or on a Bash command line with Grep and Perl, ack  (doesn’t do multi-line matches!), ag, or what-not.  grepWin is free, has an easy-to-use, versatile interface, and proves, once again, to be a powerful little tool.
  4. A a sample (in reality not cut off, of course), 2 methods with their comments showing here: image
  5. And I am only a click away from correcting errors I spot in my preferred editor that grepWin  can link in “Settings””C:\Program Files (x86)\TextPad 7\TextPad.exe” %path%(%line%,0)
  6. image
  7. Some grepWin quirk I do not understand:
    1. Why does the “Search” button do nothing when I select radio button “Regex” instead of “Text Search”, but does the expected regex match against file and directory name when I select the latter? image

How to output a list of installed programs on Windows with PowerShell

A vanilla script, but including all Win32_Product class properties – a quick search found only a very basic version how to do this in PowerShell:

# to write a installed program listing to a CSV file - just adapt the output dir below
Get-WmiObject -Class Win32_Product |`
foreach{
$AssignmentType = $_.AssignmentType
$Caption = $_.Caption
$Description = $_.Description
$IdentifyingNumber = $_.IdentifyingNumber
$InstallDate = $_.InstallDate
$InstallDate2 = $_.InstallDate2
$InstallLocation = $_.InstallLocation
$InstallState = $_.InstallState
$HelpLink = $_.HelpLink
$HelpTelephone = $_.HelpTelephone
$InstallSource = $_.InstallSource
$Language = $_.Language
$LocalPackage = $_.LocalPackage
$Name = $_.Name
$PackageCache = $_.PackageCache
$PackageCode = $_.PackageCode
$PackageName = $_.PackageName
$ProductID = $_.ProductID
$RegOwner = $_.RegOwner
$RegCompany = $_.RegCompany
$SKUNumber = $_.SKUNumber
$Transforms = $_.Transforms
$URLInfoAbout = $_.URLInfoAbout
$URLUpdateInfo = $_.URLUpdateInfo
$Vendor = $_.Vendor
$WordCount = $_.WordCount
$Version = $_.Version

$Name | Select-Object `
@{n="AssignmentType";e={$AssignmentType}},
@{n="Caption";e={$Caption}},
@{n="Description";e={$Description}},
@{n="IdentifyingNumber";e={$IdentifyingNumber}},
@{n="InstallDate";e={$InstallDate}},
@{n="InstallDate2";e={$InstallDate2}},
@{n="InstallLocation";e={$InstallLocation}},
@{n="InstallState";e={$InstallState}},
@{n="HelpLink";e={$HelpLink}},
@{n="HelpTelephone";e={$HelpTelephone}},
@{n="InstallSource";e={$InstallSource}},
@{n="Language";e={$Language}},
@{n="LocalPackage";e={$LocalPackage}},
@{n="Name";e={$Name}},
@{n="PackageCache";e={$PackageCache}},
@{n="PackageCode";e={$PackageCode}},
@{n="PackageName";e={$PackageName}},
@{n="ProductID";e={$ProductID}},
@{n="RegOwner";e={$RegOwner}},
@{n="RegCompany";e={$RegCompany}},
@{n="SKUNumber";e={$SKUNumber}},
@{n="Transforms";e={$Transforms}},
@{n="URLInfoAbout";e={$URLInfoAbout}},
@{n="URLUpdateInfo";e={$URLUpdateInfo}},
@{n="Vendor";e={$Vendor}},
@{n="WordCount";e={$WordCount}},
@{n="Version";e={$Version}}
}| Export-Csv c:\temp\installed-programs.csv -NoTypeInformation

Output:

image

image

Fun with .docx to .html transforms by means of HtmlConverter from PowerTools for Open XML

  1. The transform is FOSS and platform-independent:
    1. It neither requires Office nor Windows (The OpenXML SDK runs on Linux via Mono on the server.
    2. However, the most recent installment of Powertools for OpenXML, a high-level API to the OpenXML SDK, comes with a PowerShell interface (benefit: no Visual studio requirement).
  2. Valuable features of the transform,  among many other things, are:
    1. HtmlConverter is able to translate MS-Word styles into CSS (insofar needed – my code style has “No proofing” set, however, this cannot be implemented on the WWW), so the layout is preserved as designed, but w/o need for inline formatting:
        span.pt-StrongEmphasis-000052 {
            font-family: Calibri;
            font-size: 11pt;
            font-style: italic;
            font-weight: bold;
            margin: 0in;
            padding: 0in;
        }

        span.pt-lowCodeConsoleChar0 {
            color: #FFFFFF;
            background: #000000;
            font-family: Consolas;
            font-size: 10pt;
            font-weight: normal;
            margin: 0in;
            padding: 0in;
        }
     <h3 dir="ltr" class="pt-000040">
            <span class="pt-000041">2.2.1</span><span class="pt-000042"><span class="pt-000043"> </span></span><span class="pt-Heading2Char"><b>References</b></span>
          </h3>

          <p dir="ltr" class="pt-BodyText">
            <span class="pt-DefaultParagraphFont-000003"><br />
            ‎</span><span class="pt-000000"> </span>
          </p>

          <h1 dir="ltr" class="pt-000006">
            <span class="pt-000007"><b>3</b></span><span class="pt-000008"><b><span class="pt-000009"> </span></b></span><span class="pt-Heading1Char"><b>Introduction</b></span>
          </h1>

          <h2 dir="ltr" class="pt-000018">
            <span class="pt-000019">3.1</span><span class="pt-000020"><span class="pt-000021"> </span></span><span class="pt-Heading2Char"><b>Purpose of Document</b></span>
          </h2>
    1. There are many more options that I have not yet tried:
            SimplifyMarkupSettings simplifyMarkupSettings = new SimplifyMarkupSettings
            {
                RemoveComments = true,
                RemoveContentControls = true,
                RemoveEndAndFootNotes = true,
                RemoveFieldCodes = false,
                RemoveLastRenderedPageBreak = true,
                RemovePermissions = true,
                RemoveProof = true,
                RemoveRsidInfo = true,
                RemoveSmartTags = true,
                RemoveSoftHyphens = true,
                RemoveGoBackBookmark = true,
                ReplaceTabsWithSpaces = false,
            };
            MarkupSimplifier.SimplifyMarkup(wordDoc, simplifyMarkupSettings);

            FormattingAssemblerSettings formattingAssemblerSettings = new FormattingAssemblerSettings
            {
                RemoveStyleNamesFromParagraphAndRunProperties = false,
                ClearStyles = false,
                RestrictToSupportedLanguages = htmlConverterSettings.RestrictToSupportedLanguages,
                RestrictToSupportedNumberingFormats = htmlConverterSettings.RestrictToSupportedNumberingFormats,
                CreateHtmlConverterAnnotationAttributes = true,
                OrderElementsPerStandard = false,
                ListItemRetrieverSettings = new ListItemRetrieverSettings()
                {
                    ListItemTextImplementations = htmlConverterSettings.ListItemImplementations,
                },
            };
    1. One would really wish there was a way to get such HTML cleaned up automatically (ouch!):
               <span class="pt-DefaultParagraphFont-000006">M</span>
                <span class="pt-DefaultParagraphFont-000006">anaged requirements for system integration </span>
                <span class="pt-DefaultParagraphFont-000006">of Center</span>
                <span class="pt-DefaultParagraphFont-000006"> </span>
                <span class="pt-DefaultParagraphFont-000006">software </span>
                <span class="pt-DefaultParagraphFont-000006">with </span>
                <span class="pt-DefaultParagraphFont-000006">iLearning</span>
                <span class="pt-DefaultParagraphFont-000006"> and with content production and management (BPD). To mitigate lack of integration of $50k LMS software investment into departmental workflow</span>
                <span class="pt-DefaultParagraphFont-000006">,</span>
                <span class="pt-DefaultParagraphFont-000006"> </span>
                <span class="pt-DefaultParagraphFont-000006">developed </span>
                <span class="pt-DefaultParagraphFont-000006">and documented </span>
                <span class="pt-DefaultParagraphFont-000006">software to automate</span>
                <span class="pt-DefaultParagraphFont-000006"> creation of 4K+ user accounts p.a., 30K+ learning documents and 100K+ interactive content paths in LMS.</span>
    1. There are also much more serious conversion errors:
      1. MS-Word displays a plain text content control and a repeating section content control within a table, containing one Combobox and one plain text content control per row, perfectly: openxml-convert-docxtohtml-error-word
      2. Convert-DocxToHtml gobbles the content completely (and so does Google Docs Preview): openxml-convert-docxtohtml-error-html The underlying HTML has just a blank table under each heading:
            <div class="pt-000001">
                <p dir="ltr" class="pt-qiCVHeading1">
                  <span class="pt-DefaultParagraphFont-000002">Profile</span>
                </p>
              </div>
              <div align="left">
                <table border="1" cellspacing="0" cellpadding="0" dir="ltr" class="pt-000003" />
              </div>
              <div class="pt-000001">
                <p dir="ltr" class="pt-qiCVHeading1">
                  <span class="pt-DefaultParagraphFont-000002">Technologies</span>
                </p>
              </div>
              <div align="left">
                <table border="1" cellspacing="0" cellpadding="0" dir="ltr" class="pt-000003" />
              </div>
          
      3. MS-Word shows:imageYet need to look in to the underlying XML to see whether the .docx is to blame for that…
      4. But HtmlConverter output in IE or Firefox: imageThe underlying HTML reveals that the css does not get applied in the right place:
 	<tr>
                <td class="pt-000079">
                  <p dir="ltr" class="pt-BodyTextSmall">
                    <span class="pt-BodyTextSmallChar-000081">AD</span>
                  </p>
                </td>
                <td colspan="2" class="pt-000079">
                  <p dir="ltr" class="pt-BodyTextSmall">
                    <span class="pt-BodyTextSmallChar-000081">Active Driector, Microsfot’s directory implementation.</span>
                  </p>
                </td>
              </tr>

              <tr>
                <td class="pt-000086">
                  <p dir="ltr" class="pt-BodyTextSmall">
                    <span class="pt-000085"> </span>
                  </p>
                </td>
                <td colspan="2" class="pt-000086">
                  <p dir="ltr" class="pt-BodyTextSmall">
                    <span class="pt-000085"> </span>
                  </p>
                </td>
              </tr>
  1. One could imagine MS-Word acting less strictly than OpenXML PowerTools:Convert-DocxToHtml, like a web-browser’s parser tolerates and displays bad HTML. However, not only would need to be justified how MS-Word can also serve as the originating HTML WYSIWYG editor. The OpenXML PowerTools:Get-OpenXmlValidationErrors for both of the above documents does not seem to find any OpenXML errors that could explain the bad conversion (other than dozens of Sch_UndeclaredAttribute errors (Version-related? Not sure how this could be) , there is only a Pkg_PartIsNotAllowed relating to a glossary).
  • Also yet to do:
    1. When (not always!) does my page title end up as empty?
      <title></title>
    2. Defaults to doctype xhtml, not html(5).
  • Done:
      1. Pretty-printing. The HtmlConverter output defaults to all content (not css ) on 1 line (e.g. in the example from which above code is taken, 90000chars long). For human readability, and also possibly git tracking, pretty-printing would be better. Can be enforced like so (is there a better way? cannot see a user-configurable option for the SaveOptions enumeration):
    openXml\OxPt\OxPtCmdlets\OxPtHelper.cs:var htmlString = html.ToString(SaveOptions.None); // trp: requesting pretty-printing, was:html.ToString(SaveOptions.DisableFormatting);
    

How to fix MS-Word not creating PDF Bookmarks for your Headings

  1. Problem: No navigation bar in Acrobat Reader when viewing your PDF created from MS-Word.
  2. Solution: Check this setting first in the Save as PDF Options: image
  3. But: Word 2013’s  “Save as PDF” with “Create Bookmarks”  may remains greyed out since it won’t even see your own heading styles, even if you based these styles on the built-in heading styles (which are known to contain  “hidden magic” not easily replicated) , including their outline level, if
    1. Heading appears in Content control.
    2. Heading appears in Table.
  4. Workaround:
    1. Move headings out of Content Controls (you can still “lock”the text with Grouping, which will be enabled on the Developer Tab once you select at least a conten control and text (meant for form field labels).
    2. Move headings outside of tables.

We can nest controls in repeating content controls, including repeating content controls

  1. Just saying, since it seems not easy to find within web search results the ones that nest nesting….
  2. image
  3. image
  4. Have not tried accessing the results in OpenXML yet which will have to be done  via the control ID
    1. since repeating:  Repeating-Section-content-control-in-action
    2. does not autoincrement the titles and tags. image

How to get Square brackets (and hide comments) with ISO690 in Word 2013 bibliography styles

2014/09/14 2 comments
  1. Lots of people online seem to be looking for square brackets with citations in ISO690 style in Word 2013, but having no luck with getting the Bibliography XSL  for older Word versions to work. Trying to edit the old XSL still results in it not loading into the MS-Word Citation Style dropdown.
  2. What is needed is a way to parse the XSL and debug load errors. In the meantime… Smiley
  3. I had better luck with starting from the current Word2013 ISO style. If you stream Office365, this is now in %appdata%\Microsoft\Templates\LiveContent\15\Managed\Word Document Bibliography Styles
    1. Puzzlingly, there is also a %appdata%\Microsoft\Bibliography\Style which some of your edited files get copied to – go figure….
    2. The ISO690 file  I based my variation on is called : TC102851224[[fn=iso690nmerical]].xsl
    3. Copy this file to  %appdata%\Microsoft\Templates\LiveContent\15\User\Word Document Bibliography Styles\
    4. Open it with a text editor (I use NotePad++).
    5. Change “Openbracket” section like so: And the corresponding for closebracket
      <!– trp:   –>
      [
    6. Same principle change for the corresponding for “Closebracket
      1. Lst time I carelessly introduced printing space characters before my closing brackets – just copy the leading chars from a working XML line if you run into this problem.
  4. I also needed to not print “Comment”-field of the source in my bibliography”
    1. Search for:
    2. Comment out the “print”-action inside (easier than changing each bibliographgy type):<!– trp:   
      –>
  5. Change the style name. MS-Word 2013 uses “StyleNameLocalized” instead of “StyleName”, so I added a qualifier to each localized name within the test:

    ISO 690YOURNAMEHERE

  6. Restart MS-Word, and with luck, your styles will show in the ribbon References section style dropdown: image. Apply them (using F9):image
  7. Download: TC102851224[[fn=iso690nmericalsquare0comments]]

Protected: LRC calendars requirements and configuration management

2014/07/15 Enter your password to view comments.

This content is password-protected. To view it, please enter the password below.

UNC-Charlotte Shortcuts

Archived Links: Need Help?For general computer problems call central Helpdesk: x75500 to get remote assistance on your computer. Or post to online or email help at uncc.edu. Also check for campus-wide known issues on the ITS Alerts page. LRC-specific problems? 1st ask LRC help desk. Then email a photo of problem/screen from your phone to lrchelp at uncc.edu.