Monday, April 19, 2021

Oracle Apex Date Picker to Text Field Dynamic Action PLsql

 DECLARE

  V VARCHAR2(10):='';

  vAttdt date;

BEGIN

  vAttdt := :p44_attdt;

  :P44_ATTDT2:=TO_CHAR(VaTTDT,'RRRRMMDD');

END;








Jasper Soft Character to Date conversion in Expression Editor


click [..] to go to Expression Editor.

new SimpleDateFormat("yyyyMMdd").parse($P{P_ATTDT})

$P{P_ATTDT}    ------------ > This is the Parameter or field.

Note : Month should be in MM format not in mm Format. 

e.g.  new SimpleDateFormat("yyyyMMdd").parse($P{P_ATTDT})

enjoy !!!


Friday, April 9, 2021

How to enable/disable ssh login through putty

Some time you may want to disable login through putty by the port 22 SSH. You have to reboot the pc after disable sshd. Then add the firewall ports. Start listener. Restart tomcat and start Apache.

Step 1 : Enable or disable sshd in vultr.com console after login

---- systemctl enable sshd

systemctl disable sshd

Step 2 : Restart the server.

init 6

Step 3 : Add firewall rules:

firewall-cmd --zone=public --add-port=80/tcp

firewall-cmd --zone=public --add-port=443/tcp

firewall-cmd --zone=public --add-port=1510/tcp

firewall-cmd --zone=public --add-port=1539/tcp

Step 3: Start listener :

. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

lsnrctl start

Step 4 : Restart tomcat :

cd /usr/local/tomcat/bin

./shutdown.sh 

./startup.sh

Step 5 : Start Apache :

sudo systemctl start httpd


Tuesday, April 6, 2021

How to integrate Jasper Report in Linux

cd /opt/oracle/apex

copy jri-2.7.0-jasper-6.16.0.zip to /opt/oracle/apex ---- By SSH Secure file transfer

Download : https://github.com/daust/JasperReportsIntegration/releases

unzip jri-2.7.0-jasper-6.16.0.zip

mv jri-2.7.0-jasper-6.16.0 jri


cd /opt/oracle/apex/jri

mkdir conf

mkdir logs

mkdir reports


cd /opt/oracle/apex/jri/bin


chmod +x setConfigDir.sh


cd /opt/oracle/apex


mkdir rep


cd /opt/oracle/apex/jri/bin


chmod +x setConfigDir.sh


chmod +x /opt/oracle/apex/jri


./setConfigDir.sh /opt/oracle/apex/jri/webapp/jri.war /opt/oracle/apex/jri


cd /opt/oracle/apex/jri/conf


192.168.1.1


vi application.properties

---- Change IP Address, Port, DB, Username and password.

cp /opt/oracle/apex/jri/webapp/jri.war /usr/local/tomcat/webapps/


cd /usr/local/tomcat/bin


./shutdown.sh 

./startup.sh


Copy Reports to : (.jasper)

/opt/oracle/apex/jri/reports

Javascript :

var report_server = "http://localhost:8080/jri/report?";

var report_name = "dept";
var report_format = "pdf";
var data_source = "default";

var run_report=""+report_server+"&_repName="+report_name+"&_repFormat="+report_format+"&_dataSource="+data_source+"";

window.open(run_report);

Javascript with parameter :

var report_server = "http://localhost:8080/jri/report?";

var report_name = "dept_param";
var report_format = "pdf";
var data_source = "default";

var ap_1 = $v("P3_DEPT");
var rp_1 = "&P_DEPT";

var param = ""+rp_1+"="+ap_1+"";

var report=""+report_server+"&_repName="+report_name+"&_repFormat="+report_format+"&_dataSource="+data_source+"";

var run_report = ""+report+""+param+"";

window.open(run_report);

Saturday, April 3, 2021

How to Install SSL Certbot of LetsEncrypt

 How to Install SSL Certbot of LetsEncrypt :


vi /usr/local/tomcat/conf/server.xml

-- Change tomcat port to : 1610

cd /usr/local/tomcat/bin


./shutdown.sh 

./startup.sh


firewall-cmd --zone=public --add-port=1610/tcp

firewall-cmd --zone=public --add-port=443/tcp

sudo systemctl start httpd

cd /etc/httpd/conf.d

vi 10-apex.conf

<VirtualHost *:80>

    ServerName example.com

    ServerAlias www.example.com

    Redirect Permanent / https://example.com

    ProxyRequests On

    <Proxy *>

            Order deny,allow

            Allow from all

    </Proxy>

    <Location />

            ProxyPreserveHost on

            RequestHeader unset Origin

            ProxyPass http://192.168.1.1:1610/

            ProxyPassReverse http://192.168.1.1:1610/

    </Location>

RewriteEngine on

RewriteCond %{SERVER_NAME} =example.com [OR]

RewriteCond %{SERVER_NAME} =www.example.com [OR]

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>


sudo yum install epel-release

sudo yum install certbot python2-certbot-apache mod_ssl

sudo certbot --apache -d example.com

Check the Status :

https://www.ssllabs.com/ssltest/analyze.html?d=example.com

--- Add Auto Renewal at crontab :

sudo crontab -e

-- Add this line at crontab

0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew

sudo certbot renew --dry-run

vi /etc/hosts

192.168.0.1 example.com
192.168.0.1 www.example.com