Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Wednesday, 4 May 2011

Create Work Item Template for Team

Work item templates are very good option to apply a set of changes for a group of work items( for eg: bugs). But have you come across having difficulty not to be able to have shared work item templates, if so just follow these simple steps and you can achieve it.

Before creating a work item template, choose a shared location where each of team member have access such \\csharptechies\workitemtemplates, if you do not already have one create one shared folder on a network.

Now that you have the shared location, update your work item template settings in visual studio settings to point a shared location as follows :-

1. In the Tools menu, click Options.
2. In Options window, click Team Foundation Server Power Tools then click Work Item Template.
3. In the Work Item Template option page, click Browse to change the default location to \\csharptechies\workitemtemplates.
4. Click OK.

(above steps would only work for VS2010)

Now that your default location is set for work item template, create a new work item template.

After creating, browse to \\csharptechies\workitemtemplates and you should be able to see a new file created with extension .wt

Ask all of your team members to update there default work item template location.

Note:- A work item template is specific to a project

There is only one satisfying way to boot a computer. ~J.H. Goldfuss

Thursday, 7 April 2011

Stumbled upon decision to use either cross tab or pivot in SQL Server

Here is what it is..

Create a set of views which uses pivot using SQL Server 2008 express. All goes fine if the record count is in 1000's .... Testing with 20,000 found no issues what so ever with performance.

Now dealing with a million records, struggling with performance of 4 min's for simple query run.

Googling about this, have found a nice article

Cross Tabs and Pivots

As the article states using cross tab would give better performance than pivot, happy to accept that but this too was taking 2 to 3 min's.

So now changed the design, to remove pivot and an intermediate table to have the results.

I wish life had an Undo function. ~Author

Friday, 18 March 2011

Displaying JQGrid as defaulted with multiple search conditions

Just as you would apply default search condition for JQGrid its easy to apply multiple search conditions.

But this would need some more parameters, firstly enable multiple searches using the parameter "multipleSearch: true"

The code would as follows :-

$(function () {

 var GetFilters = function () {  
  var filters = null;  
  var filterData = { groupOp: "OR", rules: [] };
  filterData.rules.push({ field: "id", op: "eq", data: "1" });
  filterData.rules.push({ field: "id", op: "eq", data: "2" });
  filterData.rules.push({ field: "id", op: "eq", data: "3" });
  filterData.rules.push({ field: "id", op: "eq", data: "5" });
  filters = JSON.stringify(filterData)  
  return filters;
 }



 jQuery("#grid").jqGrid({    
  url:'GetDetails.asmx?team=All',    
  datatype: "json",    
  colNames:['ID','Name','Country','Progress'],    
  colModel:[    
  {name:'id',index:'id', width:55},    
  {name:'Icon',index:'Icon', width:90},    
  {name:'name',index:'name asc, invdate', width:100},    
  {name:'designation',index:'designation', width:80}],    
  rowNum:10,    
  rowList:[10,20,30],    
  pager: '#grid_pager',    
  sortname: 'id',    
  viewrecords: true,    
  sortorder: "desc",    
  caption:"JSON Data",
  serializeGridData: function (postData) {
   var filters = GetFilters();
   
  if(filters != null)
  {   
   postData.filters = filters;
  }
  else
  { 
   if (postData.searchField === undefined) postData.searchField = null;
   if (postData.searchString === undefined) postData.searchString = null;
   if (postData.searchOper === undefined) postData.searchOper = null; 
   if (postData.filters === undefined) postData.filters = null; 
  }
  return JSON.stringify(postData);
  },
 }).jqGrid('navGrid', '#grid_pager', { edit: false, add: false, del: false, search: true },
      {}, // edit options
      {}, // add options
      {}, //del options
      {multipleSearch: true }
 );
 

});

That's it multiple filters are passed as default search condition to jqgrid web service. Handling of this is not upto web service.

Web service would get the filters data as

"{\"groupOp\":\"OR\",\"rules\":[{\"field\":\"id\",\"op\":\"eq\",\"data\":\"1\"},{\"field\":\"id\",\"op\":\"eq\",\"data\":\"2\"},{\"field\":\"id\",\"op\":\"eq\",\"data\":\"3\"},{\"field\":\"id\",\"op\":\"eq\",\"data\":\"5\"}]}"

which if clearly formatted would be as

