小编Ian*_*Ian的帖子

如何隐藏隐式网格行?

下面的代码段使用 CSS Grid 来增加宽容器的列数。对于窄容器(例如取消注释width: 80vw或调整示例大小),它添加了隐式行(grid-template-rows属性中只有 2 个是显式的)。如何仅保留 2 行,使“溢出”2×n 网格的网格项隐藏?

.wrapper {
  border: 2px solid #f76707;
  background-color: #fff4e6;
  display: grid;
  /* width: 80vw; */
  grid-template-columns: repeat(auto-fill, 200px);
  grid-template-rows: repeat(2, 1fr);
}

.wrapper > div {
  border: 2px solid #ffa94d;
  border-radius: 5px;
  background-color: #ffd8a8;
  padding: 1em;
  color: #d9480f;
}
Run Code Online (Sandbox Code Playgroud)
<div class="wrapper">
  <div>One</div>
  <div>Two</div>
  <div>Three</div>
  <div>Four</div>
  <div>Five</div>
</div>
Run Code Online (Sandbox Code Playgroud)

html css css-grid

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

是否从README.md自动链接到GitHub Pages URL?

有没有办法在不对URL进行硬编码的情况下在存储库的README.md(或其他Markdown文件)中创建到存储库GitHub页面的链接?

我面临的用例是派生一个README包含的存储库的结果[a link](https://their-org.github.io/repo/),而我宁愿不必手动将其更新为[a link](https://my-org.github.io/repo/)

github-pages github-flavored-markdown

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

在正半确定矩阵的Cholesky分解中正确使用枢轴

我不明白如何使用cholR中的函数来计算正半正定矩阵.(或者我这样做,并且有一个错误.)文档说明:

如果pivot = TRUE,则可以计算正半正定x的Choleski分解.x的等级作为attr(Q,"rank")返回,受数字误差的影响.枢轴以attr(Q,"pivot")返回.不再是t(Q)%*%Q等于x的情况.但是,设置pivot < - attr(Q,"pivot")和oo < - order(pivot),t(Q [,oo])%*%Q [,oo]等于x ...

以下示例似乎与此描述相符.

> x <- matrix(1, nrow=3, ncol=3)
> Q <- chol(x, pivot=TRUE)
> oo <- order(attr(Q, 'pivot'))
> t(Q[, oo]) %*% Q[, oo]
     [,1] [,2] [,3]
[1,]    1    1    1
[2,]    1    1    1
[3,]    1    1    3
Run Code Online (Sandbox Code Playgroud)

结果不是x.我错误地使用了枢轴吗?

r matrix matrix-decomposition matrix-factorization

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

配置自制程序以使用特定的 clang 版本进行编译

我需要使用 llvm.org 版本的 clang,而不是 Apple 版本的 clang,作为特定 Homebrew 公式的编译器。我安装了 llvm37

brew tap homebrew/versions
brew install llvm37
Run Code Online (Sandbox Code Playgroud)

所以我在 /usr/local/bin 中有 clang-3.7 。但 HOMEBREW_CC 不能设置为该路径:

HOMEBREW_CC=clang-3.7 HOMEBREW_CXX=clang++-3.7 brew install --build-from-source <formula>
Error: Invalid value for HOMEBREW_CC: clang-3.7
Run Code Online (Sandbox Code Playgroud)

有哪些替代方法可以尝试强制 Homebrew 在其构建环境中使用此版本的 clang?

homebrew clang osx-mavericks

5
推荐指数
0
解决办法
986
查看次数

渲染rmarkdown时Rscript和Rs源输出之间的差异

我有一个构建脚本,将多个.Rmd文件编织成.md文件,我从以下调用方法得到不同的结果:

R -e source('bin/build_script.R')
Run Code Online (Sandbox Code Playgroud)

按预期工作,但是

Rscript bin/build_script.R
Run Code Online (Sandbox Code Playgroud)

没有按预期工作.生成的.md文件之间的区别与具有该行的代码块有关as(x, "Spatial").在第一种方法中,x转换,每个人都很高兴.使用Rscript调用会导致代码块返回错误

Error in as(x, "Spatial"): no method or default for coercing "sfc_POINT" to "Spatial"
Run Code Online (Sandbox Code Playgroud)

Rscript和源处理导入库的方式有所不同吗?

这是我的构建脚本:

require(knitr)
require(yaml)
require(stringr)

config = yaml.load_file('docs/_config.yml')
render_markdown(fence_char = '~')
opts_knit$set(
    root.dir = '.',
    base.dir = 'docs/',
    base.url = '{{ site.baseurl }}/')
opts_chunk$set(
    comment = NA,
    fig.path = 'images/',
    block_ial = c('{:.input}', '{:.output}'),
    cache = FALSE,
    cache.path = 'docs/_slides_Rmd/cache/')

current_chunk = knit_hooks$get('chunk')
chunk = function(x, options) {
    x <- current_chunk(x, options)
    if (!is.null(options$title)) …
Run Code Online (Sandbox Code Playgroud)

r knitr

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