QuickFix on Windows with Python - Using MYSQL for events and messages - mysql

Is this currently possible?
This is the contents of my settings.cfg file:
[DEFAULT]
DefaultApplVerID=FIX.5.0SP2
ConnectionType=initiator
ReconnectInterval=60
FileStorePath=store
FileLogPath=*store
HttpAcceptPort=8080
HeartBtInt=30
StartTime=00:00:00
EndTime=00:00:00
UseDataDictionary=Y
DataDictionary=quickfix/FIX50SP2.xml
TransportDataDictionary=quickfix/FIXT11.xml
ValidateUserDefinedFields=N
ResetOnLogout=Y
ResetOnLogon=Y
MySQLStoreDatabase=quickfix
MySQLStoreUser=user
MySQLStorePassword=password
MySQLStoreHost=ip address
MySQLLogDatabase=quickfix
MySQLLogUser=user
MySQLLogPassword=password
MySQLLogHost=0.0.0.0
[SESSION]
BeginString=FIXT.1.1
SenderCompID=senderid
TargetCompID=targetid
SocketConnectPort=port
SocketConnectHost=host
Currently it is using the FileStorePath (/store/), but it is ignoring the MySQLStoreDatabase. Should I change these settings, or is the change going to be more complicated than that/impossible?
I'm using python 2.7 and quickfix 1.14.3 (which I installed using pip)

I bet you are constructing your app with a FileStoreFactory.
Gotta use a MySQLStoreFactory.

Related

Snort configuration dead end

I'm in a dead end at the configuration of snort.
In theory a simple problem.
I created a test rule to check if snort runs properly.
Location:\etc\snort\rules\local.rules
Content:
alert icmp any any -> $HOME_NET any (msg:"ICMP on fire"; sid:10000001; rev:001;)
Then I ran on terminal :
sudo snort -T -i enp0s3 -c /etc/snort/snort.conf
Message I receive at the end of the initialization:
"Snort successfully validated the configuration!"
"Snort exiting"
But scrolling up I'm seeing:
Initializing rule chains...
0 Snort rules read
0 detection rules
0 decoder rules
0 preprocessor rules
0 Option Chains linked into 0 Chain Headers
No rules at all!
location is correct in conf file under
/etc/snort/snort.conf
var RULE_PATH /etc/snort/rules
Snort 2.9.17 Build 199
Ubuntu 20.04
Any ideas?Thnnks in advance!
I would recommend supplying the rule path when you execute Snort using the "--rule-path" flag.
The --rule-path flag is not available and not recognized.
As far I understand this variable is just that, a variable that's not used anywhere in the configuration file.
The only way/workaround that I found was include the rule files for ex.
In the snort.conf appending this.
.
.
.
.
include c:\local.rules
Besides that, someone found a way to match content in answer/response?
I mean, let suppose that I want to check if the server has answer with a known content, for ex: success. I've tried with bidirectional operator <> and flow:to_client but nothing has worked.

Cannot connect to MySQL with Weka

