Author: TrueAl

Procrastinating by being busy optimizing

No Comments

If I just had that perfect keyboard. It would make my workflow just so much better. Certainly I can invest some time to find the perfect one. (BTW, if you know me for a while, I had at least 20 keyboards in the last ten years)

Oh, and if I just had the perfect Headphones. It would make my workflow just so much more enjoyable.

Oh, and if I just had that perfect pen…

I think you got the point? There are two mechanisms working here:

  • Procrastination
  • Wanting mind

The procrastination part is certainly hitting very close to home for me. I am learning math, which to some part seems boring, and to some part is quite challenging. It is also a area of past struggles for me, which I try to evade.

And then there is the Wanting Mind. “If I just had” is a good indicator for this. There is a deep belonging inside me, to be recognized as a nerd. By having stuff. Also, there is a side which tells me “I deserve it”. Well, all of this, of course, is just some distraction from my fear of not being enough. Of me being an imposter.

Good thing, if I notice that. In that case, I can be aware and focus back on my math learning. However, sometimes that can consume several hours.
Then it’s worth writing a blog post about it.
To avoid going back to work.

Categories: Uncategorized

Messing with local ports

No Comments

Being able to develop stuff locally is certainly on of the points I love the most working with Azure and Python. Later, you can hyper-scale the shit out of your code, but you can also debug it first on your tiny machine.

if __name__ == '__main__':
    # This code only runs when executing the script directly (not on App Service)
    logging.info("Starting Flask app in local development mode")
    socketio.run(app, host='0.0.0.0', port=5000, debug=True)

This piece of code is probably run a thousand times every day by a thousand developers. However, it was quite difficult to find an easy answer on google for this:

OSError: [Errno 48] Address already in use: ('0.0.0.0', 5000)

Easy to understand what it means, like port 5000 is in use already. WTF? Who is running something on my machine???

Of course, me. Another PyCharm window or something. But no, not this time. Strange. `netstat to the rescue 🙂 Well, not on macOS.

For whatever reason it cannot show you ports in LISTEN, at least that I could find. But how can we figure it out? lsof can help us here:

lsof -i :5000
COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ControlCe 650 trueal   10u  IPv4 0xa162a6f756348686      0t0  TCP *:commplex-main (LISTEN)
ControlCe 650 trueal   11u  IPv6  0x2c61017c47991be      0t0  TCP *:commplex-main (LISTEN)

WTF is a commplex? Another round of googling shows it belongs to AirPlay. So technically, ever developer on macOS should not be able to run the demo code?? So at least now you know, too, what is hogging your precious port 5000. You’re welcome.

Categories: Selfhosting

WordPress Admin Panel extremely slow

No Comments

Hosting a blog yourself is certainly one of the best things to do. Not only will you have full control of your data, but you will certainly learn a lot about technology along the way.

So today I decided to start writing a blog, once more, and hosting it myself. Here. Post 1.

But the /wp-admin/ panel is so painfully slow. The pages take up to six seconds to load.

But how can you figure out what is happening? I mean, sure, it could be my server. It’s just a Synology with a simple 4 core CPU.
But then, it’s just PHP?

So I found this nice plugin for WordPress, called Query Monitor. I will be visible in the top bar of the admin panel and show you exactly what is happening. And I found that:

cURL error 28: Resolving timed out after 3001 milliseconds

Seems like the admin panel is trying to connect to http://api.wordpress.org/translations/core/1.0/ and is running into a timeout.

Strange. Connecting via ssh and running a nslookup is also slow as hell. So it really seems, that the DNS lookup is somehow broken. In my setup, my router (a FritzBox) is causing the delay in DNS lookups.

Solution: Switching to public DNS servers 1.1.1.1 and 8.8.8.8 in the DSM settings, and problems all gone.

Next step: run a proper DNS caching server at home. I think it will be PiHole, but that’s another blog post 🙂