Thursday, 26 June 2014

Creating Base Class in Javascript

Like programming languages such as C#.NET and other languages, base class are often required to help with application development.
So what about Javascript, how is it possible to create base class in Javascript?
The tutorial below will show a general example of creating a base class in Javascript

Step 1: First step after creating the javascript file (eg. companyinfo.js), is to first add the following code below, which will will call it, "company_styles":


var company_styles = function(spec){
 var that = {};
 return that;
}


Step 2: next we have to create a variable function. Here we called a variable function called "CompanyName":


var company_styles = function(spec){
 var that = {};
 var CompanyName = function(){
  return "My Company";
 }
 return that;
}


Step 3: next we have reference "CompanyName" function to the public function:


var company_styles = function(spec){
 var that = {};
 var CompanyName = function(){
  return "My Company";
 }
 that.company_name = function(){
  return spec.CompanyName || CompanyName();
 }
 return that;
}


Step 4: Now we would create a new variable for debugging purpose called, "debug_company_styles", which would create a new instance of "company_styles":


var company_styles = function(spec){
 var that = {};
 var CompanyName = function(){
  return "My Company";
 }
 that.company_name = function(){
  return spec.CompanyName || CompanyName();
 }
 return that;
}
var debug_company_styles = new company_styles({});


Now in Google Chrome, we can debug function called, "company_name", and we can see that the value "My Company" is returned:




Step 5: Next we will see create a new function called, "my_company_styles" just below "company_styles", which will override the function name, "company_name" as shown below. And also, "debug_company_styles" will not create an instance of "my_company_styles":


var company_styles = function(spec){
 var that = {};
 var CompanyName = function(){
  return "My Company";
 }
 that.company_name = function(){
  return spec.CompanyName || CompanyName();
 }
 return that;
}


var my_company_styles = function(spec){


var that = new company_styles({});
 that.company_name = function(){
  return "My Other Company";
 }
 return that;
}


var debug_company_styles = new my_company_styles({});


Now in Google Chrome if we debug again, and called the function, "company_name", we can see that the value "My Other Company" is now returned:


Tuesday, 24 June 2014

Agile Scrum - How to play

Agile Scrum - Enjoyable and productive

Agile Scrum is a great way to manage your task within a project.
Agile Scrum provides a burndown chart which keeps you on track of how much task you have completed in a graph format, and what is left remaining.

Agile Scrum should be also be flexible. For example, if estimating a task deadline, it's not always going to be accurate, but some thought should be put into the deadline. Also, for the experienced developers, we all know that our clients would 99% of the time would want some sort of change requirement to a task or a section of a project, especially if it's a huge project. Agile Scrum should adopt to some change requirements if required.

So let's start of how to play Agile Scrum.

First thing we should ask ourselves is what we need to play Agile Scrum.


So here's the main things required for Agile Scrum

1. We obviously need our developers referred as team members

2. It is recommmended to have a scrum master. Someone who monitors and keeps track of how the task is progressing in the project, and any hurdles in the way.
Generally, it is the scrum master who either always develops the burndown chart, or then either tightly monitors the burndown chart.

3. Project Manager, who mainly interacts with the scrum master.

4. White board is required for managing stories and task.

5. Each team member, and possibly scrum master is required 10 cards or papers, numbering from 1 to 10. This will be used to vote to see how much importance is required for each story, and possibly how long it would take to develop.

6. Some sticky papers (post-it note) to be used as stories to be put on the white boards.

7. It is handy to have a task management tool, such as Jira Agile Scrum project to manage Sprint Runs.

8. Each team member is a player, so like monopoly having difference characters for each player, each player should be identified as a unique character.


How to play

1. Identifying each story and sub-task

Each feature or a huge task is known as a story.
And a story can consist of many sub-task or sub-story.

First thing required is the break up the project into features (or stories).
For example, if developing a blog website, then "post" can be a feature, and "comments" could be another feature. Post can be divided into more features or stories, such as "send notifications", "verify post or approval process to approve post", etc.

We should also identify which story are required before another.
For example, "post" is required before "comments", as comments without a post does not make sense.


2. Specify sprint runs and how long should they be

sprint runs can be 1 week, or 2 weeks or 1 month.

So for example, if we have specified sprint runs to be weekly. For the first week, we will put all our story and sub-task required for that first week.
Before doing this ofcourse, we should be realastic of how many hours (or time) we can put in development each week, or we can specify how many points we can do for each week.
The difference between points and time will be explained later on below.
So for example if we have 3-4 developers, then possibly 120 points might sound fair.

Points vs Time
Time is how much hours we put into a task. For example, we might put in 4 hours of work to a specific story. Therefore we might give 3 points for that task.
Points refer to how much importance that task is. So for example, we might deploy a sql script to specific live database which might take 1 hour. But because live environment is so sensative, we might still assign it 3 points (to test if everything is working, etc.)

3.  Placing stories on the white board

Stories can be put on the sticky paper or post-it notes with the text such as, "approval process for post approval". Then all stories are to be placed on the white board in a horizontal straight line.
If we have too many stories, then put atleast all the stories for that week on the white board.
Specify each sub task for a specific story, and place that vertically beneath each story.


4. Voting and assigning stories to each team member

Now that the stories and sub-task are all on the white board, each team member and scrum master should vote on how much point each story requires.
Also, each story or sub-task should also be assigned to specific character (team member), and put that character over the story sticky paper, to easiliy identify, which story or sub-task is assigned to which character.


5. Starting the sprint run

Start the sprint run for that week (meaning start developing the sub-task or story for that week). Scrum master should be monitoring the process of the sprint run and if required, interact with the project manager to keep the project manager in the loop.


6. Retrospective meeting after the sprint run

After each sprint run, a retrospective meeting is for all team members and scrum master.
In the retrospective team members and scrum master can identify the strengths and weaknesses for that sprint run, and how to improve future sprint runs.


7. Iteration process and burndown chart

Specify the story and task required for next sprint run, then repeat steps 4 to step 6 as a continous iteration process until the project is finishes. In the meantime, the Scrum Master should be developing the burndown chart for each scrum run.

Here some more details of the burndown chart.

http://en.wikipedia.org/wiki/Burn_down_chart

Thursday, 5 June 2014

Set Timeout in Nintex Workflow

In Nintex Workflow 2007 (and maybe future versions), there is no set timeout activity, so we have to do a workaround to achieve this. The current example will set timeout for 2 days for a Nintex request approval. 

Step 1: Create a ActionID in Workflow Variable



Step 2: Name ActionID, "ApprovalTimeout"



Step 3: Insert Parallel Action



Step 4: Insert Request Approval Action



Step 5: Set Action ID in Request Approval Action



Step 6: Insert Delay For Action



Step 7. Set Delay For Action to to "5 minutes" (This is set to allow time for Request Approval Action to start first)



Step 8: Insert Task Reminder



Step 9: Set Task Reminder (in this case we have set 2 reminder for each 1 day, so total is 2 reminders in 2 days



Step 10: Add End Workflow Action



Your Nintex Workflow should look like the following below



Tuesday, 18 March 2014

SharePoint 2013 - Modify Master Page

To get sharepoint master page to look
From:




To:



You can download the master page here, or you can follow the steps below:

here are the steps involved:

Step 1:
In the master page, set the style sheet with the following css style below:

 /* Aligns the Top Bars */
 .ms-cui-ribbonTopBars, #s4-titlerow,#contentBox {width: 960px !important;margin-left:auto !important;margin-right:auto !important;}  /* Turns off the border on the bottom of the tabs */
 .ms-cui-ribbonTopBars > div {border-bottom:1px solid transparent !important;}



And sharepoint site should look like:



Step 2:
Then add the following css:

.ms-core-sideNavBox-removeLeftMargin{ display:none; }

And sharepoint site should look like:



Step 3:
Then we need to cut the following tag and the elements within the tags, and move them above the dashboard tag which is <SharePoint:DeveloperDashboard runat="server" />:
<wssuc:Welcome> tag
<span class="ms-siteactions-root" id="siteactiontd"> tag
<span id="ms-help"> tag



And sharepoint site should look like:



SharePoint 2013 Rest api

SharePoint rest api gives user flexibility to retrieve data via URL.
Not only can this be used in development, but also can be used for debugging, such as, checking if list item data is returning from sharepoint list.

This is a whole new approach in comparison to sharepoint 2007, where rest service was not available, and only invoking web service methods were possible.

Below format of calling a sharepoint

http://(sharepoint site url)/_api/lists/getbytitle('<sharepoint list name>')/items

Replace <sharepoint list name> with the sharepoint list name.

for example,
if sharepoint site url = http://www.metadatadescription.com/
and sharepoint list name = AnnouncementCategory

then rest api url is:

http://www.metadatadescription.com/_api/lists/getbytitle('AnnouncementCategory')/items

SPServices Extension

SP Service extension, is a extension to SP Services javascript library, and can be used more easily to debug javascript.

For example, if we had  a sharepoint list called, 'AnnouncementCategory'. Then in google chrome console, we would just type in the following the retrieve the iteams in AnnouncementCategory list:

DEBUG_SPHelper.get_all_spList_items_as_XML('AnnouncementCategory')


This tool is really handy for simple queries. some of the functions are:

DEBUG_SPHelper.does_splist_exist(spListName)
DEBUG_SPHelper.add_splist(spListName, optusListDescription, optusListTemplateID)
DEBUG_SPHelper.get_splist_description(spListName)
DEBUG_SPHelper.get_splist_items_as_XML(spListName, CAMLQuery)
DEBUG_SPHelper.get_all_spList_items_as_XML(spListName, camlViewFields)
DEBUG_SPHelper.update_spList_new_fields(spListName, spNewfields)
DEBUG_SPHelper.batch_to_spList_item(spListName, batchCommand)
DEBUG_SPHelper.get_spList(spListName)
DEBUG_SPHelper.get_spList_fields(spListName)
DEBUG_SPHelper.get_spView_collection(spListName)
DEBUG_SPHelper.get_spView_GUID(spListName, spViewName)
DEBUG_SPHelper.update_spView(spListName, spViewName, spViewFields)
DEBUG_SPHelper.does_fields_in_spList_exist(spListName, spListFields)
DEBUG_SPHelper.get_array_from_XML(xmlData, arrayColumns)
DEBUG_SPHelper.CAML_new_item_batch(fieldNamesAndValues)
DEBUG_SPHelper.CAML_update_item_batch(listItemID, fieldNamesAndValues)
DEBUG_SPHelper.CAML_delete_item_batch(listItemID)
DEBUG_SPHelper.add_fields_to_spListView(spListName, spViewName, fieldsArray)
DEBUG_SPHelper.get_object_from_XML(xmlData, arrayColumns)
DEBUG_SPHelper.does_object_contain_items(objList)

Here are the steps below to get DEBUG_SPHelper working:

Step 1:
download SPServices, and download sharepoint-helper.js, and upload that file to the required SharePoint site.

Step 2:
Using sharepoint designer, add the link reference in the master page.

Remember:
JQuery file and SPServices javascript file has to be linked first in scripts before sharepoint-helper javascript file.



Step 3:
Open google chrome console, and type in the following:

DEBUG_SPHelper.get_all_spList_items_as_XML('<your sharepoint list name>')

Please replace <your sharepoint list name> with the sharepoint list name you want to query:

DEBUG_SPHelper.get_all_spList_items_as_XML('AnnouncementCategory')

Monday, 17 March 2014

SharePoint Foundation - Add Master Page to Subsite

In SharePoint foundation, one way to move master page from site collection to subsite is to download the master page from site collection and upload that master page to the subsite.

site collection master page look and feel:



original subsite master page look and feel:



Here are the steps to achieve set the subsite master page from site collection master page.

Step 1:
In site collection, click on Site Actions > Site Settings > Master Pages (This link will go to Master Page Gallery)



Step 2:
Download the master page that is used in the site collection.



Step 3:
Go to subsite master page gallery




Step 4:
In the ribbon, click on Files > Upload Document > Then browse and upload the site collection master page > Ok





Step 5:
Leave the default settings, and click Save


Now the master page is uploaded


Step 6:
Go to SharePoint Designer and open subsite. Then click on Master Pages, and select site collection master page (that was uploaded), then right click the master page, and then click:
Set as Default Master Page
and, Set as Custom Master Page



Now go to subsite, and the site collection master page should be applied to the subsite master page