Posts

Showing posts from 2016

Mac

"Verifying  jdk......" I just got a new macbook pro OS X EL Capitan and I was not able to run applications needing java. I tried installing java but it always got stuck at "verifying jdk.......".  Finally I saw a post on google where it mentioned that issues was due to SIP ( System Integrity Protection) being enabled. I found an article how to disable it. http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/ Once I disable , I was able to install jdk.

Excel

1. To get sum for all the values from column B1 to B6 where value in column C1 to C6 is "S1"  all  from Sheet1. =SUMIF(Sheet1!C1:C6,"S2",Sheet1!B1:B6) See "S2" in double quotes because without that, it will represent the value in cell S2. 2. In a formula, a single string can only 255 char long. So if you need to have longer string, you will have represent it by concatenation of multiple smaller strings like  for example   "abcdef" => "abc" & "def" 3.  If you are editing a long formula and getting errors, one thing you might want to look for is new lines in it esp. if you copied the text and pasted it from some place. 4. LEFT(txt , num_chars) => Returns  left num_chars characters from   txt. 5. How to escape double quote in string  as part of formula ? by double quote itself .   If you want to have "abc" as text where double quotes are included in it ...you have to put it  like ""...

Cookies, Tomcat

1. How to enable secure cookies in an application.  Include below config in web.xml at the top level.   <session-config>     <cookie-config>       <http-only>true</http-only>       <secure>true</secure>     </cookie-config>   </session-config> Once you do that , you will have request server to set secure cookies or http only cookies and it will set those . Without this config , even if you request server to set secure cookies or http only cookies , it wont do it.  This is true at least for Tomcat. 2. Some versions of  Tomcat remove trailing =  in cookies.  To stop Tomcat from removing the trailing "="  signs, start Tomcat with  "-Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE=true"  option.eds

AWS

1. To find the list of IPs of any particular attributes of the nodes belonging to a particular stack  aws ec2  describe-instances --filters "Name=tag:aws:cloudformation:stack-name,Values=yourstack"  --output text --query 'Reservations[*].Instances[*].PrivateIpAddress' 2.  If you multiple VPCs , make sure your access keys which used during aws  configure point to the VPC you are searching the instances in.  If you are looking for a stack which returns zero result and stack is there , most likely your keys belong to different VPC. 3.  To get only the required attributes as key value pair from AWS CLI output.  aws ec2  describe-instances --filters "Name=tag:aws:cloudformation:stack-name,Values=yourstack" --output text --query 'Reservations[*].Instances[*].{IP:PrivateIpAddress,ID:InstanceId}' 4. To stop multiple instances aws ec2 stop-instances --instance-ids  "i-06eea80" "i-00eww42a86" 5. To upload all *.sh files from a ...

OpenAM

ssoadm/openam/bin/ssoadm get-attr-defs  -u amadmin -f passwd -s iPlanetAMPlatformService -t global -a "iplanet-am-platform-cookie-domains" 1.  At times when you create a new module instance under a newly created realm , it does not show up the in list of module instances.  But if I delete it using ssoadm and recreate it , it shows up.

mySQL

1. Concatenating the fields SELECT CONCAT('http://www.abc.com?parentCategoryId=' ,CATEGORY_ID,'&categoryId=', RELATED_CATEGORY_ID ) FROM RELATED_CATEGORY WHERE CATEGORY_ID IN (SELECT CATEGORY_ID FROM CATALOG_TO_CATEGORY WHERE CATALOG_ID = 1 AND ACTIVE_FLAG='Y') 2.  ERROR 1148 (42000): The used command is not allowed with this MySQL version .  LOAD DATA LOCAL INFILE 'users.txt' INTO TABLE  users FIELDS TERMINATED BY  ',' ENCLOSED BY '"'  LINES TERMINATED BY '\n' (userid,fistname); Throws an error something like " ERROR 1148 (42000): The used command is not allowed with this MySQL version ."  For me the mysql server was an RDS and I was trying to load data from another ec2 instance.  When I google around I got suggestions to restart mysqld as "mysql -u user -p --local-infile menagerie" , which was not possible as it was an RDS service. To get it working I had to add following in /etc/mysq...

Serialization

An object is serializable if either itself or any of its ancestors implement Serializable or Externalizable. When a object is serialized, the serialization occurs recursively, which means all the object refrenced within the current object also get serialized and so..on. Complete object graph gets serialized. Serialzation is done by passing the object as parameter to writeObject() method of ObjectOutputStream instance. Serialization can be used for deep copy but there a few issues. 1) all the objects refrenced has to be serializable 2) relative poor performce , hence not advisable in performance critical situations 3) Issue involving object instances like Singleton instances ...use readResolve() 4) how to handle transient variables , as those are not serialized. default clone() method inherited from Object class does shallow copy.

Directory ( LDAP )

1. DNvs. RDN DN is globally unique RDN : unique under same parent. RDN is typically a unique identifier ( id or uid ) attribute for an entry.  DN  =   RDN + Path to Parent 2.  ldap errorcode=10 I was having  connection to read replica and was trying to update an attribute in LDAP was resulting in this error. 3. Starter Query dirsrv]# ldapsearch -x -h <host>  -D '<UserDN>' -w  password -b '<BaseDN>' '(&(uid=91203074))' uid cn 4.   At times when you execute a query which may result in large result set and  if nsslapd-sizelimit is set to smaller value , it wont return any results.  This limit is set is /etc/dirsrv/slapd-{ServerName}/dse.ldif. 5. To find the number of entries under  a DN ldapsearch -u -D "cn=Directory Manager" -h ldapserver -p 389 -b "ou=myou,c=myc,o=myo" -w password  -s base "(objectclass=*)" numsubordinates 6. To add an aci     ./ldapmodify -h localhost...

UNIX/LINUX

1. Use Ctrl+D for specifying EOF for stdin. 2. Removing the files returned by svn status command. svn status | awk '{cmd = "rm " $2; system(cmd)}' 3. To find the Linux distribution on the machine more /etc/*-release 4.  top, htop, iotop,sysstat  for seeing the system usage. 5.  jstack   for seeing the threads inside a java process 6. In LDAP access log , to print all the lines which has etimes greater than 10 ms and also print next line if it has "SRCH" into it, use following command awk -F= '/etime/ && $7>0.02000 {print FNR; print;getline; print FNR;if (match($0,"SRCH")) {print}}'  access 6.1  To list all the lines which have etime > 1000 ms   awk -F"etime=" '$2>1000 {print }' access 7.  In LDAP access log, print the previous line and the line where etimes greater than 10 ms. awk -F= '/etime/ && $7>0.01000 { print line;print;} {line=$0}'  access 8. Su...