Monday, November 26, 2012

Make ALT+TAB to work in fallback mode of Ubuntu 12.04 without CCSM

 

I was really frustrated with ALT+TAB not working in ubuntu 12.04 in fallback mode. I tried many things as suggested by many other bloggers. Some suggested installing compizconfig-settings-manager but I don’t like that solution. This solution was actually suggested by arnulf-heimsbakk in the bug 971051. His solution is buried deep in the bug report. I honestly thing writing would help others. Here is the code


cat <<EOF > /etc/xdg/autostart/metno-switcher-fix.desktop
[Desktop Entry]
Name=metno-switcher-fix
Comment=ALT+TAB hotfix for compiz fallback session
Exec=bash -c "test -f ~/.metno-switcher-fix || /usr/bin/gconftool-2 --set --type list --list-type=string /apps/compiz-1/general/screen0/options/active_plugins '[core,composite,opengl,compiztoolbox,decor,vpswitch,snap,mousepoll,resize,place,move,wall,grid,regex,imgpng,session,gnomecompat,animation,fade,workarounds,scale,expo,ezoom,staticswitcher]' && touch ~/.metno-switcher-fix"
Terminal=false
Type=Application
OnlyShowIn=GNOME;
X-GNOME-Autostart-Delay=2
EOF


Saturday, July 7, 2012

Oracle SOA Suite Part 1 Hello BPEL

In this N part series, I am going to blog about each and every piece of Oracle SOA suite. Today, I am going to start with Hello BPEL.

Requirements

I assume that you have some knowledge on BPEL and SOAP based web services. I assume that you have installed oracle SOA suite 11g along Jdeveloper and required plugins. I am using the 11.1.1.6 version pre built VM from oracle site. If you have enough resources like >8 GB RAM, 50-70 extra Hard drive space and good internet speed then I would encourage you to download the pre-built VM as it would not affect your computer performance.

Overview

In this demo, we are going to create a BPEL process and pass a String as input to BPEL process and in return we get “Hello “+String (from input) as output.

Hello Word Project

1. Let us fire up Jdeveloper and create a new Application.

2. Enter the Application Name as HelloBPEL

3. Choose Application Template as SOA Application and click Next button

clip_image001

4. Enter the project name as HelloBPEL and click Next

clip_image002

5. For now let us have the defaults and click Finish

clip_image003

6. You should see a composite.xml file opened in your editor. Note: if you did not install SOA plugin you would just see the xml file not the composite editor. Make sure you have installed the SOA plugin

clip_image005

7. Let us understand few details about composite editor. Composite editor gives a high level view of what is happening in your project. It is divided into three columns

a. Components: Components column display all the components such as BPEL, Mediator, Human Task etc. being used in the project. It also displays how these components are interconnected.

b. Exposed Services: Exposed Services lists out all the front ends for your application using which external applications/code can interact with this SOA application.

c. External References: External References lists out all the services that are being used by your application.

8. If you don’t see a Component Palette window, then click on View > Component Palette

clip_image006

9. Drag “BPEL Process” from Component Palette window on to Components column of the Composite editor. Notice that during drag when you place your mouse on references or services column then mouse pointer turns as wrong arrow indicating that you cannot drop BPEL Process onto those columns. When you place it on components column during drag it show a little plus symbol

10. You should see a “Create BPEL Process” window after you have dropped BPEL Process icon. Please perform following actions

a. Use BPEL 2.0 Specification

b. Enter the project name as “HelloBPEL”

c. Switch Template to Synchronous BPEL Process and leave the defaults

d. In order to invoke this BPEL process, you need a service end point so you should have check box “Expose as a SOAP Service” checked.

e. Since this BPEL process is going to take String as input and return String as output, we are ok with default values in input and output. In later blogs, I will show you how you can customize these parameters

f. Please verify your values with the image below and click OK

clip_image007

11. You should see the following in the composite editor

clip_image008

12. Now double click on the HelloBPEL block in the composite editor and it opens a new editor called BPEL Editor. You should see the following (if you don’t see it then you did not install SOA plugin for Jdeveloper)

clip_image010

13. We can clearly depict that as client invokes BPEL process by supplying the input, which is received using receiveInput activity and replyOutput returns the output back to the client.

14. You should also see a panel named “HelloBPEL – Structure” on the lower left of the jDeveloper, expand the Variables > inputVariable > payload > client:process > client:input and observe that input is String. Similarly, confirm that outputVariable is also String type

clip_image011

15. Now we need to assign “Hello[SPACE]input” to the output so, drag assign activity present under BPEL Constructs section of the Component Palette and drop it on the line connecting receiveInput and replyOutput. See the image below

