Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Thursday, 12 September 2013

JavaScript parseInt function fails in IE8 for string "08" and "09"

We have used the java script function parseInt to parse the strings, however on the 9 th sept it started failing, I debugged the script and observed the following things :

var dt = parseInt("09");  // gives result as 0
var dt = parseInt("08");   // gives result as 0
var dt = parseInt("07");  // gives result as 7

solution is specify base 10

var dt = parseInt("09", 10);  // gives result as 9
var dt = parseInt("08", 10);   // gives result as 8
var dt = parseInt("07", 10 );  // gives result as 7

Reason : Both parseInt('08') and parseInt('09') return zero because the function tries to determine the correct base for the numerical system used. In Javascript numbers starting with zero are considered octal and there's no 08 or 09 in octal, hence the problem.

Tuesday, 11 December 2012

Improve the SharePoint web application performance


Following are few quick tips for improving your SharePoint/ASP.Net web application performance :

1. Use minified or compressed version of the JavaScript files

While referring any third party JavaScript files, try to use their release version for example if we are planning to use the jQuery in your application you should refer minified and Gzipped version (32KB)

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>

instead of development version (252 KB)

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script>

You can also minify and compress your js files using Visual studio extension available at

http://visualstudiogallery.msdn.microsoft.com/5469b7e2-90d7-4f54-b299-ae47e26323e6

You can install it in visual studio and at the time of development it self it get compressed. So you can refer the compressed version on your pages.

2. Using Script manager to composite the JavaScript files 

If you are using ASP.NET AJAX in your application, you can create a composite script automatically by using the ScriptManager control. To combine scripts, add the CompositeScript element and list the script references in the order that you want them included in the composite script. 


   <asp:ScriptManager ID="ScriptManager1" runat="server">
    <CompositeScript>
     <Scripts>
      <asp:ScriptReference Path="~/Scripts/Script1.js" />
      <asp:ScriptReference Path="~/Scripts/Script2.js" />
      <asp:ScriptReference Path="~/Scripts/Script3.js" />
     </Scripts>
     </CompositeScript>
  </asp:ScriptManager>



You can find more details about it at -
http://msdn.microsoft.com/en-us/library/cc488552%28v=vs.90%29.aspx



 


Migration issues for SAP.Connector.dll from Win 2003 to Win 2019 server

Recently I got task of migration of asmx web services from windows 2003 to windows 2019 server. These web services fetch data from SAP us...