Sunday, May 12, 2019

Remove All BookMarks

Sometimes MS Word documents can get loaded with useless bookmarks. Here is a macro to remove them:

Sub RemoveAllBookmarks()
    Dim objBookmark As Bookmark

    For Each objBookmark In ActiveDocument.Bookmarks
        objBookmark.Delete
    Next
End Sub

PowerPoint: Change that Template


To change the template in a PowerPoint document:

Design -> Themes -> (click drop down arrow at end of themes) -> Browse for themes…
Select the template, then Apply.

[Source Powerfinish]

Tuesday, May 7, 2019

Add a Copy Button to Code Blocks

MadCap has a blog post about adding a copy button to code blocks, found here.

Here's what I had to do to get it working:

Step 1: Download the clipboad javascript and put it in your Resources/Scripts folder:
https://github.com/zenorocha/clipboard.js/archive/master.zip

Step 2: Add this to the <head> section:
<script src="../../../Resources/Scripts/clipboard.min.js"></script>

Step 3: Before the final closing body tag (</body>), add this:
<script>new ClipboardJS('.cbtn');</script>

Note: I named the button is named cbtn.

Step 4: Enclose each code block like the following:
<div class="Code">
   <p class="Codeblock" id="t01">Here's my code block text.</p>
   <button class="cbtn" data-clipboard-action="copy" data-clipboard-target="#t01" MadCap:conditions="Default.ScreenOnly"> </button>
</div>

Note: The button class must match what you defined in step 3.
Note: The ID must be unique for each code block.
Note: I added the Default.ScreenOnly condition so that it doesn't appear in PDF/Word.

Step 5: Add the following to your CSS file:
div.Code
{
   position: relative;
   overflow-x: auto;
}
p.Codeblock + button
{
   position: absolute;
   bottom: 0;
   right: 0;
   width: 26px;
   height: 26px;
   margin-bottom: 6pt;
   background: url(/url/to/image/content-copy.png)
}

Note: I use an image for the button, defined in the CSS. If you don't want an image, you can just put the plain text "Copy" in the HTML in step 4.
Note: The positioning places the button at the bottom right corner of the div.

Tuesday, October 9, 2018

Are You a Man or a Bloke?

I recently tested the Mad Quality Plugin for Flare, which is a rule-checking application that uses various rule sets to check your text (kind of like the grammar checker in Word). The tool is a useful plug-in for Flare. Maybe I'll review it in another post.

One of the sample rule sets checks for British English (see the list below). Now, I really like finding all the differences between British and American English. I know what trainers are and sometimes I wear a jumper. But, I have no idea what some of the ones in this list mean.

Do you wrap your leftovers in aerofoil?

What do you do with a breakdown van? Is it really old and doesn't run well?

Courgette? Wasn't she that girl from Les Miserables?

Is a draughts game where you see whose lawn looks the best after not watering it for a month?

Are you insulted if someone asks you if you have a dummy for a baby?

Do you get green fingers after picking your nose?

I think there are some new diseases in England, like mangetoutaubergine, and diamante.

Is a windcheater a type of sailor?

Boob tube? Titbit? Um, maybe I don't want to know what those are.

Here's the complete list. How many do you know?
  1. accommodation
  2. action replay
  3. aerofoil
  4. aeroplane
  5. agony aunt
  6. Allen key
  7. aluminium
  8. aniseed
  9. anticlockwise
  10. articulated lorry
  11. asymmetric bars
  12. aubergine
  13. baking tray
  14. bank holiday
  15. beetroot
  16. biscuit
  17. black economy
  18. blanket bath
  19. block of flats
  20. boiler suit
  21. bonnet
  22. boob tube
  23. boot
  24. bottom drawer
  25. bowls
  26. braces
  27. brawn the food
  28. breakdown van
  29. breeze block
  30. bridging loan
  31. bumbag
  32. candyfloss
  33. car park
  34. casualty
  35. catapult
  36. central reservation
  37. chemist
  38. chips
  39. cinema
  40. cling film
  41. common seal
  42. consumer durables
  43. cornflour
  44. cos
  45. cot
  46. cot death
  47. cotton bud
  48. cotton wool
  49. council estate
  50. courgette
  51. court card
  52. crash barrier
  53. crisps
  54. crocodile clip
  55. cross-ply
  56. crotchet
  57. current account
  58. danger money
  59. demister
  60. dialling tone
  61. diamante
  62. double cream
  63. draughts game
  64. drawing pin
  65. dressing gown
  66. drink-driving
  67. drinks cupboard
  68. drinks party
  69. driving licence
  70. dual carriageway
  71. dummy for a baby
  72. dust sheet
  73. dustbin
  74. engaged
  75. estate agent
  76. estate car
  77. ex-directory
  78. faith school
  79. financial year
  80. fire brigade
  81. first floor
  82. fish finger
  83. fitted carpet
  84. flannel
  85. flat
  86. flexitime
  87. flick knife
  88. flyover
  89. football
  90. footway
  91. fringe
  92. full stop
  93. garden
  94. gearing
  95. gear lever
  96. goods train
  97. greaseproof paper
  98. green fingers
  99. grill
  100. ground floor
  101. groundsman
  102. hairslide
  103. hatstand
  104. hen night
  105. hire purchase
  106. hoarding
  107. hob
  108. holdall
  109. holiday
  110. holidaymaker
  111. homely
  112. hosepipe
  113. in hospital
  114. hot flush
  115. housing estate
  116. hundreds and thousands
  117. ice lolly
  118. icing sugar
  119. indicator
  120. inside leg
  121. jelly babies
  122. Joe Bloggs
  123. Joe Public
  124. jumble sale
  125. jump lead
  126. jumper
  127. junior school
  128. kennel
  129. ladybird
  130. a lettuce
  131. level crossing
  132. lift
  133. lolly
  134. lollipop lady
  135. loose cover
  136. lorry
  137. loudhailer
  138. low loader
  139. lucky dip
  140. luggage van
  141. maize
  142. mangetout
  143. market garden
  144. marshalling yard
  145. maths
  146. metalled road
  147. milometer
  148. minim
  149. mobile phone
  150. monkey tricks
  151. motorway
  152. mum
  153. mummy
  154. nappy
  155. needlecord
  156. newsreader
  157. noughts and crosses
  158. number plate
  159. off-licence
  160. opencast mining
  161. ordinary share
  162. oven glove
  163. paddling pool
  164. paracetamol
  165. parting in hair
  166. patience
  167. pavement
  168. pay packet
  169. pedestrian crossing
  170. peg
  171. pelmet
  172. petrol
  173. physiotherapy
  174. pinafore dress
  175. plain chocolate
  176. plain flour
  177. polo neck
  178. positive discrimination
  179. postal vote
  180. postbox
  181. postcode
  182. potato crisp
  183. power point
  184. pram
  185. press stud
  186. press-up
  187. private soldier
  188. public school
  189. public transport
  190. punchbag
  191. pushchair
  192. pylon
  193. quantity surveyor
  194. quaver
  195. queue
  196. racing car
  197. railway
  198. real tennis
  199. recorded delivery
  200. registration plate
  201. remould
  202. reverse the charges
  203. reversing lights
  204. right-angled triangle
  205. ring road
  206. roundabout
  207. rowing boat
  208. sailing boat
  209. saloon
  210. sandpit
  211. sandwich cake
  212. sanitary towel
  213. self-raising flour
  214. semibreve
  215. semitone
  216. share option
  217. shopping trolley
  218. show house
  219. home
  220. silencer
  221. silverside
  222. skeleton in the cupboard
  223. skimmed milk
  224. skipping rope
  225. skirting board
  226. sledge
  227. sleeper
  228. sleeping partner
  229. slowcoach
  230. snakes and ladders
  231. solicitor
  232. soya
  233. soya bean
  234. splashback
  235. spring onion
  236. stag night
  237. Stanley knife
  238. starter
  239. state school
  240. storm in a teacup
  241. surtitle
  242. swede
  243. sweet
  244. takeaway
  245. taxi rank
  246. tea towel
  247. terrace house
  248. tick
  249. ticket tout
  250. timber
  251. titbit
  252. toffee apple
  253. touch wood
  254. trade union
  255. trading estate
  256. trainers
  257. transport cafe
  258. trolley
  259. twelve-bore
  260. underground
  261. vacuum flask
  262. verge
  263. vest
  264. veterinary surgeon
  265. wagon
  266. waistcoat
  267. walking frame
  268. wardrobe
  269. water ice
  270. weatherboard
  271. white coffee
  272. white spirit
  273. wholemeal bread
  274. windcheater
  275. windscreen
  276. worktop
  277. zebra crossing
  278. zed
  279. zip

Sunday, October 7, 2018

Make APIs Look Nice with Shins

Anyone who is documenting or using APIs has probably come across a new, slick web interface for viewing APIs, like the one in this image:
So, what is this interface? And how do I get my APIs to look like it?

This interface is called Slate. It provides a 3-pane view, with a TOC, the API reference, and code samples. Unfortunately, I am running a Windows machine, and I couldn't get Slate to install.

Fortunately, there is a port of Slate, called Shins (Shins Is Not Slate). This port runs on Windows and uses NodeJS instead of Linux, Ruby, Bundler, etc.

Shins generates the Slate-like output with minimal effort from a Markdown file that contains your APIs. Since my R&D team creates a YAML file, I used widdershins to convert the YAML to Markdown.

Here's what you need to do:
  1. Create a folder on your computer called shins
  2. Clone the Shins repository to your local directory.
  3. Create a folder called widdershins in the shins directory.
  4. Clone the widdershins repo to your local directory.
  5. Copy your latest YAML file into the defs dir:
    .\shins\widdershins\defs 
  6. Change directory to this one:
    .\shins\widdershins
  7. Run the following command:
    node widdershins --search true .\defs\my-api.yaml -o my-api.md
    Note: You can add a flag that lets you choose which languages to include in the output, such as:
    --language_tabs 'javascript:JavaScript' 'shell:Shell'
  8. Change directory to this one:
    .\shins
  9. Run the following command:
    node .\shins.js --logo company-logo.png .\widdershins\my-api.md 
  10. The index.html file in that directory is created with the Slate/Shins output.
Now you have the Slate output. You can now upload the index.html file as well as the pub and source directories to your website.