
Author Archives: dmitriano
Building QT 6.9.1 on MacOS Sequoia
Determine XCode command line tools version:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
version: 16.4.0.0.1.1747106510
volume: /
location: /
install-time: 1750710554
clang --version
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: x86_64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Squid unexpectedly stopped working
Squid unexpectedly stopped working with my home internet connection. I created a temporary user:
cd /etc/squid/
sudo htpasswd -B squid-password temp
sudo service squid reload
tried the following command
curl -v -x https://developernote.com:3129 --proxy-user temp:<password> -I https://api.ipify.org/
with another internet provider and it succeeded.
(more…)Reducing image size with command line
With the command below
mogrify -path . -strip -quality 50% *.jpg
I reduces the size of the following images
-rwxrwxrwx 1 def def 4.0M Apr 9 16:48 20250409_164822.jpg*
-rwxrwxrwx 1 def def 3.6M Apr 9 16:48 20250409_164831.jpg*
-rwxrwxrwx 1 def def 4.2M Apr 9 16:49 20250409_164902.jpg*
-rwxrwxrwx 1 def def 4.1M Apr 9 16:49 20250409_164910.jpg*
-rwxrwxrwx 1 def def 3.7M Apr 9 16:49 20250409_164917.jpg*
-rwxrwxrwx 1 def def 3.8M Apr 9 16:49 20250409_164924.jpg*
Subscribing to all ByBit trade streams in Python
from pybit.unified_trading import WebSocket
from pybit.unified_trading import HTTP
from time import sleep
session = HTTP(testnet=False)
info = session.get_instruments_info(category="spot")
symbol_infos = info["result"]["list"]
websockets = []
def handle_message(message):
print(message)
def subscribe(websockets, symbols):
print(f'Subscribing to {symbols}')
ws = WebSocket(
testnet=False,
channel_type="spot",
)
ws.trade_stream(symbol=symbols, callback=handle_message)
websockets += [ws]
Subscribing to ByBit WebSocket streams in Python
Spot is limited to 10 symbols:
from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="spot",
)
def handle_message(message):
print(message)
#ws.orderbook_stream(50, "BTCUSDT", handle_message)
ws.ticker_stream(symbol=["BTCUSDT", "ETHUSDT"], callback=handle_message)
while True:
sleep(1)
An example of connecting a signal by name in QT
class TableColumn : public QObject
{
Q_OBJECT
public slots:
void onValueChanged()
{
emit onChanged();
}
signals:
void onChanged();
};
An example of using base iterator in C++
The code below demonstrates how to access underlying range iterator by transformed iterator:
struct A
{
int x;
};
struct B
{
A* a;
};
std::vector<B> v;
int main()
{
auto a_range = v | std::views::transform(std::mem_fn(&B::a));
auto i = std::ranges::find(a_range, 5, std::mem_fn(&A::x));
A* a = *i;
B& b = *(i.base());
}
An example on what ROWID is in SQLite
ROWID is of alias of an integer primary key:
CREATE TABLE test1(id INTEGER, b TEXT, PRIMARY KEY(id))
INSERT INTO test1 (id, b) VALUES (5, 'five');
INSERT INTO test1 (id, b) VALUES (6, 'six');
INSERT INTO test1 (b) VALUES ('seven');
SELECT rowid, * FROM test1;