Quote of the day

Friday, August 17, 2012

prevent $(document).ready to load the functions on every post back

today, i was going through the jquery selectors section and tried an animation using recursion. Using call backs, i was able to do the "blinking" of text in a lable. When a button is clicked, I update the lable with current date and time (new Date()), but the default text was set again after the click and new Date display. When I went through forums, I found a solution. ie., using "e.preventDefault()" to be called in the click event. Using that prevented me to call the $(document).ready every time any event occurs in the page....



 $(document).ready(function () {

            
            BlinkLabelSample("lblSample");

        });
function BlinkLabelSample(elem) {
            var obj = $("#" + elem);
            obj.fadeIn("1000", function () {
                $(this).fadeOut("1000");
                BlinkLabelSample("lblSample");

            });
        }

$("#btnAnimationChange").live("click", function (e) {
    $(":animated").text(new Date());
    e.preventDefault();
});


Tuesday, March 13, 2012

Team foundation server working folder is already in use error

Today I faced an issue in TFS when I tried to Map the project. It said that TFS is already mapped to the c:\ drive and did not let me to map in any of the c drive's folder. I even tried to remove all the workspaces created but still it did not allow. Then I went through the following link which helped me to resolved the problem.

The issue was, we have Virtual machines which may be used by someother person in past and that user might have created a workspace mapping to local drive. I used a software called "Attrice (below link has the link to that software)", which will list all the worspaces "by user", "by date", "by machine name". When I tried to query "by machine name" and "by past date (a year back)", it listed me the old workspace which was mapped by the other user. I deleted and it worked!!!!

http://blogs.msdn.com/b/davidmcg/archive/2007/02/21/team-foundation-server-working-folder-is-already-in-use.aspx

Tuesday, February 14, 2012

jquery tooltip sample

my friend Ohm Ganesh asked for a tooltip sample in jQuery. I used a jquery plugin from http://flowplayer.org/tools/demos/tooltip/index.html

You can download the tooltip image from the above mentioned site itself. If not required, you can remove the "backgroud" property in the css class.

aspx with javascript in it:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="jTooltip.aspx.cs" Inherits="jTooltip" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.tooltip
{
display: none;
background: transparent url(_assets/images/black_arrow.png);
font-size: 12px;
height: 70px;
width: 160px;
padding: 25px;
color: #fff;
}
</style>

<script src="_assets/scripts/jquery/jquery-1.7.1.js" type="text/javascript"></script>

<script src="_assets/scripts/jquery/jquery.tools.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function(){
$("#lblText").tooltip();
$("#tblSample tr").each(function(){
$("td:eq(2)", this).tooltip();
});
});
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<asp:Label ID="lblText" runat="server" Text="Hello World" ToolTip="this is tool tip" />
Please hover on the<h2> column 3</h2> to see the tooltip
<table id="tblSample" border="1">
<tr>
<td>
1
</td>
<td>
achu
</td>
<td title="they call him 'super'">
madurai
</td>
</tr>
<tr>
<td>
2
</td>
<td>
ohm
</td>
<td title="he is from a village">
kovilpatti
</td>
</tr>
<tr>
<td>
3
</td>
<td>
kathir
</td>
<td title="he is sumaaaar guy only">
karur
</td>
</tr>
<tr>
<td>
4
</td>
<td>
ranjith
</td>
<td title="good leader we had">
kerala
</td>
</tr>
<tr>
<td>
5
</td>
<td>
jegan
</td>
<td title="very good moulded person">
chennai
</td>
</tr>
</table>
</div>
</form>
</body>
</html>