Fix: Input past end of file

  Error: Input past end of file     Error Causing Code:   <script type="text/javascript">     function readfile(){         var line         var fso = new ActiveXObject("Scripting.FileSystemObject");         file = fso.OpenTextFile("C:\Temp\File1.txt", 1);         var User = getuserName();         while (!file.AtEndOfStream) {             line = file.ReadLine();             return line         }         file.Close();     }     function getuserName() {         var line         var fso = new ActiveXObject("Scripting.FileSystemObject");         file = fso.OpenTextFile("C:\Temp\users.txt", 1, false);         line = file.ReadLine();         return line         file.Close();     } </script>   Fixed Code:   <script type="text/javascript">     function readfile(){         var line        var User […]

Read more

JavaScript case insensitive string match

Code: SELECT * FROM [SessionProfile].[dbo].[ReadableSessions] (nolock) where application like ‘%gmmev9%’ select u.userprincipalname, sp.stagename, sp.tmst from StageProgress sp (nolock) inner join ServerProfile servp (nolock) on sp.SessionId = servp.ProfileId inner join [User] u (nolock) on u.id = servp.UserId where sp.tmst > DATEADD("MINUTE", -5, getdate()) and u.userprincipalname like ‘%gmmob002%’ order by sp.tmst desc, u.userprincipalname     Output:

Read more

JavaScript String Operations

Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">     <body>         <script type="text/javascript">             var wshShell = new ActiveXObject("WScript.Shell")             var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")             var text_match = "GOVARDHAN"                         if(sComputerName.match(text_match))             //if(sComputerName.match("govardhan"))             {                 document.write("[" + sComputerName + "] String matched criteria: [" + text_match + "]");             } else {                 document.write("String Match failed");                 //document.write("<br /><br />Would you like to try again?<br /><br />");             }         </script>     </body> </html>     Output:

Read more