Feeds:
Posts
Comments

Archive for May, 2007

     In my project, I have to display the total of selected item in thousand separated format. I am using java script to find total of selected values. Now I have to display the result in Thousand deperated format (like 12,345.00). Here the function that I have used to do that.   

<script language = “javascript”>
function ThousandSeparator(decimalDigits,Value)
{
     // Separator Length. Here this is thousand separator
     var separatorLength = 3;
     var OriginalValue=Value;
     var TempValue = “” + OriginalValue;
     var NewValue = “”;

      // Store digits after decimal
      var pStr;

      // store digits before decimal
      var dStr;

      // Add decimal point if it is not there
      if (TempValue.indexOf(“.”)==-1)
     {
           TempValue+=“.”
     }

    dStr=TempValue.substr(0,TempValue.indexOf(“.”));

    pStr=TempValue.substr(TempValue.indexOf(“.”))

    // Add “0” for remaining digits after decimal point
    while (pStr.length-1< decimalDigits){pStr+=“0”}

    if(pStr ==‘.’)
            pStr =
   
   if
(dStr.length > separatorLength)
  {
        // Logic of separation
       while( dStr.length > separatorLength)
      {
              NewValue = “,” + dStr.substr(dStr.length – separatorLength) + NewValue;
             dStr = dStr.substr(0,dStr.length – separatorLength);
       }
       NewValue = dStr + NewValue;
   }
   else
  {
       NewValue = dStr;
   }
   // Add decimal part
   NewValue = NewValue + pStr;
    // Show Final value
    alert(NewValue);
  }
</script>

 Fig (1) Thousand Separator Function in Java Script

   You just need to  pass 2 parameters. Number of digits require after decimal point and value you want to conver in thousand seperated format.

Happy Programming !!

Advertisements

Read Full Post »

      I have seen this error so many time so I thought that let me post the solution that work for me. First thing check your connection string that it points correct server. This is the most common mistake. Sometime connection string points to SQL Express, while machine does not have SQL Expressed installed.

      If the connection string is correct, second step is to check congiguration of SQL. Click on Start – All Programms – Sql Server 2005 – Configuration Tool – SQL Server Configuration Manager. You can see the mmc as shown below,

Fig (1) – Sql Server Configuration Manager.

 Click on SQL Server 2005 Network configuration – Protocols for MS SQL Server. Make sure that TCP/IP and Named Piped are Enable. If not that enable it. Now click on SQL Server 2005 Services. Restart Sql Server Browser Service and then restart SQL Server (MSSQLSERVER) service. Yupiiii !!! its all. Check your application now your error should be resolved.

Happy Programming !!

Read Full Post »

       Here is the code to disable right click on page.

<html>
<body oncontextmenu=”return false;”>
     Try right click.
</body>
</html>

   Happy Programming !!

Read Full Post »

       Today while surfing, I found a good javascript framework Prototype.js. It is a JavaScript library written by Sam Stephenson. This amazingly well thought and well written piece of standards-compliant code takes a lot of the burden associated with creating rich, highly interactive web pages that characterize the Web 2.0 off your back.

       This framework helps the developers to write a good javascript witout knowing much about syntax of javascript and reduce the overhead of remembering lots of complex function.

      You can download this library from here.

       Here is a really good artilce which explains few methods of prototype.js with examples.

Read Full Post »

UML Diagrams

      I have to create class and Sequence diagrams in my recent project. I was searching for for some quick and good material for UML diagrams. I found the really cool article here.

Read Full Post »

   Please find article at

http://chiragrdarji.blogspot.com/2007/05/custom-datetime-format-specifier.html

Read Full Post »