我开始与 Elm 一起工作,Browser.application这很有趣,但是(据我所知)从未真正解释过的一件事是Browser.Navigation.Key类型。
榆树文档说
需要一个导航键来创建更改 URL 的导航命令。这包括 pushUrl、replaceUrl、后退和前进。
我认为在这一点上,我认为我几乎可以从 elm 指南中的以下示例中了解如何使用它,但我很好奇,只是在学术上:
我的项目使用sbt docker:publishor构建得很好sbt docker:publishLocal,但是当我去运行图像时,它失败并显示以下堆栈跟踪:
eleanor@demo-machine:~/workbench/opendar/opendar$ docker run eholley/opendar:1.0-SNAPSHOT
Oops, cannot start the server.
java.nio.file.AccessDeniedException: /opt/docker/RUNNING_PID
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
at java.nio.file.Files.newOutputStream(Files.java:216)
at play.core.server.ProdServerStart$.createPidFile(ProdServerStart.scala:136)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:43)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:25)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
eleanor@demo-machine:~/workbench/opendar/opendar$
Run Code Online (Sandbox Code Playgroud)
该图像在 DockerHub 上的 eholley/opendar:1.0-SNAPSHOT 下是公开的。(在运行命令中,我省略了几个环境变量,因此预期的输出应该是基于 application.conf 的配置失败,而不是上述错误。)
如果你想尝试自己构建和打包,可以克隆https://0x00F3@bitbucket.org/0x00F3/opendar.git。
这个问题与这个问题并不完全不同,所以作为在黑暗中的一个镜头,我尝试添加这个
import com.typesafe.sbt.packager.docker.DockerChmodType
dockerChmodType := DockerChmodType.UserGroupWriteExecute
Run Code Online (Sandbox Code Playgroud)
根据线程中的建议。它似乎没有改变任何东西。
在这里不是寻求意见,但我想知道是否有任何组织发布了命名 JavaScript IndexedDb 对象的标准。我正在努力寻找“unique”和“DOMString”之外的任何内容。
我有两个班级:
Expression 有一个字符串 Name 和一个名为 Literal 的 LiteralModel。
public class ExpressionModel
{
private string name;
public string Name { get => name ?? ""; set => name = value; }
private LiteralModel literal;
public LiteralModel Literal
{
get => literal ?? new LiteralModel();
set => literal = value;
}
}
public class LiteralModel
{
private string value;
public string Value { get => value ?? ""; set => this.value = value; }
}
Run Code Online (Sandbox Code Playgroud)所有都是具有公共 getter …
我正在将此入门项目改编为我自己的博客。我指的是这个 Eleventy 文档 来获取帖子摘录。
我首先编辑我的.eleventy.js以启用灰质摘录,根据上述文档,如下所示:
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginSyntaxHighlight);
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.setFrontMatterParsingOptions({ excerpt: true
});
/* file continues below */
Run Code Online (Sandbox Code Playgroud)
接下来,根据示例,我在一些博客文章的第一段之后添加了“---”。
最后,我更新了/_includes/postslist.njk以包含对每个帖子的摘录的引用,因此我的新文件现在显示为:
<ol reversed class="postlist" style="counter-reset: start-from {{ (postslistCounter or postslist.length) + 1 }}">
{% for post in postslist | reverse %}
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
<a href="{{ post.url | url }}" class="postlist-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url …Run Code Online (Sandbox Code Playgroud) 我不确定这是否会归结为意见问题,但我一直看到代码中的模式,我不明白.
在所有C#应用程序中,我一直看到表达式:
System.Configuration.ConfigurationManager.AppSettings["key"].ToString()
Run Code Online (Sandbox Code Playgroud)
很长一段时间以来,我认为这只是我工作的一个怪癖,但我搜索了它,看起来它不仅仅是一些一次性的事情.人们做了相当多的事情,但据我所知,并没有真正谈到它.
例如,这个博客确保调用.ToString()AppSettings,这个博客也是如此
此外,所有关于此问题的程序员都要确保调用.ToString()AppSettings集合.
为了确保我不会发疯,我在Visual Studio中翻转了该方法,这确保了,是的,AppSettings[key]强类型字符串,并且在调用时"没有执行实际的转换" .ToString().
在我看来,唯一真正的区别是AppSettings[key]和AppSettings[key].ToString()抛出NullReferenceException的可能性.
这样做是否有任何技术原因,或者出于某种原因它是广泛推荐的C#最佳实践,还是仅仅是一个没有实际意义的奇怪怪癖?