How to add two files? - file

How can I have two files in the same .sh file of mine? I have two files:
create.sql,
update.sql.
I am trying to use something like this:
psql \
-X \
-U "User" \
-h "$Host" \
--dbname "$DB" \
-f /create.sql \
-f /update.sql \
Is it correct to write like this?
Or Do I need to use \i for entering two files? How can I do that?
Thanks

Related

Writting dockerfile file for installation of opencv

I'm writting a dockerfile to install the C version of opencv.
I have found a working solution for the python version, which looks like this.
FROM python:2.7
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Various Python and C/build deps
RUN apt-get update && apt-get install -y \
wget \
build-essential \
cmake \
git \
unzip \
pkg-config \
python-dev \
python-opencv \
libopencv-dev \
libav-tools \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libgtk2.0-dev \
python-numpy \
python-pycurl \
libatlas-base-dev \
gfortran \
webp \
python-opencv \
qt5-default \
libvtk6-dev \
zlib1g-dev
# Install Open CV - Warning, this takes absolutely forever
RUN mkdir -p ~/opencv cd ~/opencv && \
wget https://github.com/opencv/opencv/archive/3.0.0.zip && \
unzip 3.0.0.zip && \
rm 3.0.0.zip && \
mv opencv-3.0.0 OpenCV && \
cd OpenCV && \
mkdir build && \
cd build && \
cmake \
-DWITH_QT=ON \
-DWITH_OPENGL=ON \
-DFORCE_VTK=ON \
-DWITH_TBB=ON \
-DWITH_GDAL=ON \
-DWITH_XINE=ON \
-DBUILD_EXAMPLES=ON .. && \
make -j4 && \
make install && \
ldconfig
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
My problem is that I don't know to change it to install the C version. Do I really need to put the whole installation procedure as written here? I don't need the newest version. 3.x would be awesome.
Any ideas are welcome!

How to encode a query in CURL Command Line when passing a query as a sql parameter

I am trying to query via CURL command line but I believe I need to encode it.
Example:
curl -X GET -H "Authorization:c02c66a4531a43c5a0971d16c2823e1a" 'http://127.0.0.1:8050/api/core/query?sql=select n return n limit 10' -i
I don't ever see why this is a good idea, but here is a curl with an encoded match(n) return n limit 10' -i:
curl -X GET \
http://127.0.0.1:8085/api/core/query \
-H 'Authorization: c02c66a4531a43c5a0971d16c2823e1a' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'sql=match(n)%20return%20n%20limit%2010'\''%20-i'

Directadmin php 7 with MsSQL extension

i have searched a lot on the internet and tried all tutorials.
But i am not able to install Directadmin with PHP7 and MsSql extention
i am using CentOs 7 + Directadmin + php7.0
Can anyone please help ?
The following tutorial will walk you through enabling extensions
https://help.directadmin.com/item.php?id=252
Custombuild]# more configure/ap2/configure.php70
#!/bin/sh
./configure \
--with-apxs2 \
--with-config-file-scan-dir=/usr/local/lib/php.conf.d \
--with-curl=/usr/local/lib \
--with-gd \
--enable-gd-native-ttf \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
-with-mysqli=mysqlnd \

Chinese text incorrectly identified as Portuguese

When I pass a snippet of Chinese text to the IBM Watson language detection method, the text is incorrectly identified as pt -- Portuguese:
curl -X POST -d "outputMode=json" \
"https://gateway.watsonplatform.net/language-translation/api/v2/identify" \
--data-urlencode "text=中国的工厂" \
--header "content-type: text/plain" \
--user "MY_USERNAME:MY_PASSWORD"
Am I encoding the text wrong, or doing something else wrong?
Or are IBM Watson's language identification models not useful in some cases, with Portuguese being returned as some kind of default?
You are referring to the old deprecated service. I am actually surprised that you got any result. The API for the current service record that you should be using is documented here - https://www.ibm.com/watson/developercloud/language-translator/api/v2/?curl#identify
The sample curl command is:
curl -u "{username}":"{password}" \
-H "content-type: text/plain" \
-H "accept: application/json" \
-X POST \
-d "this is a test" \
"https://gateway.watsonplatform.net/language-translator/api/v2/identify"

