Short solutions of 2016

Back to Blog

In this section I will collect short things that have taken me some time to figure out. The intent is that I would be able to avoid wasting time in the future after I have forgotten about them.

Hotmail not syncing on tablet



An android tablet won’t sync a Hotmail email-account. Although everything seems to work, the inbox shows only one email in Inbox, which says in capital letters that the account requires attention. The post resembles a spam message, but is actually from Microsoft, and advertises the Outlook app to read email.


Hotmail disables email-syncing until you explicitly op out of using Outlook, by visiting a tiny link contained in the post.

Qt keyboard modifiers



In PyQt5, it seems difficult to test for keyboard modifiers on a key press event.

# Always returns True.
controlDown = (event.modifiers() & Qt.ControlModifier) != 0
# There is no testFlag function, although according to
# the documentation there should be.
controlDown = event.modifiers().testFlag(Qt.ControlModifier)


# This works.
controlDown = bool(event.modifiers() & Qt.ControlModifier)

Scarlett Solo and Windows 10 Anniversary Update



After the recent Windows 10 Anniversary update, Scarlett Solo (1st generation) soundcard gets stuck into ASIO exclusive mode even when not using ASIO; e.g. there is no sound in Winamp, Spotify or any other non-ASIO application. This persists even after unplugging the soundcard or rebooting the computer.


There seems to be a bug in Scarlett Solo drivers — perhaps in earlier drivers too. After contacting Focusrite’s support, I was provided with new beta drivers which fixed the problem.

Meanwhile, it is possible to fix the problem temporarily up until the first ASIO use by the following:

It is not sufficient to just reinstall the driver; uninstallation is important.

PyPy, OpenCv, PyQt



You want to use OpenCv, SciPy, and PyQt with PyPy.


This does not seem to be possible at the moment.

PyPy on Windows



You want to install PyPy on Windows, along with NumPy.


How to use screen



You want to run weechat in a separate screen in a Linux machine.


To run weechat in a screen:

screen weechat

To detach from a screen:

(Ctrl + A) D

To connect back to an existing screen:

screen -dr

Lilyglyphs Latex package

19.05.2016 (28.11.2016)


MikTeX 2.9 does not contain the lilyglyphs package, so it needs to be installed manually.


Extract the lilyglyphs package .zip file from CTAN to tex/latex subdirectory of MikTeX. This provides a new lilyglyphs subdirectory. Create a symbolic link emmentaler from fonts/opentype to tex/latex/lilyglyphs/fonts. In Windows, on MikTeX 2.9 64-bit,

mklink /D "C:\Program Files\MikTeX 2.9\fonts\opentype\emmentaler" "C:\Program Files\MiKTeX 2.9\tex\latex\lilyglyphs\fonts"

Finally, go to MikTeX Options (Admin), and refresh the filename database (FNDB).

Insight Toolkit path



When trying to run CMake on your project which uses ITK, it says that

Could not find a package configuration file provided by "ITK" with any of
the following names:



After building ITK to a directory build, set the ITK_DIR path variable to point to it:

set ITK_DIR=C:\Code\InsightToolkit-4.8.2\build

Clang in Visual Studio 2015



Changing to use the Clang code generator in Visual Studio 2015 results in various errors.

Solution (partial)

To solve the error

Element <ExceptionHandling> has an invalid value of "Sync".

change the “Enable C++ Exceptions” field of each project to -fexceptions. To solve the error

cannot specify -o when generating multiple output files

change the “Object file name” field of each project to


To solve the error

boost/smart_ptr/detail/sp_counted_base_clang.hpp(29,1): error : cannot mangle this C11 atomic type yet

add the compiler definition


Unfortunately, some errors still remain, such as

boost/smart_ptr/detail/lwm_win32_cs.hpp(110,13): error : no matching function for call to 'LeaveCriticalSection'

Upload to PyPi



You have forgotten how to upload to PyPi.


Write on source root:

python sdist
twine upload -u username -p password dist/*

Note that PyPi no longer accepts multiple formats such as both zip and gztar.

D-Link DCS-2210 camera

25.02.2016 (02.05.2016)

The D-Link DCS-2210 IP-camera records video in both visible light and infrared. The infrared switches on automatically as the illumination gets low. The imaging hardware is reasonable. Here are some considerations to make it work.


The D-Link software is exceptionally bad. To install the drivers and the software requires to turn off user access control (UAC) off in Windows. The UAC needs to remain disabled in order to be able to use the camera. The user-interfaces are very unintuitive, not documented well, and contain non-standard abbreviations, such as DI for digital input.

Do not install eiher the included drivers or the included software — or if you do, do so in a virtual machine. Instead, use the camera over the ethernet, and configure it through the browser interface. Use the iSpy open-source program to access the video stream. The browser interface does not work well with Chrome — use Internet Explorer instead.

If you still decide to use the included software, here are some tips. The checkbox to enable audio recording is behind the schedule button — not in the settings. The video is recorded in a proprietary format, and seems not to be compressed at all; recording eats up hard-disk space relatively fast. To manipulate the video outside of the software requires to export the proprietary format to a common format. The export process is slow enough to be impractical for any real use. Additional CPU cores are not utilized.


The RSTP video-stream names are found from the Network setup. By default they are named live1.sdp and live2.sdp. These streams correspond to the two profiles in the Audio and Video setup. A full address is of the form


Your IP-address may be different; I am assuming here that the camera is connected to the local network. Your user-name and password may be different too (not admin). If you use DHCP, then the IP-address of the camera varies. To avoid this, set a fixed IP for the camera in the Network setup.

Make sure you have a fast router, coupled with network cables of at least Cat-5e or better. Also, connect the computer to the router directly for maximum speed — not through Wifi.

Make sure to use RTSP (Real-Time Streaming Protocol) to stream the video — not HTTP. The former gives much better performance. This is a matter of configuring the camera correctly in iSpy.

Video quality

The bandwidth of the video stream gets big very fast, unless restricted somehow. The following settings in Audio and Video setup provide good quality, while keeping bandwidth reasonable (3.3 Mbps peak with maximal motion under visible light):

Property Value Comments
Mode H.264 Best encoder.
Resolution 480 x 270 Smallest without looking too pixelated.
Intra-frame period 1 Minimum, best.
Maximum frame-rate 25 Maximum, best.
Video quality standard Could not see difference with good or excellent.

Note that the bandwidth requirement changes depending on the amount of motion — with higher settings you may get bandwidth to stay in 12 Mbps when keeping motion minimal. However, with motion the bandwidth exceeds the networks capacity, freezing the video few seconds at a time.

Shutter and image-processing

These are good settings for the Image setup, to avoid exceeding motion blur and unnatural look from image processing.

Property Value Comments
White balance Indoor Assuming the camera is used inside.
Exposure mode Customize1 To be able to specify the following yourself.
Shutter [1/10000, 1/12.5] No reason to restrict much.
Max gain 21 dB Keeps the light level natural.
Denoise 0 The denoising algorithm is bad; it makes everything blurry.
Sharpness 0 No sharpening filter; it looks unnatural.
Power line 50 Hz That’s what we have in Finland.


The audio recorded by the camera is dominated by noise, which makes it useless. To record audio, use a separate microphone. Synchronize the audio later with the video using video-editing software.

SumatraPDF really slow at printing



When at my workplace, printing a paper through SumatraPDF takes about 1 minute per page, which is super slow. All this time, wifi shows a constant upload speed of 11MB/s, and a download speed of 0.5MB/s. When at my home, SumatraPDF prints the same paper in few seconds. I use the same computer at both locations, and use wifi.


Do not use SumatraPDF to print a paper. The same paper takes only a few seconds to print through Foxit Reader (say), both at my workplace and at my home.