venerdì 25 febbraio 2011

UCM: default datepicker with idoc

If you need to include a datepicker in a page template or in an hcsp and you won't use jquery, you can use the default UCM calendar with datepicker.
Check the following code as an example:



FROM:<input type="text" id="calendarFrom" />
<img onClick="javascript: pucToggleCalendar('calendarFrom');" border="0" style="cursor: pointer; cursor:hand; vertical-align: middle;" src="images/PopUpCalendar/calendar.png"/>

TO:<input type="text" id="calendarTo">
<img onClick="javascript: pucToggleCalendar('calendarTo');" border="0" style="cursor: pointer; cursor:hand; vertical-align: middle;" src="images/PopUpCalendar/calendar.png"/>

<script type="text/javascript">
pucCreateCalendar({ id: "calendarFrom",caption: "From date"}, "calendarFrom");
pucCreateCalendar({ id: "calendarTo",caption: "To date"}, "calendarTo");
</script>


Pay attention to include "std_checkin_html_head_declarations" in your template ; the static javascript code (with the "pucToggleCalendar" function) used to create the popup is included in that resource:

<$include std_checkin_html_head_declarations$>


Linux: boot with terminal

I've just finished installing "stuff" on a VM with Oracle Enterprise Linux and I need to configure the machine without the resource consuming X11 automatically loaded at startup.

The Linux boot process has six states of operation of which "0" is the shutdown state and "3" and above are fully operational with all essential processes running for user interaction. The init process is the last step of the boot procedure and it is identified by process with id=1; Init is responsible for starting system processes as defined in the "/etc/inittab" file.

Editing the inittab file, I changed the default line:

id:5:initdefault:

with the following:

id:3:initdefault:

Here there are the available states:

0 halt system (loaded the /etc/rc.d/rc0.d/ library)
1 single user (/etc/rc.d/rc1.d/)
2 multiuser with no network (...2.d)
3 terminal
4 reserved for local use
5 X11 GUI mode
6 reboot


After startup type "starx" or "init 5" to enter X11.

domenica 6 febbraio 2011

WLS: embedded LDAP client access

To view the entries of the embedded LDAP server through an LDAP client browser, first of all you have to change the embedded LDAP credentials:

1. Access WLS admin console
2. Expand the Domain node.
3. Select the Security-->Embedded LDAP tab.
4. Change the Credential attribute from its generated value to a new password
5. Click SAVE.
6. At last, reboot WebLogic Server.

Now configure a new connection in the LDAP browser (as a suggestion, I use Apache Directory Studio based on Eclipse).

Use the http server port 7001 (7002 if SSL is being used), "dc=[UCM_DOMAIN_NAME]" as the base dn, cn=Admin as the ldap administration user with the newly created password.

giovedì 8 aprile 2010

UCM: Rules and Profiles metadata

UCM do not store metadata of Rules and Profiles. To obtain those information you need to use IdcServices (or parse the rules/profiles HDA files).

Following a list of sample URLs:


All profiles:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCPROFILES&IsSoap=1

Rules vs single Profile:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCPROFILE&dpName=PROFILE_NAME&IsSoap=1

All rules:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCRULES&IsSoap=1

Attributes of a single rule:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCRULE&dpRuleName=RULE_NAME&IsSoap=1

UCM: Modify the check-in menu

To modify the "New check in" menu structure in UCM you have to customize the dynamic include "custom_finish_layout_init" using component wizard.

After creating the new resource and the new include use the javascript "navBuilder" object to modify the structure of the menu; use "navBuilder.getNodeById("NEW_CHECK_IN").childNodes" method to search the leafs of the node.

The leaf IDs of the new check in menu are usually named "MY_PERSONAL_CHECKINS_[n]" (with n starting from 0).


<$include super.custom_finish_layout_init$>
APChilds = new Array();
ARChilds = new Array();
var children = navBuilder.getNodeById("NEW_CHECK_IN").childNodes;
for (var i = 0; i < children.length; i++)
{
TEXT = children[i].getAttribute("label") ;
if (TEXT.match(/\bAR\b/i) != null)
{ arrLength =ARChilds.push(children[i].getAttribute("id")); }
if (TEXT.match(/\bAP\b/i) != null) {
arrLength =APChilds.push(children[i].getAttribute("id")); }}



Then you can add new nodes or collections using:

navBuilder.addChildNodeTo("NEW_CHECK_IN","collection","id==ACCOUNT_PAYABLES","label==Account payables","url==");

navBuilder.addChildNodeTo("NEW_CHECK_IN","item","id==ACCOUNT_PAYABLES","label==Account payables","url==http://oramack.blogspot.com");


If trying to add a new collection you can choose the position of the leaf specifying the sibling node:


navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_RECEIVABLES","label==<$lc("wwACCOUNT_RECEIVABLES")$>","url==");

navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_PAYABLES","label==<$lc("wwACCOUNT_PAYABLES")$>","url==");


then move check in profile into the newly created collections:


i=0;
while(i navBuilder.moveItemInto("ACCOUNT_RECEIVABLES",ARChilds[i]); i++;
}

i=0;
while(i navBuilder.moveItemInto("ACCOUNT_PAYABLES",APChilds[i]); i++;
}


Note: use the IDOC function "lc" for getting translation; example: <$lc("wwACCOUNT_RECEIVABLES")$>

Here is the include full code:


<$include super.custom_finish_layout_init$>


APChilds = new Array();
ARChilds = new Array();

var children = navBuilder.getNodeById("NEW_CHECK_IN").childNodes;
for (var i = 0; i < children.length; i++)
{
TEXT = children[i].getAttribute("label") ;
if (TEXT.match(/\bAR\b/i) != null) {
arrLength =ARChilds.push(children[i].getAttribute("id"));
}
if (TEXT.match(/\bAP\b/i) != null) {
arrLength =APChilds.push(children[i].getAttribute("id"));
}
}

navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_RECEIVABLES","label==<$lc("wwACCOUNT_RECEIVABLES")$>","url==");
navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_PAYABLES","label==<$lc("wwACCOUNT_PAYABLES")$>","url==");

i=0;
while(i navBuilder.moveItemInto("ACCOUNT_RECEIVABLES",ARChilds[i]); i++;
}

i=0;
while(i navBuilder.moveItemInto("ACCOUNT_PAYABLES",APChilds[i]); i++;
}


mercoledì 14 ottobre 2009

Search inside files

In order to search for a specific text pattern inside every file in every subdirectory of a given path in linux you can do:

grep -r "text_2_search" *

"-r" stands for "recursive."
Note that with "zgrep" util you can search recursively inside a .zip or .tar.gz file.

Linux resize screen resolution with xrandr

You can quickly resize the screen resolution using "xrandr" utility (/usr/bin/xrandr).

with xrandr -q you can see all the available resolutions

Input xrandr -s (size) to dynamically resize screen; for example:

xrandr -s 1440x900