小编Sof*_*mur的帖子

定义模块的递归签名

我知道可以定义递归模块,有人知道如何定义递归签名吗?例如,我想知道:

module type AAA = sig
  module Bbb : BBB
  type 'a t 
  val f : 'a Bbb.t -> 'a t
end

module type BBB = sig
  module Aaa : AAA
  type 'a t 
  val g : 'a Aaa.t -> 'a t
end
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

ocaml types module signature

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

从加载项在默认浏览器中打开 html 页面

我想在加载项的任务窗格中插入一个超链接,并且我希望此链接support.html在默认浏览器中打开页面。

<a href="https://example.com/support.html" target="_blank">Support</a>
Run Code Online (Sandbox Code Playgroud)

但是,上面的代码会support.html在任务窗格内打开页面。用户可能不知道如何返回加载项的主页。

有谁知道如何在用户的默认浏览器中打开页面?(顺便说一句,是否建议在加载项之外启动某些内容?如果没有,帮助页面的通用 UX 设计是什么?)

ms-office office-js

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

使用自定义函数提交加载项(更新?)

我问了一个关于 6个月前提交自定义函数加载项的问题.目前的结论是an add-in that uses custom functions cannot currently be published to the Office Store or via Office 365 centralized deployment.

但我意识到文件已经改变了,现在已经改变了

已知的问题

......

尚未启用通过Office 365管理员门户和AppSource进行的部署.

而且,我functions在Script Lab中找到了新按钮.用户可以注册一个类似的功能=ScriptLab.BlankSnippet1.add10(…),并在Excel中使用它.

所以我的问题是

1)Script Lab是否已ScriptLab在AppSource中成功提交了一个函数?

2)今天,微软之外的其他开发人员是否可以使用Script Lab等自定义函数提交加载项?

ms-office office-js scriptlab custom-functions-excel

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

函数中的变量

我看到以下代码......第一次调用(next-num)return 1,第二次返回2.

(define next-num
  (let ((num 0))
    (lambda () (set! num (+ num 1)) num)))

(next-num)   ; 1
(next-num)   ; 2
Run Code Online (Sandbox Code Playgroud)

我无法理解的是... num是由let内部创建的next-num,它是一种局部变量...方案如何知道每次next-num被调用,值num都没有被删除let ((num 0)); 方案如何知道num每当next-num调用它时它总是相同的?

它似乎num是本地的和静态的......我们如何定义局部变量,而不是静态变量?

scheme closures scope racket

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

使用多个可单击的行显示文本

我有一张桌子.对于某些元素,我想要产生一种效果,当我们鼠标悬停(或点击)一个元素时,它旁边会出现一个文本,文本可能有几行,有些行可以点击.

例如,在以下代码生成的表格中,当我们鼠标悬停时30,会出现一个文本

<table style="width:100%">
  <tr>
    <th>First Name</th>
    <th>Points</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td><span title="monday: 10; tuesday: 10; wednesday: 10">30</span></td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

JSBin

不过,我想出现的文字是monday: 10,tuesday: 10wednesday: 10一行行.我们可以点击例如,monday: 10打开页面或移动到页面的另一部分.title不允许这样做.

有谁知道如何实现这一点?我们可以使用JavaScript,CSS ......

(*此主题没有解释如何在出现的文本中插入链接*)

html javascript css jquery

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

在nginx中的MEAN-stack应用程序的漂亮URL

(*正如一些评论建议,我按照这个答案删除index.ejs并使用index.html了项目.所以我调整了我的OP*)

我在Mac中开发了apache一个可以请求的MEAN-stack应用程序 https://localhost:3000/#/home.在使用nginx服务器进行生产时,可以请求应用程序 https://www.myapp.io/#/home.#在所有情况下都需要片段标识符,因为angular ui-router.

所以我想让漂亮的网址没有#(如https://www.myapp.io/home,https://localhost:3000/home)的工作.我做了以下事情:

1)添加$locationProvider.html5Mode(true); $locationProvider.hashPrefix('')app.config(['$stateProvider'....

2)加入<base href="/" />index.html

因此,在浏览器栏中https://localhost:3000/#/home自动更改https://localhost:3000/home,同样适用于https://www.myapp.io/#/home.

但是,直接进入https://localhost:3000/homehttps://www.myapp.io/home在浏览器中会出现错误(我不知道如何将之前<h1><%= message %></h1><h2><%= error.status %></h2><pre><%= error.stack %></pre>的内容error.ejs转为error.html,所以我没有更多细节).

所以现在,目标是制造https://localhost:3000/homehttps://www.myapp.io/home工作.

通过这个帖子,我添加了以下内容app.js:

app.use('/js', express.static(__dirname + '/js'));
app.use('/dist', express.static(__dirname …
Run Code Online (Sandbox Code Playgroud)

.htaccess nginx url-rewriting pretty-urls angular-ui-router

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

检查Office.js是否在Office客户端之外加载

如果我们office.js在Office客户端外部加载引用网页,则会收到警告:Office.js is loaded outside of Office client

此信息很有用。

有人知道我的代码中是否有API可以检查该API?

编辑1:

我会解释一下我的情况以及为什么问这个问题。我正在使用angularjs制作应用程序,可以将其作为网页加载到浏览器中,也可以作为加载项加载到Office中。我意识到,我们不应该做的<body ng-app="myApp">angular.bootstrap(document, ['myApp'])在一起,否则控制器将执行两次。因此,我决定不编写<body ng-app="myApp">并且始终angular.bootstrap在两种情况下都使用(即网页和加载项)。

所以对于一个网页,我可以这样写:

$(document).ready(function () {
    angular.bootstrap(document, ['myApp'])  
})

app = angular.module('myApp', ['ui.router', 'ui.bootstrap'])
...
Run Code Online (Sandbox Code Playgroud)

因此,对于网页,我需要在angular.bootstrapinside 中编写Office.initialize代码,并在插件的情况下共享其他代码:

Office.initialize = function (reason) {
    $(document).ready(function () {
        angular.bootstrap(document, ['myApp'])
    });
}

app = angular.module('myApp', ['ui.router', 'ui.bootstrap'])
// share the same code
Run Code Online (Sandbox Code Playgroud)

但是,如果我按以下方式将这两种情况写在一起,则它适用于网页,而我给出了错误:ng:btstrpd应用程序已经使用此Element引导加载项

$(document).ready(function () {
    angular.bootstrap(document, ['myApp'])
    console.log("bootstrapped …
Run Code Online (Sandbox Code Playgroud)

ms-office office-js

6
推荐指数
2
解决办法
2200
查看次数

对话框的Url不适用于angular.bootstrap(无限$ digest循环)

我有一个卑鄙的堆栈网站.我想使用ExecuteFunction绑定按钮以在对话框中启动此网站:

function doSomethingAndShowDialog(event) {
    clickEvent = event;
    Office.context.ui.displayDialogAsync("https://localhost:3000/try", {}, function () {})
}
Run Code Online (Sandbox Code Playgroud)

单击该按钮将打开一个带有以下URL的对话框,它确实显示了页面的内容:

https://localhost:3000/try?_host_Info=excel|web|16.00|en-us|7fe9b4e9-d51e-bea5-d194-c817bc5ed4bc|isDialog#%2Ftry%3F_host_Info=excel%7Cweb%7C16.00%7Cen-us%7C7fe9b4e9-d51e-bea5-d194-c817bc5ed4bc%7CisDialog
Run Code Online (Sandbox Code Playgroud)

然而,在控制台中,有错误:$ rootScope:infdig无限$消化循环angular.bootstrap(document, ['myapp']):

var wait = setTimeout(myFunction, 1000);
Office.initialize = function (reason) {
    $(document).ready(function () {
        angular.bootstrap(document, ['myapp']) 
        console.log("bootstrapped inside Office.initialize");
        clearTimeout(wait);
    })
}

function myFunction () {
    $(document).ready(function () {
        angular.bootstrap(document, ['myapp']) 
        console.log("bootstrapped outside Office.initialize");
    })
}

app = angular.module("myapp", []);
app.config(...);
app.controller(...);
Run Code Online (Sandbox Code Playgroud)

如果我们只是https://localhost:3000/try在浏览器中打开,则没有错误.

有谁知道为什么这个长网址没有用angular.bootstrap?我们怎么能解决这个问题?

编辑1:控制台的屏幕截图https://localhost:3000/try?_host_Info=excel....请注意,既不显示bootstrapped inside Office.initialize也不bootstrapped …

javascript ms-office angularjs angularjs-digest office-js

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

摩纳哥编辑的高度

我想制作一个非常简单的摩纳哥编辑器:JSBin:

<!DOCTYPE html>
<html>
<head>
    <script src="https://code.jquery.com/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
    <style>
        .me {
          height: 100vh;
        }
    </style>
</head>
<body>
    <div class="me" id="container"></div>
    <script src="https://www.matrixlead.com/monaco-editor/min/vs/loader.js"></script>
    <script>
        require.config({ paths: { 'vs': 'https://www.matrixlead.com/monaco-editor/min/vs' }})

        require(["vs/editor/editor.main"], function () {
          var editor = monaco.editor.create(document.getElementById('container'), {
            value: 'function x() {\n\tconsole.log("Hello world!");\n}',
            language: 'javascript',
            minimap: { enabled: false },
            scrollBeyondLastLine: false
          });
        });
    </script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我在Chrome中看到它并向上和向下滚动时,整个窗口都有一个滚动条.这似乎是因为编辑器的高度大于窗口的高度.我只是不想看到任何滚动条.有谁知道如何实现这一目标?

编辑1: Safari 10.1.2中的截图height: calc(100% - 24px)

在此输入图像描述

解:

在答案的帮助下,这是适合我的解决方案:

1)我们需要在一个独立的html文件而不是JSBin中测试它

2)关键是使用 overflow: hidden

3)因此,下面的代码在向上和向下滚动时不会创建任何滚动条,当代码很长时,底部没有隐藏的行:

<html>
    <style>
    body {
        overflow: …
Run Code Online (Sandbox Code Playgroud)

javascript css height monaco-editor

6
推荐指数
2
解决办法
2619
查看次数

错误:听EACCES 0.0.0.0:443

我试图在我的MacOS上运行NodeJS的Web项目.

之后npm install,npm start返回错误

events.js:183
  throw er; // Unhandled 'error' event
  ^

Error: listen EACCES 0.0.0.0:443
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at Server.setupListenHandle [as _listen2] (net.js:1334:19)
    at listenInCluster (net.js:1392:12)
    at Server.listen (net.js:1476:7)
    at Object.<anonymous> (/Users/softtimur/Startup/PRODSERVER/tmp/WeCard/models/www:36:8)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
Run Code Online (Sandbox Code Playgroud)

我的Mac上没有运行其他网站.

有谁知道什么是错的?我需要在Mac上配置一些东西吗?

编辑1:

sudo npm start 回报

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen …
Run Code Online (Sandbox Code Playgroud)

node.js express

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