Tuesday, February 25, 2020

POSTMAN - How to save a response field as a variable

In the "Tests" tab, use the code below:

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("myId", jsonData.id);

It will save the id field in the JSON response payload to the variable myId. The variable can be used in another request this way: {{myId}}

Friday, February 21, 2020

POSTMAN - How to use random number in the request

Just use the variable randomInt, for example:
In the request:
{
    "id": "{{$randomInt}}"
}

In the pre-request Script:
postman.setEnvironmentVariable("myId", "MY_ID_"+ _.random(1,99999));
console.log(postman.getEnvironmentVariable("myId"));
Read this link for more information: https://learning.postman.com/docs/postman/variables-and-environments/variables/

Monday, March 5, 2018

How to restart Oracle

Shutdown

$ sqlplus '/ as sysdba'
SQL> shutdown

Options:
shutdown - waits for sessions end
shutdown immediate - rollbacks and ends sessions (waits for rollback finish)
shutdown abort - kills everything - usually database has to perform some recovery on startup.

Startup

$ sqlplus '/ as sysdba'
SQL> startup

References:
https://dba.stackexchange.com/questions/42774/how-to-quickly-startup-shutdown-oracle-11
https://docs.oracle.com/cd/E17781_01/server.112/e18804/startup.htm#ADMQS124
https://www.cyberciti.biz/faq/how-do-i-start-oracle-service-in-unix/

Monday, February 5, 2018

How to enable Tomcat to list files

It is called Directory Listing.

Tomcat default web.xml must be changed: $CATALINA_BASE/conf/web.xml

<servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>
          org.apache.catalina.servlets.DefaultServlet
        </servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>


Reference: https://tomcat.apache.org/tomcat-7.0-doc/default-servlet.html

Friday, January 26, 2018

Create and extract a .tar.gz archive using command line


To create a tar.gz archive from a given folder you can use the following command:

tar -zcvf tar-archive-name.tar.gz source-folder-name

This will compress the contents of source-folder-name to a tar.gz archive named tar-archive-name.tar.gz

To extract a tar.gz compressed archive you can use the following command:

tar -zxvf tar-archive-name.tar.gz

This will extract the archive to the folder tar-archive-name.

To Preserve permissions:

tar -pcvzf tar-archive-name.tar.gz source-folder-name

Switch the ‘c’ flag to an ‘x’ to extract (uncompress):

tar -pxvzf tar-archive-name.tar.gz

Reference:
https://popoleodesigns.com/create-and-extract-a-tar-gz-archive-using-command-line/

Friday, January 19, 2018

How do I find all files containing specific text on Linux?

grep -rnw '/path/to/somewhere/' -e 'pattern'  
or

    grep -r YOUR_PATTERN .
or
find /path/to/somewhere -type f -exec grep -H 'text-to-find-here' {} \;

Reference:
https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux

Wednesday, December 26, 2012

1Z0-895 Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Exam


I passed in Oracle EJB Developer certification.

I studied the book EJB 3 In Action (http://www.amazon.com/EJB-3-Action-Debu-Panda/dp/1933988347). No need to study JPA chapters. The problem with this book is that it is about EJB 3 only, so it is necessary to study EJB 3.1 topics in another sources. This book is not so good, but it is starting point.

After reading the book I started doing mocks. I used Enthuware (http://enthuware.com/index.php/mock-exams/oracle-certified-expert/oceejbd-ejb-6). It is excellent and very similar as the exam.

As doubts were emerging during the mock I studied JSR 318 (http://jcp.org/en/jsr/detail?id=318). The JSR is not good to be used as initial source of learning, it is not a teaching document, but it is the best source of information.

The study method I have adopted is to learn by repetition. I did the initial mock and four standards mocks. For every mock, I did it by the first time, after reviewed all questions and then retraced the mock. The first time the grade was always low, but repeating grade was high.

The time it takes to make the mock by the first time is around 2 hours. The review needs 3 to 4 hours because that's when you really study. Repeating the mock takes 1 hour because you are already dominating the subject. It is important not to memorize the answers, but rather try to explain them.

To cover all topics of exam is necessary to make all the 4 standards mocks because the distribution of the questions is not 100%.

When finished doing the mocks, redid the questions I never hit (neither the first nor the repetition) for all mocks. It has a feature for this in Enthuware software.

I passed with 90% and I was pleased with the time spent to study.

Good luck in your studies.