Its really great feature Silverlight realtime augment toolkit

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.


5) On main page XAML put following coding

<UserControl x:Class=”SLARTest.MainPage”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml
xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
mc:Ignorable=”d”
d:DesignHeight=”300″ d:DesignWidth=”400″ Loaded=”UserControl_Loaded”>
<Grid x:Name=”LayoutRoot” Background=”White”>
<StackPanel>
<TextBlock Text=”IndianDotnet.wordpress.com ” HorizontalAlignment=”Center” />
<Grid Width=”640″ Height=”480″>
<Rectangle Name=”Viewport” Stroke=”Black” StrokeThickness=”2″ />
<Canvas>
<TextBox Name=”Txt” Text=”SLAR toolkit test with Indiandotnet” Width=”300″ Height=”300″ TextWrapping=”Wrap” AcceptsReturn=”True” FontSize=”16″ />
</Canvas>
</Grid>
<Button Content=”Start Fun” HorizontalAlignment=”Center” Click=”Button_Click” />
</StackPanel>
</Grid>
</UserControl>

On Main page ‘s code behind we  need to write below code
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// Initialize the webcam
captureSource = new CaptureSource();
captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

// Fill the Viewport Rectangle with the VideoBrush
var vidBrush = new VideoBrush();
vidBrush.SetSource(captureSource);
Viewport.Fill = vidBrush;

//  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);

// Attach the AR detection event handler
// The event is fired if at least one marker was detected
arDetector.MarkersDetected += (s, me) =>
{
// Change to UI thread in order to manipulate the text control’s projection
Dispatcher.BeginInvoke(() =>
{
// Calculate the projection matrix
var dr = me.DetectionResults;
if (dr.HasResults)
{
// Center at origin of the TextBlock
var centerAtOrigin = Matrix3DFactory.CreateTranslation(-Txt.ActualWidth * 0.5, -Txt.ActualHeight * 0.5, 0);
// Swap the y-axis and scale down by half
var scale = Matrix3DFactory.CreateScale(0.5, -0.5, 0.5);
// Calculate the complete transformation matrix based on the first detection result
var world = centerAtOrigin * scale * dr[0].Transformation;

// Calculate the final transformation matrix by using the camera projection matrix from SLARToolkit
var vp = Matrix3DFactory.CreateViewportTransformation(Viewport.ActualWidth, Viewport.ActualHeight);
var m = Matrix3DFactory.CreateViewportProjection(world, Matrix3D.Identity, arDetector.Projection, vp);

// Apply the final transformation matrix to the TextBox
Txt.Projection = new Matrix3DProjection { ProjectionMatrix = m };
}
});
};
}

private void Button_Click(object sender, RoutedEventArgs e)
{
// Request webcam access and start the capturing
if (CaptureDeviceConfiguration.RequestDeviceAccess())
{
captureSource.Start();
}
}

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.


Thanks & Regards
Rajat Jaiswal

Advertisements

Are you a smart Dotnet Developer?

Dear Friends,

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

Utility for Printing all the PDF from a folder

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.

You can download the source code from

http://cid-1eda2012469ff8ad.office.live.com/self.aspx/.Public/RAJAT%5E_JAISWAL%5E_PRINT%5E_PDF.zip

Enjoy utility.

Thanks & Regards
Rajat Jaiswal

How to check your SQL Server Performance using new Utility Performance Dashboard Reports ?

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 link
http://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

How to check Best Practices of your SQL Server with Best Practices Analyzer tool (BPA)

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.

Thanks & Regards
Rajat Jaiswal