小编And*_*dre的帖子

R树和四叉树比较

我想比较地理空间数据的R-Tree和Quadtree.虽然有文献,但我很难找到涵盖真正基本比较的文件.所以我决定问这个问题.

在我看来,R-Tree具有平衡的优点,树没有空叶.作为缺点,插入或删除等基本操作可能导致重构整个索引.

四叶树是相反的,它不平衡并且有空叶,但它不需要被重新修剪.

因此,作为一个讽刺,我会说R-Tree确实需要更少的内存,并且由于最小的高度,搜索速度更快.当有许多更新操作时,四叉树更好,但结果树可能是不平衡的.

您认为这些观点是否正确?那里有没有涵盖这个主题的好文件?

Auf Wiedersehen,安德烈

indexing quadtree geospatial r-tree

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

如何启动一个自编的驱动程序

我在Visual Studio 2013中编写了一个驱动程序.该构建过程是成功的.然后我准备了一个traget-computer并将驱动程序文件复制到它.然后我安装了驱动程序:

C:\Windows\system32>pnputil -a "E:\driverZeug\KmdfHelloWorldPackage\KmdfHelloWorld.inf"
Microsoft-PnP-Dienstprogramm

Verarbeitungsinf.:            KmdfHelloWorld.inf
Das Treiberpaket wurde erfolgreich hinzugefügt.
Veröffentlichter Name:            oem42.inf


Versuche gesamt:              1
Anzahl erfolgreicher Importe: 1
Run Code Online (Sandbox Code Playgroud)

看起来它很成功.我在PC上运行DebugView但现在我不知道如何启动驱动程序,以便我可以看到调试输出.我的源代码中有一个DbgPrintEx() - Statement.

有人能告诉我如何启动这个驱动程序,以便我可以看到输出.

这是驱动程序的源代码:

#include <ntddk.h>
#include <wdf.h>
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;

NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT  DriverObject, _In_ PUNICODE_STRING RegistryPath)
{
    NTSTATUS status;
    WDF_DRIVER_CONFIG config;

    DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n");
    KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n"));
    WDF_DRIVER_CONFIG_INIT(&config, KmdfHelloWorldEvtDeviceAdd);
    status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
    return status;
}

NTSTATUS KmdfHelloWorldEvtDeviceAdd(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit)
{
    NTSTATUS status;
    WDFDEVICE …
Run Code Online (Sandbox Code Playgroud)

c windows driver wdf

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

Mongoexport不适合收藏

我想尝试导出这样的集合:

C:\Program Files\ConEmu>mongoexport --db test --collection person --out personTest.json
connected to: 127.0.0.1
couldn't open [personTest.json]
Run Code Online (Sandbox Code Playgroud)

它不起作用.有什么建议?

mongodb mongoexport

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

在eclipse中突出显示一个makefile

我在Eclipse中有两个makefile,一个名为alle.mak,第二个名为Makefile.我的问题是,当使用Makefile-Editor打开时,Makefile会正确突出显示,但是alle.mak不是.我知道在Window-Preferences-General-Editors-File_Associations下可以设置Makefile-Editor来打开这个文件,我这样做了(但没有突出显示alle.mak).

为了正确突出alle.mak文件,我还有另一个偏好吗?

格鲁斯,安德烈

c++ eclipse makefile

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

从输入事件中读取条形码(linux,c)

我有一个小程序从/ dev/input/event4读取条形码.这是代码:

#include <sys/file.h>
#include <stdio.h>
#include <string.h>
#include <linux/input.h>

int main (int argc, char *argv[])
{
        struct input_event ev;
        int fd, rd;

        //Open Device
        if ((fd = open ("/dev/input/event4", O_RDONLY|O_NONBLOCK)) == -1){
                printf ("not a vaild device.\n");
                return -1;
        }

        while (1){

                memset((void*)&ev, 0, sizeof(ev));

                rd = read (fd, (void*)&ev, sizeof(ev));

                if (rd <= 0){
                        printf ("rd: %d\n", rd);
                        sleep(1);
                }

                if(rd>0 && ev.value==0 && ev.type==1){
                        printf("type: %d, code: %d, value: %d, rd: %d\n", ev.type, ev.code, ev.value, rd);
                } …
Run Code Online (Sandbox Code Playgroud)

c linux barcode device barcode-scanner

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

我不懂C++指针算法

我有以下程序,它定义了2个整数和一个指向整数的指针.

#include <stdio.h>

int main() {

    int bla=999;
    int a=42;
    int* pa=&a;

    printf("%d \n", *pa);
    printf("%d \n", pa);

    pa++;
    //*pa=666; //runs (no error), but the console is showing nothing at all

    printf("%d \n", *pa);
    printf("%d \n", pa);

    pa++;
    //*pa=666; //runs and changes the value of *pa to 666;

    printf("%d \n", *pa);
    printf("%d \n", pa);

}
Run Code Online (Sandbox Code Playgroud)

输出是:

42

2686740

2686744

2686744 //这个值很奇怪,我想

999

2686748

地址对我来说很有意义,但第四个值很奇怪,因为它正是int的地址.有人可以解释一下这种行为吗?

当我评论*pa = 666(第一个外观)时,控制台什么也没显示,所以这里有一些错误,但编译器没有显示错误.也许这是因为我的系统上的int的大小,我有一个64位的Windows-os,所以也许int是64位而不是32?并且因为第二次增量后*pa值是999而不是第一次?

我相信,有很多C程序员可以解释发生了什么:)

c c++ pointers integer pointer-arithmetic

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

找不到方法compile()

我想在android studio中添加一个lib,但它不起作用.这是一个截图

在此输入图像描述

我还尝试在gradle.build中添加依赖项,但这也不起作用.也许是因为我支持代理?

在此输入图像描述

android zxing android-studio build.gradle android-gradle-plugin

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

std :: sort和compare-function与模板不起作用

我想对任意类型的向量进行排序,因此我编写了以下代码:

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

template<class T>
bool compare(T a, T b) {
    return a < b;
}

int main() {
    vector<int> v;
    v.push_back(3);
    v.push_back(4);
    v.push_back(2);
    v.push_back(1);

    sort(v.begin(), v.end(), compare);

    for (size_t i = 0; i < v.size(); i++) {
        cout << v.at(i) << " ";
    }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

此代码未编译,错误消息如下:

..\src\Test.cpp:22:34: error: no matching function for call to 'sort(std::vector<int>::iterator, std::vector<int>::iterator, <unresolved overloaded function type>)'
..\src\Test.cpp:22:34: note: candidates are:

... and more
Run Code Online (Sandbox Code Playgroud)

当我使用具体类型实现compare-function时,它可以工作.有人可以告诉我如何使用模板比较功能吗?

c++ sorting templates vector std

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