小编Sur*_*rya的帖子

有人可以用简单的术语解释"超文本作为应用程序状态的引擎"

这似乎是我最难以绕过头脑的REST主要内容.据我所知,在设计一个rest api时,大部分工作都应该用于设计/描述应用程序的超文本.指向这个主体的真实世界应用的指针?原子协议如何应用此主体?有人可以用简单的方式解释如何将其应用于假设的购物车休息api.

rest

7
推荐指数
2
解决办法
1535
查看次数

Jquery喜欢Haskell中的选择器

我在Haskell中做一些服务器端html处理.想知道是否有相当于jquery类型的选择器引擎实现haskell在那里,我可以使用.谷歌不会产生任何结果.

jquery haskell

7
推荐指数
1
解决办法
1336
查看次数

RAILS:"会话包含其类定义不可用的对象."

Session contains objects whose class definition isn\'t available.
Remember to require the classes for all objects kept in the session
Run Code Online (Sandbox Code Playgroud)

我正在尝试将http://github.com/binarylogic/authlogic集成 到我的rails应用程序中进行身份验证.我完成了文档中提到的所有步骤.现在,当我点击控制器时,我似乎得到了这个错误.看起来我错过了一些明显的东西.

堆栈跟踪

/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/abstract_store.rb:77:in `stale_session_check!'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/abstract_store.rb:61:in `load!'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/abstract_store.rb:28:in `[]'
/Library/Ruby/Gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/session.rb:48:in `session_credentials'
/Library/Ruby/Gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/session.rb:33:in `persist_by_session'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in `run'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `send'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `run'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
/Library/Ruby/Gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/callbacks.rb:79:in `persist'
/Library/Ruby/Gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/persistence.rb:55:in `persisting?'
/Library/Ruby/Gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/persistence.rb:39:in `find'
/Users/suryagaddipati/myprojects/groceryplanner/app/controllers/application_controller.rb:12:in `current_user_session'
/Users/suryagaddipati/myprojects/groceryplanner/app/controllers/application_controller.rb:17:in `current_user'
/Users/suryagaddipati/myprojects/groceryplanner/app/controllers/application_controller.rb:30:in `require_no_user'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:225:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:629:in `run_before_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:615:in `call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in …
Run Code Online (Sandbox Code Playgroud)

session ruby-on-rails

7
推荐指数
2
解决办法
3992
查看次数

Mockito在测试方法之外存根

我在测试方法之外有以下方法

private DynamicBuild getSkippedBuild() {
    DynamicBuild build = mock(DynamicBuild.class);
    when(build.isSkipped()).thenReturn(true);
    return build;
}
Run Code Online (Sandbox Code Playgroud)

但是当我调用这个方法时,我得到以下错误

org.mockito.exceptions.misusing.UnfinishedStubbingException: 
Unfinished stubbing detected here:
-> at LINE BEING CALLED FROM

E.g. thenReturn() may be missing.
Examples of correct stubbing:
    when(mock.isOk()).thenReturn(true);
    when(mock.isOk()).thenThrow(exception);
    doThrow(exception).when(mock).someVoidMethod();
Hints:
 1. missing thenReturn()
 2. you are trying to stub a final method, you naughty developer!
Run Code Online (Sandbox Code Playgroud)

当你在测试方法之外存在时,看起来mockito不高兴.这不受支持吗?

编辑:我可以通过在@Test方法中进行存根来实现这一点,但我想在@Tests中重用存根.

java mockito

7
推荐指数
1
解决办法
6512
查看次数

不要在xcode目标属性中看到代码签名权利

我正在尝试为我的应用程序构建一个adhoc构建,我遵循苹果文档中的说明

选择目标并打开构建设置检查器.在"代码签名权利"构建设置中,键入包含扩展名的新Entitlements.plist文件的文件名.除非您将Entitlements.plist文件放在项目顶层以外的其他位置,否则无需指定路径.

但我没看到那一节,我错过了什么?替代文字

iphone xcode code-signing

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

struts 2文本标签用动态表达,怎么样?

我需要动态地从动作提供密钥到文本标记

<s:text name="<%=talkToUsInfo.messageKey%>" />  
Run Code Online (Sandbox Code Playgroud)

但是text标签上的name属性被声明为false(不知道为什么?)

如何在不更改jar文件中的tld的情况下获得此类工作?

struts2

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

clojure pmap/preduce vs fork-join

看起来clojure 将有一个fork-join实现,它看起来像是java的fork join框架的功能包装器.

我想知道这些和pmap/preduce之间的区别是什么?

concurrency clojure

6
推荐指数
1
解决办法
1779
查看次数

Java Generics:警告需要未经检查的强制转换以符合<InterfaceName>

我有一个界面

interface x {
    A getValue();
}
Run Code Online (Sandbox Code Playgroud)

和实施

class y implements x {
    public B getValue() { return new B();}
}
Run Code Online (Sandbox Code Playgroud)

B是A的子类.我猜这是因为协变覆盖的原因.

但是,如果我重写接口为

interface x{
    <T extends A> T getValue();
}
Run Code Online (Sandbox Code Playgroud)

我在实施中得到了一个警告

警告需要未经检查的强制转换以符合A.getValue()

两个版本的界面有什么区别?我以为他们是一样的.

java generics

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

如何从sudo'd程序中执行作为原始用户的命令?

我必须用来sudo运行我的程序:

 sudo ./my_program
Run Code Online (Sandbox Code Playgroud)

我试图git clone从我的程序运行,但它尝试使用root用户的SSH密钥而不是我的.有没有办法以最初调用我的程序的用户身份执行此单个命令?

我想我能做到:

su - original_user -c "git --version"
Run Code Online (Sandbox Code Playgroud)

但是如何计算原始用户的用户名?还是有另一种优雅的解决方案吗?

c unix sudo

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

从谷歌阅读器api获取用户的标签列表

这篇博客文章中我看到,一旦你知道标签名称,就可以在标签中找到项目

/reader/atom/user/[user id]/label/[tag]
Run Code Online (Sandbox Code Playgroud)

但我怎么知道用户可以使用哪些标签?如何从谷歌阅读器api获取用户的可用标签列表.

我见过第三方应用程序这样做,不知道他们是如何做到的.

google-reader

4
推荐指数
1
解决办法
953
查看次数