Pages

Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Thursday, March 12, 2015

An Example of a Self Organizing Team

After a recent presentation where I talked briefly about self organizing teams, someone came up to me afterward and said (Im paraphrasing) "That team stuff is great and all, but some people are just lazy and need to be told exactly what to do and when." Argh.

But before you judge that person, let me tell you a story. In this true story youll have the opportunity to judge me for having the same thoughts before trying a different approach. This is the story of my self organizing daughter.

My kids go to a great school - the kind of school that fosters engaged teachers who go the extra mile to create engaged students. Throughout the school year the teachers run numerous clubs before school, at lunch, or after school including run club, football club, circus club (complete with unicycles!), reading club, wrestling club, girls club, gymnastics club, etc. My kids love attending these clubs and my oldest (aged 10 during this story) was determined to be in every one of those clubs.

This is great, except there were a few problems. Many of the clubs started before the school day so she had to be ready and out the door pretty early. Since most of the clubs had a strict attendance policy (if you miss two days, you are out of the club), being on time was important. Further, because of our cold winter weather, she received a ride on many of the mornings with one of her friends. If she was late getting out the door, her friend also risked being late and missing out on the clubs.

So, being the responsible parents that we are, we nagged her out the door each the morning. "Time to get out of bed", "Have you brushed your teeth yet?" "Go comb your hair",  "Its time to make your lunch now!" "Hurray up, youre going to be late!" It made for some pretty frustrating mornings for all of us. We treated her exactly as the statement above: "some people are just lazy and need to be told exactly what to do and when." She would do the task we asked her to do and then wait to be told what to do next. Looking at it now, she was disengaged and dis-empowered. I cringe at the memory.

While this was happening, I was reading the 7 Habits of Highly Effective People by the late Dr. Stephen R. Covey. I had my "Oh crap" moment when he said this:

"You cannot hold people responsible for results if you supervise their methods. You then become responsible for results and rules replace human judgement, creativity, responsibility...  Effective leaders set up the conditions of empowerment and then... get out of people’s way, clear their path and become a source of help as requested.“

After talking it over with my wife, we approached our daughter and apologized. We then discussed a new plan with her. Since she clearly was capable of getting out the door on time on her own, she would take over that responsibility. We would make ourselves available to be a source of help if requested but otherwise stay out of it. She jumped at the chance to take ownership of her morning routine. On the first day of this new arrangement she was ready fifteen minutes early and there hasnt been a day since then that she wasnt ready on time. Not so lazy after all I guess - just the victim of well intentioned managers.

After getting over my embarrassment, I pondered how this is a great parallel to self organized teams:

1. Status is known daily. We had daily status of her progress - if she was late she would miss her ride or be kicked out of a club. Our agile teams have daily standups, visual boards, frequent deliveries and demos so that everyone understands that status of the project at all times.

2. Agreed upon goals. She understood the goal (get out the door on time so that she can keep going to clubs) and desired to reach it. Self organized teams need to understand the goals of the project, not just the tasks to complete the project.

3. Freedom over methods. She started out being assigned tasks and moved to taking ownership of her own methods. Self organizing teams are given freedom to achieve the project goals and pull their own tasks rather than being assigned tasks.

4. Ask for help. She wasnt abandoned if she ran into trouble (oh no! I cant find the shirt that matches these pants!) - we stepped into help when asked. An effective scrum master, agile project manager, IT director, etc helps the team in a similar manner.

5. Empowerment brings results. This change turned a painful morning routine into a simple one because she was given the trust and responsibility to achieve the goal. When a team is given the trust and empowerment to accomplish the goal using their own methods, great things occur.

(Note :You can ready a similar story about Dr. Covey and his son entitled "Green and Clean")

Read more »

Sunday, February 15, 2015

What is Tail Recursion Example to Explain Tail Recursion

Tail recursion refers to recursive call at last line. Tail recursion can be eliminated by changing the recursive call to a goto preceded by a set of assignments per function call. This simulates the recursive call because nothing needs to be saved after the recursive call finishes. We can just goto the top of the function with the values that would have been used in a recursive call.

What is Tail Recursion? Example to Explain Tail Recursion?

The recursive function for Tower of Honoi Problem is given below. It is an example of recursive function with tail recursion.

Also Read: C Program for Tower of Hanoi Problem
Also Read: How to Convert a Recursive Function or Algorithm to Non-Recursive?

Recursive function TOH with tail recursion

void TOH(int n,char x,char y,char z)
{
                if(n>0)
                {
                                TOH(n-1,x,z,y);
                                printf("
%c -> %c",x,y);
                                TOH(n-1,z,y,x);                 //tail recursion
                }
}

Without tail recursion

void TOH(int n,char x,char y,char z)
{
                char temp;
                label:

                if(n>0)
                {
                                TOH(n-1,x,z,y);
                                printf("
%c -> %c",x,y);
                                temp=x;
                                x=z;
                                z=temp;
                                n=n-1;
                                goto label;
                }


}

Watch below video to understand tail recursion easily.



Image source: http://learnyousomeerlang.com/recursion
Read more »

Saturday, February 14, 2015

Playing with Date Format in Date selector component in Pentaho CDE Example Converting 2015 02 04 to 4 Feb 15

In this post, we will see how to customize date input control for default value & for its format.

Thank you Sam Kumar( A community guy) for asking me to explore this and hope this solution might be useful in your project.

Though, there is a direct property of setting format for date in Date selector , that will not work when you set a default value for date type parameter.

Scenario : 

 Lets say  you have given "yesterday" as default value for date parameter and in Date selector if you give "dd-M-yy" format then you can able to see the selected date in that format BUT for the first time you will not find anything in Date selector because your default parameter value is "yesterday"

Software Setup : 

Pentaho BA Server version : 5.3.0.0.196 ( test server - not stable one)
C-Tools (CDE,CDF,CDA & CGG) : 5.3.0.0.196(5.3) - Formally TRUNK version with 5.3 server

Problem statement : 

Default values like "today", "yesterday", "One week ago", "One month ago" should take 5-Feb-15, 4-Feb-15 and etc format in Date selector when dashboard loads ...


Step by Step Screenshot solution :


1)  Design the lay out for Date label & for Date selector (i.e., Html Objects for label & selector  - lets assume these html objects are Col1 & Col2).

2) Creating Date parameter : parameter name = date_param
    Go to components -> Click on Generic from left side -> Click on Date parameter
   Give default value as "yesterday" ( or today or other from the drop down).

3) Creating Date selector for Date parameter created in Step 2 : Date selector name = date_picker
  *    Components section -> selections -> Date input component
  *    Give parameter(date_param) for listeners & parameter section.
  *    Give html object for this (i.e., Col2 )

4) Test -1 : Default view



5) Now, Converting the format
  * Go to Advanced properties of Date selector (date_picker)
  * Write below code in Post Execution section 


function f(){
       var date1 = Dashboards.getParameterValue("date_param").toString();

    testdate = $.datepicker.formatDate("d-M-y",new Date(date1));


 //alert(testdate);


 document.getElementById(render_date_picker).value=testdate;

}



6) Save the dashboard and test it : Test -2

parameter default value is : yesterday


Thats it... We are done

Download Example here :  Click Me

NOTES :

1) From the stack overflow link below , as the CDE is already integrated with jQuery technology we have to use formatDate function for formatting the date. 
2) The code should go in Post Execution section. 
3) render_date_picker ----> render_ is the keyword for which we attach Date input component name. 
4) Code is independent for specific date control as it is going into Date input components own Post Execution section. 
for example : I have taken another date component and tested..

  5) Find jQuery supported formats using this link https://jqueryui.com/resources/demos/datepicker/date-formats.html

 References : 
1) http://stackoverflow.com/questions/3552461/how-to-format-javascript-date 
2) https://jqueryui.com/resources/demos/datepicker/date-formats.html

R&D links from Sam :-)
3)
http://stackoverflow.com/questions/3552461/how-to-format-javascript-date
4)
http://api.jqueryui.com/datepicker/#option-dateFormat
:-) Sadhakar Pochampalli :-) BI developer :-)




Read more »

Friday, February 13, 2015

Pentaho CDE Dashboard complete example Adding few more functionality to it

Sales Dashboard Demo in Pentaho CDE :



Drill down functionality on 2nd Chart (State wise individual details) which is a tabular display of data


Features:
1. Superb Layout (Back ground color, rows, columns structured based one)
2.Charts
      a. Pie Chart ( 1st row 1st 2 charts -SQL based charts & 3rd one is MDX based)
  • Pie charts are converted to circulared
  • Percentage values, actual values(featured any one of them we can remove)
  • Drill down from 2nd pie chart to another dashboard(tabular display of data) - passing field value from one dashboard to another dashboard.
      b. Bar Charts(4 and 5) - SQL based charts 
  • Dynamic with number of bars 
  • X-axis labels are rotated.
  • Dynamic with date input controls.
  • Currency symbol is added.
      c. Line Chart
  • Two lines are plotted
  • Dynamic with date input controls
SQL queries :
Complex queries are written to get the exact result sets ... for instance, JOINS, aggregate functions

CSS and JavaScript
To design the lay out written CSS code and to get the Advanced functionalities written java script..


Export Functionality :
Provide "Button Component" in one of the columns in Lay out section as shown in figure.
Write below code in Expression
function f() { window.print() }

NOTE :
Currently it is exporting XPS .. i.e, the window will be exported..
If you have pdf installed for your printer , you can save your file in the PDF format.

Source code : Click this link
 NOTE: 
1) You need to change database connection details .
2) For 5.0.1 CE, you need to use the Import/Export(Upload/Download) facility to fetch the .zip file as project in the server.
3) For 4.8 CE, you need place the folder of the source code(not zip file) in pentaho-solutions folder.
4) Note that this example may not work with older C-Tools. It was developed on 13.06. If you deploy it in older versions you might get comparability issues.

References:
1. On drill down
i) http://forums.pentaho.com/archive/index.php/t-84586.html
ii) forums.pentaho.com/showthread.php?95413-confused-about-drilldowns-on-cde




Sadakar
BI developer

I believe in "Learning Never Exhausts The Mind" 






Read more »

Wednesday, February 11, 2015

Exporting table component to Excel Or CSV Button Component Example in Pentaho CDE

Hi Guys,
We can export the tabular display of data to excel or csv using Button component available in pentaho CDE.

Example:
1) Lay out section
Design your lay out as per your requirement.
For example find the image below.

2) Components Section 
 i) Select "Export Button" from the list of "Others"
ii) In the properties
Name : Component Name (ExportExcel)
Lable : Name that appear on your button (Eg : ExportExcel_
Component Name: your table component Name(Eg: tableData)
HtmlObject : the column name where you are placing this button (Eg :ExportExcel or Panel1)


3) Data sources section :
In this example taken foodmart database to display some data in the form of table component.
Browse for the database connections in this blog site.


4) Preview
* Click on "ExportExcel" button ... you will find the pop up asking you to save the exported file.


NOTE :
Currently(23rd dec 2013 is the post written date) "Export button supports " Excel , CSV formats but not pdf.
In future pentaho may provide the functionality to export.

Formats Tested :
Excel:
xls ->Worked
xlsx -> Not worked
csv -> Worked

Need to figure out the following
1) Exporting to multiple pages
2) Pagination
3) Bulk data exporting  to Excel




Read more »