小编Ste*_*fan的帖子

Pydev相对项目路径

我用pydev插件安装了eclipse.我需要在eclipse上运行我现有的项目.但是我的代码中有文件的相对路径.我期望从eclipse将相对路径附加到项目的默认目录.相反,它会将相对路径附加到安装Eclipse的目录.我找不到解决问题的方法.

提前致谢.

python eclipse relative-path pydev

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

如何在 Visual Studio 中执行自定义文件特定命令/任务?

我希望能够为 VisualStudio 解决方案定义自定义命令/任务/宏。然后我想对在Solution Explorer.

有几种可能来执行对我来说没问题的命令:

a) 右键单击​​中的文件Solution Explorer并从上下文菜单中选择命令(我最喜欢的)

b) 在Solution Explorer. 然后单击工具栏上的按钮。然后该命令会以某种方式从Solution Explorer.

c) 在Solution Explorer. 然后从Task Runner Explorer. 执行的任务会以某种方式从“解决方案资源管理器”中检索所选文件

我尝试使用 VisualStudio 扩展VsCommandBuddy。但是,它不支持特定于文件的命令,请参阅

https://github.com/PaulHuizer/VsCommandBuddy/issues/21

我还试图用一个GruntGulp可从启动任务Task Runner Explorer。但是,我不知道如何传递/访问当前Solution Explorer.

https://blogs.msdn.microsoft.com/webdev/2016/01/06/task-runners-in-visual-studio-2015/

=> 是否有一个 VisualStudio 扩展可以轻松地为文件定义自定义命令?

=> 如何在脚本文件(例如 Gulp、Grunt、Webpack)中传递/访问在 SolutionExplorer 中选择的文件?

=> 您会推荐其他任何舒适的工作流程吗?

可以编写我自己的 VisualStudio 扩展。但我想其他人已经知道了解决方案。

task visual-studio gruntjs add-custom-command gulp

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

如何导入html中<script type ="module">标签中定义的es6模块?

我可以在我的html文件me.html中定义一个模块:

<script type="module" id="DEFAULT_MODULE">   
           import Atom from './atom.js';       
           console.log("definition of getAtom")
           export default function getAtom(){
            return new Atom('atom');
           }
           console.log("exported getAtom")
</script>
Run Code Online (Sandbox Code Playgroud)

另见

=>是否可以将"匿名"模块导入同一个html文件中的另一个模块脚本?或者某些"代码隐藏" - 也是由me.html文件加载的JavaScript文件?出口似乎有效; 至少它不会抛出任何错误.

为了导入getAtom我试过的方法,例如:

<script type="module">
    import getAtom from '.'; //this line does not work
    console.log("usage of getAtom")
    var atom = getAtom();             
</script>
Run Code Online (Sandbox Code Playgroud)

我希望有一些语法

 import getAtom;
 import getAtom from '.';
 import getAtom from window;
 import getAtom from './me.html';
 import getAtom from '.DEFAULT_MODULE';
Run Code Online (Sandbox Code Playgroud)

但是,这些线都不起作用.

=>如果可能的话,引用"匿名"模块的正确语法是什么?

我使用Chrome版本63.0.3239.108.

相关问题:

如何动态执行/评估包含ES6模块的JavaScript代码/需要一些依赖项?

html javascript es6-modules

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

如何处理 Html5 &lt;details&gt; 元素的展开/折叠事件?

我使用详细信息/摘要元素来获取可扩展部分:

https://www.w3schools.com/TAGS/tag_details.asp

d3.select('details')
  .on('click',()=>{
     alert('clicked');
  });
Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<details>
  <summary>Header</summary>
  <p>Content</p>
  <p>Content</p>
</details>
Run Code Online (Sandbox Code Playgroud)

我想在切换详细信息元素的打开状态时执行操作。我怎样才能这样做呢?

如果我要使用该onclick事件,则当用户单击摘要或内容时也会触发该事件。我只想处理“点击切换箭头”。

html events expander dropdown

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

如何为Eclipse&M2E的maven pom.xml文件中的类路径条目定义访问规则?

为了避免对jfxrt.jar的非法访问警告,我手动将类路径文件更改为包括访问规则:

想要的类路径条目

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
        <accessrules>
            <accessrule kind="accessible" pattern="javafx/**"/>
            <accessrule kind="accessible" pattern="com/sun/javafx/**"/>         
        </accessrules>
</classpathentry>
Run Code Online (Sandbox Code Playgroud)

