Microsoft Technologies, ASP.NET & SQL SERVER Tips with Rajat Jaiswal

Month: May 2011

Dear Friends,
Today is Sunday. I am sure you have many plans for the day even I have also. My plan is to share one awesome feature of Silverlight which is Augment Reality. I am very excited for this.
A new toolkit is introduced which is SLAR toolkit. The Silverlight Augment reality by the name it is clear that it’s more about reality work.
The current sample project we match pattern of an image. We just move the corresponding images in front of our web cam and if the pattern matches we put some kind of marker like text box, images.
Is it interesting? , Really it is when you tried it you will enjoy the functionality more.
I tried this toolkit and I am very much impressed with this new utility. With this utility you can try various feature programs, games and make the things more interesting more live.

You can download this new feature toolkit from http://slartoolkit.codeplex.com/releases/view/45629
I am going to show you an existing sample to you which is mainly for recognizing the pattern images.
Although I am not going to do something extra it’s exactly same which is provided by SLAR Toolkit.
So here are the steps
1) Create a new Silverlight project in VS 2010 (don’t include host Silverlight option)
2) Copy Matrix3DEx.dll, SLARToolkit.dll in bin folder of the project and add reference of the DLL in the project.
3) Now add pat files in projects (the pat files are basically pattern file which you can create for an image. The pattern file can be create from photo shop or other image editing tool)
4) The structure of the project now looks like as below.

// Initialize the Detector
arDetector = new CaptureSourceMarkerDetector();
// Load the marker pattern. It has 16×16 segments and a width of 80 millimeters
var marker = Marker.LoadFromResource(“Marker_Hiro_16x16segments_80width.pat”, 16, 16, 80);
// The perspective projection has the near plane at 1 and the far plane at 4000
arDetector.Initialize(captureSource, 1, 4000, marker);

Now when you will run the code you are surprised by the working functionality of the page.
In our example we have taken “Hiro.pat” file
So when we run this if we put hiro image pattern print out the image is captured and the textbox comes in front of the image.

As you are using Microsoft Visual Studio you have proved you already a smart person.
Most of the time we are doing lot of hard work to execute a project. If we see our back so we observe that we write thousand of the lines for a project (without actual logic). Sometimes a minor project can take number of days to complete.
When you think about a project most of the time we have to write same line of code except the core logic. But again we have to write whole bunch of lines for the project and put lot of efforts from our side.
I realized that sometime I am only hard working programmer not smart programmer while I have many options provided by Microsoft to make myself a smart work. Although I tried many times to be smart programmer as you have seen in my previous articles like database utility, three tier architecture code generator, Macros code generator etc.
Here I want to share a small utility provided by Microsoft visual studio which will be a step towards making our self smart. Although this topic needs to be introduce in the same series of code generator but I am really sorry, I missed this utility at that time. Recently one of my friends asked me this question so I thought this should be share with every one because we are a team.
I know some of you aware of this utility, some of you using this but it is for those friends who really wants to improve and not aware of this.
The utility function is “Snippets “. Are you surprised? , I don’t think so.
A snippet is a utility provided by Visual studio which is helpful in making us smart programmer.
We can access the Snippets by using Ctrl + K, ctrl + X key. When you press this in visual studio you will get the list of existing snippets codes existing is visual studio. We just need to select particular code which we required and change small variable declaration and bang, we will find we write a complete code in few minutes.As shown in fig (1) we are accessing crystal report code

Great fig (2) shows we created bunch of lines for accessing crystal report by just simple clicks one more great thing is you don’t need to add reference in your code for require DLL the snippet automatically handle that.

