Friday, 19 August 2016

Quick sort


Iterative approach:-

public class QuickSort {

public static void main(String args[]){
int numbers[] = {-1,10,8,4,12};
int number = numbers.length;

}

private static void sort(int[] numbers,int number){
int low =0;
int i =0;
int high = number-1;
while(low<high){
int pivot = numbers[low + (high-low)/2];
 while(numbers[low]<pivot){
 low++;
 }
 while(numbers[low]>pivot){
 high--;
 }
 if(low<=high){
 exchange(low,high,numbers);
 low++;
 high--;
 }
}
if(i<high){

}


}
private static void exchange(int low, int high,int[] numbers) {
// TODO Auto-generated method stub
int temp = numbers[low];
numbers[low] = numbers[high];
numbers[high] = numbers[temp];
}
}

Recursive approach :- 

public class QuickSort {

public static void main(String[] args) {
int[] xyz = { 5, 2, 4, 8, 1, 5, 3 };
if (xyz != null && xyz.length > 0) {
quickSort(xyz, 0, xyz.length - 1);
} else {
System.out.println("Empty array");
}
printArray(xyz);
}

private static void printArray(int[] xyz) {
for (int i = 0; i < xyz.length; i++) {
System.out.println(xyz[i]);
}
}

private static void quickSort(int[] xyz, int low, int high) {
if (low < high) {
int pi = calculatePartion(xyz, low, high);
quickSort(xyz, low, pi - 1);
quickSort(xyz, pi + 1, high);
}
}

private static int calculatePartion(int[] xyz, int low, int high) {
int pivot = xyz[high];
int i = low;
for (int j = low; j < high; j++) {
if (xyz[j] <= pivot) {
swap(xyz, j, i);
i = i + 1;
}
}
swap(xyz, i, high);
return i;
}

private static void swap(int[] xyz, int i, int placeHodler) {
int temp = xyz[placeHodler];
xyz[placeHodler] = xyz[i];
xyz[i] = temp;
}


}

Member fixer


Steps to enable member fixer :-

Step 1: Set up the below properties in the WAS Admin Console  under Resource environment providers > WCM WCMConfigService > Custom properties: If already present check for the correct values
· connect.businesslogic.module.memberfixer.autoload : false
· connect.businesslogic.module.memberfixer.class: com.aptrix.pluto.security.MemberFixerModule
· connect.businesslogic.module.memberfixer.remoteaccess: true

Step 2: Make property user.cache.enable  : false  in the WAS Admin console under the same path as mentioned in Step 1

Step 3: Stop the DealerPathMDB application through WAS Admin console

Step 4: Disabled the syndication if any running or enabled on the environment.

Step 5: Ask WPS team to run the cleanup user task. Details are present in the attached email. Check for the output and it should have any specific group which we are setting up on library.

Step 6: Bounce the server.

Step 7: Set the log level to info in the Administration tab in Enable tracing section

Step 8: Run the Member Fixer Command on the browser: Details can be found under the SharePoint link
   
     
Step 9: Check logs to see  the details on the command run.

Post member fixer tasks :-

Step 1 :- Start DealerPathMDB application through WAS Admin console

Step 2 :- Verify security groups at library level if they are missing please add then manually



ML specific links for content

ML Notification: Subject [Multi-locale Item Created Notification - fr]
An item has been created/modified by the author in the _en library. As per the Multi-locale processing settings, a link to this item has been added to the _fr library.

The path of the item is <a href="http://localhost:10039/wps/myportal/VirtualPath/Applications/Content/Authoring/?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_ContentLink/efd0f7da-3fc1-4762-bb9a-7402d74c246c/f962ddf7-17aa-4b75-ac11-2ca22a0043ce/DRAFT">library_content_fr/SA-My_DealerPath/A1339.2.1/SA-Human_Resources/efd0f7da-3fc1-4762-bb9a-7402d74c246c</a>.
[8/19/15 19:52:38:490 IST] 000001b7 MLNotificatio I   ML Notification: Subject [Multi-locale Item Created Notification - de]
An item has been created/modified by the author in the _en library. As per the Multi-locale processing settings, a link to this item has been added to the _de library.

