2020. november 10., kedd

Office 365 Windows apps not upgrading to latest

 If you have ever come across the situation when your colleagues have features or annoyances in Office 365 desktop applications that your Outlook / Excel does not have?
And no matter how many times you manually initiate Office Update under File / (Office) Account / Update Options / Update Now nothing new comes?

We do a lot of collaborative editing of tracking lists in Excel where private, temporary Sheet Views of Data Filtering and Sorting come very handy so that one does not alter the filter criteria for the other editing the same list.

I did not have this option since I could not upgrade further than the (20)20-02(Feb) version of the apps:

You can also see the culprit: after much research, uninstall-reinstall that did not help I figured that the Semi-Annual Enterprise Channel is not delivering the updates (yet).

If you do not want to wait you have to change the Office Update Channel: https://docs.microsoft.com/en-us/deployoffice/change-update-channels however the enterprise methods linked in this article did not work for me.

Thus I have researched some more and changed my update channel manually through changing my registry: https://www.solver.com/switching-office-365-monthly-update-channel however the changes described in this article also were not enough for me.

So what I did:

  1. start regedit
  2. navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration
  3. Change CDNBaseURL to http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60
  4. Change AudienceId to 492350f6-3a01-4f97-b9c0-c7c6ddf67d60
  5. Change UpdateChannel to http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60
  6. Change UpdateChannelChanged to True
  7. Start Excel (or any other Office application)
  8. Initiate File / (Office) Account / Update Options / Update Now
  9. Exit Excel and wait for the updates to download and install.
  10. Open Excel: File / Account now I am on version (20)20-10(Oct):


Same with Word:

Office Update Channel changed to Current!

I also did some restarts in between, #6 and #7 above. You should do it too, if the above steps alone do not work for you straight away.

2020. augusztus 11., kedd

Reccursive directory list to CSV in a single

 How to create a recursive list of all files and separate size, path, filename and extension into CSV fields in a single command line of standard Windows 10 CMD?

TL;DR for the current directory, not including directories:

for /f "delims=*" %A in ('dir /s /b /a:-d') ^
do @echo %~zA,"%~pA","%~nA",%~xA >>dirlist.csv

(feel free to omit the carrot and put it on a single line)

  • Details: you can use the Parameter Expansion known from parsing the command line arguments on parameters of the FOR command (yes, even if you indicate %L you can have %M, %N and so on as well) https://ss64.com/nt/syntax-args.html and
  • https://ss64.com/nt/for.html

Have fun!

2020. július 26., vasárnap

Configuring wifi-ap and hostapd on Ubuntu 20.04

If you have a fresh new, shiny Ubuntu focal installed and you are thinking to set up wifi sharing (an Access Point) in the part of your apartment that computer is located in installing and starting the wifi-ap snap is a great way to do so.
Especially if you, like me have installed it without a graphical desktop, so setting up an AP using the Network Manger GUI is now straightforward.

Make sure you have snap:
sudo apt install snapd

Then install wifi-ap:
snap install wifi-ap

Theoretically an automated setup will make it work straight after install, you can check that with:
wifi-ap.status

This did not work on my box, because I do not have a wlan0 interface, instead I had to configure it with:
wifi-ap.config set wifi.interface=wlp1s0

Configuring is very easy as far as you can live with the few options it gives you:
root@XXXXX:~# wifi-ap.config get
debug: false
dhcp.lease-time: 12h
dhcp.range-start: 10.0.60.2
dhcp.range-stop: 10.0.60.199
disabled: false
share.disabled: false
share.network-interface: enp3s0
wifi.address: 10.0.60.1
wifi.channel: 1
wifi.country-code: SG
wifi.hostapd-driver: nl80211
wifi.interface: wlp1s0
wifi.interface-mode: direct
wifi.netmask: 255.255.255.0
wifi.operation-mode: g
wifi.security: wpa2
wifi.security-passphrase: XXXXXXXXXX
wifi.ssid: XXXXXXXXXX


You can turn off the snap and back on with:
wifi-ap.config set disabled=true
wifi-ap.config set disabled=false

And restart with:
wifi-ap.status restart-ap

After these my hostapd was running but the few settings above did not allow me to set the settings to the optimal speed with the tuning options in hostapd.conf I have already experimented with earler:
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]

And editing /var/snap/wifi-ap/355/hostapd.conf does not help as the snap regenerates it upon every startup in /snap/wifi-ap/355/bin/ap.sh which is a read-only mounted squashfs:
root@XXXXXX:~# mount |grep snap
/var/lib/snapd/snaps/wireless-tools_7.snap on /snap/wireless-tools/7 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_9665.snap on /snap/core/9665 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/wifi-ap_355.snap on /snap/wifi-ap/355 type squashfs (ro,nodev,relatime,x-gdu.hide)


