Emacs 24现在具有词法范围的变量.当然,它还具有动态范围的变量.既然它有两者,我很困惑变量什么时候会有哪种范围.有一个lexical-binding
变量控制何时启用词法绑定,我想我defvar
现在读到一些关于动态范围变量的声明,但总的来说我很丢失.在Emacs 24的新范围规则中,是否有一个很好的解释?换句话说,当我查看为Emacs 24编写的Emacs Lisp代码中的变量时,如何判断变量使用的范围?
在这个片段中:
@RequestMapping(method = GET)
public List<Place> read(Principal principal) {
principal.getName();
}
Run Code Online (Sandbox Code Playgroud)
principal.getName()
给了我用户身份,但我需要一种方法来接收客户端凭据(client =>使用我的API的应用程序).我怎样才能做到这一点?
我在我的系统上编译和构建了Emacs24.之后,我的一些.emacs自定义已停止工作.
最重要的问题是:我将菜单栏模式和工具栏模式设置为nil.
;;; No Menu Bar
(menu-bar-mode nil)
;;; No tool bar
(tool-bar-mode nil)
;;; No Scrollbar
(scroll-bar-mode nil)
Run Code Online (Sandbox Code Playgroud)
但是,如果我启动Emacs,它们总是设置为t.
更糟糕的是:如果我使用迷你缓冲区将其设置为nil,然后转到临时并键入menu-bar-mode并评估表达式,它总是将其更改为t.
任何想法为什么这可能是问题,我该如何解决它?
我刚刚开始使用google的Guava集合(ComparisonChain和Objects).在我的pojo我覆盖了equals方法,所以我先做了这个:
return ComparisonChain.start()
.compare(this.id, other.id)
.result() == 0;
Run Code Online (Sandbox Code Playgroud)
但是,我意识到我也可以使用它:
return Objects.equal(this.id, other.id);
Run Code Online (Sandbox Code Playgroud)
我没有看到比较链何时更好,因为你可以轻松添加更多条件,如下所示:
return Objects.equal(this.name, other.name)
&& Objects.equal(this.number, other.number);
Run Code Online (Sandbox Code Playgroud)
如果您特别需要返回int,我可以看到的唯一好处.它有两个额外的方法调用(开始和结果),并且对于菜鸟来说更复杂.
我错过了ComparisonChain有明显的好处吗?
(是的,我也用适当的覆盖哈希码Objects.hashcode()
)
当你有一个异步事件总线和fire事件时,让我们说在UI中捕获的模型中你可能有以下问题:
已注册的处理程序在工作线程中执行,但所有UI swing更改都需要在AWT事件线程中执行.这意味着您需要将所有处理程序clode包含在内EventQueue.invokeLater(...)
.
这看起来像很多锅炉板代码.我想知道是否有更智能的解决方案来解决这个问题.
guava事件总线的扩展如何标记在特殊线程中执行的处理程序?这可以用注释标记,例如@ExecuteWithinEDT
:
class EventBusChangeRecorder {
@Subscribe @ExecuteWithinEDT void recordCustomerChange(ChangeEvent e) {
recordChange(e.getChange());
}
}
Run Code Online (Sandbox Code Playgroud) 我试图使用以下方法调试一些正则表达式:
perl -Mre=debug file.pl
Run Code Online (Sandbox Code Playgroud)
file.pl脚本有许多正则表达式.其中一些是重复的.使用上面的语法,正在调试file.pl中的所有正则表达式.
有没有办法告诉Perl只调试脚本中的特定正则表达式?
我熟悉YAPE :: Regex模块,但这不是我要求的.所以请不要建议使用它.
我在archlinux中使用emacs24.如果我使用marmalade.org的slime软件包,那么当我使用Mx slime时,错误是:
debugger invoked on a SB-INT:SIMPLE-FILE-ERROR in thread
#<THREAD "initial thread" RUNNING {AB007A9}>:
Couldn't load
"/home/sinners/.emacs.d/elpa/slime-20100404.1/swank-loader.lisp": file does
not exist.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
Run Code Online (Sandbox Code Playgroud)
但如果我使用官方网站上的slime-cvs软件包,则错误是:
Debugger entered: (("Error in timer" slime-attempt-connection (#<process inferior-lisp> nil 2) (void-variable --cl-accu--)))
#[257 "\302\303\304\300\301F\"\207" [slime-attempt-connection (#<process inferior-lisp> nil 2) debug nil "Error in timer"] 7 "\n\n(fn DATA)"]((void-variable --cl-accu--))
funcall(#[257 "\302\303\304\300\301F\"\207" [slime-attempt-connection …
Run Code Online (Sandbox Code Playgroud) 我正在使用Spring Security,并想知道如果该页面包含#
(哈希)符号,如何在成功登录到源页面后实现重定向.
现在我使用always-use-default-target="false"
它在URL类型的工作正常:/path/to/page/
.
但是当URL变为#/path/to/page
它时,它不会进行任何重定向.
有没有办法解决它?
我创建了2个简单的类.一个类的构造函数注释为@Autowired.它接受另一个类的对象.但是这段代码失败了.
类: - 1)SimpleBean.java
@Configuration
public class SimpleBean {
InnerBean prop1;
public InnerBean getProp1() {
return prop1;
}
public void setProp1( InnerBean prop1) {
System.out.println("inside setProp1 input inner's property is "
+ prop1.getSimpleProp1());
this.prop1 = prop1;
}
@Autowired(required=true)
public SimpleBean(InnerBean prop1) {
super();
System.out.println("inside SimpleBean constructor inner's property is "
+ prop1.getSimpleProp1());
this.prop1 = prop1;
}
}
Run Code Online (Sandbox Code Playgroud)
2)Inner.java
@Configuration
public class InnerBean {
String simpleProp1;
public String getSimpleProp1() {
return simpleProp1;
}
public void setSimpleProp1(String simpleProp1) {
this.simpleProp1 = simpleProp1; …
Run Code Online (Sandbox Code Playgroud) spring annotations default-constructor constructor-injection