Friday, October 21, 2011

Useful UNIX commands



String operations (commonly used)
Equal: = (equal sign) 
Not equal: != (Not equal sign)
And: -a
Or: -o


Secure Copy
scp [local-file-path] user@host:/[remote-file-path]
scp myfiles*.jar user1@abc1234:/tmp/user1/

Secured Shell Commands
ssh user@host [unix-command] [unix-command-parameters]
ssh user1@abc1234 cp [local-file-path] [remote-file-path]
ssh userx@host123 "command-to-run-locally-1; command-to-run-locally-2"

Who all are logged into terminal
finger

To see list of all processes
top

List the file descriptors for a process id
lsof -p [process-id]

Get the length of the string
${#StringVariable}

Evaluate Mathematical/ General expression
Var1=`expr ${VAR-X} - $((${VAR-Y}*2)) - 5`
Var2=`expr substr ${TEXT1} ${Start-Index} ${End-Index}`

Secure FTP Command Sample
sftp user-x@server-y:/tmp/locationget ./abc/xyz.txt .


Read from XML Tag
function getTagValue
{
        _TAG=$( echo $( echo $1 | cut -d'<' -f2 ) | cut -d'>' -f1 )
        _OUTPUT=$( echo $( echo $1 | cut -d'>' -f2 ) | cut -d'<' -f1 )
}

function getValueFromTag
{
        # get the tag name from the text
        getTagValue $1
        case ${_TAG} in
        Target)
                _OUT1=$( echo ${_OUTPUT} | cut -d'#' -f1 )
                _OUT2=$( echo ${_OUTPUT} | cut -d'#' -f2 )
                echo "${_TAG} value1: ${_OUT1} and value2: ${_OUT2}"
        ;;
        User)
                echo "${_TAG} value: ${_OUTPUT}"
        ;;
        *)
                echo "ERROR: Incorrect TAG : ${_TAG} found!"
                exit 2
        ;;
        esac
}

getValueFromTag "new-env#right-now"
getValueFromTag "user-xxx"







Friday, October 14, 2011

Propagation not working for "Offered Capability" for portlets

Propagation of portlets does not propagate all the capabilities of portlets. Use Case: One or more portlets have entitlements with capability "Offered" added to the entitlement along with other capabilities including View, Edit, Minimize, Maximize etc.


Offered capability is highlighted with green color here in the screen shot.

This screen shot is from source environment.


When these portlets along with the entitlements are propagated to target environment, the capability "Offered" of the portlets are not propagated along with other capabilities.

Monday, October 3, 2011

Sample REST (API) Urls

REST URL Format: http://:/portalWebApp/rest-command-api?name1=value1&name2=value2

1. To list the portlets from a portal application
/bea/wlp/api/portlet/list?webapp=webappname

2. To get the details of the portlet
/bea/wlp/api/portlet/details/actual_porlet_def_label?webapp=webappname

3. Get the page list
/bea/wlp/api/page/list?webapp=webappname

4. Get the book list
/bea/wlp/api/book/list?webapp=myWebapp

5. Get the desktop list
/bea/wlp/api/desktop/list?webapp=myWebApp&locale=en

6. Get the Layout list
/bea/wlp/api/layout/list?webapp=myWebApp&max=2&start=2&locale=en-us

7. Login a user
/bea/wlp/api/login?username=user&password=pass

8. Logs out a user
/bea/wlp/api/logout?invalidate_session=true

9. Get the status of a user
/bea/wlp/api/userstatus?webapp=myWebapp&portal=myPortal&desktop=myDesktop

Note: To download the json file for the result of REST commands, append &format=json to the url

Reference: http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/clientdev/rest.html
API : http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/apidocREST/index.html

Wednesday, September 28, 2011

Propagation Servlet URL

Weblogic Portal propagation servlet URL is required to propagate the entities from source to destination. Propagation servlet documented is
http://[hostname]:[port]/propagation/inventorymanagement which returns 404 when trying to access it. Correct propagation servelt url is :
http://[hostname]:[port]/[EarProjectName]Propagation/inventorymanagement unless it is modifed.

Find Weblogic Password (Encrypted)

Weblogic server encrypted password can be found in boot.properties file. Make sure that any \ (slash) characters have been removed from the encrypted password. Location of boot.properties can be found in domain's admin server folder.

Monday, July 18, 2011

Maven :: maven-apt-plugin


<plugin>
<groupId>org.apache.myfaces.tobago</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>1.0.10-BEA</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<generated>.apt_generated</generated>
<aptOptions>x=3,web.content.root=WebContent</aptOptions>
<target>1.5</target>
<nocompile>true</nocompile>
<showWarnings>true</showWarnings>
<verbose>false</verbose>
<fork>false</fork>
<sourcePath>src</sourcePath>
</configuration>
</execution>
</executions>
</plugin>

Wednesday, July 6, 2011

Eclipse shows Initializing Java Tooling NullPointerException Error

Eclipse IDE shows Initializing Java Tooling java.lang.NullPointerException when a new workspace is trying to load
One of the reason for this error is due to different JRE used by the Eclipse IDE and the System environment variable settings for JAVA_HOME. Edit the environment variable JAVA_HOME and set it to the same JRE used by Eclipse IDE. Close and reopen the Eclipse IDE will resolve the hanging or taking long time to load.
You will notice a glimpse of Initializing Java Tooling and it will complete soon without any error.

Tuesday, November 9, 2010

Firefox useful plugins for Web developer

  • Firebug - Web development and debugging tools to debug HTML, Javascript and CSS
  • Firefox Throttle - Bandwidth utilization throttling plug-in
  • HTTP Fox - An HTTP protocol/packets/requests analyzer
  • User Agent Switcher - Tool to switch the user agents without switching the browsers

Tuesday, November 2, 2010

Microsoft Excel Useful Tips

Click the followings to see the solution (tested in Ms Excel 2007), these links will open in new popup window:
  1. Convert Column to Rows and vice versa
  2. Get started with PivotTable Reports
  3. Create a drop-down list from a range of cells
  4. Get started with PivotTable reports in Excel 2007
  5. Example of formatting a cell to percentage :: =TEXT(J5,"0.0%")
  6. Example of concatenating cells/texts :: =CONCATENATE(H3, "(",H6,")")