I am trying to connect a database to Weka 3.6.13 in Linux Elementary OS.
First, I had a problem with JDBC connection, solved by this answer changing the /usr/bin/weka file.
Now, when I load the database, this error comes:
Unknown data type: INT. Add entry in weka/experiment/DatabaseUtils.props.
However, I am trying to use explorer only, this file doesn't even exists in my installation.
I installed via sudo apt install weka.
What should I do?
Look inside the directory where your weka.jar file resides, and check if there exists a file called DatabaseUtils.props.
The Weka wiki says:
Weka only looks for the DatabaseUtils.props file. If you take one of
the example files listed above, you need to rename it first.
My file is different I think the actual name does not really matter, it's the filename extension that matters.
In my version of this file there is a section that looks like this:
... (snip...
# mysql-conversion / type-mappings
CHAR=0
TEXT=0
VARCHAR=0
STRING=0
LONGVARCHAR=9
BINARY=0
VARBINARY=0
LONGVARBINARY=9
BIT=1
BOOL=1
NUMERIC=2
DECIMAL=2
FLOAT=2
DOUBLE=2
TINYINT=3
SMALLINT=4
#SHORT=4
SHORT=5
INTEGER=5
INT=5
BIGINT=6
LONG=6
REAL=7
DATE=8
TIME=10
TIMESTAMP=11
#mappings for table creation
CREATE_STRING=TEXT
CREATE_INT=INT
CREATE_DOUBLE=DOUBLE
CREATE_DATE=DATETIME
DateFormat=yyyy-MM-dd HH:mm:ss
#database flags
checkUpperCaseNames=false
checkLowerCaseNames=false
checkForTable=true
setAutoCommit=true
createIndex=false
# All the reserved keywords for this database
Keywords=\
AND,\
ASC,\
BY,\
DESC,\
FROM,\
GROUP,\
INSERT,\
ORDER,\
SELECT,\
UPDATE,\
WHERE
# The character to append to attribute names to avoid exceptions due to
# clashes between keywords and attribute names
KeywordsMaskChar=_
#flags for loading and saving instances using DatabaseLoader/Saver
nominalToStringLimit=50
idColumn=auto_generated_id
If you do a google search for this file, another guy has posted his on github. The weka Wiki or SVN/Git-Repo might also list an offfical version somewhere (cannot find it right now), or you can open your weka.jar file as a zip file and extract the .props file (/src/main/java/weka/experiment/DatabaseUtils.props.mysql).
In any case, Mysql exists in many different versions, and I think you can even switch the query engine inside mysql. So I cannot express any guarantees that any of these 2 .props files shown here really work for you. You should experiment a bit.

Erlang Config File Oddness

I have got the following .erlang file in my home directory (Ubuntu):
io:format("executing user profile in home/user/.erlang\n",[]).
code:add_pathz("/media/user/Disk2/Cloud/Workspace/Erlang").
code:add_pathz("/media/user/Disk2/Cloud/Workspace/Erlang/code").
shell_default:cd("/media/user/Disk2/Cloud/Workspace/Erlang").
io:format(".erlang rc finished\n",[]).
I can see that the file is run when I start the Erlang shell in the terminal. What is more, the shell_default:cd-command works fine. However, the code:add_pathz-commands do not. When I try to run anything in the code-directory, I get an "undefined function"-error. Besides, when I list the paths with "code:get_path().", I get:
[".","/usr/lib/erlang/lib/kernel-2.16.4/ebin",
"/usr/lib/erlang/lib/stdlib-1.19.4/ebin",
"/usr/lib/erlang/lib/xmerl-1.3.5/ebin",
"/usr/lib/erlang/lib/wx-1.1.1",
"/usr/lib/erlang/lib/webtool-0.8.9.2/ebin",
"/usr/lib/erlang/lib/typer-0.9.5/ebin",
"/usr/lib/erlang/lib/tv-2.1.4.10/ebin",
"/usr/lib/erlang/lib/tools-2.6.13/ebin",
"/usr/lib/erlang/lib/toolbar-1.4.2.3/ebin",
"/usr/lib/erlang/lib/test_server-3.6.4/ebin",
"/usr/lib/erlang/lib/syntax_tools-1.6.12/ebin",
"/usr/lib/erlang/lib/ssl-5.3.2/ebin",
"/usr/lib/erlang/lib/ssh-3.0/ebin",
"/usr/lib/erlang/lib/snmp-4.25/ebin",
"/usr/lib/erlang/lib/sasl-2.3.4/ebin",
"/usr/lib/erlang/lib/runtime_tools-1.8.13/ebin",
"/usr/lib/erlang/lib/reltool-0.6.4.1/ebin",
"/usr/lib/erlang/lib/public_key-0.21/ebin",
"/usr/lib/erlang/lib/pman-2.7.1.4/ebin",
"/usr/lib/erlang/lib/percept-0.8.8.2/ebin",
"/usr/lib/erlang/lib/parsetools-2.0.10/ebin",
"/usr/lib/erlang/lib/otp_mibs-1.0.8/ebin",
"/usr/lib/erlang/lib/os_mon-2.2.14/ebin",
"/usr/lib/erlang/lib/orber-3.6.26.1/ebin",
"/usr/lib/erlang/lib/odbc-2.10.18/ebin",
"/usr/lib/erlang/lib/observer-1.3.1.2/ebin",
"/usr/lib/erlang/lib/mnesia-4.11/ebin",
[...]|...]
Why isn't "code:add_pathz" working? Thanks.
Erlang R16B03
Eshell V5.10.4
Ubuntu LTS 14.04
The path above works. The fault was with .beam-files in the code-directory. Recompiling made them accessible from outside the "code"-directory.

dpkg-shlibdeps: error: no dependency information found for

I'm compiling a deb package and when I run dpkg-buildpackage I get:
dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libopencv_highgui.so.2.3
...
make: *** [binary-arch] Error 2
This happens because I installed the dependency manually. I know that the problem will be fixed if I install the dependency (or use checkinstall), and I want to generate the package anyway because I'm not interested on dependency checking. I know that I can give to dpkg-shlibdeps the option --ignore-missing-info which prevents a fail if dependency information can't be found. But I don't know how to pass this option to dpkg-shlibdeps since I'm using dpkg-buildpackage and dpkg-buildpackage calls dpkg-shlibdeps...
I have already tried:
sudo dpkg-buildpackage -rfakeroot -d -B
And with:
export DEB_DH_MAKESHLIBS_ARG=--ignore-missing-info
as root.
Any ideas?
use:
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
if your rule file hasn't the dh_shlibdeps call in it. That's usually the case if you've
%:
dh $#
as only rule in it ... in above you must use a tab and not spaces in front of the dh_shlibdeps
If you want it to just ignore that flag, change the debian/rules line from:
dh_shlibdeps
to:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
Yet another way, without modifying build scripts, just creating one file.
You can specify local shlib overrides by creating debian/shlibs.local with the following format: library-name soname-version dependencies
For example, given the following (trimmed) ldd /path/to/binary output
libevent-2.0.so.5 => /usr/lib/libevent-2.0.so.5 (0x00007fc9e47aa000)
libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007fc9e4161000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fc9e3b1a000)
The contents of debian/shlibs.local would be:
libevent-2.0 5 libevent-2.0
libgcrypt 20 libgcrypt
libpthread 0 libpthread
The "dependencies" list (third column) doesn't need to be 100% accurate - I just use the library name itself again.
Of course this isn't needed in a sane debian system which has this stuff defined in /var/lib/dpkg/info (which can be used as inspiration for these overrides). Mine isn't a sane debian system.
Instead of merely ignoring the error, you might also want to fix the source of the error, which is usually either a missing or an incorrect package.shlibs or package.symbols file in package which contains the shared library triggering the error.
[1] documents how dpkg-shlibdeps uses the package.shlibs resp. package.symbols, files, [2] documents the format of the package.shlibs and package.symbols files.
[1] https://manpages.debian.org/jessie/dpkg-dev/dpkg-shlibdeps.1.en.html
[2] https://www.debian.org/doc/debian-policy/ch-sharedlibs.html
You've just misspelled your export. It should be like this:
export DEB_DH_SHLIBDEPS_ARGS_ALL=--dpkg-shlibdeps-params=--ignore-missing-info
dpkg-buildpackage uses make to process debian/rules. in this process, dpkg-buildpackage it might call dpkg-shlibdeps.
thus, the proper way to pass modify a part of the package building process is to edit debian/rules.
it's hard to give you any more hints, without seeing the actual debian/rules.
Finally I did it in the brute way:
I edited the script /usr/bin/dpkg-shlibdeps, changing this :
my $ignore_missing_info = 0;
to
my $ignore_missing_info = 1;
You can use this:
dh_makeshlibs -a -n
exactly after dh_install

Verify presence of MySQL driver

I have a perl application that uses a MySQL backend.
How do I verify that the MySQL and database drivers are accessible?
I'm currently doing the following, but I don't know if it is actually a sufficient test -- I'd hate to find out six months down the line that I'm not doing the right test:
use Test::More;
BEGIN { use_ok('DBI'); }
BEGIN { use_ok('DBD::mysql'); }
done_testing();
This is enough to check that connection will be available from Perl side. If you want to check if mysql server is available, you need to connect to it.
P.S. You can also add version checking for DBD::mysql. For ex. 4.001 fixes serious bug in utf8 support.
Well, it looks fine to me, but if you want to be sure, you can check for the presence of the actual filepaths in your %INC ie:
perl -MDBI -e 'die unless $INC{"DBI.pm"}'
perl -MDBD::mysql -e 'die unless $INC{"DBD/mysql.pm"}'