copy (select * from shared_db.dt_process where process_name = 'AM_PARTITION') to '/tmp/shared_db__dt_process.csv' delimiter ',' csv header;Import
copy shared_db.dt_process from '/tmp/shared_db__dt_process.csv';
copy (select * from shared_db.dt_process where process_name = 'AM_PARTITION') to '/tmp/shared_db__dt_process.csv' delimiter ',' csv header;Import
copy shared_db.dt_process from '/tmp/shared_db__dt_process.csv';
cd /usr/local/share
tar xvfz /media/host/jdk-8u60-linux-x64.tar.gz
ln -s jdk1.8.0_60 jdkalternatives --install /usr/bin/java java /usr/local/share/jdk/bin/java 1
alternatives --install /usr/bin/javac javac /usr/local/share/jdk/bin/javac 1
alternatives --install /usr/bin/jar jar /usr/local/share/jdk/bin/jar 1setxkbmap -layout fr -model macintosh
vi /share/CACHEDEV1_DATA/homes/dnsomatic/dnsomatic.sh
#!/bin/sh
HOSTNAME="all.dnsomatic.com"
USER="my_dnsomatic_user"
PASS="my_dnsomatic_password"
TMPFILE="/tmp/dnsomatic.oldip"
DATENOW=$(date)
IP=$(/sbin/curl -s http://myip.dnsomatic.com)
if [ -r "/tmp/dnsomatic.oldip" ]; then
OLDIP=`cat /tmp/dnsomatic.oldip`
if [ "$OLDIP" = "$IP" ]; then
echo "IPs match; no update"
exit 0
else
RETURN=$(/sbin/curl -s -m 60 -k -u ${USER}:${PASS} https://updates.dnsomatic.com/nic/update?hostname=${HOSTNAME}&myip=$IP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG)
echo "Return message of DNS-O-Matic : " $RETURN
echo $RETURN | grep "good" > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo $IP > /tmp/dnsomatic.oldip
else
echo "" > /tmp/dnsomatic.oldip
fi
fi
else
touch /tmp/dnsomatic.oldip
fi
Then update crontab to run it once an hour:
vi /etc/config/crontab
0 */1 * * * /share/CACHEDEV1_DATA/homes/dnsomatic/dnsomatic.sh >/tmp/dnsomatic.log 2>&1
crontab /etc/config/crontab
/etc/init.d/crond.sh restart
select * into archive.radius_cdr_pdp_p2015_07_09 from ods_db.radiucdr_pdp_p2015_07_09;
select pg_get_functiondef(pg_proc.oid) from pg_proc, pg_namespace where proname = 'add_cdr_req' and pg_namespace.oid = pg_proc.pronamespace and pg_namespace.nspname = 'crm_db';
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel
# cd to libevent2 src
./configure --prefix=/usr/local
make && make install
# cd to tmux src
LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local
make && make install
# you're good to go, for a sample ~/.tmux.conf check out
# https://github.com/sturadnidge/misc/blob/master/.tmux.conf
set -g status-left '#{pane_current_path} '
sub handler {
my ($i_request_rec) = @_;
@{$i_request_rec->pnotes}{'err_txt', 'err_content_type'} = ('appid=45465&status=-42', 'application/x-www-form-urlencoded; charset=utf-8');
$i_request_rec->custom_response(Apache2::Const::SERVER_ERROR, '/error_vas/');
return Apache2::Const::SERVER_ERROR;
}
Apache conf.:
<Location /error_vas/>
SetHandler perl-script
PerlResponseHandler Toto::ErrorVas
</Location>
ErrorVas.pm:
package Toto::ErrorVas;
use strict;
use warnings;
use Apache2::Const -compile => qw(:common :log);
sub handler {
my ($i_request_rec) = @_;
return Apache2::Const::NOT_FOUND unless $i_request_rec->prev;
$i_request_rec->content_type($i_request_rec->prev->pnotes->{err_content_type});
$i_request_rec->print($i_request_rec->prev->pnotes->{err_txt});
return Apache2::Const::OK;
}
source: http://foertsch.name/ModPerl-Tricks/custom-content_type-with-custom_response.shtml
perl -MData::Dumper -e '@{$h}{qw/toto tata/} = (34, 56); print Dumper $h;'
$VAR1 = {
'tata' => 56,
'toto' => 34
};
local @LWP::Protocol::http::EXTRA_SOCK_OPTS = (
PeerAddr => $my_hostname,
MultiHomed => 1,
);
my $ua = LWP::UserAgent->new;
my $response = $ua->post("https://$my_hostname/action",
Content_Type => 'application/x-www-form-urlencoded; charset=utf-8',
Content => {
param1 => 'value1',
param2 => 'value2',
});
$a = '.63';
echo (float) $a;
source: http://stackoverflow.com/questions/4284571/php-oci-oracle-and-default-number-format
REGEXP_REPLACE(TO_CHAR(x), '^\.', '0.')or if we handle negative numbers
REGEXP_REPLACE(TO_CHAR(x), '(-?)^\.', '\10.')
<td> <input type="checkbox" name="cb[]"/> <input type="checkbox" name="cb[]"/> </td>
<td> <input type="hidden" name="cb[0]" value=""/> <input type="checkbox" name="cb[0]"/> <input type="hidden" name="cb[1]" value=""/> <input type="checkbox" name="cb[1]"/> </td>
<td> <input type="checkbox" name="cb[0]"/> <input type="checkbox" name="cb[1]"/> </td>
$post_array = $_POST['cb'];
$defaults = array_fill(0, 2, '0');
$post_array = $post_array + $defaults;
db=# select array_to_string(array['a', 'b', 'c'], '-'); array_to_string ----------------- a-b-c (1 row)