Note: As you try to drag on to the line, you should see a Green Plus symbols indicating the potential places where you can drop Assign activity

clip_image012

16. Notice that in the BPEL-Log window, you should see the following warning message. This is because every assign statement should have at least one assignment

clip_image014

17. Now Let us finish the assignment, double click on Assign1 activity and it should open Edit Assign window

clip_image016

18. On the Copy Rules tab, expand the outputVariable on the right hand side up to the leaf node i.e., client:result. Drag the expression buttonclip_image017 (located on top) to the client:result. You should see following window after you have dropped the expression icon. In the Functions section, change the drop down to “String Functions” and find concat function and double click on it. You should see that concat() is auto typed in the Expression section.Put your cursor with in the paranthesis of concat() and type “‘Hello ‘,” (include single quote, space and comma. From BPEL Variables section, expand inputVariable > payload > client:process >client:input and double click on it. You should see following as expression


concat('Hello ', $inputVariable.payload/client:input)


clip_image019

19. Click OK button to close Expression Builder. Click OK to close Edit Assign window

20. You should see that BPEL Log mentioned in step 16 will not have any errors and warnings

21. We can do an additional check to see if you BPEL is has problem by clicking on validate button (clip_image020) present at the top of the BPEL editor

clip_image021

22. Save the project and you are done with coding aspect of BPEL

Deployment:

You need to add Weblogic server to Jdeveloper before, you can deploy this application. A quick search on “how to add Weblogic server to Jdeveloper” would give you the details.

1. Make sure that your Weblogic and SOA server are up and running.

2. Now Right click on the project in Jdeveloper, and select deploy > HelloBPEL…

clip_image022

3. You should see following window

clip_image023

4. Select Deploy to Application Server and hit Next > button. Have the defaults on the next screen and click Next > button

clip_image024

5. Now select the server ( devsoa in my case) and hit Next > button

clip_image025

6. After a brief period of time, you should see this window (see below). If you have more than one server listed then select the server on which have installed SOA Suite and click Next > button

clip_image027

7. You should see the following window and hit Finish button.

clip_image029

8. In the deployment log window, you should see a line as deployment finished

clip_image031

9. This confirms that your deployment is complete.

Test:

In this blog post, I would show the simplest way to test BPEL process. In subsequent blog posts, I would show you various other ways to test BPEL Process.

1. Login to your enterprise manager. It should be located at http://servername:7001/em (in my case it servername is localhost). The default username/password should be weblogic/welcome1 unless you have changed it.

2. From your Farm folder present on the left, expand SOA > soa-infra > default and observer that HelloBPEL[1.0] version is present. Note: you path might be different depending on your installation. Click on the HelloBPEL[1.0]

clip_image032

3. You should see that the main window present on the right side changes to something like below. Click on the Test tab

clip_image034

4. You should see following window. In the input Arguments section, specify some name (For e.g., Srikalyan :)) and click Test Web Service button

clip_image036

5. You should see the Response result as Hello inputName.

clip_image038

6. That’s it. You are done creating, deploying and testing your first BPEL process.

Note: You can download the code from https://bitbucket.org/srikalyans/bpelexamples/downloads

Please drop a comment if you face a problem.

Display Sparkline/Graphs in OBIEE 11g in columns

My aim was to display revenue across regions over past 3 months and an additional column for displaying the graphs (just like Sparkline feature in office 2010).

Requirements:

1. OBIEE 11 installed and running

2. You need to have Internet connection to the machine on which you have installed OBIEE 11g else see step 3. You need the Internet connection in order to refer the JavaScript library files available over the Web (instead of downloading and installing them).

3. If you don't have Internet connection then

a. Download jQuery from http://jquery.com/

b. Download Sparkline plug-in for jQuery located at http://omnipotent.net/jquery.sparkline/1.6/jquery.sparkline.min.js

c. Install them on your Weblogic server.

Note: I am using sample application for the demo. You should be able to correlate it with your application.

Note: I used jQuery 1.5.2 and Sparkline 1.6 version.

jQuery and Sparkline plug-in:

jQuery is a popular JavaScript library. I don't expect an OBIEE developer to know about jQuery and I have covered enough information required for this process. Sparkline plug-in is a library which runs on top of jQuery for displaying graphs in a Web browser using JavaScript.

The logic of displaying graphs is very simple

Step 1: You need to have HTML container like div or span tag with values separated by commas. For e.g.,


<span class="myClass1">120.9,140.6,100.3</span>


Step 2: You need to add the libraries mentioned in requirements and add an additional script to the HTML page

Add JavaScript libraries like this


<script type="text/javascript" src="Path/jquery-1.5.2.js"></script><script type="text/javascript" src="Path/jquery.sparkline.js"></script>


