Thursday 7 August 2014

XAMPP and CakePHP on OSX

To get CakePHP running on XAMPP OSX

On my install I have a folder in htdocs called imdb

/Applications/XAMPP/xamppfiles/htdocs/imdb
*CAKEPHP is installed here

Open and Edit
/Applications/XAMPP/xamppfiles/etc/extra/httpd-xampp.conf

Add in the following snippet
alias /imdb  /Applications/XAMPP/xamppfiles/htdocs/imdb/app/webroot

<Directory "/Applications/XAMPP/xamppfiles/htdocs/imdb/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>


Friday 18 July 2014

PHP Script not executing in HTML pages - Dreamhost

I recently spun up my Dreamhost account from a few years ago to do play around PHP and couldnt get php running! After installing PHP 5.4 using the Dreamhost provided script I still had the problem until I added the following to .htaccess
<FilesMatch "\.(htm|html)$">
SetHandler application/x-httpd-php5
</FilesMatch>

Thursday 29 May 2014

HighCharts - Graph sizes in Tabs not resizing to Tab

<style type="text/css">    /* bootstrap hack: fix content width inside hidden tabs */    .tab-stats-content > .tab-stats-pane  {        display: block;    /* undo display:none          */        height: 0;         /* height:0 is also invisible */        overflow: hidden;  /* no-overflow                */        padding: 0px;    }    .tab-stats-content > .active, .tab-stats-pane > .active {          /* let the content decide it  */        height: 100%;
   }    /* bootstrap hack end */
</style>
<ul class="nav nav-tabs" id="myTab">
   <li class="tab-pane active"><a href="#active" data-toggle="tab">Teams And Users By Week</a></li>
   <li><a href="#teamsbysport" data-toggle="tab">Teams By Sport</a></li>
   <li><a href="#teamsthismonth" data-toggle="tab">Teams Created This Month</a></li>
</ul>
<div class="tab-stats-content">
   <div class="tab-stats-pane active" id="active">    {{ render(controller('RosterbotAnalyticBundle:Graph:Draw', {'graph':'TeamsAndUsersByWeek', 'div' : 'active'} ))}}  </div>
   <div class="tab-stats-pane" id="teamsbysport">      {{ render(controller('RosterbotAnalyticBundle:Graph:Draw', {'graph':'TeamsBySport', 'div' : 'teamsbysport'} ))}}  </div>
   <div class="tab-stats-pane" id="teamsthismonth">        {{ render(controller('RosterbotAnalyticBundle:Graph:Draw', {'graph':'TeamsThisMonth', 'div' : 'teamsthismonth'} ))}} </div>
</div>

Thursday 3 April 2014

Oracle OHS 2 VirtualHost domains on the same port with different RewriteRules

#Ensure the listening port
Listen 80
#Name the virtualhost
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domaindns1
ServerAlias domaindns1
RewriteEngine On
  RewriteOptions inherit
RewriteRule ^/$ /webcenter/spaces/Space1Name[PT,L]
RewriteRule ^/webcenter$ /webcenter/spaces [PT,L]
RewriteLog /home/oracle/rewrite.log
<Location />
  SetHandler weblogic-handler
        WebLogicCluster WCSSERVER:8888
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName domaindns2
ServerAlias domaindns2
RewriteEngine On
  RewriteOptions inherit
RewriteRule ^/$ /webcenter/spaces/Space2Name[PT,L]
RewriteRule ^/webcenter$ /webcenter/spaces [PT,L]
RewriteLog /home/oracle/rewrite.log
<Location />
  SetHandler weblogic-handler
         WebLogicCluster WCSSERVER:8888
</Location>
</VirtualHost>

Add the DNS to the /etc/hosts
sudo nano /etc/hosts

Then add the following two lines
127.0.0.1               domaindns1 domaindns1 
127.0.0.1               domaindns2 domaindns2 

Then
Sudo ./opmnctl stopall

Sudo ./opmnctl startall

If you do not "super user do" stop and then start opmnctl you will receive the following error
(13)Permission denied:  make_sock: could not bind to address 0.0.0.0:80

Wednesday 12 March 2014

Iframing a UCM(WCC) form/page and CORs

To iframe in a UCM page and stop it from constantly busting into fullscreen apply the following variable to the config.cfg

  • AllowContentServerInAnyDomains=1
Complete list of config.cfg Configuration variables can be found here

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