When you need to confirm a bug, sometimes it’s a good idea to write a small program that reproduces the behavior, it will be more convincing to managers and colleagues.
Month: November 2016
Strategy to debug Javascript
Make sure you read the relevant API docs.
Use Chrome’s developer tools, Firebug, or IE’s, and Visual Studio debugger, they are awesome.
Use console.log and alert in code when necessary when tracing code is difficult.
Run JS scripts from JS console.
Don’t be afraid to trace through third party’s frameworks and libraries when necessary.
Chrome DevTools was disconnected from the page, IE error out of stack space
This issue, according to the stackoverflow answers seem to stem from the webpage having.
- Infinite recursion(likely)
- Infinite loop(not likely?)
The same issue will make IE display an error: “SCRIPT28: Out of stack space”
If you can debug and find out the infinite recursion, maybe it’s possible to fix this issue.
500.19 – Internal Server Error – The requested page cannot be accessed because the related configuration data for the page is invalid
Today I faced this error while trying to run a web application.
It turned out that it was occurred in a REST request to the server to retrieve a JSON file. I tried to solve this issue by first opening IIS and check the declared MIME types under the web application, then it complained that there is a duplicate entry in the web.config file.
It turned out that if the web.config file contains a declaration for the MIME type .json and under the application in IIS the MIME type is also declared, IIS will complain. I solved the issue by removing the MIME type declaration from the web.config file.
Tips to generate a large SQL Server table for testing
To generate a large table with millions of records, it’s possible to use the following script:
declare @RecordsNum int = 10000000-(select count(*) from Person)
declare @Count int = 0
set nocount on
Begin transaction
while(@Count < @RecordsNum)
begin
insert into MyTable(Name, Address, Age)
values(substring(Convert(varchar(255), NewID()), 0, 30),
substring(Convert(varchar(255), NewID()),0 ,30), RAND(100) * 100)
set @Count = @Count + 1
End
commit
select count(*) from MyTable
Some things to do to improve performance of the script:
- Set NoCount to ON
- enclose the while loop in a transaction explicitly
Ideas were found in this page: http://mitchelsellers.com/blogs/2008/09/12/creating-random-sql-server-test-data.aspx