All posts by hougaard

There is a syntax error in a whitespace?

Today I was doing my daily dose of hacking, in this case, generating Javascript code from C/AL (Don’t ask). I had copy-pasted some Javascript into C/AL, converted it into strings and was met with this error when compiling:

A closer look quickly determined there’s NO syntax error, so what’s wrong?

The red line is kinda wide, and using some shift-cursor keys movement showed that this is one character:

But that is two spaces?

Ahh, mystery bug solved. You can paste TAB characters into C/AL, and they stay as tabs, but the compiler does not like them. Typing a tab gets translated into spaces, but not if you paste it in there, it just looks like 2 spaces but stays as one tab, that cannot be compiled.

Ctrl-H can actually search and replace the tabs with spaces, by copy’pasting the tab into the Find What field:

 

 

Clean up your Docker

Everybody who has started using Docker with Dynamics NAV and Business Central has seen their disk space vanishing over time.

Thankfully, there is a simple way to clean and reclaim your disk.

Use the command: docker system prune

This will DELETE the following:
– all stopped containers
– all networks not used by at least one container
– all dangling images
– all build cache

…. long list …..

The way I do this, is to start the containers I need and then run the command. As you can see, I just ran it, and reclaimed 60 GB of disk space.

DISCLAIMER: Don’t blame when you’re deleting something important!

 

Let NAV use TLS1.2 when talking to webservices

Lots of web service vendors these days are tightening their requirement security protocols, SSL was removed back on the hearthbleed days, and not TLS version 1.0 and 1.1 are getting outed too. So suddenly NAV code that has been working for years stop working unless you change your client to select TLS1.2. Thankfully, there is a simple trick to choose the security protocol used by DotNet. This is done with the ServicePointManager.SecurityProtocol property:

Set it to SecurityProtocol.Tls12

Now you’re talking Tls12 with DotNet from inside NAV.

Wikipedia article on TLS