Additional script:


<script type="text/javascript">// <![CDATA[
$(function() {
$('.myClass1').sparkline('html',{type:'bar', barColor:'green'});
});
// ]]></script>


Note: Replace Path with the location where you have saved these two files.
You should see a graph in place of the those numbers like this clip_image004

Explanation of additional script:

$(function(){ …. }); This statement tells browser that run this script only after loading all the JavaScript libraries, CSS files, HTML code etc.
1. In jQuery, you address anything using a jQuery operator called '$'.
2. $('.myClass1') means find all the containers which have CSS class as 'myClass1'.
3. $('.myClass1').sparkline('html',{type:'bar',barColor:'green') would let us draw a bar graph with color green (type:'bar' displays bar graph and color is green). So if you say type:'line' then you would see a line graph.
For more details, please see http://omnipotent.net/jquery.sparkline/#s-doc

Create Analysis:

Now create a new analysis with following columns in criteria tab
1. Customer Region
2. Per Name Month
3. Revenue
4. One Month Before Revenue with column formula as


AGO("Base Facts"."1- Revenue",1)


5. Two Month Before Revenue with column formula as


AGO("Base Facts"."1- Revenue",2)


6. SparklineCode with column formula as below. I am using the JavaScript libraries deployed over the web if you are using local libraries then update the src values. You should include single quotes present at start and end of the column formula


'<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.2.min.js"></script><script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/1.6/jquery.sparkline.min.js"></script>
<script type="text/javascript">// <![CDATA[
$(function(){
$(".myClass1'||cast(rcount(1) as varchar(3))||'").sparkline("html",{type: ''line'', width:''40px'', minSpotColor:''red'', maxSpotColor:''green''});
$(".myClass2'||cast(rcount(1) as varchar(3))||'").sparkline("html",{ type: "bar", width:''40px'', barColor: "green"});
});
// ]]></script>'


7. Line Graph with column formula as


''
||CAST("Base Facts"."1- Revenue" AS VARCHAR(50))||','
||CAST(AGO("Base Facts"."1- Revenue",1) AS VARCHAR(50))||','
||CAST(AGO("Base Facts"."1- Revenue",2) AS VARCHAR(50))
||''


8. Bar Graph with column formula as


''
||CAST("Base Facts"."1- Revenue" AS VARCHAR(50))||','
||CAST(AGO("Base Facts"."1- Revenue",1) AS VARCHAR(50))||','
||CAST(AGO("Base Facts"."1- Revenue",2) AS VARCHAR(50))
||''


Note: For 4, 5, 6, 7, 8 columns, I have added Revenue column repeatedly and changed their names and column formula.

Note: For 6, 7, 8 columns, I have changed their folder name as “Sparkline” as they represent Sparkline code.

Very Important Step: Since columns 6, 7, 8 contain HTML and JavaScript code, I have changed the Data Format for each of these columns as HTML using column properties option



So your criteria tab should look like this



After doing good amount of beautification on the results tab, I could finally get this view.
Note: Don't try to exclude or hide the Sparkline code column (6) just try to mask it.



Drop a comment if you face a problem or have any question.

Friday, June 29, 2012

Invoking Web Services from OBIEE

This blog explains on how to invoke Web services from OBIEE 11g using Actions.

 

Requirements

OBIEE 11g installed and running

Sample app for OBIEE 11g

SOAP UI

Note: You need internet access for the machine on which you have installed OBIEE 11g.

 

Web Service

A Web service is a Web resource which may be invoked to get some information. There are 2 different implementations of Web services

1. SOAP : Simple Object Access Protocol

2. REST: Representational State Transfer.

Today we are going to see a demo based on SOAP based Web services. SOAP based Web services are described in an xml format know as Web Service Description Language (WSDL). WSDL specifies what operations that web service contain, inputs and outputs for each operation, where the service is located etc.

The Web service that I am going to use for demo is called “zip code web service”. This service has an operation which takes zip code as input parameter and gives the city name, state name, time zone and phone area code etc. as output.

The web service is located at http://www.webservicex.net/uszip.asmx

The WSDL is located at http://www.webservicex.net/uszip.asmx?wsdl

Note: Please note that I am no way related to this Web Service.

Understanding the Web service

Let see how Web services work.

1. Download the SOAP UI Standalone version and unzip it.

2. Go to bin folder and double click on soapui.bat for windows or soapui.sh for Linux

3. It opens a GUI window as shown below

clip_image002[7]

4. Click on the File Menu and select New soapUI Project as show below

clip_image004[5]

5. It should open a New soapUI Project window. Give a name to the project (I named it as Test) and in the Initial WSDL/WADL field enter the “http://www.webservicex.net/uszip.asmx?wsdl”, leave the default settings and Click OK. See the image below

clip_image006[5]

6. SOAP UI creates the necessary stubs and you should see a new project (Test in my case) with list of services and operations as shown below

clip_image008[4]

7. Expand the USZipSoap12, expand GetInfoByZip operation and double click on the Request1. You should see a new split window. The left side represents the input message for the operation and right side represents output for the operation. Notice that on left hand side, you should see that <web:GetInfoByZip> tag which is just below the Body tag, this indicates that you are about to invoke GetInfoByZip operation. You should see that “web:USZip” under operation tag, this is the parameter that needs to be passed before executing the operation. Replace the “?” from the highlighted section (in the image below) with some zip code and click on run or green play button located on the top. You need internet for this step to work

clip_image009[6]

8. You can see that the output side is filled with data. I have entered 60563 and I got back city as Naperville, state as IL, time zone as C, area code as 60563

clip_image011[7]

9. In OBIEE, you get this information using XPath. For e.g.,

a. To get the XPath for City, you could use //CITY (since there is only city). I would suggest you to use //GetInfoByZIPResult//Table/CITY.

b. Similarly, I would use

i. //GetInfoByZIPResult//Table/STATE for State

ii. //GetInfoByZIPResult//Table/TIME_ZONE for Time Zone

iii. //GetInfoByZIPResult//Table/AREA_CODE for Area Code

Note: Please remember these XPath expressions as I am going to use them in the next section.

Create Action:

1. Let us create an action first, Log in to OBIEE 11g and go to New > Action

2. It pops up a dialog, select Invoke a Web Service link

clip_image013[4]

3. You should see “Select Web Service Operation” window, in the WSDL URL field enter the

http://www.webservicex.net/uszip.asmx?wsdl and click Open button

clip_image015

4. Expand the USZip > USZipSoap12 and select the operation GetInfoByZip and click OK

clip_image017

5. It opens New Action window as shown below. Notice that it defines only one parameter as our Web service operation takes only one parameter as input. Click on the “Options…” button located next to Help button

clip_image019

6. In the Invoke Action tab, check the Dialog Title box and enter “Get Geographic Information for Zip” in the field besides it

clip_image021

7. In the Action Results Tab,

a. Enter “The Geographic information is” in the Dialog Title field

b. Enter following in the Dialog Text area


The City is @{1}
The State is @{2}
The Time Zone is @{3}
The Area Code is @{4}


c. In the XPath Results section, add 4 Names as (use green color plus clip_image023 for adding additional parameters)

i. 1 as //GetInfoByZIPResult//Table/CITY

ii. 2 as //GetInfoByZIPResult//Table/STATE

iii. 3 as //GetInfoByZIPResult//Table/TIME_ZONE

iv. 4 as //GetInfoByZIPResult//Table/AREA_CODE

clip_image025

8. Click OK and Save Action button.

9. This finishes the action part, let us to go and create an analysis which uses this action.

Note: I can use an action link to give a demo but I thought it is better to create a demo with analysis.

Create Analysis

I have the sample app for OBIEE 11g installed and I am going to use it for the demo

1. Create an analysis from the Sample Sales subject area with Postal Code (Customer), Product, Revenue and Country(Customer) as columns

clip_image027

2. Since the Zip code Web service is going to work only for United States, add a filter on Country with value equal to United States

clip_image029

3. On the results tab, Let us exclude Country from the display

clip_image031

4. On the Analysis tab, open the column properties of the Postal Code Column

clip_image033

5. Go to Interaction Tab of the column properties and select Primary Interaction for Value as Action Links

clip_image035

6. Add action link by clicking the green plus symbol clip_image037

a. Enter the link text as Get Geographic Info

b. Select existing action button clip_image039

c. Navigate to the place where you have saved the action (mentioned in previous section, I saved it as ZipToGeoAction), click on the action and click OK button.

d. You should see a pop up “Edit Parameter Mapping” window. In the value column, click this clip_image041 button to expand it and select “Column Value” option

clip_image043

7. You should see that values are populated as list of columns present in your analysis. Select Postal code as value (see the image below). By doing this, you are saying that pass the value of Postal code as a parameter to the web service.

clip_image045

8. Click OK to close Edit Parameter Mapping window, OK to close Edit Action Link window and OK to close Column Properties.

clip_image047

clip_image049

9. Go to Results tab and click on any value in postal code column, it should pop a menu as Get Geographic Info

clip_image051

10. Click on the Get Geographic Info menu, you should see the following window

clip_image053

11. Click on Execute button and you should see the following window

clip_image055

12. Note: it might take little time as it going through the internet to get this information.

If you have any questions or comments, please drop a note below.