Posts

Showing posts from 2013

How to fix "Sys is undefined" error ?

Image
Recently I have faced a strange issue in the process of developing a task using script manager for async post backs.

The error is "webresource.axd and scriptresource.axd 404 not found" whenever I do any async call I use to get this error "sys is not defined". I have tried a lot to fix this issue by following the below links.

1. http://blogs.msdn.com/b/carloc/archive/2008/12/04/webresource-axd-or-scriptresource-axd-not-working.aspx
2. http://imnettellect.blogspot.in/2010/12/iis-75-webresourceaxd-and.html
3. http://stackoverflow.com/questions/1433512/asp-net-web-application-webresource-axd-and-scriptresource-axd-files-loading

and so on ....



After spending 4 hours I found a new property on asp.net 4.0 called EnableCdn that basically, if it's set to "true", it loads the resources from the Microsoft content resource servers.

Refer this link for information about EnableCDN.

This worked like a charm and fixed my issue.

I hope this snippet can help many techies. :-)

How to hide bootStrap popover when user click(s) outside the popover?

Hiding bootStrap popover when user click(s) outside the popover

Recently I have experienced this problem i.e., hiding the popover when we click outsode the popover.I have worked on it and fixed the issue.So,I thought to share this fix.

For more detail(s) about the bootStrap please refer this link PopOver


popover plugin has a property called "trigger" of type String with default event as "click" and popover can be triggered by click/hover/focus/manual. 

To show the popover we need to prepare the HTML mark-up as given below
<div class="btn-group"><div class="btn-group" id="ddlSelected" style="clear: both;"><button class="btn btn-primary btnSelectedStyle selectedBorderStyle" type="button">Your selected Items (<b id="lblSelectedItemCount">0</b>)</button><button class="btn btn-primary dropdown-toggle selectedBorderCaratStyle" data-toggle="d…

Why Dispose() is preferred than Finalize() for Un-Managed Resources in .NET?

Image
Memory management is very important in any application development.The Garbage collector of .NET does almost all clean up activity for your objects.For unmanaged resources (Ex:Windows API created objects, File, Database connection objects, COM objects, etc.) are outside the scope of .NET framework.

Why Dispose() is preferred than Finalize()

If we use the "Finalize()" method,the Garbage collector has to make two round in order to remove the objects.

For an instance ,let me explain clearly if we have two objects as Object1 and Object2 and we finalize the Object2 as given in the below image.The GC has to categorize the two objects and put the Finalize objects into Finalization Queue.The GC will clean the object1 which doesn't use the Finalize() method and process the second round of cleaning the Finalization Queue.


Now at this the "Dispose()" method will come into picture.This method belongs to IDisposable() interface .So the best practise to release the unmanaged co…

Detailed Table using jQuery

Image
We have seen in many sites regarding detailed information of products below the row when we click on the downwards arrow and collapse when click on upwards arrow.

We have many plugin's for this type of functionality we can also do with jQuery simple logic also.

I have done some R&D regarding this and want to share information of detailed table using jQuery.

We need to download the latest jQuery File from this link http://jquery.com/download/

We have many CDN links also available for directly accessing the jQuery library files.

Google :

https://developers.google.com/speed/libraries/devguide#jquery


Micro-soft :

http://www.asp.net/ajaxlibrary/cdn.ashx

Git-hub:


https://github.com/jquery/jquery

How to use constants in .NET?

I have a written this Dev tip for the new folk who entered in this Dev World.

Normally in the development we use some of the success message's or failure messages in general common message's.We do have a habit of writing the messages as given below

MessageBox.Show("Successfully created a record!");

MessageBox.Show("Successfully deleted a record!");

We can make use of Constants in .NET which will be declared using the keyword "const".For the above scenario we can create a  class like "Messages.cs" and define constants as given below


 public class Messages
    {
        public const string strUserExist = "User Name already exists.";
        public const string strUserSaved = "User information saved successfully.";
        public const string strUserDeleted = "User deleted successfully.";

    }

Advantage :We can change the message text only in the Message.cs class which will be applicable through out the project where …

Difference between Debug and Release Modes in Visual Studio

Difference between Debug and Release Modes in Visual Studio


We have two options to build a application in production or development stage.Both have their own importance's and characteristics .


Debug:Developer use debug mode for debugging the web application on live/local server.Debug mode stores debug information so it takes time to execute.We can use F10,F11 function keys as well keep tracking the break point.In debug mode the *.pdb (Program debug database) file will be created which contains the debug steps in the binary format.Less optimized code.

Release: We can't do the debug in this mode ,hence no chance of creating *.pdb file.Scripts & images downloaded by webresource.axd are cached.It has small size, and runs fast.More optimized code.

I hope this information could help folks.

Happy coding :-)

Get the SQL Server Information from Query

Some times we need to get the information of the SQL Server where it is installed. Simply we can get the info from Query also

-- Get the version info


select @@version
We have a in-built stored procedure called 'xp_msver' to the Server information.
-- Get the Server Information
exec xp_msver


This is a basic information provided but may be useful to the SQL Server learners .

Good day :-)

How to update Row which is not having Primary Key?

We all find some different scenario where the table has no primary key column and need to update the records having same data.

For this type of scenario's we need to update the particular column based on some Unique value.In SQL Server we have a option called "ROW_NUMBER()" .Every one know about Row_Number() I will present a brief intro about this.

ROW_NUMBER():

ROW_NUMBER to find the Row number of a particular column if its specified in orderby Clause.It has the following syntax 

Syntax:

select  row_number() over (order by name) as ROWNumber, Namefrom sys.all_objects order by name 
For more details about the ROW_NUMBER() refer this MSDN.
Here I will present a example query to update a table which has no primary key and having same data for few rows.

WITH Record AS (select  row_number() over (order by [columnName]) as ROWNumber, Name from sys.all_objects order by name )
 UPDATE Record set [col1]=@col1,[col2]=@col2,[col3]=@col3 where Record.rownum=@rownum


columnName -->…