Author Archives: dmitriano

Bold font in VS2022 C++ code editor

Visual Studio 2022 uses Cascadia Mono font by default:

They probably think that we all are infected by something and need to be vaccinated.

(more…)

Waitable QTimer with C++20 coroutines

Found an example of overriding co_await operator and was able to implement my own version:

#include <QTimer>
#include <QMetaObject>

#include <chrono>
#include <coroutine>

//QTimer accepts only milliseconds.
class TimeAwaitable
{
public:

    explicit TimeAwaitable(std::chrono::milliseconds d) : m_d(d) {}

    ~TimeAwaitable()
    {
        if (m_connection)
        {
            QObject::disconnect(m_connection);
        }
    }

    bool await_ready() const noexcept
    {
        return m_d <= std::chrono::milliseconds(0);
    }

    void await_suspend(std::coroutine_handle<> h) noexcept
    {
        m_connection = QObject::connect(&m_timer, &QTimer::timeout,
            [this, h]()
            {
                QObject::disconnect(m_connection);

                h.resume();
            });

        m_timer.setSingleShot(true);
        m_timer.start(m_d);
    }

    void await_resume() const noexcept {}

private:

    std::chrono::milliseconds m_d;
        
    QTimer m_timer;

    QMetaObject::Connection m_connection;
};

inline TimeAwaitable operator co_await(std::chrono::milliseconds d) noexcept
{
    return TimeAwaitable{ d };
}

For those who did not work with QT, QTimer::singleShot simply calls the lambda on the current thread after a given interval.

(more…)

Ethereum Classic (ETC) stopped mining on GeForce GTX 3GB cards

Today I noticed that ETC does not mine anymore on my HiveOS farm with GeForce GTX 3GB cards:

(more…)

Binance looses its orders

When I query KAVAUSDT order #561657676 with /api/v3/order?symbol=KAVAUSDT&orderId=561657676&timestamp={{timestamp}}&signature={{signature}} that normally should return

{
    "symbol": "KAVAUSDT",
    "orderId": 561657676,
    "orderListId": -1,
    "clientOrderId": "ce86e0a9-85a8-4d9b-99b1-b08e227e2464",
    "price": "4.80700000",
    "origQty": "10.00000000",
    "executedQty": "0.00000000",
    "cummulativeQuoteQty": "0.00000000",
    "status": "CANCELED",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "stopPrice": "0.00000000",
    "icebergQty": "0.00000000",
    "time": 1632183933417,
    "updateTime": 1632184233620,
    "isWorking": true,
    "origQuoteOrderQty": "0.00000000"
}

I periodically get

{
    "code": -2013,
    "msg": "Order does not exist."
}

see a video on YouTube that demonstrates this effect.

(more…)

An example of real-time TableView in QML

Looks like CheckBox-es respond to clicks and work correctly even if they are in a TableView that is updated once a second:

(more…)

How I fixed “No such file” error in Visual Studio Code on Windows 10

Found an answer on stackoverflow.com:

and updated c:\Users\D-Ef\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js on my machine:

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;
(more…)

Building QT 6.2.2 for iOS

I built QT 6.2.2. for MacOS first and then configured QT 6.2.2 for iOS as follows:

./configure -c++std c++20 -opensource -confirm-license -no-openssl -securetransport -DQT_NO_EXCEPTIONS=1 \
  -platform macx-ios-clang -release -qt-host-path /usr/local/Qt-6.2.2 -prefix /usr/local/Qt-6.2.2-ios \
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity \
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua \
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects \
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland \
  -skip qtwebchannel -skip qtwebengine -skip qtwebview
(more…)

Building QT 6.2.2 for MacOS – Part 2

In my previous post I described my first attempt to built QT 6.2.2 for MacOS. Probably my mistake was that I did not switch to full XCode with the command:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

and that I used the configuration script with a wrong syntax and missed -- in the command line. Probably the following configuration can be a step to a right direction:

./configure -c++std c++20 -opensource -confirm-license -no-openssl -securetransport -DQT_NO_EXCEPTIONS=1 \
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity \
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua \
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects \
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland \
  -skip qtwebchannel -skip qtwebengine -skip qtwebview \
  -- -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
(more…)

Running an app with QT 6.2.2 on MacOS

Built QT 6.2.2 and installed QT Creator 6.0.1, it started but with the following errors:

(more…)

Building QT 6.2.2 for MacOS – Part 1

Installed XCode 13:

(more…)