我想将YAML前端问题用作通用数据管理器的元数据持有者,例如:
---
layout: "user"
title: "Mario Brega"
slug: "mario-brega"
skills:
- fire
- water
- leaf
---
# Here I will be using Markdown
yes I will, _I swear_
Run Code Online (Sandbox Code Playgroud)
它被许多静态生成器用作:
问题:那有标准吗?我可以轻松验证的一些工具,例如,同意所有字符串值应该用引号括起来,booleans不应该,等等.
将YAML前端映射到JSON模式将是一个很大的优势.
我有一个生成以下异常的代码:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at edu.createArrays(ExhaustivePCFGParser.java:2188)
at edu.considerCreatingArrays(ExhaustivePCFGParser.java:2158)
at edu.ExhaustivePCFGParser.parse(ExhaustivePCFGParser.java:339)
at edu.LexicalizedParserQuery.parse(LexicalizedParserQuery.java:247)
at edu.LexicalizedParser.apply(LexicalizedParser.java:283)
at current.Gen.textParsen(Gen.java:162)
at current.Gen.gen(Gen.java:90)
at current.Foo.main(Foo.java:120)
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下代码捕获它:
try {
// this is the line which cause the exception
LinkedList<Foo> erg = Gen.gen(rev);
} catch (Exception e) {
System.out.println("exception: out of memory");
}
Run Code Online (Sandbox Code Playgroud)
但是当我运行代码时,异常没有被捕获.怎么解决这个?
我写了一个小命令行脚本来处理文档[带有lilypond乐谱插入的降价文件,只是为了完整性].
#!/usr/bin/env php
<?php
$body = "";
...
// text gets processed here and stored in $body
...
ob_start();
include 'template.php';
file_put_contents(
__DIR__ . '/' . str_replace('.md', '.html', $argv[1]),
ob_get_flush()
);
Run Code Online (Sandbox Code Playgroud)
的template.php
<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
<body>
<div id="wrapper">
<?php echo Markdown($body); ?>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我打电话的时候:
$ ./phlily source.md
Run Code Online (Sandbox Code Playgroud)
文件生成正确,但模板内容也打印到控制台:
GNU LilyPond 2.14.2
Processing `/Users/.../phlily/ly/4add05a74d249f34b3875ef6c3c1d79763927960.ly'
Parsing...
Converting to PNG...
<!DOCTYPE html>
<html lang="en">
<head>
...
</html>
Run Code Online (Sandbox Code Playgroud)
这很烦人,因为我想从LilyPond脚本中读取错误和警告,将它们隐藏在终端的html墙后面.
简而言之,是否可以在CLI环境中关闭输出缓冲区?
<?php
function sum($y) {
$y = $y + 5;
}
$x = 5;
sum($x);
echo $x;
?>
Run Code Online (Sandbox Code Playgroud)
所以我有这个代码.问题是:它输出了什么?答案:5.如何输出10?答案:总和(&$ x).
问题是我不明白为什么第一个问题的答案是5.当你得到总和($ x)时,它不应该用$ x替换函数,所以$ x = 5 + 5 = 10?为什么答案是5?我真的不明白.有人解释了与指针和地址相关的东西,但我不明白.我从来没有理解指针的概念,我用谷歌搜索它,显然在PHP中没有指针,所以我非常困惑.我的朋友说变量是由一个值和该值的内存地址组成的.有人可以解释我,就像我5岁,为什么答案是5而不是10?请
<?php print("a")."b".print("?"); ?>
Run Code Online (Sandbox Code Playgroud)
结果:сab1
为什么php在这段代码中打印"b1"
我没有在附近完成,但当我尝试npm开始这个项目我得到错误:
Unexpected token, expected ;
2 |
3 |
> 4 | const App = fucntion() {
| ^
5 | return <div>HI!</div>;
6 | }
7 |
Run Code Online (Sandbox Code Playgroud)
这是index.js的完整文件:
import React from 'react';
const App = fucntion() {
return <div>HI!</div>;
}
//shove into dom (page)
React.render(App);
Run Code Online (Sandbox Code Playgroud) php ×3
java ×1
javascript ×1
node.js ×1
react-redux ×1
reactjs ×1
redux ×1
reference ×1
yaml ×1