Friday, 16 August 2019

Correlation in Application Insights

operation_parentId does not hold the value of the parent's operation_id. Instead it holds the value of the parent's request id. Confusing, eh?

operation_id has to be set in every logical service.

the request id has to be globally unique for every call, so you cannot set it to be a business key, such as an order reference.


Tuesday, 13 August 2019

Docker for Windows Desktop clock skew: Cosmos DB "The authorization token is not valid at the current time. Please create another token and retry"

I had a containerised application that connects to my Cosmos DB emulator running on my development environment.

Sometimes when I went back to the app after a couple of days it would fail. The Cosmos DB client would error with:

"The authorization token is not valid at the current time. Please create another token and retry"

Looking at the times in the message they were earlier than the current time so that token was out of date.

Attaching to the container with:

docker exec -it <container ID> /bin/bash

I could see that the container time was indeed wrong.

Solution 1

The solution was to restart Docker for Windows desktop.

Solution 2

The other solution is to go into Hyper-V Manager, select the Linux VM, select the settings, Integration Services and then disable and then re-enable Time Synchronisation.

Saturday, 15 June 2019

View HikVision cameras in VLC player

The camera feed is located at:

rtsp://<ipaddress>:554/ch1/main/av_stream

Create the following registry file and execute it:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\rtsp]
@="Real Time Streaming Protocol"

"URL Protocol"=""
[HKEY_CLASSES_ROOT\rtsp\shell]
[HKEY_CLASSES_ROOT\rtsp\shell\open]
[HKEY_CLASSES_ROOT\rtsp\shell\open\command]
@="\"C:\\Program Files\\VideoLan\\VLC\\vlc.exe\"%1"

Thursday, 13 June 2019

Android 9 breaks audio volume sync on JVC HA-S30BT bluetooth headphones

On Android 8 the media volume controls adjust the volume played back by the headset.
After applying the upgrade to Android 9 the controls seemed sporadic: sometimes the handset volume controls would adjust the headphones, sometimes it would not.

If you go into the Settings > Connections > Bluetooth > ... > Advanced the "Media Volume Sync" setting was greyed out and it said underneath "Not supported by the connected Bluetooth device".

This post seemed to fix it. By renaming the headphones to ABS-DO-ENABLE and disconnecting and reconnecting the handset volume then controlled the bluetooth headphone volume.

Once you've got it working, renaming it back seems to continue to work.

Monday, 8 April 2019

Recording the audio from the computer

I had to archive the audio from a radio stream.

For this you can use Audacity, use the Windows Audio Session API (WASAPI) and select the speaker as the loopback.

https://www.howtogeek.com/217348/how-to-record-the-sound-coming-from-your-pc-even-without-stereo-mix/

Sunday, 10 March 2019

Cosmos DB emulator returns wrong IP address

I configured the Cosmos DB emulator to listen across the network. It was running on a developer laptop that had Docker for Windows installed.

Connecting from a different Linux laptop using Gateway mode, I was getting long delays and then "a task was cancelled". This was coming from deep within the HTTP stack.

On closer inspection I could see that the client was trying to connect to https://10.0.75.1 - this is the Docker network.

In the GetDatabaseAccountAsync method the client connects to the gateway and enumerates the databases:

https://cosmosdb.test:8081/

The gateway returns a JSON response. This can be seen in Visual Studio Code with the following debug query:

System.Text.Encoding.ASCII.GetString(((System.IO.MemoryStream)documentServiceResponse.ResponseBody).ToArray())

The databaseAccountEndpoint property returns https://10.0.75.1:8081 and this is used to form subsequent responses.
{
    "_self": "",
    "id": "localhost",
    "_rid": "cosmosdb.test",
    "media": "//media/",
    "addresses": "//addresses/",
    "_dbs": "//dbs/",
    "writableLocations": [
        {
            "name": "South Central US",
            "databaseAccountEndpoint": "https://10.0.75.1:8081/"
        }
    ],
    "readableLocations": [
        {
            "name": "South Central US",
            "databaseAccountEndpoint": "https://10.0.75.1:8081/"
        }
    ],
    "enableMultipleWriteLocations": false,
    "userReplicationPolicy": {
        "asyncReplication": false,
        "minReplicaSetSize": 1,
        "maxReplicasetSize": 4
    },
    "userConsistencyPolicy": {
        "defaultConsistencyLevel": "Session"
    },
    "systemReplicationPolicy": {
        "minReplicaSetSize": 1,
        "maxReplicasetSize": 4
    },
    "readPolicy": {
        "primaryReadCoefficient": 1,
        "secondaryReadCoefficient": 1
    },
    "queryEngineConfiguration": "{\\"maxSqlQueryInputLength\\":262144,\\"maxJoinsPerSqlQuery\\":5,\\"maxLogicalAndPerSqlQuery\\":500,\\"maxLogicalOrPerSqlQuery\\":500,\\"maxUdfRefPerSqlQuery\\":10,\\"maxInExpressionItemsCount\\":16000,\\"queryMaxInMemorySortDocumentCount\\":500,\\"maxQueryRequestTimeoutFraction\\":0.9,\\"sqlAllowNonFiniteNumbers\\":false,\\"sqlAllowAggregateFunctions\\":true,\\"sqlAllowSubQuery\\":true,\\"sqlAllowScalarSubQuery\\":true,\\"allowNewKeywords\\":true,\\"sqlAllowLike\\":false,\\"sqlAllowGroupByClause\\":false,\\"maxSpatialQueryCells\\":12,\\"spatialMaxGeometryPointCount\\":256,\\"sqlAllowTop\\":true,\\"enableSpatialIndexing\\":true}"
}

TomTom 6100 has a 32GB SD card limit

The TomTom 6100 has a 32GB maximum SD card limit because it requires the FAT32 file system.