Beware of localhost

One day at work we encountered odd bug with our application. It was Windows Service that was client/server for TCP/IP connections.

The bug was that the server part didn’t seem to listen to any connection.

The oddness of this bug was, that this bug occurred only when service started automatically after restarting PC. When we restarted the service it started to work.

My first idea was that somehow DNS service was connected. (thinking back, it was totally stupid from me thinking that) So my first attempt was disabling DNS cache. Obviously that didn’t help.

Secondly I thought that maybe there were some dependent services for network communication which started after our service. So I set our service to start automatically but delayed. This fixed the underlining issue. But obviously I wasn’t satisfied without knowing what was the culprit.

Then I finally remembered that I can enumerate all listening ports. So I did that. First I enumerated when the service didn’t work and then when the service worked. To my big surprise on this port the IP addresses were different… So by taking this into consideration I deduced that network is not immediately connected after restart so our service bound to the wrong network 127.0.0.1 instead of our internet facing IP address.

Good thing that I investigated this further, because If I was satisfied with delayed autostart I wouldn’t find that our server bound on localhost IP. Why binding to specific IP? Why not to listen globally on all networks?

In the end, we changed binding to IP 0.0.0.0 which listens on all networks.

My take from this is to investigate issues into depth and not be satisfied with “just a quick-fix”

Cheers!

Reblog: Deep Synergy Between Testability and Good Design

  • Testable code does not imply Good design.
  • Good design should imply testable code.

But if you think your code base have a Good Design and you can’t easily test your code, then you can be biased about good design from your point of view.

However real good SOLID design imply easily testable code.

Why am I talking about this? Because in video below Michael Feathers really nicely explains that into big depth. After watching this I got a lot of nice guides how to design better for easily testable code.

Enjoy watching it!

Lumia 950 won’t connect to PC

I don’t know how long has it been, that my phone (Lumia 950) wouldn’t connect to my PC. But one day I really needed to copy some photos from my phone (Lumia 950) to my PC. And that damn phone still just wouldn’t connect! So I started my investigation in Device Manager, where there was an Unknown Device of type “MTP Device”. After trying to update that driver I got this:

“INF is invalid”

This also was a case for Lumia 650. The same problem.

Then I started googling and after a few minutes my problem was solved:

https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware/solved-mtp-not-working-on-windows-10-aniversary/391842ee-bacc-4e35-84e2-8089dfdbb0bf

This issue was bugging me for weeks or even monts and it took only few minutes to fix it. So if you have some issue that is bugging you a long time, don’t be lazy and give it a few minutes and you might solve it in a few minutes like I did.

Cheers!

Youtube 1.25x speed lagging problem

Funny thing happend to me. I was reinstalling my PC the other day and when I set it up again, I wanted to watch some youtube videos. But when I started to watch them in 1.25x speed or more they were seriously lagging and obviously I didn’t have ANY clue why. So I backtracked some of my steps of installing and setting up my PC. And guess what change fixed that youtube problem… Reverting my Playback Device Advanced Setting Format from 24bit, 192KHz to something lower fixed it. Possibly my default sound card couldn’t handle this much data and youtube was compensating for it by lagging. So the sound card could keep up.

My way of learning

I don’t read books. Heck I’ve read only like 4 books in my life from start to finish. So how do I learn? I watch and listen. It’s that simple! Most often the tempo of the speaker is too slow and my brain is wandering off to other thoughts. So I am compensating that by speeding the video or track up a bit. My best speed-up range is from 1.4x to 1.9x. It depends on how fast can you process the speaker, if he is understandable at that speed and how am I accommodated to that certain speed. I often start slower and then speed up. Then I am 100% on the topic and that is the most effective way for me to learn something.

Welcome

I am starting this blog because of one person. http://pablojuan.com/ He has an amazing blog, where he only documents his experiences and it brought me some value. He’s writing it funny, understandable and short as it should be. So let’s hope I will do too.