PostGIS Queries and Cayenne - postgis

I have just started evaluating the use of Cayenne for use with my PostGIS database. I found the CayenneModeler extremely easy to use in order to generate the code for my persistent classes. I thought that using the Expression.fromString("...") would allow me to make an Expression using the PostGIS functions, but I receive a ExpressionParser error. Upon further reading, it looks like I may need a PostGIS database adapter. Does anyone know of the existence of one that can be downloaded freely or a way to get around this? Thanks so much.

looking at source, these are currently supported/shipped db adapters:
$ ls -l org/apache/cayenne/dba/ | grep ^d
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 db2
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 derby
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 frontbase
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 h2
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 hsqldb
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 ingres
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 mysql
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 openbase
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 oracle
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 postgres
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 sqlite
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 sqlserver
drwxr-xr-x 2 zeratul zeratul 4096 2010-11-11 16:15 sybase
Cayenne provides abstraction and adapters provider specific translation. So yes, you are right about needing it. You might want to extend PostgreSQL Adapter as PostGIS builds on Postgres.
If you know something about BNF, here is formal grammar of language that Expression parser recognizes.

Related

Choregraphe Software doesn't launch

I'm trying to install the choregraphe for robotics purpose .
I'm running Ubuntu 18.04 .
So i downloaded the choregraphe-suite-x.x-linux64-setup.run file from the official website . And then :
chmod +x choregraphe-suite-x.x-linux64-setup.run
sudo ./choregraphe-suite-x.x-linux64-setup.run
Then I followed the installation steps , i accepted the license agreement and followed the wizard steps .
But the software does not launch ..
What is the issue ?
I can't vouch for backwards compatibility, but was able to get the app to launch by addressing the reported error and adding a library link:
$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libz.so /opt/'Softbank
Robotics'/'Choregraphe Suite 2.5'/lib/libz.so.1
On Ubuntu 18.04, the error is:
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".
The culprit is this error message:
Cannot load library /opt/nao/plugins/platforms/libqxcb.so: (/opt/nao/bin/../lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))
The solution is to skip the shipped libz.so.1.2.8 in lib/ with symbolic links, like so:
abacus:/opt/nao/lib$ dir libz.so*
lrwxrwxrwx 1 root root 9 feb. 4 11:16 libz.so -> libz.so.1
lrwxrwxrwx 1 root root 31 feb. 4 11:15 libz.so.1 -> /lib/x86_64-linux-gnu/libz.so.1
-rwxr-xr-x 1 root root 105032 feb. 1 16:32 libz.so.1.2.8
lrwxrwxrwx 1 root root 15 feb. 1 16:32 libz.so.1.old -> ./libz.so.1.2.8
lrwxrwxrwx 1 root root 15 feb. 1 16:32 libz.so.old -> ./libz.so.1.2.8
and
abacus:/opt/nao/lib$ dir /lib/x86_64-linux-gnu/libz.so.1
lrwxrwxrwx 1 root root 14 mai 23 2017 /lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.11
With this linking, both Choregraphe and robot_settings should start up.

Cant start jetty from terminal - get error on start up

directory where the jetty is installed, i used brew install jetty
Vallis-MacBook-Pro:9.3.7.v20160115 ValliSA$ cd libexec/
Vallis-MacBook-Pro:libexec ValliSA$ ls -ltr
total 1208
drwxr-xr-x 60 ValliSA admin 2040 Jan 15 16:37 modules
drwxr-xr-x 8 ValliSA admin 272 Jan 15 17:04 demo-base
drwxr-xr-x 3 ValliSA admin 102 Jan 15 17:05 webapps
drwxr-xr-x 3 ValliSA admin 102 Jan 15 17:05 resources
drwxr-xr-x 3 ValliSA admin 102 Jan 15 17:05 bin
drwxr-xr-x 44 ValliSA admin 1496 Jan 15 17:05 lib
-rw-r--r-- 1 ValliSA admin 3978 Jan 15 17:05 start.ini
-rw-r--r-- 1 ValliSA admin 142605 Jan 15 17:06 start.jar
-rw-r--r-- 1 ValliSA admin 30012 Jan 15 17:06 license-eplv10-aslv20.html
drwxr-xr-x 50 ValliSA admin 1700 Jan 15 17:06 etc
-rw-r--r-- 1 ValliSA admin 428261 Jan 15 17:06 VERSION.txt
-rw-r--r-- 1 ValliSA admin 5 Feb 7 19:05 jetty.pid
drwxr-xr-x 4 ValliSA admin 136 Feb 7 19:05 logs
-rw-r--r-- 1 ValliSA admin 98 Feb 7 19:05 jetty.state
here is where i start jetty
Vallis-MacBook-Pro:libexec ValliSA$ java -jar start.jar
after executing start i get below exception and am not sure how to resolve the issue.
2016-02-07 19:06:08.794:INFO::main: Logging initialized #591ms
2016-02-07 19:06:08.892:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html
2016-02-07 19:06:09.134:INFO:oejs.Server:main: jetty-9.3.7.v20160115
2016-02-07 19:06:09.160:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///usr/local/Cellar/jetty/9.3.7.v20160115/libexec/webapps/] at interval 1
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:6 2)
I don't recommend installing Jetty and then trying to configure Solr into it (if that's indeed what you're trying to do), especially if you're using the latest version of Solr (5.4.1). As of 5.3, Solr is designed to be a standalone server. If, for some bizarre reason, you want to make things hard on yourself and put bits and pieces of Solr into Jetty when an official Solr download would already have this done for you, you need to go to, at the latest, 5.2.1. The only time I've seen people pick apart a Solr download is when using a different container, like Tomcat.
Not only that, but you shouldn't be using start.jar to start Solr. You should be using the scripts in bin/solr. I want to stress here that you're not starting Jetty in this situation, you're starting Solr.
Start here to be directed to the closest mirror for a Solr 5.4.1 download. Read the documentation or find a good tutorial and you'll have Solr doing what you want soon enough.
You shouldn't need to brew install jetty in this case.

Compiling C programs using libssl on OS X El Capitan?

I have a simple C program using libssl.
On Linux, I installed the openssl-dev package and compiled the program with the following line:
gcc test_libssl.c -o test_libssl -lcrypto -lssl
Now I would like to do the same on my Mac. The same line resulted in:
fatal error: 'openssl/conf.h' file not found
I tried installing openssl (openssl-dev did not work) with home-brew via brew install openssl
This gave me:
...
==> Installing openssl
==> Downloading https://www.openssl.org/source/openssl-1.0.2a.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
I found a related SO question with no answer.
I also tried
brew info openssl
and got informed that
This formula is keg-only.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
What do I have to do / install in order to be able to compile libssl-using C programs programs on OS X?
Or, is it a bad idea the first place (given the warning above)?
UPDATE:
I got the openssl installed using brew. I am not sure if this was the problem but I updated brew.
Taking brew's advice
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
and this issue into account.
Then, following #Alex Reynolds's advice, I compiled it successfully with
gcc test_libssl.c -o test_libssl -lssl -lcrypto -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include
I have Homebrew installed on El Capitan (10.11.1) and have installed a current version of OpenSSL with no apparent ill effects:
$ uname -a
Darwin hostname.local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
$ brew info openssl
openssl: stable 1.0.2d (bottled)
OpenSSL SSL/TLS cryptography library
https://openssl.org/
This formula is keg-only.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
/usr/local/Cellar/openssl/1.0.2d_1 (464 files, 17M)
Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/openssl.rb
==> Dependencies
Build: makedepend ✔
==> Options
--universal
Build a universal binary
--without-check
Skip build-time tests (not recommended)
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
Have you tried adding the flags that it suggests to your app's build statement? You might edit your app's makefile or other build statement and add those entries, after a brew install openssl. This may help your compiler find and link the library and header files it needs.
Looks like everything is there. Here are headers:
$ ls -al /usr/local/opt/openssl/include/openssl/
total 3688
drwxr-xr-x 77 alexpreynolds admin 2618 Aug 24 13:46 .
drwxr-xr-x 3 alexpreynolds admin 102 Aug 24 13:46 ..
-rw-r--r-- 1 alexpreynolds admin 6182 Aug 24 13:46 aes.h
-rw-r--r-- 1 alexpreynolds admin 63142 Aug 24 13:46 asn1.h
-rw-r--r-- 1 alexpreynolds admin 24435 Aug 24 13:46 asn1_mac.h
-rw-r--r-- 1 alexpreynolds admin 34475 Aug 24 13:46 asn1t.h
-rw-r--r-- 1 alexpreynolds admin 38566 Aug 24 13:46 bio.h
-rw-r--r-- 1 alexpreynolds admin 5351 Aug 24 13:46 blowfish.h
...
And static and dynamic libraries:
$ ls -al /usr/local/opt/openssl/lib
total 11664
drwxr-xr-x 10 alexpreynolds admin 340 Aug 24 13:46 .
drwxr-xr-x 11 alexpreynolds admin 374 Aug 24 13:46 ..
drwxr-xr-x 14 alexpreynolds admin 476 Aug 24 13:46 engines
-r--r--r-- 1 alexpreynolds admin 1861780 Aug 24 13:46 libcrypto.1.0.0.dylib
-r--r--r-- 1 alexpreynolds admin 3206344 Aug 24 13:46 libcrypto.a
lrwxr-xr-x 1 alexpreynolds admin 21 Aug 24 13:46 libcrypto.dylib -> libcrypto.1.0.0.dylib
-r--r--r-- 1 alexpreynolds admin 364144 Aug 24 13:46 libssl.1.0.0.dylib
-r--r--r-- 1 alexpreynolds admin 524424 Aug 24 13:46 libssl.a
lrwxr-xr-x 1 alexpreynolds admin 18 Aug 24 13:46 libssl.dylib -> libssl.1.0.0.dylib
drwxr-xr-x 5 alexpreynolds admin 170 Aug 24 13:46 pkgconfig
The answer of #Alex Reynolds is correct, but if you want to compile/configure someone else's program, then you can run this beforehand:
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include

