Good things should be appreciated–SQL sentry Plan Explorer TIP #95

Although , It is out of box but I would like to share here. I am very choosy in food. When my mother/wife cooked food and I didn’t like the taste then I explicitly said I didn’t like but when food taste was awesome then I didn’t say a word.

My mother taught me “You should appreciate every thing which is good.” Your single appreciation word do things

1. You yourself feel better

2. The person who did the good thing will be motivated to do more good things (in my case more tasty food wow Open-mouthed smile)

This lesson of my mother is now one of the rule life.

So here I would like to say  one of the best tools I came across is “SQL Sentry plan Explorer”.   There are various great features of this tool but I would like to share few things which attract me more

1) It comes in two versions (Basic & professional ) .Basic version is absolutely free free free.

2) It makes SQL developer’s life easy. You can easily  cross check query plan easily.

see below snap.

Easy_track_of_plan

You can also view logical read ,table scan and various other useful data

features

You can download this from http://www.sqlsentry.com/

Enjoy!!

RJ!!

How easy to reduce efforts in retesting a asp.net web application?

 

Most of the time when you write code for a web application you need to test it again and again. You have to run a whole flow of positive or negative test cases to check whether your application is working or not.

Now suppose your application have 20 pages and you need to traverse each individual page and may be perform some operation and on each change of your development you need to perform same thing.

sometimes, this thing will irritate you and you will skip testing which may be harmful because most of the time it happens when you skipped something Smile you took a deep breath  and at that moment your application crashed Sad smile.

So , as a responsible developer we do not have to skip any test scenario but next question is how to reduce this effort which you feel boring sometime.

I can say we can reduce this effort by a installing a simple  Firefox add-in which is absolutely free. The add in “Selenium add in”

you can download it from https://addons.mozilla.org/en-US/firefox/addon/selenium-expert-selenium-ide/

once you have installed this you will find the selenium icon near by search bar as shown below

selenium_icon

when you click this icon you will get a selenium interface as shown below

selenium_interface

The basic concept of this tool is what ever you will run in browser it has capability of recording those steps so it is just play button and pause button game, no rocket science. You can easily run and use this.

I am sure it will reduce your testing effort and when when selenium ide will play your test cases you can take a deep breath and enjoy your coffee and snacks.

I hope this tip may be helpful to you somewhere.

Happy Holidays.

Regards,

RJ

Easy way to find result set of a stored procedure without running it- TIP #32

 

Sometimes , We need to know what is the structure of stored procedure ? , How many columns will be return ?

So to determine this we have easy stored procedure provided by SQL Server which is sp_describe_First_Result_Set.

Below is the template to run it. You can provide your stored procedure name as variable

Execute sp_Describe_First_Result_set ‘ProcedureName’

In below snap I used Adventureworks database and try to find what will be the output columns of the stored procedure “uspgetBillOfMaterials”

As you see in below image after running above query we got all the result set columns

resultset

I hope this tip help you somewhere.

Enjoy !!!

How to disable Right click on web page ?

Dear All,
Sometime, due to some security reference your application require to stop right click on web page.
In such case you need to write just simple code as shown below.

//
Right click disable

So now when you run your web page and right click you will get following message.

result
So just each code and you are good to go.

Hope you like it.

Thanks & Best Regards,
Rajat Jaiswal

QuickAccess – A new windows phone App

 

Dear Friends,

Happy New Year 2014. It give me immense pleasure to introduce new Windows phone App which is QuickAccess. You can use this utility app  i am pretty much sure it will help you in many ways. You can instantly send  SMS, E-mail with pre decided template to a group. so download and enjoy.

Download link

QuickAccess

Thank & Regards,

Rajat Jaiswal

Indiandotnet 🙂

How to do 7zip programmatically using C# ?

Dear All,

Some times it may be possible you require to  make zip of  a file or directory.

so here is simple example.

To start it you have to download “SevenZipSharp.dll”, “7z.dll” you can download sdk from http://www.7-zip.org/sdk.html

Once you download sdk copy above 2 DLL in your project bin folder.

