Sunday, 23 February 2014

LDAP Users in owc_discussions (Forums)

Posting this here so I don't lose it!
Source: https://community.oracle.com/message/4085237

1. Open a terminal;
2. cd /u01/Middleware/user_projects/domains/wc_domain/config/fmwconfig/servers/WLS_Services/owc_discussions_11.1.1.1.0. Where /u01/MIddleware is my Oracle_HOME
3. backup archive: cp jive_startup.xml jive_startup.xml.bkp ;
4 . gedit jive_startup.xml
5. Find the text: "<setup>true</setup"
6. Change to: "<setup>false</setup>"
7. Open a Browser with: http://wc11g.br.oracle.com:8890/owc_discussions . <host>:<port_discussion>/owc_discussions
8. You'll see a setup screen, like this http://www.jivesoftware.com/builds/docs/latest/documentation/images/screen_setup_checklist.png
9. Click continue;
10. In Database Setings screen, select JNDI Datasource and click next;
11. In JNDI Datasource Name put: jdbc/OWC_DiscussionsDS
12. Click next;
13. In Group and Authentication Systems screen select LDAP and next;
14. Fill the fields, like a example above:

LDAP Host: wc11g.br.oracle.com
LDAP Port: 3060
Base DN: cn=Users, dc=br,dc=oracle,dc=com
Admin DN: cn=orcladmin
Admin Password: welcome1
User Search Filter: (&(cn={0})(objectclass=person))
Group Search Filter: (&(cn={0})(objectclass=groupofUniqueNames))

15. Leave other fields default
16. In Other Settings screen, fill your email server or leave blank and click next;
17. Define administration user(e.g. orcladmin) and click next;
18. A message will appear: Jive Forums Setup Complete!
19. Restart WLS Services;
20. Login with your LDAP's user


owc_discussions: "The service was not provisioned for this space." error

When enabling discussion on a space in WebCenter Spaces/Portals. If the current user does not have contributor level access or higher they will be thrown this error when they attempt to create or post threads.

In order to solve this elevate their level to Contributor under "Members" section of space settings.

Sunday, 12 January 2014

Python: Minimum absolute sum of two integers in an Array

So I was given this problem and figured I would share my solution for others. I believe the Time Complexity to be O(n log n) due to Quicksort being O(n log n). I could be wrong though!
'''
Created on 10/01/2014

# My first foray in python
# min_abs_sum_of_two takes an Integer Array and returns the lowest absolute sum of two integers
# I did not include checking for the following: array length, non integer characters.
@author: BeauR
'''

import time
import sys

def min_abs_sum_of_two(listOfNums):
    #init y as last array place
    y = len(listOfNums)-1
    #init x as first array place
    x = 0
    #set current min to arbitrary max possible integer
    currentMin = sys.maxsize
    #quicksort array into ascending order
    quicksort(listOfNums, x, y)
    #while x is less than y to ensure they never overlap array places
    while (x < y):
        #if the current calculation is less than currentMin
        if abs(listOfNums[x]+listOfNums[y]) < currentMin:
            #store new minimum
            currentMin = abs(listOfNums[x]+listOfNums[y])
        #if the sum of arr[x] & arr[y] is greater than zero
        #x no longer need to be increased as its at optimum minimum value
        if listOfNums[x]+listOfNums[y] < 0:
            #increment search pointer x
            x = x + 1
        else:
            #decrement search pointer y
            y = y -1
    return(currentMin)
   

def quicksort(list, start, end):
    if start < end:                            # If there are two or more elements...
        split = partition(list, start, end)    # ... partition the sublist...
        quicksort(list, start, split-1)        # ... and sort both halves.
        quicksort(list, split+1, end)
    else:
        return

def partition(myList, start, end):
    pivot = myList[start]
    left = start+1
    right = end
    done = False
    while not done:
        while left <= right and myList[left] <= pivot:
            left = left + 1
        while myList[right] >= pivot and right >=left:
            right = right -1
        if right < left:
            done= True
        else:
            # swap places
            temp=myList[left]
            myList[left]=myList[right]
            myList[right]=temp
    # swap start with myList[right]
    temp=myList[start]
    myList[start]=myList[right]
    myList[right]=temp
    return right

start_time = time.clock()
print(min_abs_sum_of_two(listOfNums = [-6, -5, -4, -3, 1]))
print(time.clock() - start_time, "seconds")

Thursday, 2 January 2014

OHS HTTPD.conf RewriteRule to point DNS/HOSTNAME Straight to Space

Quick steps

  • edit httpd.conf (/u01/app/oracle/product/fmw/Oracle_WT1/ohs/conf)
  • add line at bottom
<VirtualHost *:80>
ServerName <$CUSTOMDNS$>
ServerAlias <$CUSTOMDNS$>
DocumentRoot /var/www/webcenter
RewriteEngine On
RewriteRule ^/$ /webcenter/spaces/<$SPACENAME$> [PT,L]
RewriteRule ^/webcenter$ /webcenter/spaces [PT,L]
RewriteLog /home/oracle/rewrite.log
<location />
  SetHandler weblogic-handler
  WebLogicHost <$WEBCENTERHOSTNAME$>
  WebLogicPort 8888
</location>
</VirtualHost>

Simple UCM/WCC/OCS JSR Portlet for WebCenter Spaces/Portals

So much to my dismay many of the OCS portlets available for WCS/Portal have limited functionality. I also found it pretty hard to find any portlets amongst the WebCenter Community so heres one I just finished!

Workflow Portlet

This is a pretty simple portlet that takes 2 parameters

  • UCMSERVER: The IP address or HOSTNAME of the UCM Server 
  • WorkflowID: The ID of the Workflow Queue in the target UCM (CSV Ids are accepted)
The portlet than connects to the UCM server using RIDC and builds a table showing the Documents in the current WorkflowID and the Approvers the documents are waiting on.

Download the JDev Project here
or
Download the Ear File here

Sunday, 22 December 2013

Tracing who the Final Approver was on a UCM Workflow Document

All workflow history "Approves/Rejects" etc is stored in the OCS database. Heres a quick way to track it with metadata.

Quick Steps:
  • Open Workflow Admin Applet
  • Criteria tab
  • Select Workflow from list
  • Click on the final Step on the right
  • hit Edit
  • Click Events tab
  • Hit the Edit button on the Exit event
  • Click the Custom tab on the pop up window
  • Tick Custom Script Expression
  • Copy paste the following code
<$if wfAction like "APPROVE"$>
<$wfUpdateMetaData("xComments", "Final Approval By: " & dUser)$>
<$endif$>

** You can change the xComments field to any metadata field you have set in Config Man that is applied to a Document.

*** dUser will put the username eg (rudderb) for me but I believe its possible to do the following
<$executeService("GET_USER_INFO")$>
<$name="USER_INFO"$>
<$var = rsFirst(name)$>
<$loopwhile getValue(name, "#isRowPresent")$>
<$wfUpdateMetaData("xComments", "Final Approval By: " &  getValue(name, "dFullName"))$>
<$var = rsNext(name)$>
<$endloop$>
EDIT: The above works! I just tested it.

PDF Watermark Internal error: Unexpected Exception (null) during saveTemplate

For whatever reason, it seems that its impossible to change Watermark Templates in the PDF Watermark Administration Applet. Everytime I try I get the above error.

But a work around for this is as follows:
Note the Content ID, if you do a quicksearch for that Content ID you should be able to find and Check Out the .HDA file which contains all the settings defined in the PDF Watermark Administration Applet.

The HDA should contain the following resultSets:
@ResultSet PdfwTextWatermarks
13
text
location
rotation
alignment
fontName
fontSize
fontWeight
fontColor
layer
pageRange
pageRangeModifier
x_coord
y_coord
@end

@ResultSet PdfwImageWatermarks
8
imageID
location
layer
pageRange
pageRangeModifier
x_coord
y_coord
scaleFactor
@end



Add in your settings into these resultSets in the typical HDA fashion and upload the .HDA file as a new revision.

Once you have uploaded your template as a new revision your changes will be immediately reflected in the PDF Watermark Administration Applet.


Cause:
I'm not 100% on the reason this is all buggered up but I suspect one of the following two reasons:

  1. IdcService=PDFW_SAVE_NEW_TEMPLATE contains bugs
  2. idcToken pdfwUserPassword LocalData parameters are blank in the Templates HDA file (though I think it'd be poor practice to have to include these).