Thursday, September 13, 2018

Read S3 file from AWS lambda NodeJS

var AWS = require('aws-sdk');
var s3 = new AWS.S3();

exports.handler = function(event, context, callback) {

    // Retrieve the bucket & key for the uploaded S3 object that
    // caused this Lambda function to be triggered
    // var src_bkt = event.Records[0].s3.bucket.name;
    // var src_key = event.Records[0].s3.object.key;
   
    var src_bkt = "app-proc-results";
            var src_key = "app.csv";
       

    // Retrieve the object
    s3.getObject({
        Bucket: src_bkt,
        Key: src_key
    }, function(err, data) {
        if (err) {
            console.log(err, err.stack);
            callback(err);
        } else {
            console.log("Raw text:\n" + data.Body.toString('ascii'));
            callback(null, null);
        }
    });
};

https://stackoverflow.com/questions/30651502/how-to-get-contents-of-a-text-file-from-aws-s3-using-a-lambda-function


Thursday, August 30, 2018

FND Profile Option for Navigating to a Home Page - EBS ModPLSQL

If main menu icon points to different url or another environment in Oracle EBS 12.1.3 ModPLSQL Screen- 

Updating profile option(APPS_PORTAL) should fix the issue


declare
begin APPS.<PACAKGENAME>.saveProfileOption('APPS_PORTAL', 'https://<host>:8001/OA_HTML/OA.jsp?OAFunc=OAHOMEPAGE');
end;



Monday, June 4, 2018

Restart WordPress webserver


sudo /etc/init.d/httpd restart 

or 

apachectl restart

There was a problem starting the Subversion server! SVN Edge

When you get this error, please check logs @







Then check for /***tmp/csvn/data/conf/httpd.conf file and see if the server root is right/correct

ServerRoot "/***tmp/csvn"

Next starting the server on the portal should work fine

Monday, February 5, 2018

Split 1GB XML file

https://stackoverflow.com/questions/5169978/split-1gb-xml-file-using-java

https://www.saxonica.com/html/documentation/documentation.html

Thursday, January 18, 2018

Python script to parse attribute names of XML file

------------------------------------------------------------------------------------

import xml.etree.ElementTree as ET
import csv

tree = ET.parse("ResidentData.xml")
root = tree.getroot()

# open a file for writing

Resident_data = open('/tmp/ResidentData.csv', 'w')

# create the csv writer object

csvwriter = csv.writer(Resident_data)
resident_head = []

count = 0
for member in root.findall('Resident'):
resident = []

name = member.get('name_value')
resident.append(name)
csvwriter.writerow(resident)

Resident_data.close()




______________________________________________________________________________________
XML
_________________________________________________________________

<State>
<Resident Id="100">
<Name name_value="Name123">Sample Name</Name>
<PhoneNumber name_value="Phone123">1234567891</PhoneNumber>
<EmailAddress name_value="Email123">sample_name@example.com</EmailAddress>

</Resident>
<Resident Id="101">
<Name name_value="12name1234">Sample Name1</Name>
<PhoneNumber name_value="12Phone1234">1234567891</PhoneNumber>
<EmailAddress name_value="12Email1234">sample_name1@example.com</EmailAddress>

</Resident>
</State>

________________________________________________________________________________
Sample Output
________________________________________________________________________________

Name123
12name1234





Reference:

https://docs.python.org/2/library/xml.etree.elementtree.html

http://blog.appliedinformaticsinc.com/how-to-parse-and-convert-xml-to-csv-using-python/