Now write below code which i am writing here

   1:  

   2: public bool CompressFolder(String 

   3: backupFolder)

   4:  

   5: {

   6:  

   7: try

   8:  

   9: {

  10:  

  11: SevenZipCompressor sz = new SevenZipCompressor(); 

  12:  

  13: SevenZip.SevenZipCompressor.SetLibraryPath(DLLPath);

  14:  

  15: sz.CompressionLevel = 

  16: CompressionLevel.Ultra;

  17:  

  18: sz.CompressionMode = 

  19: CompressionMode.Create;

  20:  

  21: sz.CompressionMethod = 

  22: CompressionMethod.Default;

  23:  

  24: sz.FastCompression = 

  25: true;

  26:  

  27: sz.CompressDirectory(backupFolder, BackupPath + "\\" + 

  28: DateTime.Now.Date.ToString("yyyyMMddHHmmss") + 

  29: "_7Zip.7z");

  30:  

  31: Directory.Delete(backupFolder,true);

  32:  

  33: return true;

  34:  

  35: }

  36:  catch (Exception 

  37: ex)

  38:  

  39: {

  40:  

  41: throw ex;

  42:  }

Now let me describe the code to you.

This is function which compress the folder to 7zip what ever pass as a paramter

in this function we have created a sevenzip compressor object

SevenZip.SevenZipCompressor.SetLibraryPath(DLLPath);

in the above line we set the DLLpath which is basically your bin folder path

sz.CompressionLevel = CompressionLevel.Ultra; is compress level which can be different according to your need.

sz.CompressDirectory(backupFolder, BackupPath + "\\" + DateTime.Now.Date.ToString("yyyyMMddHHmmss") + "_7Zip.7z");

above row compress the directory of backupfolder and rename with datetime_7zip.7z

I hope this will help you.

Enjoy 7zip.

Thanks & Best Regards,

Rajat Jaiswla

How to generate XSD from XML in 2 minutes ?

Dear Friends,

Many times we require XSD from XML which we can utilize in our code. so to achieve this we need to run a simple command which will create your XML in XSD. Now you are thinking what is that command so here we go

you just need to write following command on command prompt

XSD.EXE  “YourXML file Name”  /outputdir:

Example

XSD.exe “d:\myxml.xml” /outputdir:

When you run it it will generate the XSD file in system32 folder.

I hope you like it.

Thanks & Regards,

Rajat Jaiswal

LINQ tip to use proper for loop

Dear Friends,

As a programmer I would like to share some of the best tips which I found so far and this is one of the tip which I am going to share right away

suppose you have following  piece of code

string[] Names= namecollection.Split(GetDelimeter());

           List<string> NameList = new List<string>();
     

foreach (string name in Names)
          {
              if (!string.IsNullOrEmpty(name ))
              {
                  sb.Append(name .Trim() + ",");
                  NameList .Add(name .Trim());
              }
          }

Now you can write above  for each code  & if condition in following way

foreach (string Nam in Names.Where(Nam=> !string.IsNullOrEmpty(Nam)))
           {
               sb.Append(Nam .Trim() + ",");
             NameList .Add(Nam.Trim());
           }

It is much faster then a earlier code which shown

Hope you like this. Enjoy  Reading

Regards,

Rajat Jaiswal

Superb option run same single query on multiple SQL Server instances

Dear Friends,
Sometimes you stuck in situation where you need to run same set of queries on different servers.
Sometimes it is a real pan when you need to fetch records from all the server then basic approach you follow run query on different instance once by one.

I would like to share here one important facility provided in SQL Server management studio which is

“Register Servers”

With the help of Register Servers option you can run same query for the entire servers which you have registered.
You can access the “Register Servers” option from View ==> Register servers OR by pressing “CTRL + ALT + G” keys.

As shown below fig

Register Servers

Once you press the menu or follow above keys then you will get Register Servers option screen as shown in below fig.

Regiser server screen

You can right click on Local Server Groups and can create your own group also

Create group

Once the group is created you can move your Registered servers on which you want to run query in that group with right click move option on Group Folder

As you did this job your database server will come in the particular group folder as shown in below fig

MylocalGroupRegisterServers

Now right click on your group folder and go for option New Query
As you go for option new query a new query window will be open there
Now write proper query which you want to run on same database at different servers and execute it with F5 option
You will find when you will execute the result will show in query result window which is just below the query with starting column server name.

SinglQueryMultipleResult

Now you have option whether you want merge result or Individual result.
To check that option you need to go Tool –> Option then Query Result option as shown below fig

MergeREsultOption

This trick will help you in many ways to get the results from different server as well as to find results from different servers.

Thanks & Regards,
Rajat Jaiswal
Keep Learning, Keep Sharing

Great option “SQLCMD” run DOS command in SQL Server Managment Studio

Dear All,
Today I am going to share one of the interesting options of SQL Server Management studio which may be unknown to most of us.
Now you are thinking what it is? So the cool feature is you can

run DOS command in your SQL Server Management studio

.
I know your next question is how?
My answer is just follow below step
Go To Tool –> Option
After option window open you need to select Query Execution tree and Select checkbox for

SQLCMD_Option

By default, Open new queries in SQLCMD Mode

Now open new Query window and write following command
!! Dir C:\
And hit F5
You will find below in the query result you have directory & files of your current C drive.
Just check below fig to understand.

SQLCMD_Result

In this way you can run various DOS commands.
!! SSMS
!! Dir C:\New Folder

Isn’t it cool feature.

I hope you enjoyed it.

SQLCMD Option

Rocks
Keep Learning, Keep Sharing
Your friend,
Rajat Jaiswal