我的html看起来像这样:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<!--[if lte IE 8]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header>
<h1>Some title thing, who knows</h1>
<nav>
<ul>
<li><a href="one/">One</a></li>
<li><a href="two/">Two</a></li>
<li><a href="three/">Three</a></li>
</ul>
</nav>
</header>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如果我给出header自动边距和宽度,则它是水平居中的.确保它垂直居中的最不可怕的方法是什么?
我知道以下文章提供了一些关于该主题的讨论:
读者注意:请耐心等待.我保证会有一个问题.
我有一个问题需要解决并自己思考"哦,我会用Ruby做的."
$ bundle gem problemsolver
create problemsolver/Gemfile
create problemsolver/Rakefile
create problemsolver/.gitignore
create problemsolver/problemsolver.gemspec
create problemsolver/lib/problemsolver.rb
create problemsolver/lib/problemsolver/version.rb
Initializating git repo in /tmp/harang/problemsolver
Run Code Online (Sandbox Code Playgroud)
删除s.add_development_dependency "rspec"in中的注释problemsolver/problemsolver.gemspec然后
$ bundle exec rspec --init
The --configure option no longer needs any arguments, so true was ignored.
create spec/spec_helper.rb
create .rspec
Run Code Online (Sandbox Code Playgroud)
新的测试进入spec/并且必须在最终的文件中_spec.rb.例如,spec/version_spec.rb
describe 'Problemsolver' do
it 'should be at version 0.0.1' do
Problemsolver::VERSION.should == '0.0.1'
end
end
Run Code Online (Sandbox Code Playgroud)
要运行规范 - 忽略像守卫这样的代码更改运行者 - 这是微不足道的:
$ …Run Code Online (Sandbox Code Playgroud) 我有一个GitHub存储库,我想通过post-receive钩子通知Jenkins新的提交.我已经将GitHub插件安装到Jenkins中,并允许Jenkins管理它自己的钩子URL.该项目具有正确的git存储库URL,并被指示"在将更改推送到GitHub时构建".当我有GitHub发送测试有效负载时,我在前面的Jenkins的nginx网络服务器中找到了这个:
207.97.227.233 - - [15/Sep/2011:07:36:51 +0000] "POST /github-webhook/ HTTP/1.1" 403 561 "-" "-"
Run Code Online (Sandbox Code Playgroud)
我正在运行SSL,所以我禁用它无效.我是否需要在权限矩阵中为匿名用户提供特殊权限?
请原谅缺少配置文件:我很乐意分享可能存在的内容,但我不知道分享可能有用的内容.
假设我有类定义,如下所示:
class Foo
def init(val)
@val = val
end
def self.bar
:bar
end
def val
@val
end
end
Run Code Online (Sandbox Code Playgroud)
有一个规格:
describe Foo
it { should respond_to(:val) }
it { should respond_to(:bar) }
end
Run Code Online (Sandbox Code Playgroud)
第二个it断言失败了.从RSpec的文档中我不清楚respond_to应该在类方法上失败.
我需要为软件项目Debianize一些静态资源,但是对可用信息感到困惑,并且可以使用一些指导.以下是我一直在阅读的资料:
在Debian新维护者指南似乎是最中肯的,特别是这章,但它的说教演示是不是有效的我; 它更像是一个重新学习的参考而不是一个未知的指南.我发现的大部分信息同样适用于将包裹包含在我不需要的公共存储库中.为了让一些善良的人可以向我展示方式,我创建了一个小项目statrec,它举例说明了我需要创建的包类型.它的源代码树看起来像这样:
statrec/
??? LICENSE
??? README.md
??? share
? ??? gilgamesh.txt
? ??? thoreau.txt
??? VERSION
Run Code Online (Sandbox Code Playgroud)
我需要,但无法推断如何:
statrec/share到/usr/share/statrec/VERSION/,/usr/share/statrec/current/到/usr/share/statrec/VERSION/,然后我理解如何完成其中的一些,可能使用哪些工具,但感觉过多的信息过度平行.
在我的Khatami项目中,我使用maven来管理编译并将结果打包成一个可运行的工件:顶层的可执行shell脚本,bin/包含可执行jar及其依赖的jar.请看看我的意思在这里.
作为参考,这是Khatami的重要部分pom.xml:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>${project.groupId}.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<dependencySets>
<dependencySet>
<outputDirectory>bin</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/assembly</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>khatami</include>
</includes>
<fileMode>744</fileMode>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
</fileSet>
</fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
和编译尝试:
$ mvn clean compile assembly:single
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building khatami 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ khatami ---
[INFO] …Run Code Online (Sandbox Code Playgroud) 我有一个包含许多小组织文件的组织模式项目,我想将其导出为HTML.我没有设置#+TITLE很多文件,因为他们没有合适的标题.我在导出时发现部分第一句被导出为文档的标题.
例如,组织文件如下:
This is a short file.
Mary had a little lamb, etc.
Run Code Online (Sandbox Code Playgroud)
将导出为具有以下HTML:
*snip*
<div id="content">
<h1 class="title">This is a short file.</h1>
<p>Mary had a little lamb, etc.</p>
*snip*
Run Code Online (Sandbox Code Playgroud)
我希望看到上面文件中的两个句子都标记为段落.如何禁用标题的自动占卜?
我有兴趣在角色流中偷看.根据我的理解,Peekable将是最佳选择.我不能很弄清楚如何使用它.
第一次尝试:
fn trawl<I, E>(pk: &mut I) where I: std::iter::Peekable<Result<char, E>> {
loop {
let cur = pk.next();
let nxt = pk.peek();
match (cur, nxt) {
(Some(i), Some(nxt_i)) => println!("{} {}", i.ok(), nxt_i.ok()),
_ => (),
}
}
}
fn main() {
trawl(&mut std::io::stdio::stdin().chars());
}
Run Code Online (Sandbox Code Playgroud)
这无法编译
> rustc /tmp/main.rs
/tmp/main.rs:1:37: 1:73 error: `std::iter::Peekable` is not a trait
/tmp/main.rs:1 fn trawl<I, E>(pk: &mut I) where I: std::iter::Peekable<Result<char, E>> {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Run Code Online (Sandbox Code Playgroud)
好的,公平的.我还没有完全理解特征所以我尝试传递一个迭代器,然后创建一个可窥探的版本: …
假设我们有这些表格:
CREATE TABLE A (
id SERIAL NOT NULL PRIMARY KEY
);
CREATE TABLE B (
id SERIAL NOT NULL PRIMARY KEY
);
CREATE TABLE Parent (
id SERIAL NOT NULL PRIMARY KEY,
aId INTEGER NOT NULL REFERENCES A (id),
bId INTEGER NOT NULL REFERENCES B (id),
UNIQUE(aId, bId)
);
CREATE TABLE Child (
parentId INTEGER NOT NULL REFERENCES Parent (id),
createdOn TIMESTAMP NOT NULL
);
是否可以创建一个唯一约束,Child使得对于Child最多一个引用中的所有行,Parent具有某个值aId?换句话说,我可以创建一个唯一约束,以便上表的连接没有重复aId吗?我在想 - 我能找到的每个数据库的语法似乎都与每个约束的一个表相关联 - …
sql postgresql relational-algebra normalization denormalization
我开始学习亚历克斯并相信我已经达到了有状态的环境会有所帮助,但我不完全确定如何去做.我试图lex有限的erlang二进制子集.使用以下词法分析器:
{
module Main (main, Token(..), AlexPosn(..), alexScanTokens, token_posn) where
}
%wrapper "posn"
$digit = 0-9 -- digits
$alpha = [a-zA-Z] -- alphabetic characters
$dbl_quote = \"
tokens :-
$white+ ;
"," { tok (\p s -> Comma p) }
"<<" { tok (\p s -> BinaryOpen p) }
">>" { tok (\p s -> BinaryClose p) }
$dbl_quote [^$dbl_quote]* $dbl_quote { tok (\p s -> ErlStr p (init (tail s))) }
$digit+ { tok (\p …Run Code Online (Sandbox Code Playgroud)