Tuesday, September 29, 2020

Compile Trading System with C++17

 Library versions

 

gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC) 

boost_1_74_0

glog-0.4.0

libprotoc 3.13.0  (proto buffer)

NO ZeroMQ


Compile errors fixes

getopt_pp.h -> comment all throw(GetOptEx)

SyncCircularBuffer.h -> boost::interprocess::scoped_lock

boost bind errors -> boost::placeholders::_1 , boost::placeholders::_2

 

hash_map errors -> Just replace with std_map and do NOT use unordered_map. string search does not work with unordered_map

 

Exception errors -> Replace catch(Exception e) with catch catch(IoException &e) [& important]

floor function error -> Add #include <cmath>


Add  LIB += -lrt -lpthread to the Makefile for bellow error

undefined reference to symbol 'shm_unlink@@GLIBC_2.2.5'

undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'

Saturday, September 19, 2020

libevent

https://libevent.org/

https://github.com/libevent/libevent

 http://blog.gaurav.im/2014/12/15/a-gentle-intro-to-libevent/?fbclid=IwAR0-TS7VZblI959v_dnSSnoFoIFnRuPCso6s-clDJF-RI6UHAGbsZfcneGs

How to install

./configure

make

make install

 How to compile

g++ filename.cpp -levent -levent_core

 

if this error comes when running "error while loading shared libraries: libevent-2.1.so.7: cannot open "shared object file: No such file or directory

 sudo ln -s /usr/local/lib/libevent-2.1.so.7.0.1  /usr/local/lib/libevent-2.1.so.7

Wednesday, September 16, 2020

std::this_thread::yield

 https://en.cppreference.com/w/cpp/thread/yield

 

#include <iostream>
#include <chrono>
#include <thread>
 
// "busy sleep" while suggesting that other threads run
// for a small amount of time
void little_sleep(std::chrono::microseconds us)
{
    auto start = std::chrono::high_resolution_clock::now();
    auto end = start + us;
    do {
        std::this_thread::yield();
    } while (std::chrono::high_resolution_clock::now() < end);
}
 
int main()
{
    auto start = std::chrono::high_resolution_clock::now();
 
    little_sleep(std::chrono::microseconds(10000));
 
    auto elapsed = std::chrono::high_resolution_clock::now() - start;
    std::cout << "waited for "
              << std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count()
              << " microseconds\n";
}

Thursday, September 10, 2020

C++ law latency communication libraries

 1. Solarflare OpenOnload (https://support.solarflare.com/wp/onload)


2. Hummingbird Code Software LLC (https://www.hummingbirdcode.net/p/hmbdc-is-c-framework-and-library-built.html)

 

3. eCAL (https://github.com/continental/ecal) 

 

4. shadesmar (https://github.com/Squadrick/shadesmar)


5. tcpshm (https://github.com/MengRao/tcpshm)


6. cpp-ipc (https://github.com/mutouyun/cpp-ipc)

Wednesday, September 9, 2020

eCAL How To Install in CentOS 8

 This is eCAL git repository

https://github.com/continental/ecal

*** install cMake

1. install git

yum insall git

2. Download eCAL repository

git clone https://github.com/continental/ecal.git


3. download third party libraries. 

git clone spdlog,tclap,tinyxml etc. 

BUT download  install protobuf from the release. (extract tar file, ./configure, make, make install)


4. README.md has mre detals how to install eCAL. Some third party can be optional

cmake .. -DCMAKE_BUILD_TYPE=Release -DECAL_THIRDPARTY_BUILD_PROTOBUF=OFF -DECAL_THIRDPARTY_BUILD_CURL=OFF -DECAL_THIRDPARTY_BUILD_HDF5=OFF -DHAS_QT5=OFF -DHAS_HDF5=OFF

Saturday, June 4, 2016

Moving a Subversion Repository to Another Server

Moving a subversion repository from one server to another, while still preserving all your version history may seam like a daunting task, but fortunately it's not too difficult.
I recently had to move a subversion (svn) repository to another server. The repository was on a Windows server and had to be moved to a Linux server.

Step 1: Backup your old Repository

The first thing you need when moving from one server to another is a dump of your subversion repository. Hopefully you are already creating dump's with a backup script, but if not here's how you can create a subversion dump file:
svnadmin dump /path/to/repository > repo_name.svn_dump
The dump file contains all the revisions you have ever made to your svn repository, so it will probably be quite large (it even includes files you may have deleted in a previous revision).

Step 2: Create the new Repository

Now, simply transfer the dump file on to your new subversion server, and create an empty repository:
svnadmin create /path/to/repository

Step 3: Import your old repository into the new one

Next import your dump file:
svnadmin load /path/to/repository < repo_name.svn_dump
You may want to force subversion to use the same UUID for the new repository as the old repository. To do this add --force-uuid to your svnadmin load command. In my case I wanted to do this. If you have already loaded your repository, there is a way to set the UUID at a later date, check the docs.
That's it, you now have a replica of your old repository on your new server.

FAQ's

What if someone committed a new revision to the old server during installation?
You can easily import the new revision, by creating an incremental dump on the old server:
svnadmin dump --incremental -r 1234 /path/to/repository > rev1234.svn_dump
Now to import that revision on your new server:
svnadmin load /path/to/repository < rev1234.svn_dump
Can't I just use a hotcopy to restore the repository?
It depends, hotcopies created with svnadmin hotcopy must be moved to a server with identical setup. You should have the same version of subversion installed on both servers, same operating system, etc.
Subversion dumps are designed to work with different versions of subversion, and are just more flexible. Hotcopies are handy to have, but I recommend creating both hotcopies and dumps as part of your backup plan.