Posts

AngularJS caching issue for Internet Explorer for Ajax (GET) requests

Generally we face the cache issue for particularly internet explorer in angularJs when we use $http to get the data from the server.The reason for this problem is when we request the same call again to the server , IE fetches the response from the cache instead from updated result. This can be shown clearly from the network capture window of IE.
When we request the server for the first time the response code would be 200(OK) , if we make the same call again , we would get response code as 304 (Not Modified) .
To fix the above problem we can plug few settings to the main angular module  or to each HTTP get request.
var myApp = angular.module('myApp', ['ngRoute']);

myApp.config(['$routeProvider', '$httpProvider', function($routeProvider, $httpProvider) {
    $httpProvider.defaults.cache = false;
    if (!$httpProvider.defaults.headers.get) {
      $httpProvider.defaults.headers.get = {};
    }
    // disable IE ajax request caching
    $httpProvider.defaults.header…

Allow Video format to play in MediaPlayer

Image
This is a common problem with video format type to play in the web site/web applications if we use the media player.
In this article, I would like to give a simple solution to allow the “*.mp4” format video files to play in the media player in our web application in the IIS.

This video file format is not allowed in the IIS under MIME type. The following steps are done in the Internet Information Server (IIS). Step# 1 Start IIS Manager


Select the appropriate website to which we want to allow “mp4” format, then click MIME types

Step# 2
Click on Add

 Step# 3 Enter the video format information File name extension:

Suppress the warning messages in Visual Studio

Image
Sometimes we might have seen the warning message when we build the solution. These warning won't stop your application execution in fact these are most useful to preventing the defects.
In order to suppress this warning message we need to use the pre-processor directives i.e., "#pragma warning".
Example : As shown in the below image , the variable count is assigned and didn't used that value any where. When we build the project able to see a warning in the Error List window.



To overcome this warning we need to define the pragma warning pre-processor directive to the variable as shown below.

#pragma warning disable
  int count = 1;
#pragma warning resotre

Hope this article helped you to supress the warnings in visual studio :-)

Column COLLATION can affect SQL Server query performance ?

I found an interesting article on column collation in SQL Server. Please refer this Column Collation article from SQL Server Tips site.

Exporting to excel from a custom class object using C#.NET

We may face a scenario to export the data of custom class object to excel using InterOp.You can get the property name's from the class object using Reflection.Create a work sheet header by reading the each propety of the class object.I have created a separate method to get the all properties into a list collection of string as given below

///

        /// Get the list of Properties Name into a list collection.
        ///
        ///
        ///
        public List GetPropeties(Employee objEmployee)
        {
            Type myType = objEmployee.GetType();
            IList props = new List(myType.GetProperties());
            List lstPropertiesNames = new List();

            foreach (PropertyInfo prop in props)
            {
                lstPropertiesNames.Add(prop.Name);
            }
            return lstPropertiesNames;
        }
We need to call this method to create the worksheet header's as given beloe
List lstProperties = GetPropeties(new Employee());
                Char x = …

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…