Char
是Haskell中Unicode字符的类型,String
简单来说[Char]
(即Char
项目列表).这是一些简单的代码:
main = putStrLn "©" -- Unicode string
Run Code Online (Sandbox Code Playgroud)
这段代码编译得很好,但是当我在PowerShel.exe或cmd.exe中运行它时,我得到了运行时异常:
app.exe :: commitBuffer:无效参数(无效字符)
为什么会这样?奇怪的是,当我在C#中做同样的事情时,我也不例外:
Console.WriteLine("©");
Run Code Online (Sandbox Code Playgroud)
在.NET中,字符也是Unicode.相反,PowerShell或cmd打印,但至少我不会例外.如何让Haskell可执行文件顺利运行?c
©
我在Windows上使用Intellij IDEA 14,在Unix服务器上使用Git作为VCS.Windows中的行分隔符是Unix中的CLRF(\r\n
)和LF(\n
).在Git中,我正在使用config --global core.autocrlf input
.这将在提交时将所有CRLF转换为LF.
当我在格式良好的文件上使用"重新格式化代码"选项时,IDEA会将文件标记为已更改,并仅在行分隔符中显示diff.
如何在IDEA中禁用它?
我正在尝试使用Google 的ExoPlayer在Android设备上播放DASH视频(http://developer.android.com/guide/topics/media/exoplayer.html).文档非常非常差,我找不到一些最简单的DASH工作示例(如果有人这样做).在视频(https://www.youtube.com/watch?v=6VjF638VObA#t=462)中,它看起来很简单,但实际上有很多未知对象.我想只使用ExoPlayer库而不使用他们的github演示,因为它非常复杂,我找不到添加测试URL的方法,因为所有样本都来自YouTube.
谢谢
GitHub Web界面有一个很好的功能,告诉我一个分支是否与master
分支.
是否有与此功能等效的命令行?我使用多个存储库,我正在寻找快速查看分支是否均匀或需要注意的方法.
以下是GitHub Web界面的屏幕截图,对于那些对此功能感到疑惑的人:
Scala in Depth演示了Loaner模式:
def readFile[T](f: File)(handler: FileInputStream => T): T = {
val resource = new java.io.FileInputStream(f)
try {
handler(resource)
} finally {
resource.close()
}
}
Run Code Online (Sandbox Code Playgroud)
用法示例:
readFile(new java.io.File("test.txt")) { input =>
println(input.readByte)
}
Run Code Online (Sandbox Code Playgroud)
此代码看似简单明了.什么是Scala中Loaner模式的"反模式",以便我知道如何避免它?
我只想将数组转换为Swift中的元组; 类似以下内容:
>>> myArray = [1,2,3,4,5]
>>> mytuple = tuple(myArray)
>>> mytuple
(1, 2, 3, 4, 5)
Run Code Online (Sandbox Code Playgroud)
最简单的方法是什么?
(我今天才开始学习Swift,所以我非常非常新).
在最近的回答中,他详细介绍的典型应用案例git-reset
的三个最常用的选项(--hard
,--mixed
,和--soft
),托雷克顺便提到的是git-reset
还提供了两个比较深奥的标志,被称为--merge
和--keep
.该git-reset
手册页描述了如下的两个标志:
Run Code Online (Sandbox Code Playgroud)--merge Resets the index and updates the files in the working tree that are different between <commit> and HEAD, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). If a file that is different between <commit> and the index has unstaged changes, reset is aborted. In …
不知道为什么会这样:
git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: file (modified content)
no changes added to commit (use "git add" and/or "git commit -a")
starkers@ubuntu:~/Documents/currentWork/protection_demo$ git add --all
starkers@ubuntu:~/Documents/currentWork/protection_demo$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what …
Run Code Online (Sandbox Code Playgroud) 我有一个文件,检入Git.该文件需要持有API密钥,但出于安全原因,我不希望将API密钥提交给Git.我解释了如何为每个开发人员生成API密钥而不是API密钥.
我不希望任何开发人员意外提交他们的API密钥并覆盖基本文件.
我有:
.gitignore
文件中,但是,由于它已经提交,因此不执行任何操作.git update-index --assume-unchanged myFile.js
但是,我刚搬到我的笔记本电脑,忘了运行命令,并意外地将一把钥匙交给了回购.我正在寻找一种更加自动防故障的方法.本质上,我想将该文件的初始版本提交给GitHub,然后禁止修改该文件.
这可能吗?
作为参考,该文件看起来像:
define(function () {
// The Simple API Access API key is used here.
// Please note that I've specifically omitted this key from GitHub for security.
// Feel free to generate your own in order to use YouTube's API: https://code.google.com/apis/console/
// A valid key will look something like:
// Key for browser apps (with referers)
// API key: -------------------------------
// Referers: Any referer allowed
// …
Run Code Online (Sandbox Code Playgroud) 我必须使用我的提交git show c36432
.文件非常大,有时需要很长时间才能逐行进行.
我可以做些什么来快速移动,例如逐页?我iterm
在Mac OS X上用作终端.