小编Jon*_*nan的帖子

在Summernote中禁用图片上传

有没有办法完全禁用Summernote中的图像上传,但保持图像网址输入?我发现最接近的是disableDragAndDrop: true选项,但这不会从图像弹出窗口中删除上传按钮

javascript jquery wysiwyg summernote

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

是否可以跳过node express中的路由中间件?

在express中使用以下POST功能.(我使用快递3.5.1)

app.post('/example', someFunctionOne, someFunctionTwo, function(req, res){
    if(!req.someVar){
        return res.send(400, { message: 'error'});
    } else{
        return res.json(200, { message: 'ok'}); 
    }
});
Run Code Online (Sandbox Code Playgroud)

如果我从someFunctionOne得到一些结果,这意味着someFunctionTwo是多余的,有没有办法跳过someFunctionTwo并转到最后一个未命名的函数,它将发送响应?

所以我想以同样的方式存在"next()"函数,其中是"last()"函数?如果这不可能,为什么不呢?这似乎是对我的疏忽,但有充分的理由吗?

middleware node.js express

8
推荐指数
2
解决办法
8219
查看次数

删除图表系列但保留其格式

这是我用来动态创建图表的代码Virtual Basic:

Dim Chart As Object
Set Chart = Charts.Add
With Chart
    If bIssetSourceChart Then
        CopySourceChart
        .Paste Type:=xlFormats
    End If
    For Each s In .SeriesCollection
        s.Delete
    Next s
    .ChartType = xlColumnClustered
    .Location Where:=xlLocationAsNewSheet, Name:=chartTitle
    Sheets(chartTitle).Move After:=Sheets(Sheets.count)
    With .SeriesCollection.NewSeries
        If Val(Application.Version) >= 12 Then
            .values = values
            .XValues = columns
            .Name = chartTitle
        Else
            .Select
            Names.Add "_", columns
            ExecuteExcel4Macro "series.columns(!_)"
            Names.Add "_", values
            ExecuteExcel4Macro "series.values(,!_)"
            Names("_").Delete
        End If
    End With
End With

#The CopySourceChart Sub:
Sub CopySourceChart()
    If Not …
Run Code Online (Sandbox Code Playgroud)

excel formatting charts vba excel-vba

6
推荐指数
1
解决办法
646
查看次数

如何在.Net控制台应用程序中获取承载令牌?

我正在按照教程讲解如何授权和从Web-api服务器获取承载令牌。通过fiddler在那里执行的任务非常简单,但是,当我尝试从控制台应用程序执行相同操作时,请求失败,并显示400 Bad Request Error。这是向服务器发出请求的代码:

var request = WebRequest.Create("http://localhost:12698/token") as HttpWebRequest;
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.CookieContainer = new CookieContainer();         
    var authCredentials = "userName=" + user + "&password=" + password;
    byte[] bytes = System.Text.Encoding.UTF8.GetBytes(authCredentials);
    request.ContentLength = bytes.Length;
    using (var requestStream = request.GetRequestStream()){
        requestStream.Write(bytes, 0, bytes.Length);
    }

    using (var response = request.GetResponse() as HttpWebResponse){
        authCookie = response.Cookies["access_token"];
    }
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我确定我在做什么错吗?还是我应该使用其他方法来获取身份验证令牌?

c# asp.net-mvc authorization asp.net-web-api

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

搜索超过2个元素的元组

如何根据第一个元素或第二个或第三个元素搜索元组?

我知道如何搜索两个元组,但我怎么做两个以上呢?

type Stuff = (String, String, Int)

testStuff :: [Stuff]
testStuff = [
    ("beans","black",5),
    ("cod","fish",4),
    ("coke","diet",3)
]
Run Code Online (Sandbox Code Playgroud)

如何编写一个搜索"Stuff"并返回"int"值的函数?

例如,searchStuff"beans"应该返回5.

haskell

-1
推荐指数
1
解决办法
156
查看次数