Wednesday, August 28, 2013

Unix sed: Modify xml file or move characters around

Following example can be used when we want to move characters around in the file based on xml tags or other character prefixes.

I wanted to remove sequencenumber tag along with value within tags from following line. I also wanted to move tags salary and suffix to first position after begin.

101886122arpit23452345shah116056III

Following script can help:
$ sed 's:\(\)\(.*\)\(.*last>\)\(.*suffix>\)\(.*\):\1\4\3\5:' a


116056IIIarpit23452345shah  

Friday, January 11, 2013


My (Arpit's) Art of Living Experience in Initial Days

Image
A lucky break (or, really, drag)
What’s incredible about my story is that my friend dragged me along to this course, which I had no intention of attending, but then, somehow, I liked it. And he…didn’t. Fast forward to now, and I have no idea what my life would be like without it had he not done that that day. What an unrepayable debt I owe to him!! I’m actually not sure if he’s done it yet or not – I will have to check and make him do it soon : ).
Image
Pray, don’t spray
All was well — for a while. The course was going fine, but when I started doing that vigorous breathing exercise (what did they call it?), snot came flying out of my nose in ridiculous quantities. I was worried!!! What would the people around me think? It is actually a miracle, in retrospect, that I stuck with it through all that. But, I guess with the power of the Kriya and pranayams, don’t you know it, in a couple of months, it went away!!!
Image
Tongue (and body)-tied
One thing that I noticed after the course was that I was able to speak. Not that I wasn’t able to speak before – I’m talking about giving speeches. When I used to do it, I would shake like crazy, jumble up my words like I didn’t know my own language, and rush through it, barely enunciating and hardly giving anyone a chance to hear or think. But somehow, after some simple body-breath-coordination exercises, it was gone – not completely, but a lot. Before, when I would give presentations for whatever reason in school, I would always rank near the bottom – I don’t even know how low, they didn’t tell me (probably good, to save my feelings). But the first time I spoke after the course, I got third out of a large group!!!! AMAZING!!!!
Above mentioned is true. I had help of Great writer Sanjay Kapoor in writing and adding images. Thanks Sanjay!

Monday, October 1, 2012

My Aunt Polly Game

Likes
Dislikes
Soccer, Football
Cricket
Nashville
Mt Juliet
Trees
Plants
Moon
Stars
Speed
Fast
Food
Eat
Tennessee
Kentucky
Jeff, Willie
Everybody else
Glass
Window
Beer
Wine

For secret of the game, please scroll down.







































My aunt Polly like each word with double letters.

Tuesday, May 1, 2012

Query to find unused (not referenced in other DB packages, procedures, function) package

Following query can be used to find unused (not referenced in other DB packages, procedures, function) packages. Packages can still be used in DBMS Jobs / Scheduler Jobs / Application select distinct owner || '.' || name from dba_DEPENDENCIES where name in ( select referenced_name from dba_DEPENDENCIES where type != 'SYNONYM' and owner in ('SCOTT', 'SCOTT2') group by referenced_name having count(*) = 1) and owner in ('SCOTT', 'SCOTT2') and type in ('PACKAGE BODY', 'PACKAGE') order by 1

Friday, April 27, 2012

Oracle ACL Error Resolution:ORA-24247: network access denied by access control list (ACL)


We were often seeing following network ACL error.

ORA-24247: network access denied by access control list (ACL)

Query to check for existing ACLs.
SELECT NACL.ACLID,ACL, PRINCIPAL
FROM DBA_NETWORK_ACLS NACL, XDS_ACE ACE
WHERE NACL.ACLID = ACE.ACLID ;

We had to run following steps to resolve the issue.


EXEC DBMS_NETWORK_ACL_ADMIN.DROP_ACL(acl => 'mails.xml' );


EXEC DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'mails.xml', description => 'Mail ACL', principal => 'SCOTT', is_grant => TRUE, PRIVILEGE => 'connect');
Principal ==> says which schema will primarily own the ACL
is_grant => TRUE will allow other schema in DB to access this ACL (this line needs verification)

BEGIN
   DBMS_NETWORK_ACL_ADMIN.add_privilege (acl          => 'mails.xml',
                                         principal    => 'SCOTT', --Schema name
                                         is_grant     => TRUE, --same as above
                                         PRIVILEGE    => 'connect',
                                         position     => NULL,
                                         start_date   => SYSTIMESTAMP,
                                         end_date     => NULL);

   COMMIT;
END;
/


EXEC DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL ( acl => 'mails.xml', HOST => 'mailhost', lower_port => 21, upper_port => 30);

BEGIN
   DBMS_NETWORK_ACL_ADMIN.add_privilege (acl          => 'mails.xml',
                                         principal    => 'SCHEMA2',
                                         is_grant     => TRUE,
                                         PRIVILEGE    => 'connect',
                                         position     => NULL,
                                         start_date   => SYSTIMESTAMP,
                                         end_date     => NULL);

   COMMIT;
END;
/

For more details: http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_networkacl_adm.htm