Pages

Thursday, 24 March 2016

Preparing for the PMP exam - The Journey, The Experience

Its been a while since Ganaraj and me blogged. Both of us have been slightly busy for the past few months and hence couldn't take time out for this. Finally, I have decided to sit down and just blog!! But this post, unlike the title of our site stick2code, does not really stick to coding :) Excuse me for that.
As a project lead, a fairly good amount of my work involves project and people management. Hence I decided to go ahead and give the PMP exam (Project Management Professional) a shot. This blog is all about the experience and journey through preparation, struggles and the final exam.

After ensuring that I had the requisite qualifications and was eligible for the exam, I sat down to take a look at the syllabus. Going through the syllabus of the PMP exam was quite exhausting and exciting. While there were a few things I was familiar with, there were those other areas that were completely dark zones for me. I realized it was not going to be a cake walk. After extensively googling around and reading about various PMP experiences, I decided to start my preparation.
As PMBOK5 serves as a bible for the PMP exam, the first thing I did was to get hold of it. But two days into the PMBOK and I realized that it was a bit too drab for my liking. As I looked around for other resources, I found the HeadFirst PMP book. I have never been a HeadFirst fan, but trust me, after using it for PMP, I strongly recommend that aspiring PMPs give it a try.
The PMP exam has a lot of areas you may not have worked on or may have worked on in a different way. So, its important to just forget everything you have worked on and start with a clean slate.

I started my preparation by reading through a topic in HeadFirst first and then followed it by reading the corresponding topic in PMBOK. This helped me in correlating and identifying gaps in my knowledge. As I read, I marked out the important sections and put in sticky notes for additional references. In parts that I had difficulty in understanding, google was my savior. There is a sea of resources on google and it answers and untangles almost all the problem areas. You just have to be wise and ensure that you are looking in the right direction.
Some excellent resources out there are youtube videos by iZenBridge and PassionatePM. While iZenBridge provides in-depth knowledge on some topics and helps you get a clear understanding, PassionatePM uses a comparative approach and clarifies concepts that are confusing. I highly recommend these two sites to be used in parallel in your preparation.

At the end of each topic, it is important to also attempt practice questions on that topic. After each topic, there are a set of questions in HeadFirst. I attempted these questions with all seriousness and tried to figure out my areas of weakness, and brushed up on those areas.

Once I was done with both these books, I enrolled with SimpliLearn's self-learning PMP course. This was essentially to get the 35 hours of learning required for PMP. I went through their course at my own pace and then went through the PMBOK a second time as I always considered PMBOK to be the primary resource in my preparation. Of course, SimpliLearn's course acted as a nice refresher and helped me in reinforcing my concepts.

I was also active on iZenBridge and SimpliLearn forums and posted many queries there. They have very interactive forums and the responses are generally quite prompt.

Once I was confident with my preparation, I started attempting practice tests. SimpliLearn's package came with a set of 5 practice tests. I attempted each of these tests by clocking myself. SimpliLearn's mock exams were quite close to the real exam and were quite helpful. I also attempted tests from Oliver LehmanniZenBridge free exam and Certchamp. Post each of these tests, I went through each question to understand the gaps in my understanding. This exercise is extremely important and very useful. It gives you an idea on the kind of questions to expect in the PMP and to understand how to handle the scenario based questions.


Disclaimer: The above post describes my experience, journey and things that worked for me. Each person is different and hence what worked for me may not necessarily work for you. Find out which approach and resources work best for you and then focus your energies towards it. All the best to all the aspirants.

Thursday, 10 December 2015

Consuming REST service through JavaScript Client in JDeveloper

Purpose:
This blog is intended to give you a basic idea on the application and usage of the new JavaScript client feature introduced in JDeveloper 12.2.1.0.0.
Usecase:
This usecase talks about using the RESTful JavaScript Client feature provided by JDeveloper to invoke a RESTful service. For this, we will be creating a javascript client for a service which gives us basic employee details, ie., id and name. We will also perform search operation on the employees and insert new employee data, using HTML and JavaScript at the front end, while talking to the service behind the scene.
Pre-requisites:
JDeveloper 12.2.1.0.0

Steps:
1)      Run the attached service in integrated weblogic server. Copy the WADL URL.
2)      Create a new Custom application. Invoke the new gallery wizard and select RESTful JavaScript Client as shown below. In the resulting dialog, enter the WADL URL of the service. Navigate to the next page of the wizard. Here, you can optionally rename the ‘Class Name’ to a more convenient name. In this sample, I have used the name as ‘EmpClient’. Finish the wizard. A client.js file will get auto generated for you at this stage. As we had renamed the Class name to ‘EmpClient’, the main variable and function in this js file will also be named in a similar fashion. This file contains all the javascript code required to invoke the RESTful service. All we need to do now is design an HTML page and invoke the operations.
   
3)      To invoke the operations of the service, start off by creating a HTML page. Let’s call the html page as EmployeePage.html.
4)      To use the variables and functions defined in client.js, we need to include it in our HTML page. client.js in turn uses jquery.min.js. Thus, we need to include it as well in our HTML file. Without jquery.min.js, you will end up with the error ‘$ is not defined’ at runtime.
5)      To design the HTML page, add a button with an onClick event attached to it. A snippet of the auto-generated client.js file as well as the initial HTML page is shown below. The page also includes the skeletal structure of a table, which we will use to render the data returned from the service.
Snippet of client.js:
var EmpClientClient = {
rootUri : "http://localhost:7101/REST_Service-Model-context-root/resources/",
EmpClient : function()
{
var path0 = EmpClientClient.rootUri;
return {
Project1 : function()
{
var path1 = path0+"project1";
:
:
getAsJson : function(){
:
:

Initial HTML Structure:
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
        <title>Employee Page</title>
        <script type="text/javascript" src="js/client.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    </head>
    <body>
        <div>
            <button onclick="invokeGETOperation()">Invoke GET Operation</button>
        </div>
        <table border="1" id="tbl1" hidden="hidden">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>NAME</th>
                </tr>
            </thead><tbody></tbody>
        </table>
    </body>
</html>

6)      We then create the invokeGETOperation() function within the script tags as shown.

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
        <title>Employee Page</title>
        <script type="text/javascript" src="js/client.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script>
          function invokeGETOperation() {
              $("tbody").children().remove();   //clear table body
              var myJsonObj = EmpClientClient.EmpClient().Project1().getAsJson();
              myJsonObj.success(function (data) {
                  populateResultTable(data);
              });
          }

      function populateResultTable(data) {
var dataSize = data.list.length;
                for (i = 0;i < dataSize;i++) {
                   var tbl = document.getElementById("tbl1").innerHTML;
                   var tableData = tbl + '<tr><td>' + data.list[i].id + '<\/td><td>' + data.list[i].name + '<\/td><\/tr>';
                   document.getElementById("tbl1").innerHTML = tableData;
              }
              document.getElementById("tbl1").hidden = false;
          }
     </script>
    </head>
    <body>
        <div>
            <button onclick="invokeGETOperation()">Invoke GET Operation</button>
        </div>
        <table border="1" id="tbl1" >
            <thead>
                <tr>
                    <th>ID</th>
                    <th>NAME</th>
                </tr>
            </thead><tbody></tbody>
        </table>
    </body>
</html>

 
7)      That’s it! Run the page.

NOTE: In the browser, change the URL from 127.0.0.1 to localhost. Otherwise, the request will not go through (you may need to use Access-Control-Allow-Origin header when hostnames of service and client are different).
HTML Output:
Similarly,
For PUT operation:
Code snippet to invoke Put operation:
             //Create new JSON data and populate it with new user data
              var newJsonData = new Object();
              newJsonData.id = eId;           // eId is taken from input text box using document.getElementById("empId").value;
              newJsonData.name = ename;       
              var myJsonObj = EmpClientClient.EmpClient().Project1().putJson(newJsonData); //passing the employee JSON object to the put operation

For Search (GET) operation:
Code snippet to invoke Search operation (Uses PathParam and QueryParam):
var myJsonObj = EmpClientClient.EmpClient().Project1().SearchEmpId(eId).getAsJson(ename);
Final  Output

A sample JavaScript client app can be found here.

Friday, 6 November 2015

React-Native DrawerLayoutAndroid - How to Open the Menu on Click of an Menu Icon

Recently had a chance to develop an app using the react native. On of my requirement for the app was a hamburgur menu. While the DrawerLayoutAndroid available does the job, to a great extend, had a requirement to open the menu on click of the Home Menu/Hamburgur menu.

This turned out to be quite a challenge. The document did not provide any means to open the drawer. On digging deeper into the code, noticed one method within the DrawerLayoutAndroid.android.js called openDrawer. This looked to be promising but the challenge was this was withing the Component, but react provides a nice feature called ref which is a callback function that is executed after render returning an instance of the rendered component. By using this i was able to access the openDrawer method and open the menu as required.

The below code snippet will explain this better:
var MenuDrawerLayout = React.createClass({
    navigationView : function(){
        return (
             <View style={{flex: 1,alignItems: 'center'}}>
                <Text style={{margin: 10, fontSize: 15, textAlign: 'right'}}>Hello</Text>
                <Text style={{margin: 10, fontSize: 15, textAlign: 'right'}}>World!</Text>
              </View>
               );
    },
    drawerInstance : {instance : {openDrawer : function(){}}},
    initInstance : function(instance){
        console.log(instance);
        this.drawerInstance.instance = instance;
    },
    onMenuClick : function(event){
        //callback function called when menu is clicked. This
       console.log(this.drawerInstance.instance);
    this.drawerInstance.instance.openDrawer();
    },
    render:function(){
        return(<DrawerLayoutAndroid
            drawerWidth={dimension.width-56}
            drawerPosition={DrawerLayoutAndroid.positions.Left}
            ref={this.initInstance}
            renderNavigationView={this.navigationView}>
               <View style={styles.container} >
                    <View style={[styles.body]}>
                        <Header onMenuClick={this.onMenuClick}></Header>
                        <Dashboard.DashboardBody />
                    </View>
               </View>
        </DrawerLayoutAndroid>);
    }
})



Thursday, 5 November 2015

Creating ADFBC REST services - A new feature in Oracle JDeveloper 12.2.1

With the release of JDeveloper 12.2.1, a number of new features have come in. One particular feature w.r.t web services that has been introduced in this release is the ability to create RESTful services using ADF business components. In this blog, I will take you through the steps to expose ADFBC components as REST services.

Steps:
Create a new ADF fusion application.



Call the application ‘EmployeeDescribe’.


On the Model project, invoke the ‘Business Components From Tables’ wizard.


Connect to the DB in which you created the tables. I have used EMPLOYEES table from HR schema in my case. In Step 1 of the wizard, query and toggle the EMPLOYEES table to the RHS as shown.


In step 2, toggle EmployeesView to the RHS as shown. In Step 4, ensure ‘Add to Application Module’ is ticked. Click Finish to close the wizard.


To create the ADFBC REST service, open the AppModule by double clicking on it. Navigate to Web Service -> REST and click the plus icon. In the resulting dialog, click on the link provided.


It will take you to the adf-config.xml page. Navigate to 'Release versions' tab and create a new version.


Come back to the REST tab under App module and click the plus icon. Click Yes in the resulting dialog. Doing so will configure your application for REST services and add a new project to it.

Next, provide a name, say emp for the resource. This will expose the employee object with endpoint as emp.


Next, run the RESTWebService project. A URL gets generated in the console. Copy that to the browser and replace the last part with version/resourcename. So, the final URL may look something as below:
http://127.0.0.1:7101/EmployeeDescribe-RESTWebService-context-root/rest/rel1/emp

In the browser, a description of the emp resource is shown.
You can get the complete description of the service, by using a URL such as:

http://127.0.0.1:7101/EmployeeDescribe-RESTWebService-context-root/rest/rel1/describe


In this case, you will be able to see details about what resources the REST service exposes, the attributes that are present, their type, methods exposed etc. This is the basically a description of the REST service.
You have now successfully exposed your ADF business components as a REST service!!!

Wednesday, 16 September 2015

Obtaining the name of the key in fasterxml

In this blog, I have just presented a simple sample of using fasterxml API to parse JSON data. This shows you how you can get the name of the key within a JSON object.

Suppose, you have a JSON sample as below:

{
"data": {
        "itemId": 1,
        "itemName": "Table",
        "price": 400,
        "dimensions": {
            "length": 5.0,
            "width": 10.0,
            "height": 4.0
        },
        "warehouseLocation": {
            "latitude": -48.45,
            "longitude": 20.5
        },
 "contact": [{
  "name": "Alison",
  "phone": "6454666"
 },{
  "name": "Simon",
  "phone": "6433666"
 }]
    }
}

Now, using java, if you are interested in obtaining itemName's contents, you would write code as below using fasterxml:

            ObjectMapper _MAPPER = new ObjectMapper();
            JsonNode node = _MAPPER.readTree(reader);
            JsonNode dataNode = node.get("data");
            Iterator<String> iter = dataNode.fieldNames();
            while (iter.hasNext()) {
                String key = iter.next(); //get the key of the object node
                if (key == "itemName") {
                    JsonNode dataVal = dataNode.get(key);
                    System.out.println("KEY:"+key+" VALUE:"+dataVal);
                }
            }

This will give output as below:
 KEY:itemName VALUE:"Table"

That's it in this blog. Hope you found it useful.

Wednesday, 12 August 2015

"GraphMethodException - No node specified" Error on accessing Facebook API

Sometimes on hitting the methods provided by Facebook API, you may see an error such as below:


Cause:
The code 100 with this error indicates that there is an invalid parameter that is being passed in the request (Refer error-reference).This would in turn mean that the URL you are trying to hit is not valid. For example, in my case, the problem was with the query parameters I was passing. The keys of the query parameters were not matching with the ones specified by Facebook API. Hence, I was seeing this error. I fixed it by referring the API docs and supplying the right query parameters.


Hope this helps!


Wednesday, 29 July 2015

Add Web Service Policy Reference for JEE clients - Explored

While working on something, I recently bumped into this cool feature in JDeveloper whereby you can easily consume secure web services through servlets. As usual, Jdevloper takes care of a lot of things for you, and all you really need to do is use the wizards and write some minimalist code.

Usecase:
In this usecase, I will demonstrate how a secure SOAP service can be consumed through a JEE client using the 'Add Policy Reference feature'. I will be consuming the service in JEE through a servlet.

Pre-requisities:
JDevloper 12.1.3.0.0

Steps:
  • For the purpose of this demo, I created a basic Hello service as below and secured it with the policy 'oracle/wss_username_token_service_policy'.
package pack;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import weblogic.wsee.jws.jaxws.owsm.SecurityPolicy;

@WebService
@SecurityPolicy(uri = "oracle/wss_username_token_service_policy")
public class Hello {
    @WebMethod
    public String helloWorld(@WebParam(name = "arg0") String s) {
        return "Hello " + s;
    }
}

  • Create the web service proxy for this service in a new application. Select the corresponding client policy during creation of the proxy. This step is required since this is the proxy reference that we will be referring to in the servlet.

  • Create a servlet in the same project.

  • Right click on the servlet editor and select Insert Proxy Reference -> HelloService.java. As shown, @WebServiceRef annotation gets generated with a reference to our proxy. 
 


  • Since the proxy also has client side security attached, we can now bring in the security aspect to the servlet as well. For this, place the mouse over @WebServiceRef and right click. Select the option to 'Add JEE Client Policy Annotations'. A confirmation dialog will show up. Select Yes in that to bring in the security annotations.



  • Modify the doGet method to add code to invoke the service. This involves  initializing the port, passing security information and calling the service.
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title>Servlet1</title></head>");
        out.println("<body>");
        out.println("<p>The servlet has received a GET. This is the reply.</p>");
        out.println("</body></html>");
        
        /*Add these lines to invoke secure service*/
        Hello port = helloService.getHelloPort();
        Map<String, Object> reqContext = ((BindingProvider)port).getRequestContext();
        reqContext.put(BindingProvider.USERNAME_PROPERTY, "weblogic");
        reqContext.put(BindingProvider.PASSWORD_PROPERTY, "weblogic1");
        out.println(port.helloWorld("Sansa"));
        /* End of add lines*/
        out.close();
    }
  • Thats it. Run the servlet to see the output from the service.