如果我执行pom.xml文件,则标签accessrule会被删除,新条目为

当前由pom.xml / M2E生成的类路径条目

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
</classpathentry>
Run Code Online (Sandbox Code Playgroud)

这是因为有关访问规则的信息未包含在我的pom.xml文件中。如何修改pom.xml文件以生成所需的类路径文件?

  • 我可以对Maven-compiler-plugin使用一些配置吗?

  • 还是我必须使用一些额外的Maven插件来修改类路径文本文件?

  • 还是根本无法在pom.xml文件中解决此问题,而我将不得不为M2E编写功能请求?

这是我的pom.xml文件中的一个片段(我使用pom打包):

当前的pom.xml条目用于编译阶段

<!-- ### COMPILE ### phase -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
        <!-- specify current java version here: -->
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
    <executions>
        <execution>
            <id>compile-execution</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>                           
            </goals>
        </execution>
        <execution>
            <id>org.treez.test-compile-execution</id>
            <phase>org.treez.test-compile</phase>
            <goals>                         
                <goal>testCompile</goal>
            </goals>
        </execution>
    </executions>       
</plugin>
Run Code Online (Sandbox Code Playgroud)

java eclipse javafx maven m2e

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

如何在 C# 或 VB.NET 中使用 Sqlite 连接池?

Sqlite 的连接字符串可以包括使用连接池的选项,例如(伪代码)

Dim connectionString = "Data Source=" + Path + ";" +
                                    "Version=3;" +
                                    "Pooling=True;" +
                                    "Max Pool Size=100;"
Run Code Online (Sandbox Code Playgroud)

我希望有一些额外的类或工厂方法来使用连接池,例如

dim connectionPool = new SqLiteConnectionPool(connectionString)

dim firstConnection = connectionPool.getConnection()
...
firstConnection.dispose()

...
dim secondConnection = connectionPool.getConnection()
Run Code Online (Sandbox Code Playgroud)

但是,我找不到这样的课程。

=>如何返回连接池的连接

=>如何重用以前返回到池中的连接

https://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki上搜索“pool”没有给出任何结果。

a) 我是否必须多次调用连接的构造函数?

dim firstConnection = new SqLiteConnection(connectionString)
...
firstConnection.dispose()


dim secondConnection = new SqLiteConnection(connectionString)
Run Code Online (Sandbox Code Playgroud)

多次传递连接字符串对我来说似乎并不直观。

b) 或者我会只创建一次连接并在它关闭/处置后以某种方式唤醒它?

dim connection = new SqLiteConnection(connectionString))
using connection 
 ...
end using 

connection.open()
using connection
 ...
end using 
Run Code Online (Sandbox Code Playgroud)

c# sqlite connection-pooling

3
推荐指数
1
解决办法
3865
查看次数

如何添加org.eclipse.swt(和其他插件依赖项)作为自动Java9模块?

为了能够将我的Eclipse插件"treezCore"也用作Java9模块,我在src文件夹中创建了一个module-info.java.

此外,我将Plug-in Dependencies从Classpath移动到Modulepath.我可以在插件依赖项中看到一个模块"org.eclipse.swt.3.106.1.v20170926":

在此输入图像描述

但是,我无法在module-info.java中引用该模块.我试过了

require  org.eclipse.swt.3.106.1.v20170926;
require  org.eclipse.swt;
require  swt;
Run Code Online (Sandbox Code Playgroud)

这些选项都没有奏效.Eclipse使用的jar文件\ plugins\org.eclipse.swt_3.106.1.v20170926-0519.jar不包含模块定义,

jar --file org.eclipse.swt_3.106.1.v20170926-0519.jar -d

说无法导出模块描述符.另见

无法在Java 9中为自动生成的模块名称派生模块描述符?

在此输入图像描述

如果我从中下载更新版本的swt.jar

http://download.eclipse.org/eclipse/downloads/drops4/R-4.7.1a-201710090410/download.php?dropFile=swt-4.7.1a-win32-win32-x86_64.zip

我得到以下有希望的输出:

