New PyCharm tricks I learned today

Perhaps it’s been more than a decade since I started using PyCharm and today I learned a new trick! If you want the autocomplete to suggest names from modules that you have not imported yet, press ctrl+space twice (instead of once).

The documentation page is a must read for everyone. I found some other cool features that I did not know about.

back to pycharm after a little vscode

I was thinking about migrating to vscode, but two simple issues at the very beginning made me change my mind.

  1. The “go to symbol in workspace” is much slower than pycharm’s search everywhere.
  2. Configuring PYTHONPATH for terminal, debugger and other features is a pain. In pycharm the project root is automatically added to path and everything works seamlessly from the beginning.

My take on pandas vs polars

pandas:

  • pros:
    • The API is easier to learn.
    • The API is reacher, there are many utilities and mature convenience functions/methods that will save your time. (e.g. reading from clipboard, styler class, the keep argument of duplicated, etc.)
  • cons:
    • The type system: having to deal with several dtype (int vs Int, string[pyarrow] vs internal string) is a pain. dtype is just weaker than schema and schema_overrides and sometime does not even support a dict dtype, you either have to let it infer or force a single dtype.
    • The default value of some arguments are chosen poorly in my opinion. I want lineterminator to always be ‘\n’ when I write csv files. The default value for low_memory should be false. …
    • Too much customizability. Sometimes I get tired of having to think about the best combination of parameters like engine, copy, inplace, etc.
    • slower

polars:

  • pros:
    • A better/more capable type system. Handling Null values by the default Int64 datatype helps. having separate Date, Time and Datetime types is handy.
    • A better API design: the schema parameter, lazy API, good defaults.
    • Fast.
  • cons:
    • Less higher-level features. Some APIs like df.update are experimental. Some, like to_html and styler, do not exist. Some, like duplicated, lack features.
    • pycharm does not support viewing polars dataframes.
    • more verbose syntax. Modifying a df is usually more cumbersome.
    • Choosing between eager and lazy API is a dilemma I wish I could avoid. I think many developers, including myself are too lazy for the lazy API.

Avoid services like 403.online and shecan.ir

These are unreliable services that cause very hard to detect network issues for everyday websites. I learned it they hard way. A good VPN/Proxy will probably save you from wasting your time and a ton of headaches. Paying 2 or 3% of your salary is probably worth it.

Internet access in Iran has become more horrible than ever.

Decrease MTU to resolve network issues

For quite some time I was having network issues on my computer. DNS failures from time to time, connections dropping, lots of refreshes required on the browser, etc.

Today I was messing around with my router settings and noticed that decreasing the TCP MSS and MTU options by nearly 100 units significantly reduces network problems. The default values were 1400 and 1480. I’m using an ADSL connection by the way.

In Iran, internet connectivity is a disaster, but at least now I have a few less issues to deal with.

P.S. I’m sure there are more optimal values. I’m just recording an observation here. I don’t know much about networks really.

Disabling streak notifications on WordPress.com

Go to https://wordpress.com/me/notifications and look for “Site achievements”.

اگه خر وبسایت بانک ملت رو طراحی کرده بود بهتر در میامد

می‌خواستم پیامک‌هام رو تمدید کنم، اول از همه یک ساعت باید تو سایت بگردی ببینی بین هزارتا منو، تنظیمات پیامک کجاست. برای کسایی که نمی‌دونن: پروفایل > ابراز احراز هویت > تنظیمات پیامک

بعد میری اونجا، معلوم نیست بستهٔ قبلی تا کی فعاله. اصلاً فعال هست یا نیست؟ هیچی دیگه، اگه شک داشته باشی باید دوباره بخری.

بعد موقع درخواست، چندین و چند گزینه داره، یکیش هست «وضعیت بسته خدمات با آبونمان»، یکی دیگه هست «وضعیت بسته خدمات با آبونمان کمتر از ۳۰۰,۰۰۰ ریال»، هیچ توضیحی هم نداده که منظور از آبونمان کمتر از فلان چیه؟ ربطش به گزینهٔ وضعیت بسته خدمات با آبونمان چیه؟

سرتون رو درد نیارم. یک مشت بی‌شعور وبسایت بانک ملت رو طراحی کردن. باز خوبه جدیداً اون کپچای مسخره موقع لاگین رو حذف کردن.

Do not install newly released Python feature versions

It happened again! Excited about the new release of Python 3.12, I uninstalled 3.11 and installed the new Python, only to later realize that some of the packages I need, do not yet support the new version. (In this particular case: pyarrow and aiohttp).

A good console autocomplete: the feature I miss the most in Firefox

Firefox is my goto browser on all platforms. I’m pretty satisfied with it. There are some features that I miss however. The most important one for me is a good autocomplete in developer console.

In Edge you can type any part of the method name to get an autocomplete suggestion:

In Firefox, you have to correctly type the beginning, otherwise it won’t suggest it:

Related bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1657350

Also, Edge reminds you of the function signature while you’re invoking it:

In Firefox this feature does not exist:

Related bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1555698

Opening files in vscode while in PyCharm

Here is how I currently do it:

I’ve added vscode as an external tool:

When I want the current file lunched in vscode, I just invoke action menu and look for vscode: