Command to find which version of armadillo is installed? - armadillo

I tried armadillo -v and ldconfig -p | grep arma* , but neither one helps.

Try
arma::arma_version ver;
std::cout << "ARMA version: "<< ver.as_string() << std::endl;

Related

Issues when installing drake in M1 macOS

I follow the steps in the webpage, a problem came out when executing./setup/mac/install_prereqs.sh
drake % ./setup/mac/install_prereqs.sh
+ binary_distribution_args=()
+ source_distribution_args=()
+ '[' '' '!=' '' ']'
+ source ./setup/mac/binary_distribution/install_prereqs.sh ''
++ set -euxo pipefail
++ with_update=1
++ '[' '' '!=' '' ']'
++ [[ 501 -eq 0 ]]
++ command -v conda
++ command -v brew
++ [[ -z '' ]]
++ export HOMEBREW_NO_AUTO_UPDATE=1
++ HOMEBREW_NO_AUTO_UPDATE=1
++ export HOMEBREW_NO_INSTALL_CLEANUP=1
++ HOMEBREW_NO_INSTALL_CLEANUP=1
++ binary_distribution_called_update=0
++ [[ 1 -eq 1 ]]
++ brew update
Already up-to-date.
++ binary_distribution_called_update=1
++ brew tap robotlocomotion/director
+++ cat
++ brew uninstall --force robotlocomotion/director/scipy#1.5.4 robotlocomotion/director/numpy#1.19.4
++ brew bundle --file=./setup/mac/binary_distribution/Brewfile --no-lock
Using dreal-deps/ibex
Using robotlocomotion/director
Using adoptopenjdk
Using clp
Using cmake
Using double-conversion
==> Installing ibex#2.7.4 from dreal-deps/ibex
==> Downloading https://github.com/dreal-deps/ibex-lib/archive/ibex-2.7.4_10.tar.gz
Already downloaded: /Users/marui/Library/Caches/Homebrew/downloads/cf1b94f6783b4d23cc0bd34c10833f34cea5e7cff82ddfa24d7613f439a9d7f2--ibex-lib-ibex-2.7.4_10.tar.gz
==> ./waf configure --prefix=/opt/homebrew/Cellar/ibex#2.7.4/2.7.4_10 --enable-shared --with-optim --with-solver --with-affine-extended --interval-lib=filib --lp-lib=clp --clp-path=/opt/homebrew/opt/clp
Last 15 lines from /Users/marui/Library/Logs/Homebrew/ibex#2.7.4/01.waf:
Checking for program 'make' : /opt/homebrew/Library/Homebrew/shims/mac/super/make
Applying patch : filibsrc-3.0.2.2.all.all.patch
Calling configure : done
Calling make : done
Calling install : done
Checking for header interval/interval.hpp : yes
Checking for library prim : yes
Checking for compiler flags -frounding-math : yes
Checking for compiler flags -ffloat-store : yes
Checking for header interval/interval.hpp with -msse3 : yes
Configuration of the library for LP
Library for LP : clp
Checking for 'clp' : not found
The configuration failed
(complete log in /private/tmp/ibex-2.7.4-20210319-75719-hq0bkg/ibex-lib-ibex-2.7.4_10/__build__/config.log)
Do not report this issue to Homebrew/brew or Homebrew/core!
Installing dreal-deps/ibex/ibex#2.7.4 has failed!
Using eigen
Using gcc
Using fmt
Using gflags
Using glew
Using glib
Using graphviz
Using ipopt
Using libyaml
Using lz4
Using nlopt
Using numpy
Using openblas
Using pkg-config
Using python#3.9
Using scipy
Using spdlog
Using suite-sparse
Using tinyxml
Using tinyxml2
Using robotlocomotion/director/vtk#8.2.0
Using xz
Using yaml-cpp
Using zeromq
Homebrew Bundle failed! 1 Brewfile dependency failed to install.
How can i fix this? Thanks in advance.
The official answer: "On macOS, x86_64 is the only supported architecture and running Drake under Rosetta 2 emulation on arm64 is not supported." -- https://drake.mit.edu/developers.html#supported-configurations as of 2021-03-18.
You can subscribe to https://github.com/RobotLocomotion/drake/issues/14555 for any updates regarding M1 support.
However, if you want to try to hack through it locally, you could try commenting out homebrew dependencies that do not succeed (e.g., IBEX in this case).
With IBEX disabled, you'll also have to bazel build --define=NO_DREAL=ON to disable dReal for the moment. Likely, other dependencies will also fail, but we have not tested on M1 yet so we don't know how close it is to working.
I've filed https://github.com/dreal/homebrew-dreal/issues/10 in case we can fix the IBEX problem easily.
The other option would be to spin up an Ubuntu VM (based on either 18.04 or 20.04).

Apple Clang on Debian8.1

Recently I'm porting Apple Clang-700.1.81 to debian 8.1. I have successfuly build clang with
cmake ../llvm -DLLVM_TARGET_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX="/usr" -DDLLVM_DEFAULT_TARGET_TRIPLE="x86_64-apple-darwin15.3.0"
Make clang -j8 -s 2>Logs
CC Complier:gcc-4.9
CXX complier:g++-4.9
Coming out with default target x86_64-apple-darwin3.16.0-amd64
Is there any thing I'm missing?
Okay I finally found the solution for this one.
Make sure install all these plugin.
gcc-4.9 g++-4.9-multilib gcc-4.9-multilib gobjc automake autoconf bison flex libtool python-dev libxml2-dev
Building clang-700.0.81 on Unix system
There might be some bug fix, these are what I have done.
Delete source file CFString.cpp or move out from the directory.
disable SourceManager just comment those code that cause compiler error.
"brace-initialization" add additional curly brackets to fix it.
Building clang-703.0.31 on Unix system
clang-703.0.31 do not need any configuration as clang-700.0.81 does.
Patch clang-703.0.31 with this code to enable preprocessor to dump the right version of clang.
src/tools/clang/lib/Basic/Version.cpp
## -112,6 +112,9 ##
OS << LLVMRepo << ' ';
OS << LLVMRev << ')';
}
+ OS << " (";
+ OS << 'clang-703.0.31';
+ OS << ')';
return OS.str();
}
Finally build clang-700.0.81 or clang-703.0.31 with these arguments
cmake -G "Unix Makefiles" ../src -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=False -DCOMPILER_RT_INCLUDE_TESTS=False -DLLVM_USE_SANITIZER=Address
Fix me if I am wrong

How to get the SerialNumber of MAC Laptop in QT

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

grep: repetition-operator operand invalid

