问题列表 - 第14978页

在setInput()之前保存TreeViewer状态

我正在尝试保存JFace TreeViewer扩展状态以在调用setInput()方法后刷新它.我试过getExpandedElements,setExpandedElements,getExpandedTreePaths,setExpandedTreePaths的方法,TreeViewer但它不工作.

Object[] expandedElements = viewer.getExpandedElements();
TreePath[] expandedTreePaths = viewer.getExpandedTreePaths();
viewer.setInput();
viewer.setExpandedElements(expandedElements);
viewer.setExpandedTreePaths(expandedTreePaths);
Run Code Online (Sandbox Code Playgroud)

java eclipse user-interface jface treeviewer

10
推荐指数
1
解决办法
4198
查看次数

ObjC中的#typedef和KVC

我有一个看起来像这样的课程:

@interface Properties : NSObject {
@private
    NSNumber* prop1;
    NSNumberBool* prop2;
    //etc
Run Code Online (Sandbox Code Playgroud)

其中NSNumberBool是typedef:

// in MyApp_Prefix.pch
typedef NSNumber NSNumberBool;
Run Code Online (Sandbox Code Playgroud)

我有所有必需的@property和@synthesize声明来制作prop1和prop2属性.

所有编译和工作正常,直到我试图通过[myProperties valueForKey:@"prop2"]访问prop2.这给了我一个"类不符合键值"的错误.但是,许多类似的调用工作正常:

myProperties.prop2; //works
[myProperties prop2]; //works
[myProperties valueForKey:@"prop1"]; //works
[myProperties valueForKey:@"prop2"] // throws NSUnknownKeyException ??
Run Code Online (Sandbox Code Playgroud)

这里发生了什么,我该如何解决?

谢谢,

typedef objective-c key-value-coding

7
推荐指数
3
解决办法
894
查看次数

如何在Snow Leopard中使用Python捕获iSight帧?

我有以下PyObjC脚本:

from Foundation import NSObject
import QTKit
error = None
capture_session = QTKit.QTCaptureSession.alloc().init()
print 'capture_session', capture_session
device = QTKit.QTCaptureDevice.defaultInputDeviceWithMediaType_(QTKit.QTMediaTypeVideo)
print 'device', device, type(device)
success = device.open_(error)
print 'device open success', success, error
if not success:
    raise Exception(error)
capture_device_input = QTKit.QTCaptureDeviceInput.alloc().initWithDevice_(device)
print 'capture_device_input', capture_device_input, capture_device_input.device()
success = capture_session.addInput_error_(capture_device_input, error)
print 'session add input success', success, error
if not success:
    raise Exception(error)
capture_decompressed_video_output = QTKit.QTCaptureDecompressedVideoOutput.alloc().init()
print 'capture_decompressed_video_output', capture_decompressed_video_output
class Delegate(NSObject):
    def captureOutput_didOutputVideoFrame_withSampleBuffer_fromConnection_(self, captureOutput, videoFrame, sampleBuffer, connection):
        print videoFrame, sampleBuffer, connection
delegate = …
Run Code Online (Sandbox Code Playgroud)

python isight pyobjc qtkit osx-snow-leopard

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

是否可以使用MySQL进行N-master => 1-slave复制?

我想制作一个专用的SLAVE机器,用于在三个不同的服务器上对三个数据库进行数据复制.换句话说,我想做Multiple Master => SIngle Slave复制.

有没有办法做到这一点,尽可能简单?

谢谢 !

mysql replication database-replication

6
推荐指数
1
解决办法
9448
查看次数

指纹识别器或拇指阅读器

我想用拇指阅读器开发自动考勤系统.当用户进入办公室校园时,他们必须将拇指放在拇指读取器上,然后标记为存在.

任何人都可以建议一个支持API的拇指阅读器,用于阅读和比较拇指打印图像,这样我就可以轻松地将它与我的考勤系统集成.

如果设备支持Java API,我更喜欢它.

我已经谷歌了很多,但找不到任何好的答案.

我遇到了一个微软的拇指阅读器,但我得到了足够的信息.有没有人可以提供我的Microsoft拇指阅读器的官方网站.任何在线限制器?

c# java fingerprint

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

Ruby on Rails:为RESTful Rails使用"complete_tasks_controller"

我很难解决以RESTful方式完成任务的问题.我有一个"任务"控制器,还有一个"complete_tasks"控制器.

我在complete_tasks_controller创建操作中有这个:

def create
   @task = Task.find(params[:id])
   @task.completed_at = Time.now
   @task.save
end
Run Code Online (Sandbox Code Playgroud)

我试着这样说:

<%=link_to "Complete task", new_task_complete_task_path(@task), :method => :post %>
Run Code Online (Sandbox Code Playgroud)

..但是我在提到"只允许获取,放置和删除请求"时遇到错误.

你知道我做错了什么吗?

ruby rest routes ruby-on-rails

0
推荐指数
1
解决办法
247
查看次数

用于捕获时间跨度或持续时间的UI

什么是用于从用户捕获持续时间的基于Web的良好UI.让我们说我们想要在几分钟内捕获持续时间.但是想要呈现它以便用户可以在几小时和/或几分钟内输入.

只需使用2个文本框hrs\min?或者单个文本框让他们输入"1小时31分钟"或"91分钟"?

还是有更好的东西?

user-interface

6
推荐指数
1
解决办法
1696
查看次数

ItemsControl,VirtualizingStackPanel和ScrollViewer高度

我想使用ItemsControl显示重要的项目列表.

我正在使用ItemsControl的原因是DataTemplate在我正在处理的应用程序中要复杂得多:提供的示例代码仅反映了我的调整问题.

我想要 :

