小编jub*_*0bs的帖子

尝试打印Unicode字符时出现运行时异常

Char是Haskell中Unicode字符的类型,String简单来说[Char](即Char项目列表).这是一些简单的代码:

main = putStrLn "©" -- Unicode string
Run Code Online (Sandbox Code Playgroud)

这段代码编译得很好,但是当我在PowerShel.execmd.exe中运行它时,我得到了运行时异常:

app.exe :: commitBuffer:无效参数(无效字符)

为什么会这样?奇怪的是,当我在C#中做同样的事情时,我也不例外:

Console.WriteLine("©");
Run Code Online (Sandbox Code Playgroud)

在.NET中,字符也是Unicode.相反,PowerShellcmd打印,但至少我不会例外.如何让Haskell可执行文件顺利运行?c©

haskell ghc

17
推荐指数
2
解决办法
1463
查看次数

如何在IntelliJ IDEA中禁用行分隔符中的diff?

我在Windows上使用Intellij IDEA 14,在Unix服务器上使用Git作为VCS.Windows中的行分隔符是Unix中的CLRF(\r\n)和LF(\n).在Git中,我正在使用config --global core.autocrlf input.这将在提交时将所有CRLF转换为LF.

当我在格式良好的文件上使用"重新格式化代码"选项时,IDEA会将文件标记为已更改,并仅在行分隔符中显示diff.

更改文件上的鼠标右键 - > Git  - >与最新存储库版本进行比较

如何在IDEA中禁用它?

java git diff intellij-idea

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

Exo播放器DASH Streaming示例

我正在尝试使用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.

谢谢

video android media-player exoplayer

16
推荐指数
2
解决办法
2万
查看次数

如何检查两个分支是否"均匀"?

GitHub Web界面有一个很好的功能,告诉我一个分支是否与master分支.

是否有与此功能等效的命令行?我使用多个存储库,我正在寻找快速查看分支是否均匀或需要注意的方法.

以下是GitHub Web界面的屏幕截图,对于那些对此功能感到疑惑的人:

在此输入图像描述

在此输入图像描述

git github git-branch

16
推荐指数
2
解决办法
6288
查看次数

Scala中的Loaner模式

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模式的"反模式",以便我知道如何避免它?

scala

15
推荐指数
2
解决办法
9351
查看次数

如何将数组转换为元组?

我只想将数组转换为Swift中的元组; 类似以下内容:

>>> myArray = [1,2,3,4,5]
>>> mytuple = tuple(myArray)
>>> mytuple
(1, 2, 3, 4, 5)
Run Code Online (Sandbox Code Playgroud)

最简单的方法是什么?

(我今天才开始学习Swift,所以我非常非常新).

arrays tuples type-conversion swift

15
推荐指数
2
解决办法
8065
查看次数

git-reset的--merge和--keep标志的典型用例是什么?

最近的回答中,他详细介绍的典型应用案例git-reset的三个最常用的选项(--hard,--mixed,和--soft),托雷克顺便提到的是git-reset还提供了两个比较深奥的标志,被称为--merge--keep.该git-reset手册页描述了如下的两个标志:

--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 …
Run Code Online (Sandbox Code Playgroud)

git git-reset

15
推荐指数
1
解决办法
970
查看次数

Git不会添加修改过的文件

不知道为什么会这样:

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 git-add

15
推荐指数
4
解决办法
2万
查看次数

如何在Git中将提交的文件标记为只读?

我有一个文件,检入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

15
推荐指数
2
解决办法
1万
查看次数

如何快速向下滚动git命令的输出?

我必须使用我的提交git show c36432.文件非常大,有时需要很长时间才能逐行进行.

我可以做些什么来快速移动,例如逐页?我iterm在Mac OS X上用作终端.

git macos version-control iterm

14
推荐指数
1
解决办法
2321
查看次数