Autotools not installing directories (appends ./ to directories only)

I am working with autotools to install several doc directories, however, it is adding an unneeded prefix to the directories in question:
I run
autoreconf -f;automake; ./configure; make; sudo make install
Error:
test -z "/usr/local/share/opendiameter/docs" || /bin/mkdir -p "/usr/local/share/opendiameter/docs"
/usr/bin/install -c -m 644 docs/msvc-solution-usage.txt docs/development_policy.txt docs/coding_style.txt docs/bugtracking-diagram.pdf ./docs/framework/ ./docs/libdiameter ./docs/libdiametereap ./docs/libdiameternasreq ./docs/libdiametermip4 ./docs/libeap ./docs/libpana ./docs/nasreq opendiameter.kdevelop tools/getopt.patch tools/getopt1.patch autogen.sh RELEASE README '/usr/local/share/opendiameter/docs'
/usr/bin/install: omitting directory `./docs/framework/'
/usr/bin/install: omitting directory `./docs/libdiameter'
/usr/bin/install: omitting directory `./docs/libdiametereap'
/usr/bin/install: omitting directory `./docs/libdiameternasreq'
/usr/bin/install: omitting directory `./docs/libdiametermip4'
/usr/bin/install: omitting directory `./docs/libeap'
/usr/bin/install: omitting directory `./docs/libpana'
/usr/bin/install: omitting directory `./docs/nasreq'
</code>
And here is the Makefile.am - NOTE that I have tried $(top_srcdir) as a prefix to the docs/
docdir = $(prefix)/share/opendiameter/docs
doc_DATA = docs/msvc-solution-usage.txt \
docs/development_policy.txt \
docs/coding_style.txt \
docs/bugtracking-diagram.pdf \
docs/framework/ \
docs/libdiameter \
docs/libdiametereap \
docs/libdiameternasreq \
docs/libdiametermip4 \
docs/libeap \
docs/libpana \
docs/nasreq \
opendiameter.kdevelop \
tools/getopt.patch \
tools/getopt1.patch \
autogen.sh \
RELEASE \
README
SUBDIRS_LIBS = libodutl \
libdiamparser \
libdiameter \
libdiametermip4 \
libeap \
libpana \
libdiametereap \
libdiameternasreq
SUBDIRS_APPS = applications
SUBDIRS_DOCS = docs
SUBDIRS = $(SUBDIRS_LIBS) $(SUBDIRS_APPS)
DIST_SUBDIRS = $(SUBDIRS_LIBS) $(SUBDIRS_APPS) $(SUBDIRS_DOCS)
includedir = $(prefix)/include/opendiameter
include_HEADERS = $(top_srcdir)/include/framework.h \
$(top_srcdir)/include/aaa_parser_api.h \
$(top_srcdir)/include/aaa_global_config.h \
$(top_srcdir)/include/aaa_dictionary_api.h \
$(top_srcdir)/include/aaa_parser_defs.h \
$(top_srcdir)/include/resultcodes.h
dist-hook:
rm -rf `find $(distdir) -name CVS`
You are assuming that _DATA knows how to deal with directories. It does not. It deals with files.
I'm assuming that you want the directory structure kept in the install.
In order to layout a directory structure you'll need to do something like this for each directory:
docdir = $(datadir)/opendiameter/docs
docframeworkdir = $(docdir)/framework
dist_doc_DATA = docs/msvc-solution-usage.txt \
...
dist_docframework_DATA = \
docs/framework/foo \
docs/framework/bar
Basically, you need to create a destination installation directory (like docframeworkdir)
and list out the files in it (like dist_docframework_DATA). If the toplevel (e.g. docs/framework) directories also contain directories (e.g. docs/framework/nest), you'll need to create destinations for those also if the have files you want to install.
If this is too tedious, you can write an install data hook to copy directories, which might be easier.
If you don't want the directory structure, you can add the list of files in docs to dist_doc_DATA. You can also write an install data hook for this as well.

Resources