Skip to main content

Posts

Showing posts from April, 2013

Simple script to backup all SQL Server databases

DECLARE  @name  VARCHAR ( 50 )  -- database name   DECLARE  @path  VARCHAR ( 256 )  -- path for backup files   DECLARE  @fileName  VARCHAR ( 256 )  -- filename for backup   DECLARE  @fileDate  VARCHAR ( 20 )  -- used for file name SET  @path  =  'C:\Backup\'  SELECT  @fileDate  =  CONVERT ( VARCHAR ( 20 ), GETDATE (), 112 ) DECLARE  db_cursor  CURSOR FOR  SELECT  name  FROM MASTER .dbo.sysdatabases  WHERE  name  NOT  IN  ( 'master' , 'model' , 'msdb' , 'tempdb' )  OPEN  db_cursor    FETCH  NEXT  FROM  db_cursor  INTO  @name   WHILE  @@FETCH_STATUS  =  0    BEGIN          SET  @fileName  =  @path  +  @name  +  '_'  +  @fileDate  +  '...

Bug and Fix: ASP.NET fails to detect IE10 causing _doPostBack is undefined JavaScript error or maintain FF5 scrollbar position

Browser version numbers continue to march on. IE9 is here, IE10 is coming , Firefox 5 and 6 are here with 7 and 8 in the wings , Opera's on 11, and Chrome is on, I dunno, somewhere between 14 and 50. Regardless, we'll all be on version 99 before The Singularity. There is a bug in the browser definition files that shipped with .NET 2.0 and .NET 4, namely that they contain definitions for a certain range of browser versions. But the versions for some browsers (like IE 10) aren't within those ranges any more. Therefore, ASP.NET sees them as unknown browsers and defaults to a down-level definition, which has certain inconveniences, like that it does not support features like JavaScript. If you want to see this for yourself, create a new, blank Web site (e.g. in Visual Studio 2010), add a control that requires JavaScript for postback (good example: <asp:LinkButton>), and then run the site using IE9 (where it work...

Javascript Cookies

    <script type="text/javascript">         function createCookie() {             document.cookie = "CookieName=CookieValue;" + "expires=Sat, 16 May 2020 18:40:22 GMT";         }         function getCookieValue(key) {             currentcookie = document.cookie;             if (currentcookie.length > 0) {                 firstidx = currentcookie.indexOf(key + "=");                 if (firstidx != -1) {                     firstidx = firstidx + key.length + 1;                     lastidx = currentcookie.indexOf(";", firstidx);                     if (lastidx == -1) {     ...