swt automatic
requires java.base mandated
contains org.eclipse.swt
contains org.eclipse.swt.accessibility
contains org.eclipse.swt.awt
contains org.eclipse.swt.browser
contains org.eclipse.swt.custom
contains org.eclipse.swt.dnd
contains org.eclipse.swt.events
contains org.eclipse.swt.graphics
contains org.eclipse.swt.internal
contains org.eclipse.swt.internal.gdip
contains org.eclipse.swt.internal.image
contains org.eclipse.swt.internal.mozilla
contains org.eclipse.swt.internal.mozilla.init
contains org.eclipse.swt.internal.ole.win32
contains org.eclipse.swt.internal.opengl.win32
contains org.eclipse.swt.internal.webkit
contains org.eclipse.swt.internal.win32
contains org.eclipse.swt.layout
contains org.eclipse.swt.ole.win32
contains org.eclipse.swt.opengl
contains org.eclipse.swt.printing
contains org.eclipse.swt.program
contains org.eclipse.swt.widgets
Run Code Online (Sandbox Code Playgroud)

我也依赖于org.eclipse.jface而无法找到它的单独下载.

=>我真的必须等待使用包含模块定义的新插件版本的Eclipse新版本吗?

或者我可以以某种方式从插件文件夹中引用旧版本的swt,即使它不包含模块定义?我寻找一种简单的方法来定义别名或后备依赖,例如

requires ../plugins/org.eclipse.swt_3.106.1.v20170926-0519.jar as 'org.eclipse.swt' …
Run Code Online (Sandbox Code Playgroud)

swt eclipse-plugin eclipse-rcp java-platform-module-system java-9

3
推荐指数
1
解决办法
1699
查看次数

如何在 JupyterLab/JupyterHub python 笔记本中显示服务器端文件的文件选择对话框?

我想显示一个文件选择对话框,JupyterLab 笔记本的用户可以从其工作区中选择文件(= 服务器上的文件,而不是本地计算机上的文件)。

如果我尝试使用一些 python 库(tkinter、qt),它将尝试在服务器上打开 GUI。但是,我想在客户端上有一个 GUI。由于客户端在浏览器中运行,因此该 GUI 需要基于 html/javascript。

此外,要选择的文件位于服务器上。可以使用系统命令(例如“!dir”)显示现有文件的列表。

JupyterLab 中似乎有用于文件选择的小部件:

https://jupyterlab.readthedocs.io/en/stable/developer/ui_helpers.html#file-dialogs

JavaScript 代码(需要 Jupyterlab 扩展的构建步骤;FileDialog需要从 @jupyterlab/filebrowser 导入;DocumentManager 需要作为插件依赖项从 @jupyterlab/docmanager 注入;):

var { FileDialog } = require('@jupyterlab/filebrowser');

const dialog = FileDialog.getOpenFiles({
  manager, // IDocumentManager
  filter: model => model.type == 'notebook' // optional (model: Contents.IModel) => boolean
});

const result = await dialog;

if(result.button.accept){
  let files = result.value;
}
Run Code Online (Sandbox Code Playgroud)

=>我如何在我的Python代码中使用这些小部件?是否有一些额外的 python 库可以做到这一点?

不幸的是,FileDialog似乎不包含在ipywidgets

import ipywidgets as widgets
print(dir(widgets))
Run Code Online (Sandbox Code Playgroud)

有关的:

https://discourse.jupyter.org/t/jupyterlab-file-chooser-widget-server-side/4934/3

ipywidgets

python jupyter-lab

3
推荐指数
1
解决办法
4110
查看次数

如何在 asciidoc mathjax 方程中获得粗体和斜体文本?

以下任何一种方法都不会产生粗体和斜体的输出:

:stem: latexmath

[latexmath]
++++        

\it{\bf{foo}}
\textit{\textbf{foo}}
\mathit{\mathbf{foo}} 

++++
Run Code Online (Sandbox Code Playgroud)

=> 我怎样才能实现foo

我使用 Chrome 67.0.3396.99 和 Asciidoctor.js 预览插件来呈现我的 asciidoc 文件。

有关的:

formatting asciidoc mathjax

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

使用 nodejs 进行测试时,svgElement.getBoundingClientRect() 始终返回零

我创建了一些 svg 元素并想确定它的大小

svgElement.getBoundingClientRect()
Run Code Online (Sandbox Code Playgroud)

如果 svgElement 附加到文档中,我的代码就可以工作

document.body.appendChild(svgElement)
Run Code Online (Sandbox Code Playgroud)

如果我在浏览器(谷歌浏览器)中运行代码

然而,在使用nodejs和 jest 进行测试时,生成的边界矩形的宽度和高度始终为零。

=>如何使用nodejs正确运行代码?

javascript testing node.js jestjs

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