Skip to content

Instantly share code, notes, and snippets.

@seyedmmousavi
seyedmmousavi / pretty_print_struct_in_golang.md
Last active March 30, 2020 11:32
Print Struct with field names in Golang?

To print a vriable of struct, just use Printf as follow

fmt.Printf(">RESULT: %+v \n", ticket)

This prints following output:

>RESULT: {Id:987654345 Title:ASEMAN Date:0 PlaceId:123 OwnerId:12345412312 IsActivated:true IsDeleted:false EditorId:0}

@seyedmmousavi
seyedmmousavi / embbeding_ca_cert_into_qt.cpp
Created October 3, 2021 17:08
Embedding Let's Encrypt CA root certificate into Qt application
#include <QtNetwork/QSslConfiguration>
#include <QtNetwork/QSslSocket>
#include <QtGlobal>
//more includes...
int main(int argc, char *argv[])
{
//Adding CA root certificate of the Let'sEncrypt into default CA DB
//for Qt 5.15+
@seyedmmousavi
seyedmmousavi / Qt5.15 configure options
Created April 1, 2023 17:33 — forked from h3ssan/Qt5.15 configure options
Qt 5.15 available configure options
Usage: configure [options] [assignments]
Configure understands variable assignments like VAR=value on the command line.
Each uppercased library name (obtainable with -list-libraries) supports the
suffixes _INCDIR, _LIBDIR, _PREFIX (INCDIR=PREFIX/include, LIBDIR=PREFIX/lib),
_LIBS, and - on Windows and Darwin - _LIBS_DEBUG and _LIBS_RELEASE. E.g.,
ICU_PREFIX=/opt/icu42 ICU_LIBS="-licui18n -licuuc -licudata".
It is also possible to manipulate any QMAKE_* variable, to amend the values
from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
@seyedmmousavi
seyedmmousavi / exec-sqlite-sql-file-in-qt
Created January 9, 2017 18:10
Execute Sqlite query file (.sql) in Qt
/**
* @brief executeQueryFile
* Read a query file and removes some unnecessary characters/strings such as comments,
* and executes queries.
* If there is possible to use Transaction, so this method will uses it.
* Use this gist as MIT License.
* EXCEPTION:
* Feel free to use this gist as you like without any restriction,
* if you or your country are a member of The Axis of Resistance
* (Iran + Syria + Lebanon + Russia + Iraq + Yemen + Bahrain + Palestine)
@seyedmmousavi
seyedmmousavi / build_qt_5_15_openssl_3.md
Last active May 23, 2024 04:47
How to build Qt 5.15 Community against OpenSSL 3

How to build Qt 5.15 Community with OpenSSL 3

The Qt v5.15 Community doesn't support OpenSSL 3 by default. You will face some issues at runtime if you attempt to build it with OpenSSL 3. This gist explains how to do it by yourself.

Brief

  1. Apply two attached patches
  2. Install OpenSSL 3
  3. Config the Qt with installed OpenSSL like this:
 ..\configure -prefix h:\mousavi\Qt\5.15.10\win32-msvc2019-x86 -debug-and-release -skip qtwebengine -openssl-runtime OPENSSL_PREFIX="H:\mousavi\OpenSSL-Win32"`