I am developing a desktop application for OSX using QT.
How can i get the serial number of the OSX machine using QT API's.
This is a solution in QT
QProcess proc;
QStringList args;
args << "-c" << "ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformSerialNumber/ { print $3; }'";
proc.start( "/bin/bash", args );
proc.waitForFinished();
QString uID = proc.readAll();
qDebug()<<uID;
uId is the serial number
Related
I made an script (findx.h) that doesn't have any problem when i ran it on Solaris server via console (bash-3.2$ ./findx.sh)
The problem appears when i try to run it from a windows Qt app using QProcess (code below) where it doesn't display the ouput of the command.
I tried little variations and appear to show data when just use one pipe instead of two. But i need the two: grep and ggrep.
//findx.h in solaris
//WHAT WORKS
#!/bin/bash
echo pass | sudo -S /usr/sbin/snoop -x0 -ta HSM1000 port 1000
//WHAT I WANT
#!/bin/bash
echo pass | sudo -S /usr/sbin/snoop -x0 -ta HSM1000 port 1000 | /usr/sfw/bin/ggrep -A 2 KR01
//Qt on windows
QString commands="(";
commands +="source setpath.sh";
commands +=";/path/to/script/findx.sh";
commands +=")";
this->logged=false;
QString program = "plink.exe";
QStringList arguments;
arguments <<"-ssh"
<<ip
<<"-l"
<<user
<<"-pw"
<<pass
<<commands;
this->myProcess=new QProcess(this);
connect(this->myProcess,SIGNAL(started()),
this, SLOT(onprocess_started()));
connect(this->myProcess, SIGNAL(errorOccurred(QProcess::ProcessError)),
this, SLOT(onprocess_errorOcurred(QProcess::ProcessError)));
connect(this->myProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(onprocess_finished(int, QProcess::ExitStatus)));
connect(this->myProcess, SIGNAL(readyReadStandardError()),
this, SLOT(onprocess_readyReadStandardError()));
connect(this->myProcess, SIGNAL(readyReadStandardOutput()),
this, SLOT(onprocess_readyReadStandardOutput()));
connect(this->myProcess, SIGNAL(stateChanged(QProcess::ProcessState)),
this, SLOT(onprocess_stateChanged(QProcess::ProcessState)));
this->myProcess->start(program, arguments);
this->ui->labStatus->setText("Starting");
return 0;
// How i read, i do the same for stderr and put it also in plainOutput
QByteArray err=this->myProcess->readAllStandardOutput();
QString m="Standard output:"+QString(err.data());
this->ui->plainOutput->appendPlainText(m);
please any advice would be useful.
Thanks in advance.
I have a problem with loading snowflake driver in the elixir application on arm64 Mac m1 (on x86 it works smoothly).
Installed:
unixodbc
erlang 24.1.2 with odbc support
snowflake driver
iODBC
ODBC manager & iODBC manager
Below is configuration of my odbc installation
➜ sandbox odbcinst -j
unixODBC 2.3.9
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /Users/or/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
➜ sandbox cat /usr/local/etc/odbcinst.ini
[ODBC Drivers]
SnowflakeDSIIDriver=Installed
[SnowflakeDSIIDriver]
APILevel=1
ConnectFunctions=YYY
Description=Snowflake DSII
Driver=/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib
DriverODBCVer=03.52
SQLLevel=1
ODBCInstLib=/usr/local/iODBC/lib/libiodbcinst.dylib
➜ sandbox cat /opt/snowflake/snowflakeodbc/lib/universal/simba.snowflake.ini
[Driver]
ANSIENCODING=UTF-8
DriverManagerEncoding=UTF-32
DriverLocale=en-US
ErrorMessagesPath=/opt/snowflake/snowflakeodbc/ErrorMessages
LogLevel=0
LogPath=
CURLVerboseMode=false
CABundleFile=/opt/snowflake/snowflakeodbc/lib/universal/cacert.pem
ODBCInstLib=libodbcinst.dylib
➜ sandbox cat /usr/local/etc/odbc.ini
[ODBC Data Sources]
SNOWFLAKE_ODBC = SnowflakeDSIIDriver
[SNOWFLAKE_ODBC]
Driver = /opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib
Description = Internal Snowflake
uid = <>
server = MY_SERVER
database = <>
schema = <>
warehouse = <>
role = MY_ROLE
tracing = 6
➜ sandbox
➜ sandbox odbcinst -s -q
[SNOWFLAKE_ODBC]
➜ sandbox isql -v SNOWFLAKE_ODBC <USERNAME> <PASSWORD>
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
➜ sandbox /usr/local/iODBC/bin/iodbctest
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.1521.0607
Enter ODBC connect string (? shows list):
DSN | Driver
------------------------------------------------------------------------------
SnowflakeDSII | Snowflake
Enter ODBC connect string (? shows list): SnowflakeDSII
1: SQLDriverConnect = [iODBC][Driver Manager]dlopen(/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib, 6): no suitable image found. Did find:
/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib: no matching architecture in universal wrapper
/opt/snowfl (0) SQLSTATE=00000
2: SQLDriverConnect = [iODBC][Driver Manager]Specified driver could not be loaded (0) SQLSTATE=IM003
I can connect via isql, iodbctest fails and my simple test case fails:
defmodule Sandbox.OdbcTest do
use Sandbox.OdbcCase
test "test odbc" do
conn_str = 'dsn=SnowflakeDSII'
IO.inspect :odbc.connect(conn_str, [])
end
end
I tried connection string as:
conn_str = 'driver=/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib;server=<SERVER>;uid=<USERNAME>;pwd=<PASSWORD>;role=<ROLE>;warehouse=TEST_WH;'
➜ sandbox mix test test/odbc_test.exs
true
'driver=/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib;<MY_DSN>'
{:error,
'[unixODBC][Driver Manager]Can\'t open lib \'/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib\' : file not found SQLSTATE IS: 01000 Connection to database failed.'}
.
Finished in 0.05 seconds (0.00s async, 0.05s sync)
1 test, 0 failures
Randomized with seed 529170
I am afraid message from iodbstest explains everything but I hope there is solution.
I followed these articles:
https://docs.snowflake.com/en/user-guide/odbc-mac.html
https://community.snowflake.com/s/article/How-to-create-Snowflake-ODBC-DSN-On-MacOS
How do I install the ODBC driver for Snowflake successfully on an M1 Apple Silicon Mac?
ARM processor for M1 is not yet supported for ODBC drivers provided by Snowflake.
Snowflake ODBC Driver support for ARM/M1 is now available, and you can download the driver from the Snowflake Client Repository
I got a version of this working for R. You might be able to leverage a similar approach: https://stackoverflow.com/a/71790445/4319571
I tried to use dpdk-pktgen 3.7.2 with dpdk 18.11, but it only reached about 35 Mpps traffic with 64B packet size.Following is my lua script:
package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"
require "Pktgen";
local time = 30;
local pcnt_rate = 100;
sendport = 0;
recvport = 1;
pkt_size = 64;
burst_cnt = 128
local dstip = "192.168.100.100";
local srcip = "192.168.0.0";
function main()
pktgen.stop(sendport);
sleep(2);
pktgen.set(sendport, "size", burst_cnt);
pktgen.set(sendport, "burst", 64);
pktgen.set(sendport, "rate", pcnt_rate);
pktgen.set_ipaddr(sendport, "dst", dstip);
pktgen.set_ipaddr(sendport, "src", srcip);
pktgen.set_proto(sendport..","..recvport, "udp");
pktgen.start(sendport)
sleep(time)
pktgen.stop(sendport)
end
printf("\n**** Traffic Profile Rate for %d byte packets ***\n", pkt_size);
main();
printf("\n*** Traffic Profile Done (Total Time %d) ***\n", time);
l ran the script with the following command.
sudo pktgen -l 0-7 -n 4 -- -N -T -P -m "[1-7].0" -f script.lua
My NIC is Mellanox ConnectX-5 100GbE with traffic limit of 200Mpps and 100Gbps. Is there any problem in my script that restricts performance of pktgen? Thank you for your suggestions.
As mentioned in comments this is more of configuration issue of platform or not choosing right platform. I am able to generate 120Mpps with 64B on 100Gbps (CVL NIC).
[EDIT-2] Finally got hands on Mellanox connectx6 DX cards (2 *100Gbps). With DPDK 21.11 and PKTGEN 21.11, it is possible to generate over 100MPPs
MLX PMD args used: mprq_en=1,rxqs_min_mprq=1,mprq_log_stride_num=9,txq_inline_mpw=128,rxq_pkt_pad_en=1
Platform Details:
DPDK:21.08
PKTGEN:pktgen-dpdk-pktgen-21.03.1
NIC:Ethernet Controller E810-C for QSFP
CPU: Intel(R) Xeon(R) Gold 6152 CPU # 2.10GHz
PKTGEN CMD:pktgen --legacy-mem -a 0000:86:00.0 -l 22-43 -- -P -m "[25-29:30-34].0" -N
[EDIT-1] #SoliRaven as mentioned in comments and answer one can generate up to 120 to 125 Mpps with Intel E810 & with Mellanox Connect6 DX 120MPPs. Hence this looks more like configuration, platform or firmware issues. Hence this is not DPDK or DPDK-PKTGEN is not issue.
How can I detect if my MicroPython script is running on ESP32 or ESP8266?
I want to make it work on both platforms, but deep sleep requires different implementation depending on the hardware.
You can use uos.uname().sysname to detect the hardware platform.
Here is an example script:
import uos
print(uos.uname())
sysname = uos.uname().sysname
if sysname == 'esp32':
print('detected ESP32')
elif sysname == 'esp8266':
print('detected ESP8266')
else:
print('something else')
Demo script output on ESP8266:
$ ampy run detect.py
(sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.11-8-g48dcbbe60 on 2019-05-29', machine='ESP module with ESP8266')
detected ESP8266
Demo script output on ESP32:
$ ampy run detect.py
(sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11 on 2019-05-29', machine='ESP32 module with ESP32')
detected ESP32
I would like to install Erlang for Windows.
Erlang provides a Windows installer but the installer installs Erlang into fixed folder "Program Files".
I need to install Erlang into optional location.
Please let me know how to install Erlang for Windows with a path which I want to install.
The RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
You can run the following command to specify a different installation location. Note that you should run the installer as an administrative user:
otp_win64_20.3.exe /S /D=C:\the\path\you\want
Thanks #Luke Bakken for your answer. I was able to wrap this into my script and am copying this here in case someone finds it useful. I also borrowed from https://gist.github.com/chgeuer/8342314
Function Install-Erlang {
Try{
"Starting Erlang installation..."
# Install Erlang
# Update/review below path along with version of erlang being installed
$args = "/S /D=C:\erl10.2"
Start-Process -Wait otp_win64_21.2.exe -ArgumentList $args
}
Catch{
Write-Error "Function Install-Prerequisites failed:" $_
Exit 1
}
"Erlang installed successfully"
#
# Determine Erlang home path
#
$ERLANG_HOME = ((Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Ericsson\Erlang)[0] | Get-ItemProperty).'(default)'
[System.Environment]::SetEnvironmentVariable("ERLANG_HOME", $ERLANG_HOME, "Machine")
#
# Add Erlang to the path if needed
#
$system_path_elems = [System.Environment]::GetEnvironmentVariable("PATH", "Machine").Split(";")
if (!$system_path_elems.Contains("%ERLANG_HOME%\bin") -and !$system_path_elems.Contains("$ERLANG_HOME\bin"))
{
Write-Host "Adding erlang to path"
$newpath = [System.String]::Join(";", $system_path_elems + "$ERLANG_HOME\bin")
[System.Environment]::SetEnvironmentVariable("PATH", $newpath, "Machine")
}
}