I have this regular express (?<=heads\/)(.*?)(?=\n) and you can see it working here
http://regexr.com?347dm
I need this regex to work in the grep command but I'm getting this error.
$ grep -Eio '(?<=heads\/)(.*?)(?=\n)' text.txt
grep: repetition-operator operand invalid
It works great in ack but I dont have ack on the machine I need to run this on.
ack text.txt -o --match '(?<=heads\/)(.*?)(?=\n)'
text.txt
74f3649af36984e1b784e46502fe318e91d29570 HEAD
06d4463ab47a6246e6bd94dc3b9267d59fc16c2e refs/heads/ARC
0597e13c22b6397a1b260951f9d064f668b26f08 refs/heads/LocationAge
e7e1ed942d15efb387c878b9d0335b37560c8807 refs/heads/feature/311-312-breaking-banner-updates
d0b2632b465702d840a358d0b192198ae505011c refs/heads/gulf-news
509173eafc6792739787787de0d23b0c804d4593 refs/heads/jbb-new-applicationdidfinishlaunching
1e7b03ce75b1a7ba47ff4fb5128bc0bf43a7393b refs/heads/locationdebug
74f3649af36984e1b784e46502fe318e91d29570 refs/heads/master
5d2ede384325877c24db7ba1ba0338dc7b7f84fb refs/heads/mixed-media
3f3b6a81dd3baea8744aec6b95c2fe4aaeb20ea3 refs/heads/post-onezero
4198a43aab2dfe72d7ae9e9e53fbb401fc9dac1f refs/heads/whitelabel
76741013b3b2200de29f53800d51dfd6dc7bac5e refs/tags/r10
fc53b1a05dad3072614fb397a228819a67615b82 refs/tags/r10^{}
afdcfd970c9387f6fda0390ef781c2776aa666c3 refs/tags/r11
grep does not support the (?<=...) or *? or (?=...) operators. See this table.
$ grep -Pio '(?<=heads\/)(.*?)(?=\n)' text.txt # P option instead of E
If you use GNU grep, you can use -P or --perl-regexp options.
In case you are using OS X, you need to install GNU grep.
$ brew install grep
Due to recent changes, to use GNU grep on macOS you either have to prepend the command with a 'g'
$ ggrep -Pio '(?<=heads\/)(.*?)(?=\n)' text.txt # P option instead of E
Or change the path name
Try this
grep -Eoh 'heads/.*' text.txt | grep -Eoh '/.*' | grep -Eoh '[a-zA-Z].*'

How can I have grep not print out 'No such file or directory' errors?

I'm grepping through a large pile of code managed by git, and whenever I do a grep, I see piles and piles of messages of the form:
> grep pattern * -R -n
whatever/.git/svn: No such file or directory
Is there any way I can make those lines go away?
You can use the -s or --no-messages flag to suppress errors.
-s, --no-messages suppress error messages
grep pattern * -s -R -n
If you are grepping through a git repository, I'd recommend you use git grep. You don't need to pass in -R or the path.
git grep pattern
That will show all matches from your current directory down.
Errors like that are usually sent to the "standard error" stream, which you can pipe to a file or just make disappear on most commands:
grep pattern * -R -n 2>/dev/null
I have seen that happening several times, with broken links (symlinks that point to files that do not exist), grep tries to search on the target file, which does not exist (hence the correct and accurate error message).
I normally don't bother while doing sysadmin tasks over the console, but from within scripts I do look for text files with "find", and then grep each one:
find /etc -type f -exec grep -nHi -e "widehat" {} \;
Instead of:
grep -nRHi -e "widehat" /etc
I usually don't let grep do the recursion itself. There are usually a few directories you want to skip (.git, .svn...)
You can do clever aliases with stances like that one:
find . \( -name .svn -o -name .git \) -prune -o -type f -exec grep -Hn pattern {} \;
It may seem overkill at first glance, but when you need to filter out some patterns it is quite handy.
Have you tried the -0 option in xargs? Something like this:
ls -r1 | xargs -0 grep 'some text'
Use -I in grep.
Example: grep SEARCH_ME -Irs ~/logs.
I redirect stderr to stdout and then use grep's invert-match (-v) to exclude the warning/error string that I want to hide:
grep -r <pattern> * 2>&1 | grep -v "No such file or directory"
I was getting lots of these errors running "M-x rgrep" from Emacs on Windows with /Git/usr/bin in my PATH. Apparently in that case, M-x rgrep uses "NUL" (the Windows null device) rather than "/dev/null". I fixed the issue by adding this to .emacs:
;; Prevent issues with the Windows null device (NUL)
;; when using cygwin find with rgrep.
(defadvice grep-compute-defaults (around grep-compute-defaults-advice-null-device)
"Use cygwin's /dev/null as the null-device."
(let ((null-device "/dev/null"))
ad-do-it))
(ad-activate 'grep-compute-defaults)
One easy way to make grep return zero status all the time is to use || true
→ echo "Hello" | grep "This won't be found" || true
→ echo $?
0
As you can see the output value here is 0 (Success)

Resources