我想实现一个滑块,它基本上是两条线,一条垂直线和一条水平线,穿过触摸屏幕的地方.我设法做了一个,但我必须提出问题:
这是代码:
public class Slider extends View {
private Controller controller = new Controller();
private boolean initialisedSlider;
private int sliderWidth, sliderHeight;
private Point pointStart;
private Paint white;
private int mode;
final static int VERTICAL = 0, HORIZONTAL = 1, BOTH = 2;
public Slider(Context context) {
super(context);
setFocusable(true);
// TODO Auto-generated constructor stub
}
public Slider(Context context, AttributeSet attrs) {
super(context, attrs);
setFocusable(true);
pointStart = new Point();
initialisedSlider = false;
mode = Slider.BOTH;
}
@Override
protected void onDraw(Canvas …Run Code Online (Sandbox Code Playgroud) 我有一个1D逻辑向量,一个单元格数组和一个我想要分配的字符串值.
我试过"cell {logical} = string"但是我收到以下错误:
The right hand side of this assignment has too few values to satisfy
the left hand side.
Run Code Online (Sandbox Code Playgroud)
你有解决方案吗?
我想创建一个CustomButton具有预定义的onClick.事实上,我的目标是做同样的工作
CustomButton mButton = getViewById(..);
mButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
show_something()
}
Run Code Online (Sandbox Code Playgroud)
有没有办法将其嵌入Listener从Button继承的CustomButton对象?我想要的是CustomButton在我的布局XML文件中创建一个,而不必在我的活动中提到这个按钮,这将给出:
main.xml中:
<LinearLayout xmlns:"...">
<com.mypackage.view.CustomButton
(attributes)/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
CustomButton.java:
class CustomButton extends Button implements... {
@Override
OnClick (or something like that, that's the core of my question, what to put here)
}
Run Code Online (Sandbox Code Playgroud)
myActivity.java
public class myActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
} …Run Code Online (Sandbox Code Playgroud) 我正在寻找一个Python包来执行有效的恒定Q变换(即使用FFT来加速该过程).我找到了一个名为CQ-NSGT/sliCQ Toolbox的工具箱,但是我收到以下错误:
File "build\bdist.win32\egg\nsgt\__init__.py", line 37, in <module>
File "build\bdist.win32\egg\nsgt\audio.py", line 7, in <module>
File "C:\Python27\lib\site-packages\scikits\audiolab\__init__.py", line 25, in <module>
from pysndfile import formatinfo, sndfile
File "C:\Python27\lib\site-packages\scikits\audiolab\pysndfile\__init__.py", line 1, in <module>
from _sndfile import Sndfile, Format, available_file_formats, \
File "numpy.pxd", line 30, in scikits.audiolab.pysndfile._sndfile (scikits\audiolab\pysndfile\_sndfile.c:9632)
ValueError: numpy.dtype does not appear to be the correct type object
Run Code Online (Sandbox Code Playgroud)
Numpy(我怀疑)或scikit audiolab更可能出现问题.你知道问题的来源吗?
我想原型化一种新型的音频滤波器.目前我使用GStreamer返回我的音频缓冲区,并使用Cython将滤镜应用于它.然后我将结果发送回GStreamer.
一切都包含在python主代码中,GStreamer访问使用pygst完成.使用Cython进行原型设计非常棒,因为它在运行代码时会自动重新编译,并且非常高效.
但是我觉得如果我可以使用我的Cython文件生成GStreamer本机插件(那些是用C编写的)会更好.
您对如何实现这一目标有所了解吗?
我不明白>>,&,?并且:在此计划中意味着:
case MotionEvent.ACTION_POINTER_UP: {
// Extract the index of the pointer that left the touch sensor
final int pointerIndex = (action & MotionEvent.ACTION_POINTER_INDEX_MASK)
>> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose a new
// active pointer and adjust accordingly.
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mLastTouchX = ev.getX(newPointerIndex);
mLastTouchY = ev.getY(newPointerIndex);
mActivePointerId = ev.getPointerId(newPointerIndex);
}
break;
Run Code Online (Sandbox Code Playgroud)
你可以帮帮我吗 ?Google不会搜索非字母数字字符...
我在安装OpenCV时遇到了一些麻烦.我在这里使用了2.3.1 windows superpack:http://opencv.willowgarage.com/wiki/.我将它解压缩到C:\ OpenCV并使用CMake将其构建到"OpenCV/build"目录中,用于Visual C++ 64位.生成了一个INSTALL文件,我在调试和发布模式(64位)中构建它.然后我尝试对"OpenCV/samples/c/example_cmake"中的"minarea"示例文件执行相同操作:使用CMake生成文件,然后使用Visual C++生成.
在整个过程中,我没有发现任何决定性的错误.但是当我尝试打开示例exe文件时,我得到:"程序无法启动,因为缺少opencv_highgui231d.dll".和高
我有一个从ListAPIView派生的视图,具有以下权限:
permission_classes = (permissions.IsAuthenticated, IsOwnerOrSuperuser, )
IsOwnerOrSuperuse定义如下:
class IsOwnerOrSuperuser(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
return obj.user == request.user or request.user.is_superuser
Run Code Online (Sandbox Code Playgroud)
(这与教程非常相似)
现在,当普通用户查询我的视图时,它可以看到每个人的对象.是否将权限应用于列表中的每个对象?如何以最小的开销强制执行此类行为?
谢谢
我目前坚持使用一些成功编译成.so文件的代码.当我尝试使用以下语句将我的库链接到某些代码时失败:
未定义的符号:_ZrSRKN5CORBA3AnyERPN3RTT5corba4Math7MatrixdE
我能得到的唯一有用的信息是,对象或函数有一些东西使用以下类型:"CORBA :: Any"(常规corba类型)和"RTT :: corba :: Math :: Matrixd"(使用一个hh文件和两个cc文件定义的类型.
我有兴趣知道在我的代码中确切地生成符号的位置以及无法找到它的原因.我怀疑它代表我的一个cc文件中定义的函数,所以这是我编译整个事情的方式:
g ++ -I {CORBA includes} main.cpp one.cc two.cc -L {CORBA libraries}
我应该遵循什么调试过程?