Monday, February 18, 2013
Choosing the Right Web Programming Model with ASP.NET
But it is always better to choose the right programming model with the evidences. I found a small video explaining this very briefly, from Microsoft web site..
And this is the video link..
Cheers
Lakmal
Saturday, February 16, 2013
Localized Mobile Note Pad with Google Translation API
To show you example for this, Google has this feature already implemented and hosted in their cloud. For Sinhala Version you can find from this URL - http://www.google.com/intl/si/inputtools/cloud/try/. (Just to make you update, Sinhala is the Language used by Majority of people in the country called Sri Lanka. To know about Sri Lanka, just Google it J. It’s a beautiful county, which you would love to see).
Tuesday, February 5, 2013
Signing Assemblies..
Signing assemblies make sure authenticity of it. Means once we have an assembly from the third party and assembly is signed, then it is assured we are getting the exactly same one that has been built by the the third party, which we are supposed to get it from. If assembly is not signed then it is not assured that no one has changed the assembly and built it again once it is delivered from the third that we are supposed to have it from.
Even though it is assured the authenticity of the the assemblies, still it is bit slow in loading singed assemblies. And that force lots of the parties to not to sign assemblies in some scenarios. There are scenarios that we don't need to worry about singing assemblies.
Without singing assemblies we can notdeploy them in Windows GAC and GAC only accepts signed assemblies. So if you are going to deploy any of your assemblies in GAC, make sure you sign them with Strong names.
We know that we sign the assemblies with String Names, what is the meaning of this string named assemblies. Strongly named means that name is globally unique and there will not be one string name for two signed assemblies.
The next question is how .NET platform make sure these strong names for signed assemblies.
String Name = Name Text + Assembly Version + Culture Information + Public Key + Digital Signature
So this equation makes signed assembly's name strong. And these strong names ensure following feature of signed assemblies,
1. Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name that you can, because an assembly generated with one private key has a different name than an assembly generated with another private key.
2. Strong names protect the version lineage of an assembly. A strong name can ensure that no one can produce a subsequent version of your assembly. Users can be sure that a version of the assembly they are loading comes from the same publisher that created the version the application was built with.
3. Strong names provide a strong integrity check. Passing the .NET Framework security checks guarantees that the contents of the assembly have not been changed since it was built. Note, however, that strong names in and of themselves do not imply a level of trust like that provided, for example, by a digital signature and supporting certificate.
Signing assemblies can be done through Visual Studio or through the command line. But in any case at end of the day we use .NET SDK utilities. If you have already signed assemblies, there you can generate and give or give existing key file while you signing assemblies.
This singing is been done through a Certificate Authority and if you are using the built in Key Generation facility in the Visual Studio then you are using the Windows built in Certificate Authority. But instead of that you can use third party Certificate Authorities like Verizon for sign you assemblies.
Please following links for more information about signing assemblies,
http://msdn.microsoft.com/en-us/magazine/cc163583.aspx
http://msdn.microsoft.com/en-us/library/ms247123(v=vs.80).aspx
http://blog.codingoutloud.com/2010/03/13/three-ways-to-tell-whether-an-assembly-dl-is-strong-named/
http://msdn.microsoft.com/en-us/library/xc31ft41.aspx
http://msdn.microsoft.com/en-us/library/bb385180.aspx
http://stackoverflow.com/questions/3975723/c-why-sign-an-assembly
http://stackoverflow.com/questions/1197133/anything-wrong-with-not-signing-a-net-assembly
http://stackoverflow.com/questions/4725246/signing-net-assemblies?lq=1
Wednesday, December 26, 2012
Microsoft WebMetrix
Saturday, May 26, 2012
Roslyn – C#, VB Compilers as APIs
Friday, May 25, 2012
GUIDs
Sunday, April 22, 2012
.NET Attributes
- Manage object meta data
- Handle Help information
- And more
- How we can declare attributes
- How we can use declared attributes in our implementation
- How we can access them at run time
- Inheriting our attribute class from that Attribute class which is exists under the “System” namespace.
- Specify which types of elements can use the attribute that we are going to implement. This we have to do with AttributeUsage attribute, which is coming with the .NET framework.
[HelpAttribute("http://localhost/MyClassInfo")]
class MyClass
{
}
class MainClass
{
public static void Main()
{
System.Reflection.MemberInfo info = typeof(MyClass);
object[] attributes = info.GetCustomAttributes(true);
for (int i = 0; i < attributes.Length; i ++)
{
System.Console.WriteLine(attributes[i]);
}
}
}
Wednesday, February 8, 2012
What is Software Architecture?
1. Users and Business demands for faster results
2. Better support for varying work styles and workflows
3. Improved adaptability of software design
These are few of key trends in Software Architecting,
1. User Empowerment
2. Market Maturity
3. Flexible design
Saturday, December 10, 2011
This week readings..
Sunday, December 4, 2011
This week readings..
Wednesday, November 16, 2011
Tuesday, November 15, 2011
Software System Usability....
Sunday, August 28, 2011
XAML Magic - Few of the Basic Features..
Just let me list down few of the main features that are coming with XAML,
1. Whatever you do in XAML, you can do the same with code as well
It’s like this, Here is the XAML Code,
Same thing you can do with the code too,
In XAML, Elements/Tags are representing the classes and the XML tag attributes are representing the class properties. This you alreay have seen in above XAML code and as an example,"Margin="20">Welcome to the World of XAML "
Margin is a property of TextBlock class and that you can see as attribute of tag. 2. Represent Properties as Elements
This is one of the interesting feature that you can find in XAML and it is looks like this,
Normally what you do is that you specify the content of the button directly as a text, but here you can take button content as anything that you can imagine as a UI control. In example it is a Image, but you can something different.3. Implicit Type Conversion
This is about converting the types at runtime and for an example,
Border is the class that has property, which accepts “System.Windows.Media.Brushes.Blue” object as its value. In addition to that BorderThicknss also a property and which is accepting the Thickness Object as its value. 4. Markup Extensions
This is about .NET attributes and where you can place them in XAML structure. There are number of built in Markup extensions and in addition to that you can develop custom markup extensions by your own. These are the built in markup extensions you can find in .NET, - Binding
To bind the values of two properties together. - StaticResource
One time lookup of a resource entry - DynamicResource
Auto updating lookup of a resource entry - TemplateBinding
To bind a property of a control template to a dependency property of the control - x:Static
Resolve the value of a static property. - x:Null
Return null
Example,

5. Finally, Namespaces
Normally namespaces we used to find in .cs or .vb files in .NET (in most if the times), but this time you will have to invoke them in XAML, because, in XAML you are dealing with the objects, which are already defined for you some where by Microsoft or you or any other.
To invoke a relevant class tag in a XAML, you have to import them first into XAML document. In default you will get imported basic namespaces, into you XAML document by Visual Studio, when you working with it. Basic namespaces you will find in WPF applciations,
http://schemas.microsoft.com/winfx/2006/xaml/presentation - It is mapped to all wpf controls inSystem.Windows.Controls.
http://schemas.microsoft.com/winfx/2006/xaml - it is mapped to System.Windows.Markup that defines the XAML keywords.
Here is how it’s look like in XAML,

If you any custom controls developed in an Assembly called “Project.CustomControls”, here is the how we can import it into XAML document,
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:myCustomControls ="clr-namespace:Project.CustomControls">
CheersLakmal Kankanamge
XAML Magic - Building Applications with XAML Toyes
Karl Shifflett,one of the best techi on XAML and WPF stuff has managed to introduce new toolkit, which is providing capabilities to create UI forms directly from classes that you have written already. Simply it looks amazing, because without writing any line of code, on purpose making the UI Logic, you can make a make form and have all the data bind to it.
Karl call this as XAML Power Toyes, that you can download and find more information about it from his blog.
This is the videos I found this stuff first..
http://channel9.msdn.com/shows/Continuum/XAMLPowerToys/
Lakmal Kankanamage
XAML Magic..
Saturday, August 20, 2011
Microsoft Surface Programming – Object Recognition
Microsoft Surface Technology is supporting recognizing physical objects through the surface and reacting according to the object placed on the surface. I was so curios to know about the concept behind this object recognizing with this Microsoft Surface enable applications.
With the things I leaned from Colombo Code Camp and after having searched on the internet, found few important key points attached with technology. First thing is, MS Surface is recognizing object as a Tag, which has a unique value, which is retrieved from Surface’s Vision system. Means for MS Surface Vision System, physical object is always a Tag, which always has to be pasted on the object, as surface can identify it properly.
Tags are looks like this,

Tag always has value and each value is having different dot structured as showed in the picture. After having this tag printed in a piece paper, you have to paste it on the object that you are going to place on the Surface table (or any other device which is supporting MS Surface Technology). Then that object has the value that the pasted tag has, in the surface application.

Then the next curious point is that how we can generate these tags for Surface Applications. Answer is, we have two ways obtaining these tags,
- Generate Tag with Tag Printing Tool
- 2. Tags from Microsoft.
Please refer this link for more information - http://msdn.microsoft.com/en-us/library/ee804762(v=surface.10).aspx
Once you have the tag, you can paste it on any object, then that object should be identified by a MS Surface application by the Tag which is pasted on it.
Input Visualizer and Input Simulator
There is a tool which has been delivered with Windows 7 called “Input Visualizer” and this tool can be used to show some information about the tags (objects) which are placed on surface applications. To open it - All Programs | Microsoft Surface 2.0 SDK | Tools | Input Visualizer.
And for this we need to open one more tool, Input Simulator, which I explained in my previous post in MS Surface Scatter View.
Input Visualizer | Input Simulator |
|
|
How we can identify the Tags programmatically
Just start get things going, open Visual Studio 2010 and create a MS Surface Project called “MyObjectRecognizionApp”,

Without writing any line of codes, you can start place objects on surface application and see how their tag information is looks like,
| ![]() |
Just click on the middle box of second row of tools in Input Simulator, then click upon the application surface, then you will see this kind of picture in your screen. All this you have to do because of we are testing these surface application features with our monitors which are not supporting the touch. If you seriously check the value in the detail view, you will find it like, 0x0000000000000100 and double check it with the values that I have mentioned in Tag Value field in Input Simulator.
This is how you can test surface application for object recognition with the Input Simulator, provided with Windows 7 Operating System. Before clicking on the Surface application, you can mention tag values (Tag Series and Tag Value) and those values you can use in your app code for responds for virtual objects that you test with input simulator.
So our next step is to recognize an object (In our case it is virtual object which we make with input simulator) place on the surface application and do something to respond for it. For this we need to know about two most important XAML Elements,
1. TagVisualizer – This will display the information about the tag when it is placed in the Surface. The TagVisualizer works with a known set of tags. This known set is defined in the TagVisualizer.Definitions collection.
2. TagVisualization – This is the control type which holds all the content, after particular object is placed on the surface application.
Here what I’m going to show is, I will have two virtual objects which will have tag values 100 and 200 respectively. Once first object is place on the Surface Application, system will show “My Tag1” text and for the second object it will show “My Tag 2” text.
In my project I have default window created, named “SurfaceWindow1.xaml” and I will go with it without create any new windows. This is how it’s look like SurfaceWindow1 XAML code,
<s:TagVisualizer x:Name="TagVisualizer1">
<s:TagVisualizer.Definitions>
<s:TagVisualizationDefinition
Series="0"
Value="100"
Source="MyTag1Visualization.xaml"
LostTagTimeout="2000"
OrientationOffsetFromTag="0"
PhysicalCenterOffsetFromTag="0,-1.5"
UsesTagOrientation="True"
TagRemovedBehavior="Fade" />
<s:TagVisualizationDefinition
Series="0"
Value="200"
Source="MyTag2Visualization.xaml"
LostTagTimeout="2000"
OrientationOffsetFromTag="0"
PhysicalCenterOffsetFromTag="0,-1.5"
UsesTagOrientation="True"
TagRemovedBehavior="Fade" />
s:TagVisualizer.Definitions>
s:TagVisualizer>
Grid>
And I have two Tag Visualizations created,
MyTag1Visualization.xaml
<s:TagVisualization x:Class="MySurfaceObjectRecognizionApp.MyTag2Visualization"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Loaded="MyTag2Visualization_Loaded">
<Grid>
<TextBlock Margin="31,62,0,0" FontSize="20" Height="26" Width="206">My Tag 1TextBlock>
Grid>
s:TagVisualization>
MyTag2Visualization.xaml
<s:TagVisualization x:Class="MySurfaceObjectRecognizionApp.MyTag2Visualization"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Loaded="MyTag2Visualization_Loaded">
<Grid>
<TextBlock Margin="12,53,0,0" FontSize="20" Height="26" Width="206">My Tag 2TextBlock>
Grid>
s:TagVisualization>
Now it’s time to run the application and see how output is look like,

By clicking left and right mouse buttons at once, you can place objects permanently in the surface, otherwise once you release the mouse button, the virtual object will disappear. This tip is only for testing Surface applications with Input Simulator, but with real MS Surface supported devices, you don’t need to worry about this and can place objects as you expected. In real, what exactly happens is, once you put an object with pasted tag value, relevant tag visualization control content will appear on the surface, as response to the object identification.
To get this done, I didn’t write any line of code, but all the time it’s XMAL elements. You can use coding to make things smarter and useful in real application developments for MS Surface devices.
Lakmal Kankanamge.