We can create our own snippets and use them. For this we have to create a XML and whose structure is as follows.
<CodeSnippets
xmlns=”http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet“>
<CodeSnippet Format=”1.0.0″>
<Header>
<Title>
Complex logic of Rajat Snippet
</Title>
</Header>
<Snippet>
<Code Language=”CSharp”>
<![CDATA[
We can write n number of lines here with complex code
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

I hope it would be helpful topic enjoy smartness.

I urge you to share more utility which make us smart programmer.
Thanks & Regards
Rajat Jaiswal

Hello friends,
Recently one of my friends needed a utility. According to
his need the application just select the folder and print all the PDF files
which are in the folder.
So I made a simple windows application which execute acrobat
reader exe with /h/p option which print all the PDF one by one.

Hello friends,
I know after reading the post title you are very excited to know more, even I was excited too to know more for this topic which I like very much.
Microsoft Introduced Performance Dashboard Utility reports which help us in finding the cause of low performance of our SQL Server Database.
You can download the performance Dashboard utility reports setup from below linkhttp://www.microsoft.com/downloads/en/details.aspx?FamilyID=1d3a4a0d-7e0c-4730-8204-e419218c1efc
When you install this installer you will find a new folder is created with Performance Dashboard name in tools folder of Microsoft SQL SERVER (“C:\Program Files\Microsoft SQL Server\90\Tools\PerformanceDashboard”)
Now when you open this folder you will get many RDL files.
Next question is how to use it so here we go.
1) Firstly run the script with name “setup.sql “ from Performance Dashboard folder (“C:\Program Files\Microsoft SQL Server\90\Tools\PerformanceDashboard”)

2) Now open our SQL Server Management studio
3) Open object explorer
4) Right click on the server select reports option then select standard reports as shown in below fig

5) Now select Performance_dashboard _main.rdl report
6) When you select this report you will find following screen

Great it means you are able to see performance dashboard report.
The performance dashboard report gives you following result
1) First graph of report shows System CPU utilization (With the help of this you can find how much CPU utilization done by SQL)
2) Just Below the CPU utilization graph you can see current Activity (CPU consumption time, wait time) We can see detail with two parameter either by User Session or User request (When you click on the header of the grid you will get different report)
3) Below this we have miscellaneous information which will give basic information like number of database currently on server, active trace etc.
4) Waiting log just right side of CPU utilization graph which shows different wait type for SQL
5) Below that one more tabular grid there which shows historical records of SQL according to different criteria like waits, IO Statics
6) Expensive SQL report with different parameters like BY CPU, BY Duration, BY Logical Reads, BY Logical Writes etc.
Checks out there are many more feature reports.
So with these different reports we can find where we are lacking. Where is the problem?

My personal feeling is the utility is good to finding the performance counter but it will not provide any suggestion and solution to improve performance.
So why are you waiting?
Just download and enjoy the performance dashboard.
Have fun with reports in weekends: D.
Thanks & Regards
Rajat Jaiswal

Hello Friends,
We always heard that we should adopt Best Practices in SQL Server and most of the time we tried our best to adopt best practices in our work but the problem is who will analyze the best practices which we did for our database ,SQL Server.
Hmm, that’s the point my dear friends but don’t worry on this part also because Microsoft introduce BPA (Best Practice Analyzer).
I tried this tool recently it is easy to use. It scans your database, SQL SERVER and provides you the best way to adopt Best Practices with your current structure.
You can download the installer of this tool from http://www.microsoft.com/downloads/en/details.aspx?FamilyId=da0531e4-e94c-4991-82fa-f0e3fbd05e63
After install this BPA utility you can easily scan your SQL SERVER, Databases with this.
The BPA will provide you report of scan. The scan report will give you idea about what is missing, what need to do?

Below are some listed options which BPA raised after scan report
1) Backup is latest or is it out dated?
2) Database having any anomalies.
3) Database integrity check required or not?
4) Check Disk IO delay problem
5) Backup should be on separate volume
6) Bulletin\Administrators in sysAdmin Role
7) Set Page verify option
8) SQL Login Password policy violation
9) Database is not in full recovery mode
Although some of the warning in the above list which we can ignore according to our business need.
And many more issues to make SQL Server database robust just check below report snap.

As per my opinion the tool is good but need some more functionality or utility to manage and apply
Best practices. So why you people waiting just download, install and use.
Make your database robust with best practices.
Enjoy Best Practices.