Question: I'm defining a function that I want to use both for numpy arrays and for scalars.

```
def inv(x):
    return 1/x

```

this gives back inf in numpy arrays

```
A = np.zeros([4,4])
inv(A)
array([[ inf,  inf,  inf,  inf],
       [ inf,  inf,  inf,  inf],
       [ inf,  inf,  inf,  inf],
       [ inf,  inf,  inf,  inf]])

```

and errors with a scalar

```
inv(0.0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in inv
ZeroDivisionError: float division by zero

```

To detect these zero values I can use numpy.where for numpy arrays and if(a==0) for scalars.

Do you know a way to write this that is good for both numpy arrays and scalars? 

Thanks 

GB

Answer: 
You're looking for `Global Application Class` located under the `Web` templates. That will create a file named by default as `Global.asax`

[![enter image description here](https://i.stack.imgur.com/UarAO.png)](https://i.stack.imgur.com/UarAO.png)
I am assuming you are using VS2015. I am using VS2017, and the situation is the same. Working on legacy code with legacy instructions requires some research into how things have changed and been renamed or deprecated.

I must use the same 2 step process for using the template that was formally titled `ASP.NET Empty Web Application` project. It is now titled `ASP.NET Web Application (.NET Framework)` with subsequent dialog window to specify the `Empty` sub-template type.

When I select the `Empty` sub-template type with the checkbox for `Add folders and core references for: Web Forms` unchecked, no Global.asax file is created. When that checkbox is checked a Global.asax file is created.

**When a Global.asax is already present in a solution the `Global Application Class` template is not displayed in the Add New Item dialog box.** Delete the existing Global.asax file from the solution and the template will once again show up for selection.