rajeeshcv.com

Sharing my knowledge

Google Syntax highlighter test

Testing Google syntax highlighter plugin...

public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (editorService != null)
            {
                DockableItemCollection items = value as DockableItemCollection;
                if (items == null)
                {
                    items = new DockableItemCollection();
                }
                DockableCollectionEditor itemEditor = new DockableCollectionEditor(items, editorService);
                editorService.ShowDialog(itemEditor);
                value = itemEditor.Items;
                context.OnComponentChanged();
            }

            return value;
        }
I hope the above sample code is highlighted and formatted properly

SQL Injection attack detection tool

Today I found a tool called Scrawlr that will help you to detect SQL injection loop holes in your web application. I hope it will be a good add-on to your archery against security attacks.

For those who don't know what is SQL injection –

SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.

Get more details about Scrawlr from here Check this

How web servers identify your session?

I think, you have all created session variables inside an asp.net application. Then how the web server is knows you are the same guy created that session when the successive request goes to the server. Before explain this, we have to think that every request that we sent from a web browser is considered as a new request by the IIS. This is the behavior of every web application i.e. the state less nature. For example if you open a url, first the browser sent a request for the default document. Then the browser parses the HTML response and it sends another set of requests based on the required images, scripts that are included in that page.

Read more...

1px line issue in silverlight

You might have noticed an issue when creating a line with 1px stroke thickness, when rendering the stroke thickness is more than 1px which is not we are expecting.

Image

Output of this looks like below

Image

Actually this is happening because, the rendering algorithm used inside.

 

So what we need to do to fix this issue......???

Fix: Very simple, add a translate transformation of 0.5 for both X and Y axis.

Image

 

Now if you run, u will get a correct 1px line.

Image

Creating a custom silverlight control

Download the complete source code from here

In this post, I will explain how to create a custom control in silverlight. The control we create is a simple control which will draw a circle, the radius of the circle is controlled through the exposed public property.

This is a simple control, but hope this will give you an idea about the approach to the custom control development in silverlight.

Create a the Silverlight class library project first

step1

I have named the solution and project as "SimpleControl", after the class library is created, you will get a default class "Class1.cs"

Read more...

Spell checker in JavaScript

I was looking for a spell checker in javascript, pure javascript so that I could use it in offline mode. When I googled I could find many spell checkers in javascript, but all of them are using web services to get the dictionary. Those code won't work in offline mode , hope somebody could guide me in finding the spell checker I am looking for.

Welcome to my blog!

Finally... I started a blog with my name. I wanted to do this long time back, but now only I could made this dream true. Here I will be sharing my views and thoughts... stay tuned :)