NEWS

Wednesday, March 5, 2014

To replace htmltable with div using CSS

Issue:
How to get tabular like layout using div.

Solution:

There is an in-built display property support for this with CSS 2.1.
display: table;
display: table-row;
display: table-cell;

Having below CSS and html, we can achieve this:

CSS:

.tabular
{
    display: table;
}
.tabular-row
{
    display: table-row;
    position: relative;
    height: 26px;
}
.tabular-cell
{
    display: table-cell;
    height:25px
}

.tabular-cell-small
{
    display: table-cell;
    height:25px;
    width:50px
}

.tabular-cell-medium
{
    display: table-cell;
    height:25px;
    width:114px
}


CSHtml sample:

<div class="tabular">                   
                    <div class="tabular-row">
                        <span class="prBatchEditLabelbg tabular-cell">
                            <h2>@Html.GetLocalizedString("xxxxxxxxxxxx")</h2>                             
                        </span>   
                         <span class="tabular-cell">              
                             <a class="helpButton" title="@Html.GetLocalizedString("xxxxxxxxxxxxxxx")" href="#" tabindex="-1"></a>
                        </span>                                  
                    </div>
                    <div class="tabular-row">
                        <span class="xxxxxxxxxx tabular-cell-medium">
                            @Html.GetLocalizedString("xxxxxxx")
                        </span>
                         <span class="xxxxxxxxxx tabular-cell-small">                           
                        </span>
                         <span class="xxxxxxxxxxx tabular-cell-medium">
                            @Html.GetLocalizedString("xxxxxxxxxxxx")
                        </span>
                    
                    </div>
                    <div class="tabular-row">
                        <span class="xxxxxxxxxxxxxxxx tabular-cell">                      
                             @Html.DropDownListFor(model => model.SelectedAccountXXXXX, new SelectList(Model.AccountXXXXXXList, "Id", "Name", Model.SelectedAccountXXXXX), new { @id = "accountGroupList", datavaluerequired = "data-value-required", @class = "required", style = "width:175px" })
                        </span>   
                         <span class="xxxxxxxxxx tabular-cell-small">                           
                        </span>                
                        <span class="xxxxxxxxxxxxxxx tabular-cell">
                            @Html.DropDownListFor(model => model.SelectedBankXXXXXX, new SelectList(Model.BankXXXXList, "Id", "Name", Model.SelectedBankXXXX), new { @id = "bankList", datavaluerequired = "data-value-required", @class = "required", style = "width:175px" })
                        </span>
                        <span class="prBatchEditLabelbg tabular-cell-medium">                           
                        </span>          
                        <span class="tabular-cell-medium">
                             <button class="rounded">@Html.GetLocalizedString("prXXXXXX")</button>                                       
                        </span>
                    </div>              
             </div>



Reference:

Monday, March 3, 2014

Integrate ie 10 with visual studio 2010 debugging

There is a simpler fix for the JavaScript debugging issue in IE10:
  1. Close IE
  2. In elevated cmd prompt run this command:
    regsvr32.exe "%ProgramFiles(x86)%\Common Files\Microsoft Shared\VS7Debug\msdbg2.dll"
    
(or %ProgramFiles% on a 32-bit OS)

Monday, December 2, 2013

How do I make background-size work in IE 8 and below versions?

A bit late, but this could also be useful. There is an IE filter, for IE 5.5+, which you can apply:

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
src='images/logo.gif',
sizingMethod='scale');

-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(
src='images/logo.gif',
sizingMethod='scale')";
However, this scales the entire image to fit in the allocated area. So if your using a sprite, this may cause issues.
But this will not allow the links and buttons on the div clickable, for the workaround you need to change the z-index of the div or panel like below:


Untitled Document




inhoud link b jkdsf
vdf
v
dfv
dfs
v
dfv
dsf
v
dsf
v
inhoud link b jkdsf
sdf
v
dsf
v
fdsv
sdf
v
dsf
v
fdsv
fds
v
dfsv
dsf
vsd
 

courtesy: http://stackoverflow.com/questions/2991623/how-do-i-make-background-size-work-in-ie
http://www.sitepoint.com/forums/showthread.php?462588-filter-progid-DXImageTransform-Microsoft-AlphaImageLoader-problem-in-IE6

Monday, May 13, 2013

Find Nth Maximum value


"How do I find Nth maximum value?" is one of the most asked questions

Here are some methods 
I explain how to find 5th Maximum value
01.declare  @number table(num integer
02. 
03.Insert into @number values(3456)
04.Insert into @number values(846)
05.Insert into @number values(1456)
06.Insert into @number values(3098)
07.Insert into @number values(34)
08.Insert into @number values(67856)
09.Insert into @number values(906)
10.Insert into @number values(34656)
11.Insert into @number values(9056)
12.Insert into @number values(3036)
(1) Use Inner Join
1.select t1.num from @number t1 inner join @number t2 on t1.num<=t2.num
2.group by t1.num having count(t1.num)=5
(2) Use Top Operator
1.Select top 1 num from
2.(
3.Select top 5 num from @number order by num desc
4.) T
5.order by num asc
(3) Generate Serial No based on descending order of the
1.select num from
2.(
3.Select (select count(*) from @number where num>=T.num)as Sno ,num
4.from @number as T
5.as temp
6.where Sno=5
(4) Generate Serial No based on descending order of the values in where Clause
1.select num from @number as n
2.where (select count(*) from @number where num>=n.num)=5
(5) Use Aggregate
1.Select min(num) from (select top 5 num from @number order by num desc) T
(6) Use Row_number() function
1.select num from
2.(
3.select num, row_number() over (order by num descas sno from @number
4.as t
5.where sno=5
6. 
7.Now you can replace to the number that you want to find the maximum value


General SQL query should be as follows

select sal from emp a where N = (select count(distinct sal) from emp b where a.sal <= b.sal) where N = any value.