这个问题并不是要找到一个解决方案,而是要解释我从SQL Server中看到过的奇怪行为.
我有一个带有以下签名的存储过程:
alter procedure MySP @param1 uniqueidentifier,
@param2 uniqueidentifier,
@param3 uniqueidentifier
Run Code Online (Sandbox Code Playgroud)
给定一组参数,这个过程需要很长时间才能从C#(使用SqlCommand.ExecuteReader())运行 - 大约2分钟.在直接查询会话中使用相同的参数,SP在2秒内运行.
花了很长时间,我甚至不会试图解释我们如何偶然发现这个解决方案,但这就是我们所做的:
在SP的开头,我们声明了3个局部变量并将它们分配给参数的值,如下所示:
declare @param1_copy uniqueidentifier,
@param2_copy uniqueidentifier,
@param3_copy uniqueidentifier
select @param1_copy = @param1,
@param2_copy = @param2,
@param3_copy = @param3
Run Code Online (Sandbox Code Playgroud)
然后,在SP的其余部分,我们用本地副本替换对输入参数的所有引用.
瞧.SP在2秒内执行.这里的团队非常棒.
现在,女士们,先生们,任何人都可以解释这种行为吗?
Bob Glickstein 在“编写 GNU Emacs 扩展”的第 3 章中描述了一种建议滚动功能的方法。(他建议让它们可逆,所以我们必须在滚动之前保存状态。)
例如,对于向上滚动命令,此建议是这样完成的
(defadvice scroll-up-command (before reversibilate activate compile)
"If it wants to be reversible, it must save the former state."
(save-before-scroll))
Run Code Online (Sandbox Code Playgroud)
好。我当然必须对所有滚动命令执行此操作。所以我想对它们进行排序,并想一起为它们提供建议。
(setq reversible-scroll-commands
[scroll-up-command
scroll-down-command
scroll-left-command
scroll-right-command])
Run Code Online (Sandbox Code Playgroud)
(我使用一个向量来保存 5 个引号。)
但现在我被困住了。
(mapcar
(lambda (fun-name)
(defadvice fun-name (before reversibilate activate compile)
"If it wants to be reversible, it must save the former state."
(save-before-scroll)))
reversible-scroll-commands)
Run Code Online (Sandbox Code Playgroud)
将建议(不存在的)函数 fun-name 四次,因为 defadvice 是一个宏,并且不评估 fun-name。
有什么办法吗?
(我正在使用 Emacs 24)
我试图定义一个结构,其中包含我想知道的一些属性,以及基本结构不需要的任意数量的其他属性.
(defstruct (node (:type list)) label [other args here])
Run Code Online (Sandbox Code Playgroud)
我知道你可以在一个函数中做到:
(defun foo (arg1 &rest args) ...)
Run Code Online (Sandbox Code Playgroud)
有某种&rest等价物defstruct吗?
我只是在学习口齿不清,所以我有一种感觉,我错过了一些东西.如果没有&rest相应的,关于我如何去做这个的任何想法?提前致谢!
我通常在所有 Emacs 界面中使用浅色背景颜色。但我习惯了终端的深色背景。因此我想将ansi-term的背景颜色设置为黑色。然而,当我这样做时,只有已经写入文本的部分颜色正确,背景的其余部分仍然像其他面孔一样浅。我正在寻找一种方法将 ansi-term 的背景颜色完全设置为黑色。示例: https: //i.stack.imgur.com/F3pra.png
在编写Clojure代码时,我经常在最后一个表达式和结束括号之间留下空格.就像是
(defn myfunction
[arg]
(do
(expr1)
(expr2)|
))
Run Code Online (Sandbox Code Playgroud)
哪里| 是光标的位置.Emacs中是否有一个快捷方式来删除(expr2)和最后一个括号之间的空格?目标是结束
(defn myfunction
[arg]
(do
(expr1)
(expr2)))
Run Code Online (Sandbox Code Playgroud) 假设我有两个列表,((1 2 3))并且(((1 2 3)) ((4 5))).我希望能够判断第一个列表是否是第二个列表的成员.我试图使用subsetp,但它不会为此查询返回true.我怎么能做到这一点?
在Emacs中使用PHP代码和HTML标记编辑PHP文件时,我继续收到警告:
Warning (php-indent):
Indentation fails badly with mixed HTML and PHP.
Look for an Emacs Lisp library that supports "multiple
major modes" like mumamo, mmm-mode or multi-mode.
Run Code Online (Sandbox Code Playgroud)
它弹出在我的窗口的底部,并占据了我的编辑屏幕的一半。如何关闭此功能?
我知道可以添加各种“附加组件”和模式,以使Emacs很好地格式化PHP + HTML,但是我只想关闭警告。我该怎么办?
编辑:
这是php-mode.el上面错误似乎来自文件的一部分:
Warning (php-indent):
Indentation fails badly with mixed HTML and PHP.
Look for an Emacs Lisp library that supports "multiple
major modes" like mumamo, mmm-mode or multi-mode.
Run Code Online (Sandbox Code Playgroud) 我正在编写几个辅助函数供我使用。他们首先调用org-publish-project该输出,然后调用外部脚本。我想将执行的所有输出收集到弹出的临时缓冲区中。
外部的东西更容易。该函数shell-command接受有关将标准输出发送到何处的缓冲区的第二个参数。但org-publish-project只会将内容回显到迷你缓冲区,并且它会在任何地方显示*Messages*。我可以以某种方式将所有回声重定向到给定的缓冲区吗?
我使用异步来调用elisp中的异步函数.
首先,我在github上测试自述文件代码并且运行良好.
然后我写了一个测试代码:
(defun async-function ()
(async-start
;; What to do in the child process
(lambda ()
(shell-command-to-string "~/test.sh"))
;; What to do when it finishes
(lambda (result)
(message "Async process done, result is: %s" result)))
Run Code Online (Sandbox Code Playgroud)
test.sh代码非常简单:
#! /usr/bin/env sh
sleep 2
echo "shell finish"
Run Code Online (Sandbox Code Playgroud)
它可以工作,但是当我改变这样的lisp代码时失败了:
;;;###autoload
(defun test ()
(shell-command-to-string "~/test.sh"))
(defun async-function ()
(async-start
;; What to do in the child process
(lambda ()
(test))
;; What to do when it finishes
(lambda (result)
(message "Async process done, …Run Code Online (Sandbox Code Playgroud) 上下文:我正在使用一个几乎类似excel的大文本文件,我正在添加/编辑条目.它是一个共享文件,因此其他人可以编辑该文件.
我正在使用emacs,我发现他们添加了命令delete-duplicate-lines.这个命令似乎很适合修剪额外的条目,但是知道哪些行是重复的(即已经存在于文件中)以便我知道哪些条目已经被添加将是很好的.是否有一个类似于delete-duplicate-lines的命令,但只指出哪些行是重复的而不删除它们?
emacs ×7
elisp ×3
common-lisp ×2
lisp ×2
ansi-term ×1
asynchronous ×1
c# ×1
clojure ×1
defadvice ×1
duplicates ×1
emacs23 ×1
emacs24 ×1
highlighting ×1
html ×1
key-bindings ×1
membership ×1
php ×1
structure ×1
whitespace ×1