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).

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.

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 Tweak. Go to Janitor | System

Old (10.04) :

Use Synaptic Package Manger (SPM) to remove things (eg: OpenOffice) from "Not Installed (Residual Config)" (ref: ubuntugeek).
I tried using SPM to remove ubuntu-docs which take more disk than anything else. It disappeared from SPM list, but didn't reduce disk space!

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.

Adding info to IIS log from ASP page

Use Response.appendToLog. In IIS4, at least, the text can be up to 80 characters, and must not contain commas. eg:
    Response.appendToLog "doRedirect() to: " & mid(redirectTo, 1, 50) & "..."
The output of appendToLog goes in the 2nd "word" after the GET in the log file, and has all spaces encoded to "+". If any URL parameters were supplied, the appendToLog text is appended to them in the "word".

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 unwanted capitalisation

Tools | Cell Contents | Autoinput: OFF stops change of (i) to (I) on input (thanks to acknak).

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

Domain hosting transfer

The tedious and not fully intelligible process required to transfer from LCN to 1and1 with minimum (though some) loss of mail to our @domain.net addresses:

Restore from Mozy

For one-off file restores, right-click on the file and use the Mozy client's "Restore Previous version" which lets you choose from the available backups for that file and decide whether to overwrite your current one or restore the backup under a different name (eg: so you can compare them).

To restore everything (eg: when rebuilding a computer having lost the original one, or its hard disk at least) do the following (written for the Mozy website as it was in Jul-2017; this paragraph last edited: 24-Jul-2017):

  1. Login to mozy
    Make sure its email address for you is correct (and that you can access that email account!).
  2. Click on your the name of the computer whose files you want to restore, and then Restore All Files on the right-hand-side.
  3. Select the date of the backup from which to restore.
    As the "wizard" tells you, you might want to pick an earlier date if your restore is because your computer was corrupted recently.

    You also have an option to include deleted files (again, you might want this).

  4. Your main choice is how to get the files. One option is on a DVD - which both costs, and will, presumably, take longer.
    The suggested one is to use the Mozy Restore Manger. I've never used that and it may be fine.
  5. I prefer the Download Compressed Archives option, which creates one or more massive files for you to download. This takes a few hours, and emails you when done.
  6. When emailed, log back into Mozy and download them to your computer.
    Their website makes them pretty hard to find. Last time I did it I went to:
    - View (next to Download History on the main/Summary page)
    - this lists your restores
    - click on the "i" icon in the Action column which opens a window with links to each/the file
  7. In my experience, the backup download(s) may be either .exe or .zip files (there seems to be no rhyme or reason as to which).

Some things to beware of (which really only affect Peter trying to rebuild a system as identically as possible!):

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: 8-Jan-2019