外文分享

Need to access service in function

坚强是说给别人听的谎言 提交于 2021-02-20 18:43:35
问题 I have a service (AuthService) that I need to access in my restangularInit function (in my app.module.ts) but I don't know how, I can't get access to it. I have tried to move it to the class AppModule but by then it´s to late. Calling the service functions eg. getToken works as expected. import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import {

How to parametrize a xunit class fixture?

别等时光非礼了梦想. 提交于 2021-02-20 18:42:29
问题 xUnit offers the concept of (shared) class fixtures as explained in Shared Context between Tests. What I didn't figure out so far is if there is a way of parametrizing such class fixtures. For example, what if the DatabaseFixture should be enriched with some test data which depends on the test it's being run against? A test class might want to insert test data but only once and then run all its tests against that database (fixture). In other words, what if the // ... initialize data in the

SSE/AVX: Choose from two __m256 float vectors based on per-element min and max absolute value

浪子不回头ぞ 提交于 2021-02-20 18:42:04
问题 I am looking for efficient AVX (AVX512) implementation of // Given float u[8]; float v[8]; // Compute float a[8]; float b[8]; // Such that for ( int i = 0; i < 8; ++i ) { a[i] = fabs(u[i]) >= fabs(v[i]) ? u[i] : v[i]; b[i] = fabs(u[i]) < fabs(v[i]) ? u[i] : v[i]; } I.e., I need to select element-wise into a from u and v based on mask , and into b based on !mask , where mask = (fabs(u) >= fabs(v)) element-wise. 回答1: I had this exact same problem just the other day. The solution I came up with

SSE/AVX: Choose from two __m256 float vectors based on per-element min and max absolute value

我的梦境 提交于 2021-02-20 18:40:50
问题 I am looking for efficient AVX (AVX512) implementation of // Given float u[8]; float v[8]; // Compute float a[8]; float b[8]; // Such that for ( int i = 0; i < 8; ++i ) { a[i] = fabs(u[i]) >= fabs(v[i]) ? u[i] : v[i]; b[i] = fabs(u[i]) < fabs(v[i]) ? u[i] : v[i]; } I.e., I need to select element-wise into a from u and v based on mask , and into b based on !mask , where mask = (fabs(u) >= fabs(v)) element-wise. 回答1: I had this exact same problem just the other day. The solution I came up with

.gitattributes merge strategy not working

夙愿已清 提交于 2021-02-20 18:23:50
问题 I'm using a merge strategy in .gitattributes to preserve files during merges. I also used git config --global merge.ours.driver true; to set the driver in my config (I checked the config for [merge "ours"] driver = true and it is there). My merge strategy is set correctly: src/public/bundle.js merge=ours src/public/main.min.css merge=ours server/middlewares/https_redirect.js merge=ours Yet when I merge, I am still getting the files from the branch being merged. What could I be doing wrong?

.gitattributes merge strategy not working

﹥>﹥吖頭↗ 提交于 2021-02-20 18:22:47
问题 I'm using a merge strategy in .gitattributes to preserve files during merges. I also used git config --global merge.ours.driver true; to set the driver in my config (I checked the config for [merge "ours"] driver = true and it is there). My merge strategy is set correctly: src/public/bundle.js merge=ours src/public/main.min.css merge=ours server/middlewares/https_redirect.js merge=ours Yet when I merge, I am still getting the files from the branch being merged. What could I be doing wrong?

all goroutines are asleep deadlock

£可爱£侵袭症+ 提交于 2021-02-20 18:17:53
问题 I am trying to play around with goroutines and channel package main import ( "fmt" "math/rand" "time" ) func boring(msg string) <-chan string { c := make(chan string) go func() { for i := 0; ; i++ { c <- fmt.Sprintf("%s %d", msg, i) time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond) } }() return c } func main() { c := fanInNew(boring("joe"), boring("anh")) for i := 0; i < 10; i++ { fmt.Println(<-c) } fmt.Println("You both are boring, I am leaving") } func fanInNew(input1, input2 <

.gitattributes merge strategy not working

杀马特。学长 韩版系。学妹 提交于 2021-02-20 18:17:23
问题 I'm using a merge strategy in .gitattributes to preserve files during merges. I also used git config --global merge.ours.driver true; to set the driver in my config (I checked the config for [merge "ours"] driver = true and it is there). My merge strategy is set correctly: src/public/bundle.js merge=ours src/public/main.min.css merge=ours server/middlewares/https_redirect.js merge=ours Yet when I merge, I am still getting the files from the branch being merged. What could I be doing wrong?

.gitattributes merge strategy not working

北战南征 提交于 2021-02-20 18:16:31
问题 I'm using a merge strategy in .gitattributes to preserve files during merges. I also used git config --global merge.ours.driver true; to set the driver in my config (I checked the config for [merge "ours"] driver = true and it is there). My merge strategy is set correctly: src/public/bundle.js merge=ours src/public/main.min.css merge=ours server/middlewares/https_redirect.js merge=ours Yet when I merge, I am still getting the files from the branch being merged. What could I be doing wrong?

all goroutines are asleep deadlock

不羁的心 提交于 2021-02-20 18:14:06
问题 I am trying to play around with goroutines and channel package main import ( "fmt" "math/rand" "time" ) func boring(msg string) <-chan string { c := make(chan string) go func() { for i := 0; ; i++ { c <- fmt.Sprintf("%s %d", msg, i) time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond) } }() return c } func main() { c := fanInNew(boring("joe"), boring("anh")) for i := 0; i < 10; i++ { fmt.Println(<-c) } fmt.Println("You both are boring, I am leaving") } func fanInNew(input1, input2 <