What is Pivot Viewer in Silverlight 4?

Hi Folks,
Sorry for such a late post. I know you were waiting for the new post from last 2 week. So here I am with a new interesting area which will help in data visualization. “Pivot Viewer” control is great tool supported by Silverlight 4. I know that I am bit late to explore such a great control.
I really want to thank Microsoft Pivot team for this they did such a great job.
Again our 3 basic questions WWH means,
what is Pivot Viewer control?
Why Pivot Viewer control?
And lasts but not the least How we can use & utilize it?
So, we first start with pivot viewer. “Pivot Viewer” is new control supported with Silverlight 4.
It is a representational control you can use this control where you want a BI functionality. Or we can say that it provide a unique way to represent data to analyse. You can filter data on the basis of various filters which you define and the transition from one filter to another filter is so smooth you worth to watch it. You can change view from normal grid view to column view.
Now if you are aware of BI (Business Intelligence) tools then I am just saying here it is one of the BI tools which help end user to get the result by applying multiple filters. You can define facts & fact category (facts are actual data & fact categories are the fields on which you can apply filter to get desire result).
Now I know you are most interested in where & how can we use?  So I am taking very interesting topic which is “Cricket World Cup 2011”.
Pivot viewer silverlight 4 with Cricket World cup 2011
Cricket World Cup 2011 pivot viewer

I will explain whole topic with example in next post.

Thanks
Rajat Jaiswal

Silverlight Out Of Browser Application (OOB Apps) in simple steps

Hello friends,

As we have seen last night how to access Video capturing devices with Silverlight 4.0. Now today I thought why we don’t try for OOB Application means Out Of Browser Application.

Out of Browser application means you can run your Silverlight application just like an EXE we don’t require any browser like IE, Firefox etc to run our Silverlight application. So here is the step which we have to follow to get out of Browser application.

Step 1:- Check Silverlight project’s property page. On this page you will find a checkbox which is “Enable running application out of the browser” just check this checkbox as shown in below fig.

out of Browser application

Step 2:- Click on the button “Out-Of-Browser Settings…” and you will find below screen. In this screen you set title for the application, give description for the application, define icons for application.

Step3:- Be sure if you want to access local files of computer then check “Require elevated trust when running outside the browser” checkbox.  When this checkbox is checked then you can easily access the file from my documents and local directory easily it give full trust to your application.

Step4 :- you can  check whether the application is installed on machine or not with app.current.InstallState you can check Installation state if not installed the you can choose app.current.Install() method to install app.

OOB Application

Hope you will enjoy OOB application.

Thanks & Regards

Rajat Jaiswal

webcam access in website using silverlight

Hello friends,
Microsoft Silverlight 4.0 provided another great feature of Audio & Video capturing. Today I am interested in using one of these cool features which is video capturing.
With the help of the video & audio capturing feature we can get all the capturing devices and use them. In current example there is only one source which is my laptop webcam.

videocapture
So we are using 8 simple steps. With the help this simple we are capable of capturing webcam and stop capturing.
Step 1:- Create a new project of Silverlight with version Silverlight 4 version.
Step 2:- Draw a shape either rectangle or eclipse. The shape will hold the video.
Step 3:-  CaptureDeviceConfiguration provides GetAvailableVideoCaptureDevice &   GetDefaultvideoCaptureDevice methods.
The GetAvailableVideoCaptureDevice list out the entire available video capture device attached with your machine and GetDefaultVideoCaptureDevice provides default video capture device.

But before accessing any device from any machine we need to request device access and need to determine whether the device access is allowed or not. For determining the permission or request a device access we have following 2 methods
CaptureDeviceConfiguration.AllowedDeviceAccess   CaptureDeviceConfiguration.RequestDeviceAccess

silverlight permissions
It will prompt message for accessing the capturing device when you run the program.

   var webCam = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

Step 4:-
            Once you determine the capture device configuration then you need to assign it to assign as a video capture source device of capturesource.
  captureSource = new CaptureSource();
 
Step 5:- Once you assign the capture source’s video capture device then use a new brush utility provided by Silverlight which is Video Brush.  You just need to set source of video Brush which will be your capture source.
  var videoBrush = new VideoBrush();
      videoBrush.SetSource(captureSource);

Step 6:- Once the video Brush’s source is set then you can fill any shape with video brush.
          rectangle1.Fill = videoBrush;
     ellipse1.Fill = videoBrush;

