Tahir Hassan's Blog

My Technical Notes

Thursday, 2 July 2015

MVC: disabling Owin

Owin is the new way of authenticating. If you would like to revert your project to using the old method of doing things, follow these steps:

  • Add: to your `<appSettings>` section.

  • Remove the line: from under the `<modules>` section.

Wednesday, 24 June 2015

Git: Ignoring files

given a folder `fold` with the structure:

  • fold
    • yakult.txt
    • people
      • sepp_blatter.txt
      • emile_heskey.txt
    • bin
      • gen.xml
      • gen.dll

To ignore `yakult.txt`, we must place a `.gitignore` file within its parent `fold` with the following content:

To ignore all text files within `people` folder, we need to add a `.ignore` within people with:

To add the `bin` folder, but ignore all files within it, we add a `.gitignore` file with:

The first line ignores all files, and the second line says except (exclamation) the `.gitignore` file.

To ignore the `bin` folder altogether, we need to add a forward slash at the end to say that it is a folder:

Wednesday, 17 June 2015

Git: caching credentials

To set-up caching for our password, we have to set the `credential.helper` option. This will set the credential caching for the repository you are currently in. Later, we describe how to set this option globally.

Windows Credential Store

To store passwords permanently in the Windows Credential Store, do:

To then delete a password, open the Credential Manager:

Cache (Memory)

will store the credentials for 60 minutes. You can tweak `--timeout`.

Store (on disk)

will store the credentials in `~/.git-credentials`. This is a plain text file and therefore is probably not the best option. See [1] for more information.


Setting option globally

If you wish to set a default, for example, by default you want the credential to be stored in memory for 12 hours (or `43200` seconds) after typing them in (within the same session), you need to add the `--global` argument:

Global settings are stored in `~/.gitconfig`, but they can be overridden by settings stored in the repository, which are stored in `.git/config`.

Therefore if you set the `credential.helper` option for a repository, this will override the global option.

See [2] for more information about global overrides.


Angular: using a template and including it

Given a template:

We can include it using the following statement:

Notice the single quotes around `myTemplate` in the include statement? - If they were not there, angular would treat it like a variable instead of a string.

Including an external template

To include an HTML template defined at `/path/to/template.html`:

we specify the path in the `ng-include` attribute (notice the single quotes again):

Monday, 15 June 2015

Angular: Using NgRepeat

Here is the HTML:

Here is the module/controller:

Friday, 29 May 2015

Getting Help in PowerShell

Getting help in Powershell is quite easy. To get all the loaded modules, we use:

To get all the commands in a newly installed module, for example, PowerShell Community Extensions, you type in:

In this case:

To get help on a specific command, we use `Get-Help <command name>`, for example:

To add help to your own commands, see

Friday, 22 May 2015

F# COM Component code

This is a simple COM component written in F#.

The F# library project template does not come with an `AssemblyInfo.fs`, therefore you have to add one yourself. Stick it at the top of your solution.

Google-ing for `AssemblyInfo.fs` gives many examples. There is even an extension, F# Assembly Info File, for it.

You will also need an assembly key file which can be generated using the below command, which should be created in the project root directory.


Here is a simple example of a COM class, `Class1` with an interface `IClass1`, with a string property `XYZ`: