小编noi*_*lla的帖子

如何使用Maps V2 Android API选择标记?

我目前正在使用ItemizedOverlayMaps V1 API中的类,它跟踪当前选择的标记(如果有).Maps V2中是否有类似的功能来确定当前选择的是哪个标记?另外,有没有办法以编程方式选择新标记?

android google-maps-android-api-2

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

Python 编译时类型检查

Python 不会在编译时检查类型,因为它不能,至少在某些情况下是这样。但是有没有人想出一种机制来根据用户的额外注释进行编译时类型检查?像 pylint 这样的东西使用了作者的额外保证?我在想这样的事情:

#guarantee(argument=int, return_type=int)
def f(x):
    return x + 3

#guarantee(argument=int, return_type=str)
def g(x):
    return "%d times" % x

y = f(6)

# works, z = "9 times"
z = g(y)
# error
a = f(z)
Run Code Online (Sandbox Code Playgroud)

这个检查器会解释每个函数上面的注释,意识到它只f(x)应该接受int,但 z 来自g(x),所以它是一个str。有没有类似的产品?

python static-analysis pylint

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

这是一个g ++ bug,libc bug,还是我疯了(或者全是三个)?

当我遇到内存访问错误时,我正在使用一些openFrameworks示例.经过一天缩小问题的时间后,我有一个相对纯粹的C++代码的相当小的样本仍然导致内存访问错误.我会在这里发布所有内容,因为它很短.

有三个文件:testApp.cpp,main.cpp和testApp.h.

testApp.h:

#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class X {
public:

  X();
  virtual ~X();

private:

  vector<string> vertices;
  vector<string> colors;
  vector<string> normals;
  vector<string> texCoords;
  vector<string> indices;
  bool bVertsChanged, bColorsChanged, bNormalsChanged, bTexCoordsChanged, bIndicesChanged;
  int mode;
  string name;

  bool useColors;
  bool useTextures;
  bool useNormals;
};

class testApp{

public:
  void setup();

  X x1;
  X x2;
  vector<string> stroke;
};
Run Code Online (Sandbox Code Playgroud)

testApp.cpp:

#include "testApp.h"

X::X() {}
X::~X() {}

void testApp::setup(){
  std::cout << stroke.size() << std::endl;


}
Run Code Online (Sandbox Code Playgroud)

main.cpp中:

#define _GLIBCXX_DEBUG
#include …
Run Code Online (Sandbox Code Playgroud)

c++ stl g++

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