我正在使用scala 2.10和gradle 1.11
我的问题是,当我尝试在hadoop集群中运行时,编译后的jar会丢失一个错误.我想在hadoop上运行,因为我使用烫伤.
例外是:
Exception in thread "main" java.io.FileNotFoundException:
/tmp/hadoop-root/hadoop-unjar6538587701808097105/com/twitter/bijec
tion/GeneratedTupleCollectionInjections$$anon$31$$anonfun$invert$10$$anon
fun$apply$46$$anonfun$apply$47$$anonfun$apply$48$$anonfun$apply$49$$anonfu
n$apply$50$$anonfun$apply$51$$anonfun$apply$52$$anonfun$apply$53$$anonfun$app
ly$54$$anonfun$apply$55.class (File name too long)
Run Code Online (Sandbox Code Playgroud)
欢迎任何评论......
使用在运行时计算的值作为匹配模式之一的最佳方法是什么?
我有一个值(byte),我需要匹配其他值.一些值是固定的(b'0'.. b'9').其他在运行时计算(c = some_function()).
我目前的解决方案是使用假变量和if守护(即k if (k == c)),但它对我来说看起来不太好.我尝试使用just,c但它被解释为一个catch-all变量,而不是替换c该上下文中的值.
以下代码段显示了问题:( 同样在自行车上)
fn main() {
fun(b'5', 0);
fun(b'C', 0);
fun(b'C', 2);
}
fn fun(byte: u8, i: uint) {
let CHARS = b"ABCDEFGH";
let c = CHARS[i];
let msg = match byte {
b'0'..b'9' => "numeric",
// c => "same char", // <-- I would had preferred this
k if (k == c) => "same char",
_ => "different char", …Run Code Online (Sandbox Code Playgroud) 我从三个不同的工作站完成我的工作.我希望能够在编码会话中留下工作站,然后在另一个工作站上恢复这项工作.鉴于代码是通过远程git仓库共享的,我想使用git来分享这个未完成的工作.
实际上,未完成的工作意味着
大多数情况下,这些更改都是临时的:并非所有更改和大多数未跟踪文件都将在最终提交中完成.未跟踪文件的一个示例是为了测试目的而复制了20个稍微不同的修改的测试文件; 我只关心所有这些文件,当我正在处理某个问题时,我不想在切换到另一个工作站时浪费时间重新生成它们.
我已经看到了使用分支来推动这些变化的其他问题和解决方案:当我与这个OK,有这些分支每次都会被改写的问题,需要一个git push --force(我不喜欢--force太多),或使他们成为当时非常凌乱.
我想有一个简单的命令或git的别名,让我来存储工作目录的当前状态,而不"搞乱太多"与git的历史.必须有一个简单的伴随命令或git别名,允许我从其他工作站下载这些临时更改.
是否可以rem在Chrome媒体查询中使用单位?
rem单位在Chrome中运行完美,它们似乎在媒体查询中不受支持.这可能吗?或者这个CSS有什么问题吗?
body { background-color: yellow; }
@media only all and (max-width: 40rem) {
body { background-color: red; }
}
@media only all and (min-width: 40rem) and (max-width: 60rem) {
body {background-color: green;}
}
@media only all and (min-width: 60rem) {
body { background-color: blue; }
}
Run Code Online (Sandbox Code Playgroud)
住在http://jsfiddle.net/jsQ2N/2/show/,em在-only版本http://jsfiddle.net/jsQ2N/3/show/.
我试图通过以下方式获取CSS属性"content"的值:
WebElement plusOrMinusSign = currentEntityTypeLevel1.findElement(
By.xpath("i[@class='tree-branch-head']::after"));
System.out.println(plusOrMinusSign.getCssValue("content"));
Run Code Online (Sandbox Code Playgroud)
但是,我收到一个错误: The string 'i[@class='tree-branch-head']::after' is not a valid XPath expression.
似乎" ::after"不被承认.
HTML:
<i class="tree-branch-head" ng-class="iBranchClass()" ng-click="selectNodeHead(node)">::after
</i>
Run Code Online (Sandbox Code Playgroud)
CSS:
i:after {
content: "-";
}
Run Code Online (Sandbox Code Playgroud)
知道如何获得"内容"的价值吗?
我遇到了一个问题,我需要在XML节点的名称中使用hashtag,并且hashtag导致解析错误.我试过编码#没有运气,也许我实现了编码错误.
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<properties#tags pk1="1" pk2="1" />
</dataset>
Run Code Online (Sandbox Code Playgroud) 它甚至可能吗?
从我在Java Tutorial中读到的内容来看,抛出的方法RuntimeException不需要被try/ not catch抛出.我可以写自己的RuntimeException吗?
我正在写一个宝石,我的目标是Ruby,JRuby和Rubinius.我正在使用Travis CI来构建我的库.当我定位Ruby和JRuby时,我的gem正确构建,但是当针对Rubinius时,它不起作用.这是错误:
Run Code Online (Sandbox Code Playgroud)Using worker: worker-linux-2-2.bb.travis-ci.org:travis-linux-13 git.1 $ git clone --depth=50 --branch=master git://github.com/maxgale/actor.git maxgale/actor Cloning into 'maxgale/actor'... remote: Counting objects: 74, done. remote: Compressing objects: 100% (48/48), done. remote: Total 74 (delta 29), reused 64 (delta 22) Receiving objects: 100% (74/74), 12.06 KiB | 0 bytes/s, done. Resolving deltas: 100% (29/29), done. Checking connectivity... done. $ cd maxgale/actor git.3 $ git checkout -qf f83f26d85f69e9c2965a4faa2065dd37ac789c36 $ rvm use rbx --install --binary --fuzzy rbx is not installed - installing. Searching for binary rubies, …
我想Benchmark在下面的代码中看到访问网址所花费的时间.我也试图在没有基准的情况下做同样的事情.也就是说,在测试开始和测试结束时获取时间,减去两个以获得时间.两种方法都以相同的超时错误结束.
require 'open-uri'
require 'benchmark'
response = nil
puts "opening website with benchmark..."
puts Benchmark.measure{
response = open('http://mywebsite.com')
}
puts "Done !"
status = response.status
puts status
Run Code Online (Sandbox Code Playgroud)
错误:
opening website with benchmark...
C:/ruby/lib/ruby/1.8/timeout.rb:64:in `rbuf_fill': execution expired (Timeout::Error)
from C:/ruby/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
from C:/ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
from C:/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline'
from C:/ruby/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
from C:/ruby/lib/ruby/1.8/net/http.rb:2017:in `read_new'
from C:/ruby/lib/ruby/1.8/net/http.rb:1051:in `request'
from C:/ruby/lib/ruby/1.8/open-uri.rb:248:in `open_http'
from C:/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
from C:/ruby/lib/ruby/1.8/open-uri.rb:242:in `open_http'
from C:/ruby/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
from C:/ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from C:/ruby/lib/ruby/1.8/open-uri.rb:162:in `catch'
from C:/ruby/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
from C:/ruby/lib/ruby/1.8/open-uri.rb:132:in …Run Code Online (Sandbox Code Playgroud) 我想解析MaxMind GeoIP2数据库的两个CSV文件,根据列进行一些连接并将结果合并到一个输出文件中.
我使用标准的CSV ruby库,它很慢.我认为它试图将所有文件加载到内存中.
block_file = File.read(block_path)
block_csv = CSV.parse(block_file, :headers => true)
location_file = File.read(location_path)
location_csv = CSV.parse(location_file, :headers => true)
CSV.open(output_path, "wb",
:write_headers=> true,
:headers => ["geoname_id","Y","Z"] ) do |csv|
block_csv.each do |block_row|
puts "#{block_row['geoname_id']}"
location_csv.each do |location_row|
if (block_row['geoname_id'] === location_row['geoname_id'])
puts " match :"
csv << [block_row['geoname_id'],block_row['Y'],block_row['Z']]
break location_row
end
end
end
Run Code Online (Sandbox Code Playgroud)
是否有另一个ruby库支持chuncks中的处理?
block_csv是800MB, location_csv是100MB.