Wisdom (things I seldom remember)

Gmail (aka: Google Mail)

Address aliases (dot's and +'s in address)

Useful things to remember/know about Google addresses:
  1. Any dots are ignored. For instance, these all go to the same mailbox:   aNother@gmail.com   A.N.Other@gmail.com   a.n.o.t.h.e.r@gmail.com
  2. Anything including and following a + and before the @ is ignored (referred to as an alias by Google).
    So these all go to the same mailbox:   A.N.Other@gmail.com   A.N.Other+bank@gmail.com   another+library@gmail.com
    Using such an address to register with a website means you can filter mails from the website (ref: Unlimited Gmail addresses) and identify spam mails from the website (or a breach thereof).
    NB: some websites (incorrectly) do not recognise + as a valid email address character, so won't let you register using such an alias.
  3. @gmail.com and @googlemail.com (its older antecedent) both go to the same mailboxes
  4. Like all mail systems, addresses are case-insensitive
NB: these rules apply only to the way Google handles incoming email. They do not apply when you use an email address as a login name to a website (websites generally treat such names case-insensitively, but will certainly want you to have the same characters as you used when you registered with them).
But, sadly some websites do not understand the allowed syntax in email addresses (in particular the use of + in the Local-part of the address - the bit before the @) so you cannot use aliases with such backward sites. for

Search by size, attachment, etc

size:5m
has:attachment
is:starred
is:unread
has:nouserlabels
Ref: Search operators you can use with Gmail
cf: Refine Web searches - constructs in Google search.

Filter to clear old mail

To clear old mail, you need a filter which (because filters only run on incoming mail) you open and run from time to time (thanks to Matt Skaggs for this). eg:

Filter for different labelling of mails from the same domain

Thanks to Draconian Overlord (DO) for this.
I wanted to handle incoming messages from different addresses in the same domain differently. This is done by carefully mananging the ordering (I just did it by deleting them and re-creating them in the order I wanted, rather than the more exhaustive way DO describes) of two filters :
  1. "Move" mails from a specific address to its own label:
    To: Paul@somewhere.net
    Skip the Inbox
    Apply the label: Paul@somewhere.net
  2. Then label all other mails from that domain:
    Includes the words: to:@somewhere.net -label:Paul@somewhere.net click Continue on the warning dialog saying "... searches containing "label:", ... are not recommended as they will never match incoming emails"
    Apply the label: Somewhere.net

"New mail" downgrade mid-2018

Sadly Google decided to "upgrade" the web-based UI with these consequences:
Even more sadly, since Google do not deign to allow bug reporting, they probably won't even fix the bugs above.

EE/T-mobile

Text AL to 150 to get text back with remaining credit/allowances.
Three : phone 444 for balance

Documenting bugs to support-shy suppliers like Google and Amazon

Sadly one penalty of so many of the free Internet-ware one uses is that the supplier has no bug tracking and reporting system for its users to access (on occasion one wonders whether they even have one themselves). The best I've been able to find is: See also: my Web Posts Index where I note significant (to me) things I have submitted to suppliers who do have a proper system.

CSS style sheet

Define in <HEAD>, using one of:

Note: in IE can just use asterisk (*) instead of list of elements.

Javascript

References

Define (usually in <HEAD> if possible) as one of:

Testing for presence of a variable

if (window.variableName != null)
      // NB: can't just use if (window.variableName) because that evaluates to null if the variable exists and contains a blank string
      or:
if (typeof(variableName) != "undefined")

Objects

Useful function (in utils.js):

Convert (scanned) image to text

We often get (and make) PDF's created by scanning a textual document. When viewing in Acrobat Reader you can't copy the text from them.
If the document is not sensitive, there are numerous online services to (OCR) convert these to various text formats.
I mainly use the excellent Online OCR. This handles some appalling-looking original scanned documents. If you sign up it has a 50-page limit before you have to pay for more pages (or cheat, remove cookies and create a new account with a different email address!).
I tried PDF to Text, but it's nothing like as good.

Screen-shotting

I/O errors, etc, copying data to micro SD card