So I have turned to this page on how to unmount and unpack the squashfs, modify the generating script https://askubuntu.com/questions/1046606/cannot-edit-system-file-snap-phpstorm-even-with-root-account-in-ubuntu-18-04/1046677:
cd ~
sudo umount /snap/wifi-ap/355
sudo unsquashfs /var/lib/snapd/snaps/wifi-ap_355.snap

This is when you modify anything you want in the squashfs-root directory except I could not unmount because the service process was still using the mount point. I figured out the PID for it with:
fuser -m /snap/wifi-ap/355
And killed it with:
kill -9

Then added the above config line to the config generation part of the script just before the wmm_* section, recreated the squasfs, backed up the old snap image and placed the newly generated there:
sudo mksquashfs squashfs-root wifi-ap_355.snap
sudo mv /var/lib/snapd/snaps/wifi-ap_355.snap /var/lib/snapd/snaps/wifi-ap_355.snap.backup
mv ~/wifi-ap_355.snap /var/lib/snapd/snaps/wifi-ap_355.snap

Not very elegant but then I just restarted my computer instead of figuring out how to restart the service I have killed.

I had everything in order, hostapd running in the wifi-ap snap with the updates options.

So long, and thanks for all the fish!

2020. június 3., szerda

Image resolution for OCR and how to check it

The resolution of the documents consisting of scanned pages determines how much information they store about the visual content, so how well or easily those pages are readable. This is usually measured in DPI (Dot Per Inch - how many pixels are covering a 2.54cm part of the page) so that it is independent of the page size. Horizontal and vertical DPI is usually the same, and for normal documents 300 DPI is optimal (higher is only needed for documents with small print). The minimum acceptable DPI for production OCR processing is 200 DPI (as advised by vendors of several OCR engines).
For the usual business documents of A4 and Letter standards the below table shows the amount of information contained and describing the visual content of the complete page at different usual DPIs (as well as horizontal and vertical size in inches, millimeters, pixels and DPI):


It can be seen that a 200 DPI image has less than half the information about the page (practically a 3.74 megapixel photo - worse than what any smartphone can take in 2020) compared to the optimal 300 DPI (approx. 8.5 megapixels). Anything below has even more scarce information about the page: 150 DPI only has one quarter, 100 DPI only has one tenth of the information.
Consequently a modern OCR solution using traditional engines (ABBYY, Nuance, Tesseract, RecoStart whichever company has them acquired at the moment) can be expected to perform adequately if feed with 200-300 DPI documents.
Up scaling scanned images just inserts rows and columns of smartly averaged pixels between the original pixels but this does not add the missing information: what was really there originally on the document. This is automatically performed by the engines anyways, but is not expected to make the results better, just enables processing low resolution documents (still usually producing substandard results).

Effect of JPEG: lossy compression 

JPEG uses lossy compression, this simply means, that even though you input the specific pixel information you have scanned (what color is each location in the page with a specific resolution), it does not store this information as given: it encodes 8x8 blocks converted into frequencies with a quality setting. If that is high, the JPEG closely resembles the image, so it is almost as good for OCR as the original and is larger. Lower quality adds noise and makes OCR results worse.
On comparison TIFF G4, PNG etc. formats store pixel as received, there is no degradation due to compression, this is called loss-less compressions and usually results in larger files.

How to figure out the resolution of your input files

For JPEG, PNG, TIFF etc. open them in e.g. IrfanView https://www.irfanview.com/ and fin.d the resolution in the bottom left in the status bar or press “I” for “I”mage properties. In case of TIFFs switch to the page you one to see the resolution for, they do not necessarily have the same resolution. Resolution may slightly differ from the numbers in the above table.

Finding the resolution of the images in PDFs

You can use the pdfimages command from popplers utils (free, opensource software).

Using WSL on Windows 10

Using msys2 on other Windows versions


Please note, PDFimages may calculate DPI wrong (for example if images are stored rotated) but the resolutions you can always compare to the table above.

How to install pdfimages

Using Windows Subsystem for Linux on Windows 10
  1. Enable Windows Subsystem for Linux
  2. Install e.g. Ubuntu from the Microsoft Store
  3. Start bash
  4. Install the poppler-util package (and its dependencies)
$ sudo apt install -y poppler-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
poppler-utils is already the newest version (0.62.0-2ubuntu2.10).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Using msys2

https://www.msys2.org/ is a free and open-source platform for multiple Windows versions (excluding Windows XP and below)
After installing msys2, install the package (the example below is for 64 bit installations):
c:\msys64\usr\bin\bash -lic “pacman -S mingw-w64-x86_64-poppler“

Rendszeres olvasók