Feeds:
Posts
Comments

Archive for the ‘Programming’ Category

Dundas control is powerful 3rd party tool to develop report using SQL Server Reporting Service.

Microsoft declared that they integrated Dundas Control with SQL Server Reporting Service 2008 but in reality I found that I had to install Dundas control in my SQL Server Report Service 2008 server to make my reports working, which is little disappointing.

Another disappointing thing is, you need to manually setup the configuration files every time you deploy your reports in a new server even after installing Dundas Control.

If you see the following error “The Dundas Chart for Reporting Services report item is unavailable” even after installing Dundas Control for SQL Server reporting Service you need to do the following things to make it working.

1. Modify C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\rsreportserver.config

2. Modify C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\rssrvpolicy.config

3. Remember if you use any external dll files for your report you need to add the reference manually too in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\rssrvpolicy.config

You will get the config code for all the configuration here http://support2.dundas.com/Default.aspx?article=1107, so just copy paste the configurations in you server’s configuration files and restart the SQL Server Report Service. Hope now your reports with Dundas controls are working now. happy reporting 🙂

Read Full Post »

I was calling my WCF services from JQuery. Basically I was calling $getJSON to retrieve JSON data to display it in a dynamic table.

I started facing problem with the data sequence. It looked like i was not getting data at the same sequence it is in the class. My class looked like that
[DataContract]
public class MyClass
{
public DateTime Interval { get; set; }
public Double Actual { get; set; }
public String Units { get; set; }

public MyClass(DateTime interval, double actual, string units)
{
this.Interval = interval;
this.Actual = actual;
this.Units = units;
}
}

It was returning data in the order of Actual, Interval, Units.
Looks like it sends data sorting by DataMember Name
To Solve the issue we need to add Order option for every DataMember.
[DataContract]
public class MyClass
{
[DataMember(Order = 0)]
public DateTime Interval { get; set; }
[DataMember(Order = 1)]
public Double Actual { get; set; }
[DataMember(Order = 2)]
public String Units { get; set; }

public MyClass(DateTime interval, double actual, string units)
{
this.Interval = interval;
this.Actual = actual;
this.Units = units;
}
}

By the way it did not solve my problem fully either. I needed to call DataContractSerializer to serialize/sequence/order the data before sending.
public List GetData(string token)
{
List data = null;
foreach (DataRow dr in dt.Rows)
{
MyClass points = new MyClass(param1,param2,param3);
DataContractSerializer contractSerializer = new DataContractSerializer(typeof(MyClass));
data.Add(points);
index++;
}
}

return data;
}

This post describes this too.

Read Full Post »

In my aspx page I have several CheckBoxList and the requirement is client side validation for all the CheckBoxList in the page before page submission.
As CheckListBox do not support Required Validator we need to user Custom Validator for this validation.

Here is the sample of my ASPX code

<div>
<asp:CheckBoxList runat=”server” ID=”chkList1″>
<asp:ListItem Text=”List Item 1_1″ Value=”11″></asp:ListItem>
<asp:ListItem Text=”List Item 1_2″ Value=”12″></asp:ListItem>
</asp:CheckBoxList>

<asp:CustomValidator ID=”validator_chkList1″ ClientValidationFunction=”ValidateCheckList” runat=”server”>*Select at least one item</asp:CustomValidator>

<asp:CheckBoxList runat=”server” ID=”chkList2″>
<asp:ListItem Text=”List Item 2_1″ Value=”21″></asp:ListItem>
<asp:ListItem Text=”Lsit Item 2_2″ Value=”22″></asp:ListItem>
</asp:CheckBoxList>
<asp:CustomValidator ID=”validator_chkList2″ ClientValidationFunction=”ValidateCheckList” runat=”server”>*Select at least one item</asp:CustomValidator>

<asp:Button runat=”server” ID=”btnSubmit” onclick=”btnSubmit_Click” />
</div>

&nbsp;

I used the following javascript to do the validation

function ValidateCheckList(sender, args) {
var chkControlId = sender.id.replace("validator_", "");
alert(chkControlId);
var options = document.getElementById(chkControlId).getElementsByTagName('input');
var ischecked = false;
args.IsValid = false;
for (i = 0; i < options.length; i++) {
var opt = options[i];
if (opt.type == "checkbox") {
if (opt.checked) {
ischecked = true;
args.IsValid = true;
}
}
}
}

Nice and easy trick but it took around two hours for me to figure out, that’s why sharing.
Happy coding. 🙂

Read Full Post »

are you automating test of a product?

are you sure that the automation is really important or not?

be sure that manual test cost > automated test cost.

How??

easy… just calculate first

manual test cost = manual preparation cost + (N x manual execution cost)

automated test cost = automated test preparation + (N x automated execution cost)

… where N is the number of time test run.

We should use test automation only when it advances the mission of testing.

Read Full Post »

I needed to download directory from ftp server modify it and uploaded back to server using powershell. At fist i found that [System.Net.WebRequestMethods+Ftp]::UploadFile and [System.Net.WebRequestMethods+Ftp]::DownloadFile works fine and in real life when my zip file size is bigger it does not work.

I have not found any solution to make it working so I used alternative way to solve it. I have written two batch fildes upload.bat and downlaod.bat and calling these batch files from my PS Script to execute.

Actually if anyone use bat file he/she need not to call the bat file from PS Scripts but in my case after downloading zip file from ftp server I modified many things in the files using powershell and then upload it back to server.

Here are the batch files you can try if needed upload.bat and download.bat

Read Full Post »

to rename a file we use Rename-Item command in powershell the command is very simple

Rename-Item $source $dest -force

But what about changing a folder/directory name? I made mistake to write the same command in case of folder/directory rename and it does not work, shows exception file not found which proves that the command is searching for a file not ready to rename and folder/directory.

After googling for some minutes I found the solution and the command is

Rename-Item -path $destFolder -newName $folderNewName

Example: Rename-Item -path ‘C:\AshrafTest\MyFolder’ -newName ‘MyFolder_New’

By the way the folder should contain some data to be rename. Pretty simple but wasted time to search internet so sharing 🙂

Read Full Post »

Automate internet explorer

Recently I was trying to automate one step of my internet explorer actually my automation step was very simple I just needed to navigate an URL, read DOM of the URL, get text boxes and enter data in it. After entering data in text boxes I was suppose to click on login button.

Actually one of my 3rd party tool is depending on the login and was trying to automate the login and run the 3rd party tool so I need not to go to server everyday and do that.

It is easy to automate Internet Explorer by using a COM control named Microsoft Internet Controls (SHDocVw). To browse the DOM Microsoft.mshtml is used. I found a very helpful article with code in codeproject.com. here is the article : Automating Internet Explorer

By the way, I was facing problem to insert data in the text box  and click button. It worked fine in my local computer where VS is installed but for the computers where VS is not installed it shown exception to convert _Comobject to mshtml.HTMLInputElementClass . Download modified file.

Read Full Post »

Older Posts »