Difference between curl/curl.h, libcurl, libcurl4-openssl-dev, libcurl4-nss-dev libraries?

i had the following curl headers, and i still could install the libcurl4 packages mentioned above-
kafka#metamorphosis:~$ ll /usr/include/curl/
total 200
drwxr-xr-x 2 root root 4096 Jan 16 13:29 ./
drwxr-xr-x 51 root root 20480 Jan 16 13:29 ../
-rw-r--r-- 1 root root 7303 Dec 18 01:11 curlbuild.h
-rw-r--r-- 1 root root 83928 Dec 18 01:11 curl.h
-rw-r--r-- 1 root root 8934 Dec 18 01:11 curlrules.h
-rw-r--r-- 1 root root 2741 Dec 18 01:11 curlver.h
-rw-r--r-- 1 root root 3472 Dec 18 01:11 easy.h
-rw-r--r-- 1 root root 2790 Dec 18 01:11 mprintf.h
-rw-r--r-- 1 root root 13836 Dec 18 01:11 multi.h
-rw-r--r-- 1 root root 1330 Dec 18 01:11 stdcheaders.h
-rw-r--r-- 1 root root 36918 Dec 18 01:11 typecheck-gcc.h
How are libcurl4-openssl-dev and libcurl4-nss-dev different from each other and from these curl.h files?
i noticed the following files after i installed the two packages using apt-get in ubuntu-
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0
/usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.la
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.a
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libcurl.pc
Now if i have a program with a line like- #include<curl/curl.h> , how do i go about compiling it?
gcc -L /usr/include/curl/ -lcurl nginx-isolated.c doesn't seem to work.
The different libcurl4-*-dev packages are libcurl built to use different TLS backends. They all still provide (almost) the same API. They are mutually exclusive and you link with libcurl with "-lcurl" no matter which of these packages you install.
curl/curl.h is a header file and is the same no matter which TLS backend you use.
libcurl is the name of the library.
When you communicate using HTTPS, FTPS or other TLS-using servers using certificates that are signed by CAs present in the store, you can be sure that the remote server really is the one it claims to be. this way you validate trust sites.
LibCurl have three flavours of TLS Backends.
Certificate Verification with NSS
Certificate Verification with OpenSSL
Certificate Verification with GnuTLS
The three of them are libraries for establish a secure link and validate trust CA Certificates but each library has is own features, pros and cons.
OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
GnuTLS is a secure communications library implementing the SSL, TLS and DTLS protocols and technologies around them. It provides a simple C language application programming interface (API) to access the secure communications protocols as well as APIs to parse and write X.509, PKCS #12, and other required structures.
Network Security Services (NSS) is a set of libraries designed to support cross-platform development of security-enabled client and server applications. Applications built with NSS can support SSL v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security standards.
Something very important is that when programming you must select a single library to work with since it is not possible to combine them.

Separate location for bin and conf folder in tomcat

Is there a way to change tomcat's conf folder location to something other than next to bin?
Original:
Tomcat - bin
conf
temp
lib
webapp
FolderABC -
Expected:
Tomcat - bin
temp
webapp
FolderABC -
- conf -- server.xml
-- other files
I think you have only one possibility to do something like that without patching tomcat:
Use symbolic links to redirect the conf directory to your chosen directory:
If you use linux/macos something like this should work (not that much experience with windows, sorry)
mv conf FolderABC/conf
ln -s FolderABC/conf conf
Here is a listing of /usr/share/tomcat6 from my fedora core system:
drwxr-xr-x. 2 root root 4096 May 16 09:51 bin
lrwxrwxrwx. 1 root tomcat 12 May 16 09:51 conf -> /etc/tomcat6
lrwxrwxrwx. 1 root tomcat 23 May 16 09:51 lib -> /usr/share/java/tomcat6
lrwxrwxrwx. 1 root tomcat 16 May 16 09:51 logs -> /var/log/tomcat6
lrwxrwxrwx. 1 root tomcat 23 May 16 09:51 temp -> /var/cache/tomcat6/temp
lrwxrwxrwx. 1 root tomcat 24 May 16 09:51 webapps -> /var/lib/tomcat6/webapps
lrwxrwxrwx. 1 root tomcat 23 May 16 09:51 work -> /var/cache/tomcat6/work

Resources