  • 要进行虚拟化的ItemsControl,因为要显示许多项目
  • 它的大小自动扩展到其父容器(Grid)

    <Grid>
        <ItemsControl x:Name="My" ItemsSource="{Binding Path=Names}">
            <ItemsControl.Template>
                <ControlTemplate>
                    <StackPanel>
                        <StackPanel>
                            <TextBlock Text="this is a title" FontSize="15" />
                            <TextBlock Text="This is a description" />
                        </StackPanel>
                        <ScrollViewer CanContentScroll="True" Height="400px">
                            <VirtualizingStackPanel IsItemsHost="True" />
                        </ScrollViewer>
                    </StackPanel>
                </ControlTemplate>
            </ItemsControl.Template>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
    
    Run Code Online (Sandbox Code Playgroud)

背后的代码是:

public partial class Page1: Page
{
    public List<string> Names { get; set; }
    public Page1()
    {
        InitializeComponent();

        Names = new List<string>();
        for(int i = 0; i < 10000; i++)
            Names.Add("Name : …
Run Code Online (Sandbox Code Playgroud)

wpf itemscontrol scrollviewer virtualizingstackpanel

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

mac osx雪豹中的pyqt安装问题

我正在学习制作桌面应用程序的教程.使用python和qt4,我下载并安装了qt creator ide,创建了.ui文件然后我不得不使用pyuic4转换它,我一直在尝试很多东西但仍然无法做到.

我认为pyuic4将与Qt creator IDE一起安装,但似乎并非如此,所以我通过macports安装了pyqt:

sudo port install py26-pyqt4
Run Code Online (Sandbox Code Playgroud)

我不知道,但是qt来了,所以建造它大约需要3个小时.

安装后我尝试再次转换.ui:

$ pyuic4-2.6 principal.ui -o prin.py
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/pyuic.py", line 4, in <module>
    from PyQt4 import QtCore
ImportError: No module named PyQt4
Run Code Online (Sandbox Code Playgroud)

没有名为PyQt4的模块?那不是我刚安装的那个吗?

谢谢,如果我的英语不是100%好,请原谅.

python macos qt macports

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

在Eclipse中使用C++

我想知道在Eclipse中编写C++有两种方法:下载用于C/C++开发人员Eclipse IDE,或者下载常规Eclipse for Java并添加CDT插件.这两者有什么区别?(请注意,我已经非常使用Eclipse for Java)谢谢

c++ eclipse eclipse-cdt

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