Author Archives: dmitriano

The sum of signed and unsigned is unsigned in C++

#include <iostream>

template <typename T>
void PrintValue(T val)
{
    if constexpr (std::is_signed_v<T>)
    {
        std::cout << "signed";
    }
    else
    {
        std::cout << "unsigned";
    }

    std::cout << std::endl << val << std::endl;
}
(more…)

Installed Post Password Token WordPress plugin

When the user enters a page or post password WordPress sets wp_postpass_XXXX cookie:

Use chrome://settings/cookies/detail?site=developernote.com to see the cookies in Google Chrome browser.

(more…)

How I used OMNI USDT client on my home Windows machine

First, as a true C++ developer, I installed Ubuntu 18.04 and compiled omnicore from sources, but after that I realized that Windows omnicore-0.9.0 client can be downloaded and run directly on my Windows 10 machine.

I found omnicore-qt.exe in the unpacked files and run it:

(more…)

A proper Ubuntu 18.04 installation for running Ethereum node

Create a Hyper-V machine with a disk that is large enough:

And install Ubuntu 18.04.

(more…)

I did not receive a peak price from Binance

In my app I display prices that I receive from Binance STORJ/BTC trade stream (green color):

(more…)

None of C++ compilers have heterogeneous lookup for unordered containers except MSVC

At 10/20/2020:

And std::vector is not constexpr yet:

And there is no text formatting also.

Coroutines:

std::chrono::days:

See C++20 library features compiler support.

Assignment a property of type function in QML

It is possible to do this in QML:

Item
{
    property var refreshChart: function () {}

    Component.onCompleted:
    {
        refreshChart = function ()
        {
            console.log("Hello!")
        }
    }
}
(more…)

Sample Binance API queries

Getting All Isolated Margin Symbols in PHP:

$api_key = "*****";
$secret = "*****";

$opt = [
    "http" => [
        "method" => "GET",
        "header" => "User-Agent: Mozilla/4.0 (compatible; PHP Binance API)\r\nX-MBX-APIKEY: {$api_key}\r\n"
    ]
];
$context = stream_context_create($opt);
$params['timestamp'] = number_format(microtime(true)*1000,0,'.','');
$query = http_build_query($params, '', '&');
$signature = hash_hmac('sha256', $query, $secret);
$endpoint = "https://api.binance.com/sapi/v1/margin/isolated/allPairs?{$query}&signature={$signature}";

$res = file_get_contents($endpoint, false, $context);
echo $res;
(more…)

Brain collapsing rules in C++

Consider the declaration of a class that contains a lambda function or a reference to it:

#include <utility>

template <class Func>
struct Holder
{
    Holder(Func && func) : m_func(std::forward<Func>(func))
    {
    }

    Func m_func;
};

template <class Func>
auto MakeHolder(Func && func)
{
    return Holder<Func>(std::forward<Func>(func));
}
(more…)

Setting Google AdMob Seller information

There is a new Seller information option in Google AdMob that may affect the advertising revenue. I set it up in Google AdMob Console on Settings page as follows:

See some link about this.