Tuesday, 16 August 2011

Unit Testing Framework and Type of Assert.

Few days back i had prepared a presentation about Unit Testing Framework and Type of assert in MStest.
which i have collected from ms website.
i had arranged all this in images formates so that it would be easy to access.
Thought to share the same with all of you!!
Happy Reading!!
  

Slide 1: The Title

Slide 2: Unit Testing Framework

Slide 3: Attributes Used to Establish a Calling Order

Slide 4: Assert Type

Slide 5:StringAssert Type

Slide 5: CollectionAssert Type

Slide 6: The End

Your Comments are always welcome!!
Thanks,
Md. Jawed 

What ia dumb file and how to capture it.

A nice article to read about What is a dump, and how do I create one?

i found this while surfing..so thought to share with all of you!!

http://blogs.msdn.com/b/debugger/archive/2009/12/30/what-is-a-dump-and-how-do-i-create-one.aspx

Using Visual studio you can capture the Dump file also.
make sure that under Debuge the Save Dump As menu item is added in visual atudio. if not then follow the below steps to add this menu item:

a. Select Tools -> Customize

b. Select the Commands tab

c. Select Debug from the Menu bar dropdown

d. Click Add Command...

e. Select Debug from the Categories list.

f. Find the Save Dump As entry in the Commands window.

g. Click OK (the Save Dump As... command is added to the top of the Debug menu).

h. Click Close

You can use the following steps to get a mini dump file:


1. Start Visual Studio.

2. Start another instance of VS.

3. In the second instance click Tools
Attach to Process...

4. In the list of processes locate devenv.exe.

5. Click Select... and explicitly choose 'Native' and 'Managed' code.

6. Click OK and OK to close Select dialog and Attach to Process dialog.

7. Go back to the first instance of VS and repro the crash\hang.

8. Upon the crash\hang, control should go to the second instance of VS.

9. In the second instance click Debug
Save Mini Dump (without heap).

http://connect.microsoft.com/VisualStudio/feedback/details/610988/qtagent32-crashes-on-running-unit-tests



Tuesday, 26 July 2011

Measure Execution Time taken by your code.

To measure an execution time taken by your code, just use the below piece of code at appropriate place in your code block.
using System.Diagnostics;

public static void Main(string[] args)
{
Console.WriteLine("In Main");
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();

//Your Code will go here

stopwatch.Stop();
var timeSpan = stopwatch.Elapsed;
var executionTimeTaken=String.Format("{0:00}:{1:00}:{2:00}.{3:00}",timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10);
Console.WriteLine(executionTimeTaken);
}

Thanks,
Md. jawed

Sunday, 17 July 2011

J-AXE: A File Splitter in C#

Introduction

 J-AXE file splitter is a windows application developed using C# .Net to split file in to time interval,Based on size and total files after splits. I would not ignore the fact that this is some kind of new application, Already there is so many open source project are available to achieve the same purpose. Then the question is why I have spent lots of time to develop this app: allow me to explain the question: whatever application is available as open and/or paid, you will not get the options to splits the file based on Time interval or duration. But here you will get this functionality along with other functionality with new flavor; and the main point is that I wanted to develop this using C#.Net and by developing this kind of application I will get a chance to learn something new And even I would utilize my free time into something productive .So I did this and here is the UI of this J-AXE file splitter application.
 (http://www.codeproject.com/KB/applications/JAXEFileSplitter.aspx)


                                                  Fig 1. JAXE File Splitter UI.


Might be you will think that why this application name is J-AXE? Actually the letter J came from Jawed and AXE is to cut some wooden block. So, I have chosen this application name as J-AXE.

Background

 Of course there was something which triggers me to come up with this ideas/application. Last month I recorded family videos using my camcorder after that I added few songs and effect in to recorded video to make it movies so that I can distribute this among family’s members. Now I wanted to split this file into durations instead of size so that I can make it into different parts, something like Part1 as 30 minutes and Part2 as45 Minutes. I searched here and there for open source but whatever I got all were having functionality to splits file only by size not by the time interval.

Then this requirement triggered some chemical imagination into my mind to come up with some application to fulfill my requirement and here it is an application “J-AXE: A file Splitter”.
 
Using the code

 J-AXE: A file Splitter a Windows application is very handy in use. The whole solution is divided into 2 Projects .One project would be User interface and Second Project would be nothing but our main logic which is in DLL format. The idea to separate logic from UI and make logic as DLL so, that anybody can use it easily without referring to my UI implementation.

Let me give you some pictorial presentation of the whole scenario (Class Diagram):
 
                                Fig 2. Class Diagram of JAXE File Splitter with JAXE DLL.


First I would like to explain the implementation of UI part. Then, I will explain the Logic part :

PART1: User Interface
The Block diagram would be something like this:

                                   Fig 3. Block Digaram of JAXE File Splitter.


On UI User will get below option to splits the file:
1. Based on Duration (Time duration in sec/min)
2. Size(in Bytes/KB/MB)
3. And Number of files

Based on the option selected we will call the corresponding function to splits the file:

I have already published this application on Code project., for code details and explanation you can visit the below link for the same:

J-AXE: A File Splitter in C# on Code project by Me. Jawed.

~jawed

Saturday, 9 July 2011

Move Items from one listbox to other list box

So,here is the piece of code for that:

public static void MoveSelItems(ListBox from, ListBox to)
{
for (var i = 0; i < from.SelectedItems.Count; i++)
{
to.Items.Add(from.SelectedItems[i].ToString());
from.Items.Remove(from.SelectedItems[i]);
}
}
~jawed