小编jim*_*web的帖子

Google:拒绝为localhost生成目标域的登录提示权限

我正在尝试创建Google登录并收到错误消息:

权限被拒绝为目标域生成登录提示

之前纪念这个副本,这是一样的问题,在问在网站错误谷歌标志:权限被拒绝生成目标域登录提示,因为在这种情况下,提问者是在本地主机上,而我得到的这个错误服务器.

具体来说,我在Authorized Javascript Origins中包含了服务器的url,如下图所示: Javascript起源

当我收到错误时,请求显示发送了相同的URL,如下图所示: 无效的请求页面

我还应该在限制页面中添加其他内容吗?有没有办法弄清楚这里发生了什么?开发人员控制台上是否有日志可以告诉我发生了什么?

google-admin-sdk google-signin

40
推荐指数
4
解决办法
3万
查看次数

以排序顺序将数组数组减少到数组中

我正在尝试使用reduce()"整理"顺序组合一组数组,因此具有相似索引的项目在一起.例如:

input = [["one","two","three"],["uno","dos"],["1","2","3","4"],["first","second","third"]]

output = [ 'first','1','uno','one','second','2','dos','two','third','3','three','4' ]
Run Code Online (Sandbox Code Playgroud)

只要它们在一起,具有相似索引的项目的顺序无关紧要,因此结果'one','uno','1'...是如上所述.我想尽可能使用不可变变量.

我有办法:

    const output = input.reduce((accumulator, currentArray, arrayIndex)=>{
        currentArray.forEach((item,itemIndex)=>{
            const newIndex = itemIndex*(arrayIndex+1);
            accumulator.splice(newIndex<accumulator.length?newIndex:accumulator.length,0,item);
        })
        return accumulator;
    })
Run Code Online (Sandbox Code Playgroud)

但它不是很漂亮而且我不喜欢它,特别是因为它在forEach方法中改变累加器的方式.我觉得必须有一个更优雅的方法.

我不敢相信之前没有人问过这个问题,但是我尝试了一堆不同的查询而无法找到它,所以请告诉我它是否在那里而我错过了它.有没有更好的办法?

为了澄清评论中的每个问题,我希望能够在不改变任何变量或数组的情况下执行此操作,因为我正在使用accumulator.splice和仅使用函数方法,例如.map,或者.reduce不使用类似的变异循环.forEach.

javascript arrays functional-programming

21
推荐指数
5
解决办法
507
查看次数

build.gradle 不是设置文件定义的构建的一部分

我正在尝试构建 Gradle 文件并收到错误 Build file '.../build.gradle' is not part of the build defined by settings file '.../settings.gradle'. If this is an unrelated build, it must have it's own settings file.

这是我的 build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    baseName = 'gs-securing-web'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-thymeleaf") …
Run Code Online (Sandbox Code Playgroud)

gradle

11
推荐指数
2
解决办法
2万
查看次数

将数字添加到图表的轴

所以我有一个使用 c# 的相当标准的图表方法DocumentFormat.OpenXML,命名空间工作正常。但我无法弄清楚如何在轴上放置数字标签,特别是值轴。不幸的是,c# openxml 几乎完全没有记录。如果这是一个重复的问题,我很乐意在其他地方看到答案,因为我找不到它。如何将数字标签添加到我的轴上?

我的完整代码如下,但这里是我创建值轴的部分,所以我假设我必须在这里的括号中添加一些内容,例如 anew ????但我不知道它是什么。

ValueAxis valAx = plotArea.AppendChild<ValueAxis>(new ValueAxis(new AxisId() { Val = new UInt32Value(48672768u) },
    new Scaling(new DocumentFormat.OpenXml.Drawing.Charts.Orientation()
    {
        Val = new EnumValue<DocumentFormat.OpenXml.Drawing.Charts.OrientationValues>(
        DocumentFormat.OpenXml.Drawing.Charts.OrientationValues.MinMax)
    }),
    new AxisPosition() { Val = new EnumValue<AxisPositionValues>(AxisPositionValues.Left) },
    new MajorGridlines(),
    new DocumentFormat.OpenXml.Drawing.Charts.NumberingFormat()
    {
        FormatCode = new StringValue("General"),
        SourceLinked = new BooleanValue(true)
    }, new TickLabelPosition()
    {
        Val = new EnumValue<TickLabelPositionValues>(TickLabelPositionValues.NextTo)
    }, new CrossingAxis() { Val = new UInt32Value(48650112U) },
    new Crosses() { Val = new EnumValue<CrossesValues>(CrossesValues.AutoZero) }, …
Run Code Online (Sandbox Code Playgroud)

c# charts openxml

3
推荐指数
1
解决办法
1040
查看次数

.net MVC 控制器到底如何知道要返回哪个 View()?

当我想调用 .net 中的新页面(例如“About.cshtml”页面)时,我在 HomeController 中使用以下代码:

public ActionResult About()
{
    ViewBag.Title = "About";
    return View();
}
Run Code Online (Sandbox Code Playgroud)

为了调用它,我将使用“/Home/About”的链接。例如,如果我想创建一个名为“Contact.cshtml”的新页面,我会复制上面的内容并将“关于”替换为“联系人”。

我知道“/Home”中的路由调用了HomeController。但是,该控制器到底如何知道返回 About.cshtml 页面呢?我认为它是基于函数的名称。但这对我来说听起来不对。About() 不像 Get() 或 Post() 那样是 HTTP 动词,并且函数的名称通常不应该定义它的功能,除非它已经存在。

另外,View() 到底是什么时候定义的,什么时候分配给 About.cshtml 页面?

最后,是否有一个属性允许我返回具有不同函数名称的 About.cshtml 页面(因为我可以设置一个函数以使用 [HttpGet] 属性响应 Get)?

.net asp.net asp.net-mvc controller

2
推荐指数
1
解决办法
5195
查看次数

jHipster注册表无法编译角度依赖项

所以我克隆了jHipster注册表,但是收到了以下警告:

npm WARN angular2-cookie@1.2.6 requires a peer of @angular/common@^2.0.0 but none was installed.
npm WARN angular2-cookie@1.2.6 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN ng2-translate@4.2.0 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN ng2-translate@4.2.0 requires a peer of @angular/http@^2.0.0 but none was installed.
Run Code Online (Sandbox Code Playgroud)

我如何解决这个问题,以便我可以构建?

jhipster angular

2
推荐指数
1
解决办法
152
查看次数

使用泛型扩展接口的类

所以我正在滚动我自己的最大堆,并且我使用扩展接口的泛型类做错了.说我有这样一个类:

class SuffixOverlap:IComparable<SuffixOverlap>
{
    //other code for the class
     public int CompareTo(SuffixOverlap other)
    {
        return SomeProperty.CompareTo(other.SomeProperty);
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我创建我的堆类:

class LiteHeap<T> where T:IComparable
{
    T[] HeapArray;
    int HeapSize = 0;
    public LiteHeap(List<T> vals)
    {
        HeapArray = new T[vals.Count()];
        foreach(var val in vals)
        {
            insert(val);
        }
    }

    //the usual max heap methods
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试这样做时:

LiteHeap<SuffixOverlap> olHeap = new LiteHeap<SuffixOverlap>(listOfSuffixOverlaps);
Run Code Online (Sandbox Code Playgroud)

我收到错误: The type SuffixOverlap cannot be used as a type parameter T in the generic type or method LiteHeap<T>. There is no …

c# generics interface

0
推荐指数
1
解决办法
163
查看次数