Mounting an SD (32Gig in my case) on Windows or Ubuntu and copying many Gig's of files (a photo collection) in one go invariably fails, and corrupts the SD card (whether FAT32 or NTFS).
The only solution seems to be to break the copy into pieces (in my case, I was doing test copies for a new SD and wrote a script to copy about 13,000 files with a 2 second pause between each 25).
Also, when I first tried this I was using a cheapo card, and had to move up the price range until I got one (Samsung Evo Plus) that worked each time using this technique.
I assume SD's are not designed for massive I/O ;-(

Firefox

google.co.uk search bar

Working in London for a German bank, my Google search bar always goes to google.de. I think this is because of some proxy/firewall rule that redirects google.com there.
Thanks to David Kendall's page, I forced google.co.uk by editing \Program Files\Mozilla Firefox\searchplugins\google.xml - changing all occurrences of .com to .co.uk
Alternatively, install the Google search plugin in addition to the default one.

"Show my windows and tabs from last time" stopped working

This excellent option stopped working at my work after the company fiddled with Firefox settings. It was restored by changing privacy options in about:config.
Setting all these to be false: privacy.clearOnShutdown.history privacy.clearOnShutdown.cookies privacy.clearOnShutdown.cache

Adding .xpi file extensions

If an extension writer's site simply lists a bunch of files (eg: Jan Odvarko's Firebug exporters), double-click on (or download and drag onto Firefox) a .xpi file.

Amazon - find reviews I have made

For some reason they don't make this easy to find. Their help gives you the Public Reviews Written by You link to you need.

Netflix - remove from Continue Watching

Menu | Your Account | My Profile | Viewing Activity (thanks to Martin Brinkmann)  

jQuery - upgrade from 1.4.2 to 1.6.4