The path of the item is <a href="http://localhost:10039/wps/myportal/VirtualPath/Applications/Content/Authoring/?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_ContentLink/efd0f7da-3fc1-4762-bb9a-7402d74c246c/1e92f778-c25f-4864-b5c9-12bee876a16a/DRAFT">library_content_de/SA-My_DealerPath/A1339.2.1/SA-Human_Resources/efd0f7da-3fc1-4762-bb9a-7402d74c246c</a>.
[8/19/15 19:52:40:278 IST] 000001b7 MLNotificatio I   ML Notification: Subject [Multi-locale Item Created Notification - ru]
An item has been created/modified by the author in the j_en library. As per the Multi-locale processing settings, a link to this item has been added to the _ru library.

The path of the item is <a href="http://localhost:10039/wps/myportal/VirtualPath/Applications/Content/Authoring/?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_ContentLink/efd0f7da-3fc1-4762-bb9a-7402d74c246c/622f7493-2638-4ea7-9b00-d2c42f3c9c83/DRAFT">library_content_ru/SA-My_DealerPath/A1339.2.1/SA-Human_Resources/efd0f7da-3fc1-4762-bb9a-7402d74c246c</a>

Portal WCM tech links

Process for Cur :- Create an adapter which connects to your required database and then get the xml in was understandable format.

Wcm Advanced cache :- 
https://www.ibm.com/developerworks/community/blogs/portalops/entry/customizing_the_wcm_advanced_cache_key17?lang=en

WCM best practicses :-
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/07162008083719PMWEB2RD.htm

Category Picker :- 
http://www-01.ibm.com/support/knowledgecenter/SS3JLV_8.0.0/wcm/wcm_dev_elements_taxonomy_selectiontrees.dita

Preview :-
https://www.ibm.com/developerworks/community/blogs/portalops/entry/best_practice_for_wcm_preview_server_topology4?lang=en

Portal support doc views :-
http://www-01.ibm.com/support/docview.wss?uid=swg21260098
http://www-01.ibm.com/support/docview.wss?uid=swg21417365
http://www-01.ibm.com/support/docview.wss?uid=swg21377025
Remove invalid ldap users :- 
http://www-01.ibm.com/support/docview.wss?uid=swg21377025
Soft Groups :- 
http://www-01.ibm.com/support/docview.wss?uid=swg27036224
Resolving mixed case issue :-
http://www-01.ibm.com/support/docview.wss?uid=swg21614035
Cleanup of users :-

PZN Best Practices :-
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/personalization-best-practices

Tuning Guide link :-
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/IBM_WebSphere_Portal_V_8.0
_Performance_Tuning_Guide

Viewing Cache settings :- 
http://hostname:port/wps/wcm/connect?MOD=ExportCacheSettings&processLibr
aries=false 

run-wcm-admin-task-export-cache-settings ConfigEngine task as described 
in the product documentation here. And send me the SystemOut.log file.

Prinicipal informaion cache :-
http://www-01.ibm.com/support/docview.wss?uid=swg24014207

WCM Support tool :-
http://it.delhigovt.nic.in/writereaddata/Odr20146113.pdf

Search custom seedlist:-
https://www-10.lotus.com/ldd/portalwiki.nsf/dx/Extend_WebSphere_Portal_WCM_Seedlist_with_Custom_Metadata

JMS in portal :-
http://www-01.ibm.com/support/docview.wss?uid=swg27036467&aid=1

Usage of Eval function in Javascript

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
//You can append this div via ajax
<div id="check">
var x= {
radioButtonNeeded:'True',
dealerId:'230208',
machineDescValue:'D110 Lawn Tractor',
docRefNumb:'',
pinNum:'1GX0110DHFJ289384',
machineCodeValue:'0816GX',
settlementNumb:'',
settlmentDT:'21-Mar-2016',
orderEntryDT:'04-Dec-2015',
showDialogueName:'confirmSettlmentManually'
}
</div>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

<script>
//Will make sure javascript variable is available after this method call
eval($('#check')[0].innerHTML);

</script>

</body>
</html>

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...