如何从DOM中获取所有叶子节点,比如说div?我想要一个最佳解决方案,如果没有简单而神奇的选择器.我想过使用"reachElem.find('div').length == 0"但我不确定这是不是正确的方向.有任何想法吗?
大多数文本编辑器都有一个导航窗格,可让您查看当前打开的所有文件.或者允许您浏览文件目录的窗格.
我如何在Emacs中执行此操作?
默认情况下,emacs 22.1.1仅在您首次发出编译命令时显示编译缓冲区的顶部.我想在使用compile命令时自动滚动到底部以节省击键次数.这样我只需查看编译缓冲区并查看当前正在编译的文件而不必切换窗口并滚动到缓冲区的底部,就可以轻松获取当前编译的状态.有任何想法吗?
编辑:我知道有键盘退出(通常绑定到Cg); 但我更感兴趣的是如何处理Emacs附带的编辑功能(就像在这种情况下).当我想改变一些内置函数时,我经常遇到这种情况.
在emacs中,当你按下M-ESC ESC(或ESC三次)时,你可以摆脱很多情况,比如瞬态标记等.但是我习惯性地按下了逃生键(我实际上将其重新映射到了逃脱键)比我想要的更多,并最终杀死我的Windows配置,这是非常烦人的.函数keyboard-escape-quit在simple.el中定义:
(defun keyboard-escape-quit ()
"Exit the current \"mode\" (in a generalized sense of the word).
This command can exit an interactive command such as `query-replace',
can clear out a prefix argument or a region,
can get out of the minibuffer or other recursive edit,
cancel the use of the current buffer (for special-purpose buffers),
or go back to just one window (by deleting all but the selected window)."
(interactive)
(cond ((eq last-command 'mode-exited) nil)
((> (minibuffer-depth) …Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个解决方案,并以一种强有力地实现策略/提供者模式的方式进行设计.因此,该解决方案公开了许多接口并包含这些接口的默认实现,这些接口可以通过DI类型方法替换.
在主机应用程序使用许多这些接口的情况下,它期望处理可能发生的某些异常,例如IDataRetriever接口具有方法SomeDataType GetData(int timeout);并且主机可以处理一些自定义异常,例如DataRetrievalTimeoutException或NetworkConnectionException.
我的问题是,标记接口类的最佳方法是什么,当开发人员实现它时,他们会知道应该抛出某些异常并由主机处理?
目前我刚刚将xml标签添加到方法xml注释中 - 这是否足够?
c# dependency-injection interface exception strategy-pattern
这是我的代码:
private static void TreeScan(string sDir)
{
foreach (string d in Directory.GetDirectories(sDir))
{
foreach (string f in Directory.GetFiles(d))
{
//Save file f
}
}
TreeScan(d, client);
}
Run Code Online (Sandbox Code Playgroud)
问题是,它没有得到FILES中的SDIR (启动Directory),它只是变得文件夹和文件的子文件夹.
如何让它从sDir获取文件呢?
我有一个Web项目(ASP.NET MVC 4项目),它有许多配置存储在Web.Config和NLog.config文件中.
我有几个发布配置文件PublishProfile1,PublishProfile2等.当使用发布配置文件将我的Web项目部署到服务器时,我想在部署后更改两个配置文件中的一些配置(Web.config中的一些应用程序设置和一些值NLog.config).
我已经按照这里的步骤进行操作,它非常适合更改Web.Config中的设置(例如,Web.PublishProfile1.Config的转换得到尊重).
这是我的 NLog.PublishProfile1.Config转换文件:
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://www.nlog-project.org/schemas/NLog.xsd">
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets >
<target xsi:type="File"
name="tracelog"
fileName="NEW_VALUE_HERE" layout="${longdate} [${threadname}::${threadid}] ${pad:padding=5:inner=${level:uppercase=true}} ${logger} - ${message}"
xdt:Transform="Replace" xdt:Locator="Match(name)" />
</targets>
</nlog>
</nlog>
Run Code Online (Sandbox Code Playgroud)
问题是我在NLog.PublishProfile1.config中有相同的转换,但是在部署之后也不会应用这些转换.
有没有人知道为什么这个转换对NLog.config不起作用但对发布配置文件中的Web.config有效?
请原谅我在这方面的无知.我已经阅读了很多线程,但仍然无法使我的路由正确.
我有这样的ProductsController:
public class ProductsController : ApiController
{
[ActionName("GetListOfStudents")]
public static List<Structures.StudentInfo> GetListOfStudents(string Username, string Password)
{
List<Structures.StudentInfo> si = StudentFunctions.GetListOfStudents(Username, Password);
return si;
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个控制台测试程序,我已经定义了路由:
config.Routes.MapHttpRoute(
name: "ApiByAction",
routeTemplate: "api/products/GetListOfStudents",
defaults: new { controller = "products", action = "GetListOfStudents" });
Run Code Online (Sandbox Code Playgroud)
但是当我打电话的时候
GET http://localhost:8080/api/Products/GetListOfStudents
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
MessageDetail=No action was found on the controller 'Products' that matches the name 'GetListOfStudents'.
Run Code Online (Sandbox Code Playgroud)
我一直在拔头发,无法确定正确的路线应该是什么.
任何善良的人都会照顾我吗?
我正在Console.ReadLine阅读用户的输入.但是,我想在键入时隐藏/排除控制台屏幕上输入的文本.例如,当用户写"a"时,它将"a"写入控制台,然后我将得到一个值为"a"的变量.但是,我不希望在控制台的输出上写入"a".
我怎样才能做到这一点?
我正在寻找一种方法来获取 Oracle DB Server 版本作为“XYZ”。
我可以从这里使用查询,但它会显示不仅仅是服务器的版本。
我可以使用v$version视图,但生成的字符串将包含的不仅仅是“XYZ”。
有没有一种简单的方法可以得到我想要的东西?