我知道在Lisp中列表必须以nil结尾,但表达式如此
(print (cons 1 (cons 3 2)))
Run Code Online (Sandbox Code Playgroud)
不会抛出任何错误.它打印:
(1 3 . 2)
Run Code Online (Sandbox Code Playgroud)
这是对的吗?
我正在使用GNU Clisp.
我需要一些我可以从标准集合或使用番石榴构建的数据结构.所以它应该是可变的Map<Enum, V>.哪里V是非常有趣的结构.
V 要求:
a和b,即a.equals(b) == true) -可选额外的可选要求来映射
现在它 HashMap<SomeEnum, LinkedList<Entity>>与collections.sort()代码中的不同东西一样.
谢谢.
我尝试使用ClientLogin进行身份验证
URL url = new URL("https://www.google.com/accounts/ClientLogin");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Email", "testonly%2Ein%2E2011%40gmail%2Ecom");
connection.setRequestProperty("Passwd", "mypass");
connection.setRequestProperty("accountType", "HOSTED");
connection.setRequestProperty("service", "apps");
connection.connect();
Run Code Online (Sandbox Code Playgroud)
但我明白了Error=BadAuthentication.我该如何纠正我的代码?
java authentication google-app-engine google-api google-authentication
当我运行我的Scala hello world应用程序时,就像
package pack
object App {
def main(args: Array[String]) {
println("Hello, world!")
}
Run Code Online (Sandbox Code Playgroud)
在Idea 10.0.3上,我遇到了编译错误
"应用"到D:\ prog\java2\scala3\out\production\scala3\pack\App.class(文件名,目录名或卷标语法不正确)
'app'到D:\ prog\java2\scala3\out\production\scala3\pack\App $ .class(文件名,目录名或卷标语法不正确)
我怎么处理它?
我JFrame用GridBagLayout.用户可以调整此窗口的大小.此外,他还可以执行一些更改窗口大小的编辑操作.我pack(); repaint();在这样的行动之后立即使用.但是,实际上我不应该在这样的操作之后使窗口更小 - 只是更大.我发现的解决方案是
Dimension oldSize = getSize();
pack();
Dimension newSize = window.getSize();
setSize(
(int) Math.max(newSize.getWidth(), oldSize.getWidth()),
(int) Math.max(newSize.getHeight(), oldSize.getHeight()));
repaint();
Run Code Online (Sandbox Code Playgroud)
但我根本不喜欢这个解决方案.除了丑陋的代码,我们设置两次大小(一次一包而不是直接).还有其他解决方案吗?
我想测试一些方法会在失败时被召回.调用在单独的线程中执行.所以我写这样的代码
final Foo mock = createStrictMock(Foo.class);
mock.bar();
expectLastCall().andThrow(new RuntimeException("TEST EXCEPTION"));
mock.bar();
replay(mock);
doStuff();
sleepSomeTime(); //Pretty dirty. But I need to test it in multithreading.
verify(mock);
Run Code Online (Sandbox Code Playgroud)
并且测试通过.但我还没有实现召回.
为了使测试失败,我更换了
mock.bar();
expectLastCall().andThrow(new RuntimeException("TEST EXCEPTION"));
Run Code Online (Sandbox Code Playgroud)
同
mock.bar();
expectLastCall().andAnswer(new IAnswer<Void>() {
@Override
public Void answer() throws Throwable {
sleepSomeTime();
throw new RuntimeException("TEST EXCEPTION");
}
});
Run Code Online (Sandbox Code Playgroud)
但我不喜欢在我的测试中添加sleepSomeTime.除此之外,我实际上并不理解,虽然它在这种特殊情况下有所帮助.所以,
添加延迟为何有帮助?
这样做的正确方法是什么?
我有一些第三方库Foo和类FooBar.我认为FooBar类的设计很糟糕.我想将自己的MyBar编写为适配器模式.我可以将原始FooBar标记为@Deprecated不修改其代码吗?
所以,我需要API的功能
interface BiFunction<A, B> {
B aToB(A input);
A bToA(B input);
}
Run Code Online (Sandbox Code Playgroud)
Guava是否提供了这样的smt.如果不是,你建议使用aToB/ bToA方法的名字?
在我的xml配置文件中,我可以写
<context:component-scan base-package="com.my.stuff"/>
Run Code Online (Sandbox Code Playgroud)
现在我继续进行基于java的配置.@Configuration如果没有ApplicationContext那里我怎么能在我的班级里做到这一点?
有没有办法将道具传递给通用子组件(不是您预先知道的组件)?
一些能够Wrapper传递foo给孩子们的东西。
var Wrapper = React.createClass({
render: function () {
return <div>
{this.props.children foo={2}}
</div>
}
});
var App = React.createClass({
render: function () {
return (
<Wrapper>
{this.props.foo}
</Wrapper>
)
}
});
Run Code Online (Sandbox Code Playgroud)
java ×7
guava ×2
collections ×1
deprecated ×1
easymock ×1
google-api ×1
javascript ×1
lisp ×1
list ×1
map ×1
null ×1
pack ×1
reactjs ×1
refactoring ×1
scala ×1
spring ×1
swing ×1
testing ×1