Monday, 28 September 2015

Simple steps to convert DOC to PDF

To convert DOC to PDF, we try to find the apps/online though this functionality is there in Microsoft word only :)

Basic thing is to find Create PDF/XPS Document option from menu.

To get this option there are multiple ways, one of them is

1) Open the Word doc.
2) Go to File menu >> Save and Send >> File Types >> Create PDF/XPS Document >> Create PDF/XPS
3) Click on it and save the PDF file with name as you need.
And we are done.

Please find below image for reference.


Wednesday, 23 September 2015

Oracle Jobs

Creating a oracle to job :

BEGIN

DBMS_SCHEDULER.create_job (    job_name        => 'Test_create_job',    

job_type        => 'PLSQL_BLOCK',    

job_action      => 'BEGIN DBMS_STATS.gather_schema_stats(''SCOTT''); END;',-- job action will be procedure which you want to invoke    

start_date      => SYSTIMESTAMP,    

repeat_interval => 'freq=hourly; byminute=0',    

end_date        => NULL,    

enabled         => TRUE,    

comments        => 'Job defined entirely by the CREATE JOB procedure.');

END;

Note : There are many other values for repeat_interval

Stop the Job:

BEGIN

DBMS_SCHEDULER.stop_job (job_name => 'Test_create_job');

END;

Drop the job :

BEGIN  

DBMS_SCHEDULER.drop_job (job_name => 'Test_create_job');

END;

Enable job:

BEGIN

DBMS_SCHEDULER.enable (name => 'Test_create_job');

END;

Disable he job:

BEGIN

DBMS_SCHEDULER.disable (name => 'Test_create_job');

END;

Update any job attribute :
BEGIN
DBMS_SCHEDULER.set_attribute (
    name      => 'Test_create_job',
    attribute => 'repeat_interval',
    value     => 'freq=hourly; byminute=30');
END;

You can check details of the job using follwoing query :

SELECT OWNER, JOB_NAME, JOB_CREATOR, START_DATE, NEXT_RUN_DATE, ENABLED, STATE,REPEAT_INTERVAL FROM dba_scheduler_jobs ds;

Tuesday, 22 September 2015

Custom Logging Appender for log4j version 2 based xml

Requirement :
To have our custom appender where we can play with the log files(names, size etc) which we want to create.

Solution :
Create our own appender and use it to get log files.

Used Tech :
1) log4j-api-2.2.jar
2) log4j-core-2.2.jar

Path where to put XML:
Xml under "WEB-INF\classes\" folder of  custom war.

Log4j XML file:
Please find the path for "log4j2.xml"
https://drive.google.com/open?id=0BwyaWKtCo9z7NUJwbEVaY3pIRjg

Custom Plugin(Java File) created: "LogCustomRollingFileAppender.java"
Java file which is customized version of our plugin. 
https://drive.google.com/open?id=0BwyaWKtCo9z7aEpXSExGZ29TMFU