小编bfo*_*ine的帖子

在Java中将字符串转换为带有2个小数位的十进制数

在Java中,我试图将一串格式解析"###.##"为float.该字符串应始终具有2个小数位.

即使字符串中有值123.00,浮子也应该是123.00,不123.0.

这是我到目前为止:

System.out.println("string liters of petrol putting in preferences is " + stringLitersOfPetrol);

Float litersOfPetrol = Float.parseFloat(stringLitersOfPetrol);

DecimalFormat df = new DecimalFormat("0.00");
df.setMaximumFractionDigits(2);

litersOfPetrol = Float.parseFloat(df.format(litersOfPetrol));

System.out.println("liters of petrol before putting in editor: " + litersOfPetrol);
Run Code Online (Sandbox Code Playgroud)

它打印:

string liters of petrol putting in preferences is 010.00 
liters of petrol before putting in editor: 10.0
Run Code Online (Sandbox Code Playgroud)

java string floating-point number-formatting

5
推荐指数
3
解决办法
15万
查看次数

詹金斯包括地区不工作甚至选择使用工作空间强制轮询

  • git 1.5.4
  • 詹金斯1.563
  • git插件2.2.1

我的git项目是这样的:

testproject/code/b2b/admin/...
testproject/code/b2b/app/...
testproject/code/b2c/admin/...
testproject/code/b2c/app/...
Run Code Online (Sandbox Code Playgroud)

在"附加行为"部分中,我使用工作区添加强制轮询.并且还添加轮询忽略某些路径中的提交.

在包含的地区,我写道

code/b2b/admin/.*
code/b2c/admin/.*
Run Code Online (Sandbox Code Playgroud)

在构建触发器部分,我* * * * *在Poll SCM中写道,但无论我在哪里更改了testproject中的代码,它都不会触发.

git

5
推荐指数
1
解决办法
3982
查看次数

找不到“initializer_list”文件

尝试为节点安装 phash-image 但出现此错误:

> phash-image@3.1.0 install /Users/jong/Workspace/mgmtio/phash-image
> node-gyp rebuild

  CXX(target) Release/obj.target/pHash/phash.o
In file included from ../phash.cpp:4:
In file included from /usr/local/Cellar/phash/0.9.6_1/include/pHash.h:50:
/usr/local/include/CImg.h:160:10: fatal error: 'initializer_list' file not found
#include <initializer_list>
         ^
1 error generated.
make: *** [Release/obj.target/pHash/phash.o] Error 1
Run Code Online (Sandbox Code Playgroud)

我该如何解决?我在 os x 10.10.3 上并使用自制软件安装了 phash

c++ homebrew node.js phash

5
推荐指数
1
解决办法
3687
查看次数

在 mac el capan 上将公式降级到以前的版本 (opencv3/3.0.0)

我在 mac 上使用brew安装 opencv3。我有 opencv3/3.0.0 。今天,我更新了它,得到了 3.1.0_1 版本。

但是,此更新破坏了一切,当我尝试使用 VideoCapture 读取帧并使用 waitKey 函数时,它会因以下原因而中断:

2016-02-26 23:25:16.846 tracking[99869:1026824] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[CaptureDelegate doFireTimer:]:无法识别的选择器发送到实例 0x1240a6”

所以,现在我正在尝试切换回以下版本,但我不确定如何切换。我使用了以下内容:

酿造搜索opencv

但是,这不会给我像 opencv3/3.0.0 这样的版本

在地窖里,我只有

可用版本:3.1.0、3.1.0_1

所以,我不能使用

酿造开关“版本”

任何人都可以建议我一种切换回以前版本的方法吗?

macos homebrew opencv video-capture

5
推荐指数
1
解决办法
3142
查看次数

我无法用Homebrew安装zsh

OS X El Capitan版本10.11.2

我尝试过brew update,但会显示此错误消息.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/brew.rb:15:in `<main>'
Run Code Online (Sandbox Code Playgroud)

我也尝试过brew install zsh,但会显示上面的消息.

请让我知道如何修复此错误消息.

homebrew zsh

5
推荐指数
1
解决办法
555
查看次数

Brew 找不到 git,即使 git 在路径中 (Mac/OSX)

安装brew 报告找不到git,并因错误而终止。Brew 似乎已安装(成功?)

> brew

(打印通常的帮助)

...但brew doctor不高兴:

这是我运行brew doctor时得到的结果(以及当我按照Homebrew主页上的说明第一次安装brew时得到的结果。)

> brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may …
Run Code Online (Sandbox Code Playgroud)

git macos homebrew path command-line-interface

5
推荐指数
1
解决办法
5157
查看次数

如何在OSX上安装特定的clang版本?

我需要为Travis CI for OSX使用特定的clang版本3.9。到目前为止,以下方法均无效:

方法1:这没有用,因为它没有特定的版本。另外,它花费大量时间超过Travis CI的10分钟。

brew install llvm
Run Code Online (Sandbox Code Playgroud)

方法2:确实获得了特定版本,但不起作用,因为它花费大量时间超过Travis CI的10分钟。

brew install llvm@3.9
Run Code Online (Sandbox Code Playgroud)

方法3:据说下面安装了二进制文件,因此安装速度更快,但现在已弃用并出错了:

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

我只是在寻找等效的OSX,sudo apt-get install -y clang-3.9 clang++-3.9它很快并且可以在Linux上很好地工作。

macos homebrew clang travis-ci

5
推荐指数
1
解决办法
2010
查看次数

如何在Mac上安装特定版本的cmake?

我尝试安装旧版本的 cmake。我从这里安装 .dmg 文件。

但我无法通过cmake xxx. 我知道我使用命令行安装brew install cmake。但它安装的是最新版本。如何安装特定版本?

macos homebrew cmake

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

Postgresql安装:找不到命令:createdb,psql

我尝试通过brew以下方式安装postgresql :

brew install postgresql@9.5
Run Code Online (Sandbox Code Playgroud)

它没有错误安装,但是控制台命令不安装(例如psql,postgresql)

我应该做一些额外的步骤吗?

postgresql macos homebrew

5
推荐指数
1
解决办法
4966
查看次数

AH00136:服务器必须在接受连接之前放弃启动权限。请确保加载了 mod_unixd 或其他系统安全模块

无法在 macOS Sierra 10.12.6 上启动 httpd Apache/2.4.29 (Unix)。httpd 和 apache 与brew.

/var/log/apache2/error_log我总是看到:

AH00136: Server MUST relinquish startup privileges before accepting connections.  Please ensure mod_unixd or other system security module is loaded.
AH00016: Configuration Failed
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我有什么问题吗?

apache macos homebrew httpd.conf

5
推荐指数
1
解决办法
1705
查看次数