Wednesday, October 9, 2013

Tip: IE 10 Issue with MS Report Viewer

Recently I encountered a very strange scenario whereby IE 10 failed to render the Report Viewer properly. All i got was a "disabled" view of the Report Viewer. I tried to switch the browser mode through F12 to "Internet Explorer 10 Compatibility View" with "Standard" document mode. Amazingly the Report Viewer displayed properly and at the same time preserving the CSS3 appearance. I checked the IE debugger console and found that there's a JavaScript error stating "__doPostBack is undefined", so i did a search in Google and found the following link which provides the solution: http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx I tried to download the hotfix from MS web site, but the link was invalid, so i downloaded the nuget browser files from http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx to fix the problem.

Thursday, June 6, 2013

Tip: bat or exe file not running in Windows Task Scheduler (Windows 8)?

Solution:
In order for a task to run successfully using the Windows Task Scheduler, it's important to set the "Start in (Optional)" text box of the task. If you are using the schtasks.exe command to run the task, you can include the "V1" switch so that the mentioned text box is populated automatically. The picture below shows a pre-populated task action using the schtasks.exe.

Monday, June 3, 2013

Tip: How to open a project with Visual Studio in administrator mode?

It's a pain in the ass when have to open a Visual Studio project that is set to run on local IIS and Visual Studio Visual Studio will always complain the lack of permission if the project is opened through double clicking the associated project file in Windows Explorer. The workaround to the problem is to change the windows registry so that every time a Visual Studio associated file is double clicked, it will open the Visual Studio in Administrator context, thus able to modify the IIS metabase. Below is a screen shot of an example which enable VS2010 and VS2012 to run in administrator mode.

Tuesday, February 26, 2013

Tip: Close an IE popup properly.


In order to close an IE popup that is opened through the window.open function, one has to use the following code:

Assume that before closing the popup, we need to update the parent window by calling a javascript function. The declaration of the button that closes the popup:

<input id="btn" onclick="opener.callParentFunction(params); window.close(); return false;" type="button" value="Close Me" />

Please note that the javascript statement in the button must contain the "return false" statement or else  IE will not respond to the close command.

Wednesday, January 9, 2013

Tip: JavaScript getTime cannot guarantee unique numbers generation.

Recently i have been working on a project that uses JavaScript to generate unique identifiers based on the number of items selected by a user. A loop will go through the selected items and use the getTime function to generate an id for each item. Problems could occur when things run on a fast machine, 2 same ids can be used if the difference between the 2 loops are split micro seconds only. The workaround i used is to store the generated ids and compare it with the newly generated id to ensure that the new id is not already used. Another alternative is to use an incremental number in a loop and create a way to keep track it.