Tahir Hassan's Blog

My Technical Notes

Tuesday, 21 July 2015

C#: Stringifying DateTime to SQL Date format

Thursday, 9 July 2015

Angular Links

JavaScript: defining the new operator in terms of apply/call

When `new`-ing up a function e.g:

What happens is that a new object is created which `this` reference is set to. Therefore this new object will get its `forename` and `surname` properties set.

In JavaScript, we can call a function, and with setting the `this` reference to an object of our choosing:

The `apply` function works exactly like `call` but it expects an array containing the arguments to the function rather "listing out" the arguments:

What we can surmise is that `new` creates an empty javascript object `{ }`, and then uses `apply` with the empty javascript object as the argument like so:

Visual Studio 2013: Extra Double Quotes in JavaScript

I encountered a problem in the Javascript editor, that if I had an open string (i.e. missing its end double quote character):

If I type in a double quote, the it will produce two:

To disable this behaviour, go to `Tools` → `Options`. Then go to `Text Editor` → `JavaScript` → `General`. Uncheck `Automatic brace completion`.

Don't know if this is the correct solution.

Wednesday, 8 July 2015

OpenOffice Writer: Disable asterisk to bullet point conversion

Go to `Tools` → `AutoCorrect Options`, then `Options` tab. Uncheck `Replace bullets with •`:

OpenOffice Writer: Disable smart double quotes

By default, OpenOffice will replace a double quote with curly double quotes. To disable this, go to `Tools` → `AutoCorrect Options`, the `Localised Options` tab and then uncheck `Replace` in the section `Double Quotes`.

Monday, 6 July 2015

Angular JS error

see: http://stackoverflow.com/questions/22406633/angularjs-uncaught-error-injectormodulerr-failed-to-instantiate-module