After upgrading jQuery from 1.4.2 to 1.6.4 I started getting "Error: 'nodeName' is null or not an object" in one particular UI action (at least).
The error come from the autocompleteselect handler in jQuery UI's .dialog. It used to be:
$("#txtPersonSearch").bind("autocompleteselect", function (event, ui) {
if (ui.item && $(ui.item).val().match(/^[^|]*|[^|]*$/)) {
var data = $(ui.item).val().split("|")

and the error was on the $(ui.item).val(). Turns out ui.item is a DOM element, so the fix was to simplify the code to:
if (ui.item && ui.item.value.match(/^[^|]*|[^|]*$/)) {
var data = ui.item.value.split("|")

Presumably 1.4.2's .val() is more forgiving/flexible than 1.6.4's.

DOM location.xxx fields

location.href
(full thing)
https://my.server.com:1234/page/name?query=123#anchorName
location.hostname https://my.server.com:1234/page/name?query=123#anchorName
location.pathname https://my.server.com:1234/page/name?query=123#anchorName
location.search https://my.server.com:1234/page/name?query=123#anchorName
location.hash https://my.server.com:1234/page/name?query=123#anchorName

So for "URL within server" (whatever the correct term is for that), just use: location.pathname+location.search+location.hash
For this page:

Perl syntax

Multi-line comment

Fudge using perldoc syntax:

=comment
text not treated as commands...
=cut

VIM gems

Replace CR (^M)

eg: 1,$s/\r$//

Replace Null (^@)

eg: 1,$s/Ctrl-v Ctrl-@//g # Ctrl-@ is usually Ctrl+Shift+@

Add new line below each line in range

'a,.s/.*\n/\0new line text\r/
Thanks to stackoverflow

Visual Studio (Community)

Setting HTML Designer mode when editing (giving Design/Split/Source options; thanks to stackoverflow/carpetflyer):
Open .htm file, in file select dialog drop down the Open button to be Open With and select HTML (Web Forms) Editor and click Set as Default.
Repeat this with an .html file

Re-pressurising Bosch Worcester Greenstar 25Si/30Si Combi boiler

Ours (103c) has internal filling key and needs to be re-pressurised regularly. Good Bosch video on youtube and derivative none-too-accurate instructions on this blog. Summary:

  1. Ensure key is pushed well home and is in the open padlock (anti-clockwise) position (it should already be so).
  2. Turn key clockwise to locked position (about 30°)
  3. Turn square white nut anticlockwise to let water flow, and keep open until pressure risen OK
  4. Turn square white nut clockwise (hand tight) to close
  5. Turn key anti-clockwise back to open position
  6. Put cloth below it to catch water drips and pull key out.
    Because of lack of clearance you can't remove the key, so push it all the way home again, leaving it in the open padlock position.

Arrows in MS Paint

If you are reduced to using MS paint to add arrows to a screenshot there are some character-symbols in the Windings 3 font. Set something like 48 point size, and enter a single letter:

h k g m i l f j

Thanks to Jessica Wong and w3schools.

Cygwin / MKS toolkit differences

Things that need to be changed when making a shell script that used to run under MKS Toolkit to run under Cygwin:

I have the following scripts to help with the transition:

Bug in MKS toolkit under Windows 10

Using 6.1a under Windows 10 (and, originally, XP) generally works fine, though it's not certified for it! But bugs I've found and worked-round include:

  1. shell script pipelines of the form:
        command | while read var; ...
    fail, losing data in the pipeline. Work-around is to rework them using an intermediate file. eg:
        command >tempfile
    then, if possible:
        while read var; do
            ...
        done <tempfile`

    or, provided the volume of data isn't too great:
        for var in `cat tempfile`; do ...
  2. vdiff32 (and, probably other utilities) are affected by a pre-set TMP variable.
    I have had intermittent problems - such as vdiff32 failing when called with two filename with "File Open Failed" - if the environment has a TMP variable set.
  3. "temporary file (./sh9999.xxx) error using here document: The system cannot find the file specified"
    These can occur with here-documents in more complex scripts (eg: it happened to me when a block of code was moved from an in-line section to a shell function).
    Fixed by setting TMPDIR environment variable to a writable folder.

Unix/Linux touch

Ever unmemorable: touch -t [[CC]YY]MMDDhhmm[.ss] file

Unix/Linux scriptlets

Restoring (Ubuntu) Firefox profile

Start Firefox (3.0x), and then close it. This will create a ~home/.mozilla/firefox folder, containing profiles.ini and a folder called something.default. Remove the folder and, as the correct user, extract the xxxx.default directory from backup into its folder. Then edit profiles.ini to set the new something.default name.

Clearing unused Ubuntu disk (install) space

From 12.04, used Ubuntu Cleaner (ex: Ubuntu Tweak). Go to Janitor | System

From 18.04 noticed large amount of space taken by some "snap" system. So (thanks to osgx) I did:

Clearing unused Windows space

Mainly Disk Clean Up (as Admin). See also: Scott Hanselman
Also, SoftwareDistribution folder can get huge and can be safely removed (ref: TheWindowsCub ), eg:

net stop wuauserv
net stop bits
rename c:\windows\SoftwareDistribution SoftwareDistribution-DELETEME-Mmmdd
net start wuauserv
net start bits
    
Then check a new one has been created OK and remove the renamed one.

SQL and Query Analyzer (QA)

Specifying port number on QA connection string

Comma-portnumber (cf: colon-portnumber as in JDBC connection, or backslash-instanceName).

Finding port number for SQL Server instance

Open the instance with, for instance, QA. Find IP for the server then run netstat -an | fgrep IP.number (ref: blog).

Int to Hex string in (MS) SQL query

Formatting % and decimal in (MS) SQL

select convert(NUMERIC(10,2), 123.456)                              -- 123.46
select convert(varchar, convert(NUMERIC(10,2), 1234/100)) + '%'     -- 12.00%
select convert(varchar, convert(NUMERIC(10,2), 1234*1.0/100)) + '%' -- 12.34%

Syntax for SQL SP into temp table

create table #tmp (...) -- Sadly have to pre-create with correct columns
insert into #tmp exec spName ...

Flush output during QA execution

In a long-running SQL script, force out PRINT and other message window output using:
raiserror ('', 0, 1) with nowait -- Flush messages

OK/Cancel order in dialog

The normal order is OK followed by Cancel to the right.

Excel in independent windows

Excel (2003 at least) slipped from a mode where double-clicking a .xls opened a fresh window which could be managed independently from an existing one, to opening within the existing Excel - thereby making it impossible to view the two workbooks side-by-side.

To change this, use Tools-->Options-->General and check "Ignore Other Applications" (thanks to Gord Dibben)

This causes a new instance of Excel, but means that if you click on a .xls from Windows Explorer it opens a blank Excel window.


Fix this by changing the Windows Explorer "open" file association (Explorer | Tools | Folder Options | File Types | XLS | Advanced | Open | Edit) to "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "%1" and blank out the "DDE Message" string (thanks to Randy): :

I have a suspicion that before I had to do this, double-clicks actually gave me independent windows from the same Excel instance (ie: closing the second workbook didn't leave an empty Excel as it does now), but this change gives a totally separate instance.
Maybe some mucking around with Explorer's Open/DDE association would help - but I failed down that avenue.

Adding a shared folder to an Outlook profile

Sorting out dual-boot Windows boot partitions

Probably a one-off, but I had a laptop with Ubuntu and Vista and then added Windows 8 (W8).
Ubuntu (grub) is the primary boot, and its boot menu offered Vista (on /dev/sda3).
After adding Windows 8 this menu showed the Windows 8 bootloader on /dev/sda3, when selecting this one got (usually, sometimes it went straight to W8) options for Vista and W8.

When running W8 it has C: as its main partition, and D: has the Vista one.

I wanted to clear all sign of Vista off the machine and needed to sort out this mess. Googling implied that BCDEDIT would help, but running it with no arguments failed with:
The boot configuration data store could not be opened.
The system cannot find the file specified.

I found that all the boot stuff was still on the Vista partition, and had to run: bcdedit /store d:\boot\bcd
to see:

Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=D:
description Windows Boot Manager
locale en-GB
inherit {globalsettings}
integrityservices Enable
default {default}
resumeobject {a356582b-4714-11e2-9bac-adc49a6834ed}
displayorder {a356582c-4714-11e2-9bac-adc49a6834ed}
{default}
toolsdisplayorder {memdiag}
timeout 30

Windows Boot Loader
-------------------
identifier {a356582c-4714-11e2-9bac-adc49a6834ed}
device partition=C:
path \Windows\system32\winload.exe
description Windows 8
locale en-GB
inherit {bootloadersettings}
recoverysequence {a356582d-4714-11e2-9bac-adc49a6834ed}
integrityservices Enable
recoveryenabled Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \Windows
resumeobject {a356582b-4714-11e2-9bac-adc49a6834ed}
nx OptIn
bootmenupolicy Standard

Windows Boot Loader
-------------------
identifier {default}
device partition=D:
path \Windows\system32\winload.exe
description Windows Vista (TM) Business (recovered)
osdevice partition=D:
systemroot \Windows
resumeobject {37d2a585-46d2-11e2-b599-806e6f6e6963}

More Googling (see technet and tweakhound) persuaded me to run: bcdboot c:\windows /s c:

After which, BCDEDIT (no args), showed:

Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=C:
description Windows Boot Manager
locale en-us
inherit {globalsettings}
default {default}
resumeobject {67cb9810-9499-11e2-be83-cb77527e6e5d}
displayorder {default}
toolsdisplayorder {memdiag}
timeout 30

Windows Boot Loader
-------------------
identifier {default}
device partition=C:
path \windows\system32\winload.exe
description Windows 8
locale en-us
inherit {bootloadersettings}
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \windows
resumeobject {67cb9810-9499-11e2-be83-cb77527e6e5d}
nx OptIn
bootmenupolicy Standard
detecthal Yes

After this Disk Management offered me Delete Volume on D:/Vista (before that was greyed out).

But reboot still shows w8 and Vista in windows boot menu. I hid everything on D: and rebooted which failed, and made me realise that /dev/sda3 was to the Vista / D: partition, and that /dev/sda2 is W8 / C:. So booted to Ubuntu and ran update-grub, which changed grub.cfg to /dev/sda2:

195c195
< menuentry "Windows 8 (loader) (on /dev/sda2)" --class windows --class os {
---
> menuentry "Windows 8 (loader) (on /dev/sda3)" --class windows --class os {
198,199c198,199
< set root='(hd0,msdos2)'
< search --no-floppy --fs-uuid --set=root 984E19A84E198064
---
> set root='(hd0,msdos3)'
> search --no-floppy --fs-uuid --set=root 168AD47E8AD45C35

And all is now OK!

Windows Task Manager grid intervals

As ever, I cannot find any M$ documentation on this. Empirically (and from some web posts) the update frequency seems to be every second on Normal speed. You get 6 samples per grid interval, so 10 grid intervals per minute.

Performance Monitor vs. Task Manager process memory use

The Performance tool's Virtual Bytes is usually massively more than Task Manager's VM Size.
This is because the latter is actually what the Performance tool calls Private Bytes, which is, apparently, normally more important in determining memory leaks.
See: stackoverflow and msdn.

OpenOffice

Stop various unwanted (by me) behaviours

Array formula

Enter them using Shift-Ctrl-Enter
Ref: Using_Arrays

Add month to date

eg: =DATE(YEAR(A1);MONTH(A1)+1;20) (thanks to Villeroy)

Setting values for Calc's default formatting

Ctrl-F11 and modify Default Cell Style (thanks to superuser).

Resizing comment boxes in spreadsheets

Right-click cell and Show Comment. Click on it to get resize handles. When done un-Show comment.

Removing spurious AutoFilters

Somehow I managed to get (BooksAndFilms.ods) into a state where it there were several unwanted and unremovable AutoFilters. No amount of tooling around gave me a usable Remove Autofilter option from the Data | Filter menu.
But, after reading this forum article (and this one) I got rid of them by selecting them in turn using the Data | Select Range menu (which showed 4 ranges with odd names, though not with the word Autofilter in their names) and then either:
a. Data | Filter | Remove Autofilter (when that magically appeared for one of them), or
b. Data | Autofilter then Save & Exit and reopen, to find the range and AF had gone!

Finding and updating external links in spreadsheets

To find, search for: file:
finds some links that cause the on-load prompt "This file contains links to other files. Should they be updated?"
To update links from another file (which, despite the "... Should they be updated?" prompt are often not on load, only on subsequent close and reopen!), use Edit | Links | Update

Delete manual break

Position the cursor in a cell directly below the row break and Edit | Delete Manual Break | Row Break (thanks to Hagar Delest)

Edit PDF

Install DOWNLOADS\OpenOffice\aoo-pdf-import-0.1.0-windows-x86.oxt then from OO Draw open a PDF, and do Export to PDF when done (thanks to Reference).
NB: As of July-2017 OOO extension manager errors looking for updates to this, saying: http://aoo-pdf-import.apache-extras.org.codespot.com/git/update/windows_x86-update.xml does not exist

Switching backups from Mozy to Google Drive

In early 2019 Mozy was bought by Carbonite and their free Mozy Home backup service discontinued. Since we were already Google users and their Backup and Sync application did more or less the same as Mozy we switched to that.

This isn't as good as Mozy but it is free. It uses your Google Drive (Drive) - which, as a Google customer/slave, you get automatically.

Unless you already use it actively for, for instance, photos, this gives you 15 Gbytes of free storage (compared to Mozy's 2 GB).
Additional storage is not expensive. We pay about $6/year on one Google account (which has all our photos) for an additional 20 Gbytes.

We noted and/or worked-round the following differences (using Drive from one Google account and only for backing up one Windows PC):
  1. You can only select complete folders to backup.
    Mozy lets you select a folder and then de-select subordinate files and/or folders.
  2. Restoring a single file is not nearly as slick.
    With Mozy you did so by right-clicking on the file or parent folder and the file is restored with its correct modification time.
    With Google you "restore" from Drive in a web browser where you "Download" the file. This just uses the browser file download mechanics which means you have to locate the destination folder again. Also the file's modification time is set to the download time.
    You can restore multiple files from Drive in a web browser, in which case you get a .zip file to download and extract from. The files' modification time is then restored to the Californian timestamp of the file (eg: being in London, this means such timestamps are 8 hours earlier than the correct one).
  3. The default setting is that when you delete a file Backup and Sync prompts to confirm that you also want to delete the file from Drive.
    You will probably want to change this setting. But, an advantage of leaving it as is is that it also lets you restore the file (in case you deleted it by mistake). When doing this the file is restored with its original/correct/local modification time.
  4. Drive's (web) restore is pretty flaky if you want more than a handful of files.
    See Restore from Google Drive below to use their "Takeout" mechanism instead.
  5. Drive's (web) view shows folder names only.
    This is fine if they are all siblings on one PC drive. But you lose a little context when managing/examining them if they are at different levels in the file-system hierarchy or on different Windows drives.
  6. The backup mechanism seems to semi-understand that OpenOffice lock files (eg: .~lock.mySpreadsheet.ods#) are transient. It backs them up when they are created but deletes them without prompt when they are removed.
  7. Unlike Mozy, which would run backups a few times a day, this mechanism is constantly monitoring for file changes.
    For instance if you are editing a file, Saving it from time to time, each save triggers a new backed up version on Drive.
    This is probably what some folk want. I find it overkill and, presumably, means a higher system load as Google monitors all files in your backed-up folders all the time.
  8. Because of this there's a noticable performance hit when the installer/Drive-owner first logs in (and, despite having "Open Backup and Sync on system start-up[" in Settings it only seems to start when that person logs in).
  9. It seems to hold files open on occasion (thereby causing them to open read-only in a text editor, for instance).
  10. A folder named .tmp.drivedownload is created in each PC folder being backed up.
    This seems to have temporary file copies (I think) in it named 9999.driveupload. I assume/hope it gets rid of these from time to time.
  11. I never fully checked out Mozy's storage security but it sounded a little more thorough, if locked-down to a nominated PC, than Google Drive. But, I'm sure Drive is perfectly secure. Though, of course, if someone knows your Google login they can get what they want.

Restore from Google Drive

For one-off file restores, right-click on the file and use Google Drive's "View on Web" which lets you download the latest backup using your browser. If you want a version earlier than the last backup up use "Visit Google Drive on the Web" (eg: from the cloud applet on the Windows status bar), locate the file (under "Computers"), right click on it and use "Manage versions".

To restore everything (eg: when rebuilding a computer having lost the original one, or its hard disk at least) do the following (written as things were in March-2019):

  1. Drive's (web) restore is flaky if you want more than a handful of files, so Google's Takeout is a much better way to restore all your files (and faster if all you really have on your Drive is backed-up files).
  2. On Takeout's "Download your data" page, first "Deselect all" then select "Drive" and then "Next step".
    We use a good unzip program (7zip), and so set the Archive size to 10GB to get all our files restored in one .zip (about 2.5GB at time of writing).
  3. Then "Create archive". Google mails you when the .zip is ready.
  4. When you get the .zip(s) it is best to extract from it/them to a temporary area (assuming you have disk space). Then move over file(s) as required, correcting/noting filename oddities as shown in the next section.

File(name) problems with Google Drive restore

Sadly, Drive has a number of (ill documented/publicised) restrictions on how it restores files. I'm sure there are more, but here are ones that have affected us:

CD image download and burn

Find Windows version from ISO or USB

Thanks to WinHelpOnline: find the install.esd file on the media and, in an Administrator command prompt, run
  dism /Get-WimInfo /WimFile:F:\sources\install.esd /index:1

Exporting PUTTY session registry settings

regedit to: HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions
and highlight it. Then right-click Export. This creates a .reg which can then be clicked on.

Using keypad to search Demand 5 smart TV app

Demand 5's Search box has no virtual keyboard and you have to use the keypad on the remote to enter the search string. I can't find any info on this, and thus any sign of backspace or delete options, but the characters work as on an (old fashioned) mobile.

Sadly the Sony Bravia remote we have doesn't show the number-to-letters mapping, though other ones do have them:
Page last edited: 24-Apr-2019