Step 7:- now to start capturing from video source you need to call start method of capture source.
  captureSource.Start();

Step 8:- you can stop capturing video by stop method.

     captureSource.Stop();
 From the above description you can capture video from Webcam or any other video device which attached with your machine using Silverlight video capture facility. One more advantage is that you can take image also means image capturing is also possible. For this you have to define asynchronous image capture event.

silverlight 4.0

In this way you can access video capture device.  More than this you can download code from
http://cid-1eda2012469ff8ad.office.live.com/self.aspx/.Public/RajatJaiswal%5E_IndiandotnetVideoCaptureSilverlight4.0.zip

Enjoy Silverlight.
Thanks & Regards
Rajat  Jaiswal

how to find column or text in entire stored procedure?

Hello Friends,

Sometime we want to search a particular column or some text in entire stored procedures. For this we can utilize following two simple approaches

Approach 1:-

BEGIN TRY

  DECLARE @strColumn VARCHAR(1000)

  SET @strColumn =’Rajat’

  SELECT DISTINCT o.name

  FROM sys.syscomments c

  INNER JOIN sys.objects o ON o.object_Id = c.Id

                 AND o.type =’P’

  WHERE text like ‘%’ + @strColumn +’%’

  ORDER BY o.NAME

END TRY

BEGIN CATCH

  SELECT ERROR_LINE(),ERROR_NUMBER(),ERROR_MESSAGE()

END CATCH

Approach 2:-

BEGIN TRY

  DECLARE @strColumn VARCHAR(1000)

  SET @strColumn =’Rajat’

  SELECT SPECIFIC_NAME

  FROM INFORMATION_SCHEMA.ROUTINES

  WHERE ROUTINE_TYPE= ‘PROCEDURE’

  AND ROUTINE_DEFINITION LIKE ‘%’ + @strColumn +’%’

  ORDER BY SPECIFIC_NAME

END TRY

BEGIN CATCH

  SELECT ERROR_LINE(),ERROR_NUMBER(),ERROR_MESSAGE()

END CATCH

Hope this will helpful to you somewhere.

 Thanks

Rajat Jaiswal

Call SQL Server Reporting Services by asp.net in 5 easy step

Hello friends,

Wish you Happy New Year.

Today I am going to share a simple way to use SQL Server Reporting Services locally. I am trying to share simple steps for creating report.

I am using North wind database and try to create a sample report which shows customer information.

Here we go

Step 1:- Create a project in my case I am using web project you can choose either web/window. In the project add a type dataset and drag drop customers table on XSD. (You can customize schema according to your need) as shown in below fig.

Step2:- Now add a report (.RDLC)  

Step 3:-  When you add  report then on right side a screen(Just like solution explore) will appear with name “ Web Site Data source “  in this you will find  the type dataset which we have added and  when you expand the  type dataset object you will find all the table schema as show in fig. 

 
Step 4: Now just drag drop a table from toolbars’ report item. And drag drop column from data source (type data set which shown in step3) to table column which you need to show in report. 
 

Step 5:- Once you done with step4 now next step to call report from “Asp.net”. For this just drag drop Microsoft reporting viewer and do following code.

Below is the code

Dim sqlcon As New SqlConnection(ConfigurationManager.ConnectionStrings(“connectionString”).ConnectionString.ToString())

            sqlcon.Open()

            Dim sqlcmd As New SqlCommand

            sqlcmd.CommandText = “SELECT * FROM Customers”

            sqlcmd.CommandType = CommandType.Text

            sqlcmd.Connection = sqlcon

            Dim sda As New SqlDataAdapter

            Dim ds As New myDs

            sda.SelectCommand = sqlcmd

            sda.Fill(ds, ds.Customers.TableName)

‘clearing report viewer

            Me.ReportViewer1.LocalReport.DataSources.Clear()

‘Create datasource for report

            Dim rds As New ReportDataSource()

            rds.Name = “myDs_Customers”

            rds.Value = ds.Customers

            Me.ReportViewer1.LocalReport.DataSources.Add(rds)

‘assigning report path.

            Me.ReportViewer1.LocalReport.ReportPath = “myReport.rdlc”

            Me.ReportViewer1.LocalReport.Refresh()

 Now run the page and you will get report .

SSRS 
so enjoy.

Thanks

Rajat Jaiswal