小编Seb*_*ner的帖子

为什么Maven没有解析commons-configuration的所有依赖项?

摘要

XMLConfiguration configuration = new XMLConfiguration("config/config.xml");仅在尝试时commons-configuration 1.10我需要为我的maven设置添加更多依赖项(即commons-collections不比新项目更新3.2.1).为什么会这样,为什么maven不能简单地解决所有需要的依赖?

细节

我试图让commons-configuration工作.首先,我想使用最新版本2.0-alpha2,因为我无法配置Maven来下载正确的资源,所以它完全不能正常工作 - 但这是另一回事.

在我发现版本1.10实际上是"一点十"(而不是"一点一零")并且因此是最新版本的commons-configuration 1(并且由教程覆盖)之后,我决定试一试.

对于我的maven依赖项(集成在eclipse中)我用过:

<dependency>
    <groupId>commons-configuration</groupId>
    <artifactId>commons-configuration</artifactId>
    <version>1.10</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但是,在尝试这个例子时:

package main;

import java.util.Iterator;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;

public class ConfigurationTest {
    public static void main(String... args) {
        try {
            XMLConfiguration configuration = 
                    new XMLConfiguration("config/config.xml");
            Iterator<String> iterator = configuration.getKeys();
            while (iterator.hasNext()) {
                System.out.println(iterator.next());
            }
        } catch (ConfigurationException e) {
            e.printStackTrace();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

使用以下config.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<configuration>
  <property>value</property> …
Run Code Online (Sandbox Code Playgroud)

java maven apache-commons-config

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

在 Python 中设置 WindowsHook(ctypes、Windows API)

我正在尝试使用 Python (3.4.3) 后台应用程序(在 Windows 7/8 中)全局跟踪鼠标。这涉及设置一个 WindowsHook,它应该向我返回该特定钩子的有效句柄 - 但我的句柄始终为 0。

仅跟踪鼠标位置非常容易GetCursorPos(作为替代方法GetCursorInfo):

from ctypes.wintypes import *
ppoint = ctypes.pointer(POINT())
ctypes.windll.user32.GetCursorPos(ppoint)
print('({}, {})'.format(ppoint[0].x, ppoint[0].y))
Run Code Online (Sandbox Code Playgroud)

仅跟踪位置也很方便GetMouseMovePointsEx,它跟踪最近的 64 个鼠标位置:

from ctypes.wintypes import *

# some additional types and structs
ULONG_PTR = ctypes.c_ulong
class MOUSEMOVEPOINT(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
        ("time", DWORD),
        ("dwExtraInfo", ULONG_PTR)
    ]
GMMP_USE_DISPLAY_POINTS = 1

# get initial tracking point
ppoint = ctypes.pointer(POINT())
ctypes.windll.user32.GetCursorPos(ppoint)
point = MOUSEMOVEPOINT(ppoint[0].x,ppoint[0].y)

# track last X points
number_mouse_points …
Run Code Online (Sandbox Code Playgroud)

python winapi ctypes

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

标签 统计

apache-commons-config ×1

ctypes ×1

java ×1

maven ×1

python ×1

winapi ×1