Thursday, August 27, 2015

Search Text in schema of Stored Procedure

With a big database this is one of the basic issue if you want to search whether a particular string/value available in anywhere in schema of stored procedure.
So we cant do it manually (yeah we have option of looking into dependencies but this is one step ahead) like It will help us to search in even comments too.
 

SELECT DISTINCT OBJECT_NAME(OBJECT_ID),
object_definition(OBJECT_ID)
FROM sys.Procedures
WHERE object_definition(OBJECT_ID) LIKE '%This part is commented%'
GO


Happy Living...
Happy Coding...
Happy Concepts ...

Thursday, June 11, 2015

Reset or Normalize default User Code Stylesheet of Browser

Here i am going to talk about "User Code Style sheet". It is default style sheet of browser get applied on Dom elements if nothing is specified about how to handle elements appearance on page.

Problem:

But it might get applied if the tags are not closed properly and will lead to different UI display.

Solution :


To resolve this issue we have 2 either to reset it or normalize stylesheet.

Reset CSS: (Get Reset Css)
Resets browsers defauts

Normalize CSS: 
Preserve useful browser defaults rather than erasing them. 
Normalize styles for a wide range of HTML elements.
Correct bugs and common browser inconsistencies. 
Improve usability with subtle improvements. 
Explain the code using comments and detailed documentation.

Note: Try to put it after all your style sheet to implement inherit property. 

Happy Living.....
Happy Concepts.....
Happy Coding.....

Friday, May 22, 2015

Enable Nuget packages in Visual Studio 2010

The NuGet is easier way to include dlls or other projects/utilities in your projects. If we aren't using it , in one way we are selecting some tough way to achieve something that can be implemented in straight forward way.

Open Visual studio in menu bar click on Tools-> Extension Manager


fig 1

It will open a new popup as shown below, In this popup you can see there isn't any Extension Manager installed. Once we install Nuget it will appear in this screen.

fig 2
Now we will do following steps:
1. Click on Online Gallery under Installed Extensions.
2. Type Nuget in search text box at right top corner
3. Now it will appear in middle area of window now click to Download.


fig 3
Now you will get another popup for installation read term and conditions and click on install.



fig 4

On completion of installation there will be a message box, close it.

fig 5

Once it get completed, Restart Visual Studio  you will able to see it under Installed Extensions.


fig 6
 

And its done. In next blog we will check how to use NuGet Package Manager.

Happy Living....
Happy Coding....
Happy Concepts....
 

Wednesday, November 5, 2014

Change Doc type to IE8 or IE8 Compatibility mode

Change Doc type to IE8 or IE8 Compatibility mode:

There are some old development that doesn't support in newer version of IE and Chrome. So best option is to make changes in code work for latest IE versions and Chrome. But this is the case not always possible for example previous code was built using third party controls (Infragistics in my case) to make it work with Newer version of IE we need upgraded version on Infragistics and it involves addition cost of licensing.
One other work around if it is possible to support only IE  browser than we can use solution suggested below: (BUT it is not best solution)

<html><head>
 <title> My Page</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">

<meta http-equiv="X-UA-Compatible" content="IE=8">
<head><body>
 ---------------
</body></html>


Note : Make sure to use meta tag just after title tag otherwise it wont work.





Happy Coding...
Happy Concepts...
Happy Living....

Monday, May 5, 2014

Convert local datetime to UTC or Universal data time and UTC to local datetime


--Steps required before performing conversion:

--step:

Declare @TimezoneOffset int=0

-- variable will hold the timezone difference in minutes

set @TimezoneOffset =  DATEDIFF(Minute, GETUTCDATE(), GETDATE())

--Now we have localtimezone difference with UTC.

--Convert Local datetime to UTC:-

Declare @LocalDatetime datetime= GetDate()

Declare @UTCDatetime datetime =null

select  @UTCDatetime= DateAdd(Minute,-@TimezoneOffset,@LocalDatetime)

--Convert UTC to Local datetime :-

 Declare @ConvertedLocalDatetime datetime=null

select @ConvertedLocalDatetime= DateAdd(Minute, (@TimezoneOffset),@UTCDatetime)

select 'LocalTime:-',@LocalDatetime,'  UTC Datetime : ', @UTCDatetime ,'ConvertedLocalDatetime : ', @ConvertedLocalDatetime

Monday, April 7, 2014

Download file using javascript/Jquery

On aspx page add this:

<iframe id="hiddenDownloaderForPdf" style="display:none" ></iframe>


on Javascript file:

function downloadFile (url) {
        var hiddenDownloaderForPdf= 'hiddenDownloaderForPdf'
        iframe = document.getElementById(hiddenDownloaderForPdf);
//if iframe isnt available create one dynamiclly
    if (iframe === null) {
        iframe = document.createElement('iframe');
        iframe.id = hiddenDownloaderForPdf;
        iframe.style.display = 'none';
        document.body.appendChild(iframe);
    }
    iframe.src = url;
}

using jQuery:
function downloadFile (url) {
        var hiddenIFrameID = 'hiddenDownloaderForPdf'

       $('#'+ iframe).attr('src' ,url);
  }

Happy Living.....
Happy Concepts.......
Happy Coding........


Download file using javascript/Jquery

On aspx page add this:

<iframe id="hiddenDownloaderForPdf" style="display:none" ></iframe>


on Javascript file:

function downloadFile (url) {
        var hiddenDownloaderForPdf= 'hiddenDownloaderForPdf'
        iframe = document.getElementById(hiddenDownloaderForPdf);
//if iframe isnt available create one dynamiclly
    if (iframe === null) {
        iframe = document.createElement('iframe');
        iframe.id = hiddenDownloaderForPdf;
        iframe.style.display = 'none';
        document.body.appendChild(iframe);
    }
    iframe.src = url;
}

using jQuery:
function downloadFile (url) {
        var hiddenIFrameID = 'hiddenDownloaderForPdf'

       $('#'+ iframe).attr('src' ,url);
  }

Happy Living.....
Happy Concepts.......
Happy Coding........