Question: i am using LinkedinSwift last one year but now redirect to app is not working got no valid session error.but browser working fine.any solutions available.thanks in advance.My code is below

```
linkedinHelper.authorizeSuccess({ [unowned self] (lsToken) -> Void in
    self.linkedinHelper.requestURL("https://api.linkedin.com/v2/me", requestType: LinkedinSwiftRequestGet, success: { (response) -> Void in
        print("Request success with response: \(response)")
        DispatchQueue.main.async() {
            //let data: NSData = response.data.data(using: String.Encoding.utf8)! as NSData
            do {
                let json = response.jsonObject
                if let dictionaryJson = json as NSDictionary?{

                    print(dictionaryJson)

                }
            } catch {
                print(error)
            }
            //                    print(response?.statusCode)
        }
        // self.writeConsoleLine("Request success with response: \(response)")
    }) { [unowned self] (error) -> Void in
        // self.writeConsoleLine("Encounter error: \(error.localizedDescription)")
    }
    // self.writeConsoleLine("Login success lsToken: \(lsToken)")
    }, error: { [unowned self] (error) -> Void in

        //  self.writeConsoleLine("Encounter error: \(error.localizedDescription)")
    }, cancel: { [unowned self] () -> Void in

        // self.writeConsoleLine("User Cancelled!")
})
}

```

Answer: 
We can leverage [`np.lib.stride_tricks.as_strided`](http://www.scipy-lectures.org/advanced/advanced_numpy/#indexing-scheme-strides) based [`scikit-image's view_as_windows`](http://scikit-image.org/docs/dev/api/skimage.util.html#skimage.util.view_as_windows) to get sliding windows. [More info on use of `as_strided` based `view_as_windows`](https://stackoverflow.com/a/51890064/).

```
from skimage.util.shape import view_as_windows   

# Get indices as array 
ar = np.array(list(a))

# Get all sliding windows
w = view_as_windows(matrix,(m,m))

# Get selective ones by indexing with ar
selected_windows = np.moveaxis(w[ar[:,0],ar[:,1]],0,2)

```

Alternatively, we can extract the row and col indices with a list comprehension and then index with those, like so -

```
R = [i[0] for i in a]
C = [i[1] for i in a]
selected_windows = np.moveaxis(w[R,C],0,2)

```

---

Optimizing from the start, we can skip the creation of stepping array, `a` and simply use the `step` arg with `view_as_windows`, like so - 

```
view_as_windows(matrix,(m,m),step=2)

```

This would give us a `4D` array and indexing into the first two axes of it would have all the `mxm` shaped windows. These windows are simply views into input and hence no extra memory overhead plus virtually free runtime!
```
import numpy as np

a = np.random.randn(n, n)

b = a[0:m*step:step, 0:m*step:step]

```

---

If you have a one-dimension array, you can get it's submatrix by the following code:

```
c = a[start:end:step]

```

If the dimension is two or more, add comma between every dimension.

```
d = a[start1:end1:step1, start2:end3:step2]

```