Saturday, July 29, 2017

The statement "use strict"; : List of features (non-exhaustive)



The statement "use strict"; instructs the browser to use the Strict mode, which is a reduced and safer feature set of JavaScript.

List of features (non-exhaustive)

  1. Disallows global variables. (Catches missing var declarations and typos in variable names)
  2. Silent failing assignments will throw error in strict mode (assigning NaN = 5;)
  3. Attempts to delete undeletable properties will throw (delete Object.prototype)
  4. Requires all property names in an object literal to be unique (var x = {x1: "1", x1: "2"})
  5. Function parameter names must be unique (function sum (x, x) {...})
  6. Forbids octal syntax (var x = 023; some devs assume wrongly that a preceding zero does nothing to change the number.)
  7. Forbids the with keyword
  8. eval in strict mode does not introduce new variables
  9. Forbids deleting plain names (delete x;)
  10. Forbids binding or assignment of the names eval and arguments in any form
  11. Strict mode does not alias properties of the arguments object with the formal parameters. (i.e. in function sum (a,b) { return arguments[0] + b;} This works because arguments[0] is bound to a and so on. )
  12. arguments.callee is not supported
[Ref: Strict modeMozilla Developer Network]

Wednesday, July 5, 2017

SOLVED: System.IO.FileLoadException exception by unblocking the files


When I was trying to uninstall windows service using InstallUtil.exe (This can also happen when you try to install a windows service). I was getting an error. Please read the complete story.

The command I was trying was,

installutil -u  SearchIndexService.exe

The error was,

Microsoft (R) .NET Framework Installation utility Version 4.0.30319.17929
Copyright (C) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'IDM365SearchIndexService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).

After lot of research on internet I have found following solution, You need to run following power shell command for the folder where you want to do the operation.

 get-childitem -recurse *.* | Unblock-File

The command simply unblocks the file.

You can verify the problem & solution by looking at the properties of the target file. it should show something as highlighted in following image.



After you run the command   get-childitem -recurse *.* | Unblock-File it should disappear.
After all this exercise you should be able to install/uninstall windows services.

Thanks
Happy Programming :)