25 December, 2012

Maximum characters of varchar max in sql server

Maximum 2^31-1 byte (2GB).

[2,147,483,647] Character

1 character = 1 byte


Variable-length, non-Unicode string data. n defines the string length and can be a value from 1 through 8,000. max indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage size, in bytes, is the value of the actual data entered + 2 bytes. The ISO synonyms for varchar are char varying or character varying.

Ref:

15 December, 2012

Remove Scrollbar from Textarea in IE

By default all versions of IE have a scrollbar on textareas, even when they are empty.









No other browsers do this, so if you want to remove it so IE can visually match other browsers, just:

textarea { overflow: auto; }

The scrollbar will return (rightfully) when the text in the textarea expands beyond it's bounds.








soruce:
http://css-tricks.com/snippets/css/remove-scrollbar-from-textarea-in-ie/

13 December, 2012

Disable Process Attach Warning in Visual Studio 2010

Problem:

We often debugging and we need to attach process like w3wp.exe, service process or any process in visual studio.Visual studio every time asks warning like "Attaching to this process can potentially harm your computer. If the information below looks suspicious or your are unsure, do not attach to this process."



We know that this process is not harmful and we want to disable that warning right?

Solution:

1. Close all instances of visual studio.
2. Update registry value:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger
And set the value DisableAttachSecurityWarning to 1
OR
if you don't want to find registry and update value manually then just download this registry file from here and just open this file.

28 November, 2012

Mirth : Add parameter in database query


Problem:
Insert / Update database field value using param.

Solution:

//Add param.
params = new java.util.ArrayList();

var paramValue = 'SomeValue';



//Add param Value in param array.
params.add(paramValue);

//Insert / Update in DB.
dbCon.executeUpdate('INSERT INTO tableName (?) VALUES ("' + SomeValue + '")', params);

09 November, 2012

$(document).ready vs. $(window).load


jQuery offers two powerful methods to execute code and attach event handlers: $(document).ready and $(window).load. The document ready event executes already when the HTML-Document is loaded and the DOM is ready, even if all the graphics haven’t loaded yet. If you want to hook up your events for certain elements before the window loads, then $(document).ready is the right place.
$(document).ready(function() {
 // executes when HTML-Document is loaded and DOM is ready
 alert("document is ready");
});
The window load event executes a bit later when the complete page is fully loaded, including all frames, objects and images. Therefore functions which concern images or other page contents should be placed in the load event for the window or the content tag itself.
$(window).load(function() {
 // executes when complete page is fully loaded, including all frames, objects and images
 alert("window is loaded");
});

15 October, 2012

Format dates in SSRS reports

Displaying dates in different formats in your reports is a very common requirement that one faces while working with Sql Server Reporting Services (SSRS).

Let us see how we can display dates in different formats :

=Format(Fields!myDate.Value, “M/d/yy”) - 2/11/08

=Format(Fields!myDate.Value, “MM/dd/yyyy”) - 02/11/2008

=Format(Fields!myDate.Value, “d-MMMM-yy”) - 11-December-08

=Format(Fields!myDate.Value, “d-MMM-yyyy”) - 11-Dec-2008 =Format(Fields!myDate.Value, “M/d/yyyy H:mm”) - 2/11/2008 13:50

=Format(Fields!myDate.Value, “MMM-dd-yyyy”) - Feb-11-2008

Original Source: http://www.sqlservercurry.com/2008/02/format-dates-in-ssrs-reports.html

22 September, 2012

Converting Text to Proper Case or Capital Case or Lower Case in Access

Problem:
Convert text in different format like CAPITAL CASE, lower case and Proper Case in access.

Solution:
You user StrConv fuction for all case.

OR

For UPPER CASE Use UCASE();
For lower case use LCASE();

Syntax:

1) StrConv Function:
StrConv(Target String, Conversion Type)

Target String is a string which you want to convert the string in different case.
Coversion Type:
1 – Converts the string to uppercase characters.
2 – Converts the string to lowercase characters.
3 – Converts the first letter of every word in string to uppercase.

2) UCASE and LCASE

UCASE(Target String)
LCASE(Target String)

Examples:

For CAPITAL CASE.
Select StrConv("Target String", 1); Return: TARGET STRING

For lower case.
Select StrConv("Target String", 2); Return: target string

For Proper case.
Select StrConv("target string", 3);  Return:  Target String

Extension method to check Null or Not Null in C#


we follow to check null reference.

if (o != null)
{    //Do Something}else{    //Do Something completely different}


but we follow extension method then make it easy coding like.

public static class ExtensionCommon  {    public static bool IsNull(this object obj)    {      return obj == null;    }     public static bool IsNotNull(this object obj)    {      return obj != null;    }     public static bool HasValue(this string obj)    {      return !string.IsNullOrWhiteSpace(obj);    }  }

and do code like that

if (obj.IsNotNull)
{    //Do Something.}else{    //Do Something.}

OR
if (!obj.IsNull)
{    //Do Something.}else{    //Do Something.}


08 September, 2012

Create Setup Project in Visual Studio.



I show basic setup step.

Steps:
1.Create sample windows application project.
2.Now add Setup project in same solution.



3.Select setup project.



4. Now add project output by right click on Application Folder.






10 August, 2012

Certificate's private key grants access to the application pool user


  • Open the certificates MMC.
             Download file hear and open it or manual Step below.
    • Open MMC
    • Click File –> Add/Remove Snap-in…
    • Choose Certificates and click Add
    • Select Computer Account and click Finish
  • Check if the certificate is available in the "Local Computer\Personal" cert store.

  • Right click on the certificate and choose "All Tasks --> Manage Private Keys" and "IIS_IUSRS" or other user or app pool account that the IIS 7.5 app pool is using (ApplicationPoolIdentity).
>> Click on Location and select top most item.




>> Then write "IIS_IUSRS" in object box. then click ok.



Enjoy........

06 July, 2012

Solving Error 1001 : The specified service has been marked for deletion


If you are creating Windows Services you may run into this annoying little error from time to time,
Error 1001. The specified service has been marked for deletion
At first I used to restart my machine to get rid of it, but there is a (much) simpler way.  
Simply closing the Services Manager (services.msc or the mmc.exe tool) will solve it 
Enjoy it.....

Source : http://www.laxdal.org/node/30

18 May, 2012

Regular Expression for US Phone Number

>>  Criteria


Validates a U.S. phone number. It must consist of 3 numeric characters,
optionally enclosed in parentheses, followed by a set of 3 numeric characters and
then a set of 4 numeric characters.


>>  For Example


(425) 555-0123
425-555-0123
425 555 0123
1-425-555-0123

>>  Regular Expression

"^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$"

Refence:
http://msdn.microsoft.com/en-us/library/ff650303.aspx

24 April, 2012

Make 'Associate' the default checkin action in TFS


Problem:

I don't like to change every time 'Resolved' to 'Associate' when I m check –in in TFS so I am start googling for this issue and finally I got the solution.



Solution:

 There is no alternate way to change registry, so change the registry for TFS configuration. 

Change value the following key to “False”.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Behavior 

Set value of ResolveAsDefaultCheckinAction = False.

OR

One Click Solution

If u doesn’t want to change manually then download this file and just double click on this file.
now u enjoy..............


Ref:

http://blogs.msdn.com/b/mitrik/archive/2010/12/03/how-to-make-associate-the-default-action-for-work-items.aspx