Friday, August 17, 2012

openindiana zfs nfs share root

Server

sharectl set -p nfsmapid_domain=your.domain nfs

zfs create rpool/nfsshare

zfs set sharenfs=rw,root=client.your.domain  rpool/nfsshare

sharectl get nfs

dfshares


Client

sharectl set -p nfsmapid_domain=your.domain

mount -F nfs -overs=4,rw server.your.domain:/mnt/nfsshare /mnt/nfs


Note

root=client.your.domain

if I use the IP address it doesn't work (?)



nfs mount: mount: /mnt/nfs: Permission denied
touch: cannot create /mnt/nfs/aaa: Permission denied

Tuesday, August 14, 2012

MDM^T02 with embedded PDF HL7 message sample

MSH|^~\&|PROSOLV|XYZHOSPITAL|SYSTEM|XYZHOSPITAL|200801311600||MDM^T02|PS1-20080131160038|P|2.5
EVN|T10|200801311600
PID|1|987654321|987654321||PROSOLV^SAMPLE||19721201|M||||||||||10000001|111-22-3333
PV1|1|I|CCU^2000^1|||CCU^2003^1|1234^HIPPOCRATES^KOS|9099^KEVORKIAN^JACK|8888^HOUSE^GREGORY||||||||||10000001
ORC|SC|00012345|1-1
OBR|1|00012345|1-1|02585^TransthoracicEcho^PCV4|||20080131155500|||||||||||||||200801311600|||F||||||796.4^^I9M~786.09^^I9M~414.8^^I9M||||54321^Doctorovich^Ivan^
TXA|1|DI|TX|200801311555||200801311600|||IvanDoctorovich|||1.2.840.317.5947431.51.20080131160038|1.2.840.317.5947431.51.20080131155715|00012345|1-1||AU|||||54321^Doctorovich^Ivan^^^^^^^^^^^^200801311600
OBX|1|HD|113014^DICOM Study^DCM||1.2.840.317.5947431.51||||||O
OBX|2|ED|02585^TransthoracicEcho^PCV4||^Application^PDF^Base64^Single_Line_base64_encoded_PDF||||||F


The Single_Line_base64_encoded_PDF, must be a base64 encoded PDF string, in a single line, i.e. the result of this linux command

base64 -w 0 document.pdf

Monday, August 13, 2012

Openindiana: Too many authentication failures

From an Openindiana host, and connecting to some Linux hosts, often I receive this error from the ssh client

Received disconnect from 10.11.12.13: 2: Too many authentication failures for yourfuckingusername

The fact is that ssh try to first authenticate using keys, and if you have many keys he tries every one of them, so... maybe the server or the Openindiana (I've never seen this problem on Mac OS X, in example) ssh command exit after two or three failed keys authentication.

The solution is to use PubkeyAuthentication options in the ssh command

ssh -oPubkeyAuthentication=no 10.11.12.13

Or to edit ~/.ssh/conf file

Host 10.11.12.13
    PubkeyAuthentication=no

Can't load log handler *.FileHandler

Starting Tomcat (installed from binary http://tomcat.apache.org/download-60.cgi, on a CentOS 5.5 server), I was getting an error like this in ''catalina.out''

Can't load log handler "4host-manager.org.apache.juli.FileHandler"


This was because I set ''JAVA_OPTS'' at the end of the startup script ''catalina.sh'', overwriting all the default ''JAVA_OPTS''...

So the solution is (obviously):

JAVA_OPTS="blablabla $JAVA_OPTS"

Install additional fonts (like Arial) in Openoffice

Download webfonts form http://www.freedesktop.org/software/fontconfig/webfonts/

Unpack it

Open each desired font file (like arial32.exe) with Archive Manager and extract font files to a temp directory.

Select all desired TTF files and open them with Font viewer.

In the bottom right of the application window, click on "Install Font"

Files will be copied under ~/.fonts/ directory.

Then, use Openoffice "Printer Administration" to add new fonts.
Files will be placed under ~/.openoffice.org/3/user/fonts

Cycling date in bash

Maybe you want to cycle a time frame from a day to another, taking in consideration how many days a month have (also for leap years). Here is how you can do in bash.

Date format is: YYYYMMDD

#!/bin/bash

b=$1
e=$2

while [ "$b" -le "$e" ]
do
   echo $b
   b=$(date +%Y%m%d -d "$b +1 day")
done




Execute it

./loopdate.sh 20090101 20090301


Result

20090101
20090102
...
20090226
20090227
20090228
20090301


It works on Linux, and using gdate (from opencsw, blastwave) on Solaris. On Mac OS X it doesn't work.

How to install Apache Tomcat Native library on CentOS 5.5

If you see this in your tomcat log

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
/usr/java/jdk1.6.0_24/jre/lib/amd64/server:/usr/java/jdk1.6.0_24/jre/lib/amd64:/usr/java/jdk1.6.0_24/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

Do so:

yum install apr-devel

Download package from http://tomcat.apache.org/download-native.cgi

cd tomcat-native-1.1.20-src/jni/native/

You must have java installed (I use sun-java). Since you are using tomcat, it is already installed, isn't it?

./configure --with-apr=/usr/bin/apr-1-config

In any case you will get (I don't know, I've not investigated)

configure: error: can't locate a valid JDK location

btw

./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/java/jdk1.6.0_24

make

su -

make install

At this point you must inform tomcat where this library is located

We can add
-Djava.library.path=/usr/local/apr/lib
to JAVA_OPTS in the catalina.sh script

or add
export LD_LIBRARY_PATH="/usr/local/apr/lib"
at the begginning of the same script

Friday, August 10, 2012

JAVA cache at System Level

It could be useful to avoid that each user, on a multiuser operating system, have own java cache under his home directory, i.e. a corporate application used by each user. Every time the jnlpi is upgraded, every user have to download the new version in his home directory cache.

Using system level cache, only the first user launching the jnlpi will download the java application in the cache.


vi /usr/java/jre/lib/deployment.config

deployment.system.config file:/etc/java/deployment.properties

vi /etc/java/deployment.properties
deployment.system.cachedir /var/tmp/java/wscache
deployment.system.security.trusted.certs /var/tmp/java/security/trusted.certs

mkdir /var/tmp/java
mkdir /var/tmp/java/wscache


Warning. There will be problems with write and read permission on such directory...