bar

Type definition: expected UnionAll, got TypeVar

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In the Julia manual for v0.6 I find the following: abstract type Pointy{T} end struct Point{T} <: Pointy{T} x::T y::T end This works fine, and I thought the following should as well: abstract type Foo{V, F} end struct Bar{V, F} <: Foo{V, F} x::V{F} end The definition of Bar gives, however, the following error ERROR: TypeError: Type{...} expression: expected UnionAll, got TypeVar What is wrong, and how can I achieve what I really want, namely to specify that V<:AbstractVector and F<:AbstractFloat ? 回答1: Try this: julia> abstract type Foo{T}

Moq Equals Only Works With IEquatable

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the Moq framework for unit tests, and I came across this interesting problem. public interface Bar : IEquatable<Bar> { } [TestClass] public class TestClass { Mock<Bar> a; Mock<Bar> b; public TestClass() { a = new Mock<Bar>(); b = new Mock<Bar>(); a.Setup(bar => bar.Equals(b.Object)).Returns(true); } [TestMethod] public void AssertEqualsTest() { Assert.AreEqual(a.Object, b.Object); //fails } [TestMethod] public void AssertIsTrueTest() { Assert.IsTrue(a.Object.Equals(b.Object)); //passes } } First Issue So Assert.AreEqual just fails.

Clojure: Inconsistent results using assoc-in

匿名 (未验证) 提交于 2019-12-03 00:58:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can someone explain what's the reasoning behind the following results using (assoc-in) ? (assoc-in {:foo {:bar {:baz "hello"}}} [:foo :bar] "world") => {:foo {:bar "world"}} (assoc-in {:foo {:bar nil}} [:foo :bar :baz] "world") => {:foo {:bar {:baz "world"}}} (assoc-in {:foo {:bar "hello"}} [:foo :bar :baz] "world") => ClassCastException java.lang.String cannot be cast to clojure.lang.Associative clojure.lang.RT.assoc (RT.java:702) Apparently I can replace a map and even nil with another data type (e.g. String) but I can not replace a data

How to create circular progress bar(pie chart) like indicator - Android

匿名 (未验证) 提交于 2019-12-03 00:58:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Now I have a horizontal progress bar which is updated programmatically via ProgressBar setProgress method: Is there a way to convert this progress bar to a circle (pie chart) and to be able also to update the progress programmatically? Example of what I want: 回答1: You can either make a custom view (e.g. PieProgressView ) or a custom Drawable (e.g. PieProgressDrawable ). I took the custom view approach but either is perfectly viable. A quick look at the source for Android's ProgressView yields a wildly complex implementation. Obviously, they

D3 Grouped Bar Chart - Selecting entire group?

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a grouped bar chart similar to https://bl.ocks.org/mbostock/3887051 I used a mouseover function to fade the bars the mouse is currently not over function mouseover(bar) { d3.selectAll(".bar") .filter(function(d){ return (d != bar);}) .transition(t) .style("opacity", 0.5); } While this works nicely to highlight a single bar, I now need to highlight the entire group / fade everything but this group. So far I haven't been able to figure out though how to get from the datum element d passed via .on("mouseover", function(d) ... back to the

How do I create a Dynamic Sql Query at runtime using JDBI&#039;s Sql Object API?

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been moving an existing project from jdbc to jdbi, and I've been making much use out of jdbi's beautiful SQL Object API. We're using mysql. While the SQL Object API can construct handled queries that are known at compile time, I couldn't find a way of generating queries at run time. Specifically, I want to be able to do something like this: @SqlUpdate( "UPDATE record SET "+ @IfNotZero("foo") "foo=:foo" + @IfNotNull("bar") "bar=:bar" + @IfNotNull("baz") "baz=:baz" + "WHERE id=:id" ) public abstract int updateRecord( @Bind("id") int id,

Pandas count null values in a groupby function

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: df = pd . DataFrame ({ 'A' : [ 'foo' , 'bar' , 'foo' , 'bar' , 'foo' , 'bar' , 'foo' , 'foo' ], 'B' : [ 'one' , 'one' , 'two' , 'three' , 'two' , 'two' , 'one' , 'three' ], 'C' : [ np . nan , 'bla2' , np . nan , 'bla3' , np . nan , np . nan , np . nan , np . nan ]}) Output: A B C 0 foo one NaN 1 bar one bla2 2 foo two NaN 3 bar three bla3 4 foo two NaN 5 bar two NaN 6 foo one NaN 7 foo three NaN I would like to use groupby in order to count the number of NaN's for the different combinations of foo. Expected Output (EDIT): A B C D 0 foo one

Pandas count null values in a groupby function

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: df = pd . DataFrame ({ 'A' : [ 'foo' , 'bar' , 'foo' , 'bar' , 'foo' , 'bar' , 'foo' , 'foo' ], 'B' : [ 'one' , 'one' , 'two' , 'three' , 'two' , 'two' , 'one' , 'three' ], 'C' : [ np . nan , 'bla2' , np . nan , 'bla3' , np . nan , np . nan , np . nan , np . nan ]}) Output: A B C 0 foo one NaN 1 bar one bla2 2 foo two NaN 3 bar three bla3 4 foo two NaN 5 bar two NaN 6 foo one NaN 7 foo three NaN I would like to use groupby in order to count the number of NaN's for the different combinations of foo. Expected Output (EDIT): A B C D 0 foo one

Page refresh from address bar with #hash

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Situation: url: http://mydomain.com/test.html#somehash test script: $ ( document ). ready ( function () { console . log ( "page initiated" ); if ( window . location . hash ) { console . log ( "hash changed (if-statement)" ); } $ ( window ). on ( "hashchange" , function () { console . log ( "hash changed (on statement)" ); }); }); The script can also be found on fiddle , but the environment is not suitable to display the behavior. The problem I get is when I click on the browser addressbar and hit enter without any changes. When the

Automatic vertical scroll bar in WPF TextBlock?

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a TextBlock in WPF. I write many lines to it, far exceeding its vertical height. I expected a vertical scroll bar to appear automatically when that happens, but it didn't. I tried to look for a scroll bar property in the Properties pane, but could not find one. How can I make vertical scroll bar created automatically for my TextBlock once its contents exceed its height? Clarification: I would rather do it from the designer and not by directly writing to the XAML. 回答1: Wrap it in a scroll viewer: NOTE this answer applies to a