"{
 \"groupOp\":\"OR\",
 \"rules\":
  [
   {\"field\":\"id\",\"op\":\"eq\",\"data\":\"1\"},
   {\"field\":\"id\",\"op\":\"eq\",\"data\":\"2\"},
   {\"field\":\"id\",\"op\":\"eq\",\"data\":\"3\"},
   {\"field\":\"id\",\"op\":\"eq\",\"data\":\"5\"}
  ]
}"

This would need to be converted back from json to an object to actually read the data. The following snipped explains how to form a search condition :-

string sCond = string.Empty;
Dictionary(string, object) filtDat = (Dictionary(string,object))filters.FromJson();

string gpOp = (string)filtDat["groupOp"];
object[] ruleOp = (object[])filtDat["rules"];
for (int i = 0; i < ruleOp.Length; i++)
{
        Dictionary(string, object) filterData = (Dictionary(string,object))ruleOp[i];
 string field = (string)filterData["field"];
 string op = (string)filterData["op"];
 string data = (string)filterData["data"];
 sCond += GetCondition(field, op, data);
 if (i > 0)
 {
  sCond += " " + gpOp + " ";
 }
}

return sCond;


Your requirements may vary, just need to customise little to achieve your requirement.


Spreadsheet: a kind of program that lets you sit at your desk and ask all kinds of neat "what if?" questions and generate thousands of numbers instead of actually working. ~Dave Barry, Claw Your Way to the Top

Displaying JQGrid with default search condition

Being using JQGrid for sometime, have at one point required to display data in jqgrid but with a default search condition.

Its as simple as just passing data using the parameter serializeGridData in jqgrid

$(function () {

 var defaultsearchField = "id";
 var defaultsearchString = "5";
 var defaultsearchOper = "gt";



 jQuery("#grid").jqGrid({    
  url:'GetDetails.asmx?team=All',    
  datatype: "json",    
  colNames:['ID','Name','Country','Progress'],    
  colModel:[    
  {name:'id',index:'id', width:55},    
  {name:'Icon',index:'Icon', width:90},    
  {name:'name',index:'name asc, invdate', width:100},    
  {name:'designation',index:'designation', width:80}],    
  rowNum:10,    
  rowList:[10,20,30],    
  pager: '#pager',    
  sortname: 'id',    
  viewrecords: true,    
  sortorder: "desc",    
  caption:"JSON Data",
  serializeGridData: function (postData) {

  if(defaultsearchField != null)
  {
   postData.searchField = defaultsearchField; 
   postData.searchString = defaultsearchString; 
   postData.searchOper = defaultsearchOper;
  }
  else
  { 
   if (postData.searchField === undefined) postData.searchField = null;
   if (postData.searchString === undefined) postData.searchString = null;
   if (postData.searchOper === undefined) postData.searchOper = null; 
  }
  return JSON.stringify(postData);
  },
 });   

});

Now the webservice will get the default search condition and should be able to work straight away. Unless if search is not handled on web service side.

Three things are certain:
Death, taxes, and lost data.
Guess which has occurred.
~David Dixon, 1998, winning entry of the Haiku Error Messages 21st Challenge by Charlie Varon and Jim Rosenau, sponsored by Salon.com

Thursday, 10 March 2011

Using word wrap for text using css for words with out spaces

Many web pages contains some information which needs to be displayed using word wrap. consider a small example as below:-

Here is some content for the div element

CSS used in the above example will process the text with word wrap but only if it can find a space. If you would like to have a word warp for long words that does not have space then the CSS would be

Here is some content for the div element veryveryveryverylargewordwithoutspace


Three things are certain:
Death, taxes, and lost data.
Guess which has occurred.
~David Dixon, 1998, winning entry of the Haiku Error Messages 21st Challenge by Charlie Varon and Jim Rosenau, sponsored by Salon.com

Thursday, 10 February 2011

Generate client side script with custom control in ASP.NET

As you already know custom control gives the flexibility and allows to add complex features for a server control (refer to MSDN:Developing and Using a Custom Web Server Control).


Now consider you would like to display modal dialog using JQuery UI and the respective .js files are already loaded by the main website.The following snippet allows you to display a button from your custom control and generate a script block on the client side to handle the click event.

public class CustomWebControl : WebControl
{
 protected override void Render(HtmlTextWriter writer)
 {
         writer.Write(@"
          
          
              

Text to be displayed in the modal dialog.

"); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "test-dialog-modal_1", @" "); } }

This is the simple case of explaining how to achieve it.


The most overlooked advantage to owning a computer is that if they foul up, there's no law against whacking them around a little. ~Eric Porterfield.

Wednesday, 5 January 2011

Passing vArguments or dialogArguments with window.open

Arguments can only be passed with window.showModalDialog which is quite helpful. But consider your application is using these arguments extensively in your website and suddenly it appears modal dialog is not supported on all browsers. Opera does not support modal dialog, now instead of changing the existing functionality the work around would be as follows:-

1. Detect if browser support modal dialog or not and then assign arguments
var vArguments = new Object();
vArguments.test1 = "test1 data";
vArguments.test2 = "test2 data";
if (window.showModalDialog) {
window.showModalDialog(sURL, vArguments, sFeatures);
}
else
{
window.dialogArguments = vArguments;
window.open(sURL, "_blank", sFeatures);
}

2. Now inside the pop-up window access the arguments

 var dialogArguments ;
if (window.showModalDialog) {
 dialogArguments = window.dialogArguments;
}
else {
 dialogArguments = window.opener.dialogArguments;
}
alert(dialogArguments.test1);
alert(dialogArguments.test2);

Now this should work like a charm.


Man is still the most extraordinary computer of all. ~John F. Kennedy
Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers