FAQ about the constitutional crisis in Poland

If you happen to be interested in European politics, you might want to check out my FAQ about the current constitutional crisis in Poland. (A constitutional crisis is what happens when two or more branches of the government fight so intensely that basic cooperation is impossible.) It took me over 100 hours to write – mostly because I had to do a lot of research about legal issues, including talking to constitutional lawyers.

Polish Constitutional Crisis – FAQ

Kryzys konstytucyjny – FAQ

Plasticity 1.2: Keyboard shortcuts, mobile support, and some eye candy!

I’ve just released a new version of my music training / anti-tinnitus Web app Plasticity. Here is a list of changes:

  • Keyboard shortcuts with WASD keys should make long training sessions easier (per Lord Denton’s request)
  • Mobile support with a responsive design lets you train when you don’t have your computer with you. Please use high-quality headphones and make sure all “audio enhancements” (built-in sound distortion) are disabled on your device.
  • Eye candy: Pretty sweet slide in/out transitions between questions, re-rendered high-resolution images for retina screens, redesigned buttons (uniform across platforms)
  • Improved performance when replaying last tone
  • Tested on Firefox, Chrome (Win/Android), Safari (Mac/iOS). (Worked around a Web Audio bug in Safari which sometimes resulted in sounds no longer playing until the game is restarted.)

Technicolor TC7200 router freezes under load – solution

I have a Technicolor TC7200 cable modem/router which was forced on me by my cable provider (UPC). After one of the automatic firmware updates last year, I started having intermittent problems with stability. The router would suddenly “freeze” with the following symptoms:

  • No websites can be opened
  • DNS requests fail
  • Existing connections keep working (all downloads started before the freeze just keep going)
  • Other machines connected to the same router work fine
  • If you do nothing, connectivity will come back after a while (10 minutes?)
  • Right-clicking the network adapter in Windows and choosing Diagnose successfully restores connectivity, even though Windows reports no issues.

The issue would mostly arise under heavy load. Whenever I opened a lot of new connections (for example, many concurrent downloads, streaming video in several tabs, multiple torrents downloading), I could be reasonably sure that a freeze would occur within 1-20 minutes. It would also occur 1-2 times a day regardless of the load.

Solution

The Technicolor TC7200 does not work properly if you change its default IP address. I had changed the router’s IP address from the default (192.168.0.1) to 192.168.1.1 because that was the address of my previous router and I wanted to spare myself some reconfiguration.

Changing the address of the router back to 192.168.0.1 (and moving all the devices on my LAN back to the 192.168.0.xxx subnet) has completely eliminated the issue. For the past month or so, I’ve had zero freezes despite my attempts to trigger one. Just to be sure, I briefly changed the subnet to 192.168.1.xxx, and – you guessed it – the issue came back.

Polish version

Router Technicolor TC7200 instalowany standardowo przez UPC nie obsługuje prawidłowo sieci lokalnych, których podsieć jest inna niż domyślna (192.168.0.xxx). W przypadku ustawienia w panelu administracyjnym adresu routera innego niż 192.168.0.1 (czyli np. 192.168.1.1), urządzenie zacznie od czasu do czasu się “zawieszać”, a dokładniej blokować możliwość nawiązywania nowych połączeń z danego komputera (wygląda to tak, że nie otwierają się nowe strony, nie działa DNS). Charakterystyczne jest to, że dotychczasowe połączenia trwają nadal (czyli np. pobieranie pliku rozpoczęte przed “zwisem” będzie kontynuowane) oraz że inne urządzenia w tym samym LAN-ie działają w tym czasie bez zarzutu. Problem pojawia się zwłaszcza pod obciążeniem – w przypadku otwarcia wielu połączeń, pobierania/wysyłania dużej ilości danych. Po powrocie do domyślnej podsieci (192.168.0.xxx) problem znika.

Więcej szczegółów powyżej w wersji angielskiej.

Sublime Text 3 doesn’t play well with Equalizer APO and other applications that monitor file changes

I just spent a day investigating a really baffling bug that occurred when I installed Equalizer APO on a new Windows machine. (Equalizer APO is a free equalizer that plugs into the Windows Audio subsystem, which lets you, among other things, correct the acoustic flaws of your room to dramatically improve the quality of all audio playing on your computer. Maybe I’ll write a post about it some day — it’s awesome.)

Equalizer APO uses a plain text config file (config.txt) that it constantly monitors for changes using a mechanism provided by Windows. Normally, you can hear the sound playing on your PC change within a few seconds of saving the file. Soon after installing Equalizer APO on a fresh Windows installation, I noticed that the changes I was making in config.txt were often being ignored. For example, the first two changes after reboot might get applied, but subsequent changes would be ignored. I tried fiddling around with folder permissions and moving the config.txt file to various locations on the hard drive, which seemed to fix the issue for some time (usually until the next reboot).

The weirdest thing was that whenever I changed config.txt, Equalizer APO wrote the following message to its log:

Error while reading configuration file:
The system cannot find the file specified.

This did not make any sense at all. How could Equalizer APO not find a file that was clearly there? And why was it unable to find the file only some of the time? After spending an hour studying the source code for Equalizer APO, I grew convinced that the only possible reason was a bug in Equalizer APO which somehow blocks access to the config.txt file (after all, weird contention issues are not unheard of in multithreaded apps) combined with an obscure Windows bug which results in CreateFile() reporting a sharing violation as a missing file.

After submitting a lengthy and detailed bug report to the author of Equalizer APO, I accidentally opened config.txt in Notepad instead of Sublime Text 3, my go-to text editor…

Impossible. The problem was gone. I could edit the file as much as I wanted, and every change was applied. Back to Sublime Text 3 — it stopped working. I tried opening the file in Komodo Edit — it worked just like it did in Notepad.

A-ha! Clearly Sublime Text 3 was doing something weird with the file. Could it somehow be hiding the file from Equalizer APO?

It turns out, when you save a file in Sublime Text 3, in its default configuration, it doesn’t simply overwrite it like all other editors. Instead, it does the following:

  1. Write the modified text into a temporary file.
  2. Delete the original file.
  3. Rename the temporary file so that it looks like the original file.

At the exact moment when ST3 deleted the original file, Windows would notify Equalizer APO about the “change” and cause it to re-read the file. If the read operation was quick enough (which would have depended on things like the overall disk load), Equalizer APO would find the file missing.

Why does Sublime Text 3 save your files in such a weird way? It’s supposed to be a safety feature. If ST3 simply overwrote the original file and something really bad happened during the overwrite, you could lose data. Making a temporary file first guarantees that you will always be able to get your data back.

However, this roundabout way of modifying files can cause problems with software that monitors file changes. I’m not just talking about the scenario that gave me the headache which occasioned this post, but other scenarios as well. For example, there are backup and versioning apps which monitor filesystem changes. To such an app, a save operation in ST3 will look like a file got deleted, and then a new file got created, which may ruin the association between the current version of the file and its earlier versions. For real-life reports of problems like that, see the previously linked thread on the ST forum and this StackOverflow question.

According to the above sources, the “atomic save” feature can be disabled in ST3 by editing user preferences, but I could not get it to work (in build 3065). In the end I simply downgraded to ST2.