问题列表 - 第28243页

使用C或C++从USB设备接收数据

我需要一个所有插入USB设备的列表,并让用户选择一个让控制台应用程序接收USB设备发送的任何数据.

然后,我可以开始使用我的程序中的数据.

我不想使用库,只有标准的C++函数,程序应该在Windows 98中使用.

c++ windows usb

12
推荐指数
2
解决办法
4万
查看次数

谷歌地图如何确定没有GPS的手机的位置

http://www.google.com/mobile/maps/

在没有gps的手机上使用它,也可以获得locatiosn.

我目前正在使用html5地理编码器/齿轮来获取位置.但是这只适用于iphone和android.如果没有这个功能,谷歌地图如何从手机获取信息?

maps gps google-maps geolocation cellid

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

WPF:如何调试绑定错误?

我在输出窗口中得到了这个:

System.Windows.Data错误:4:无法找到绑定源,引用'RelativeSource FindAncestor,AncestorType ='System.Windows.Controls.ItemsControl',AncestorLevel ='1''.BindingExpression:路径= VerticalContentAlignment; 的DataItem = NULL; target元素是'ListBoxItem'(Name =''); target属性是'VerticalContentAlignment'(类型'VerticalAlignment')

这是我的XAML,运行时看起来是正确的

        <GroupBox Header="Grant/Deny Report">
            <ListBox ItemsSource="{Binding  Converter={StaticResource MethodBinder}, ConverterParameter=GrantDeny, Mode=OneWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="{Binding Entity}"/>
                            <Label Content="{Binding HasPermission}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </GroupBox>
Run Code Online (Sandbox Code Playgroud)

wpf binding

13
推荐指数
1
解决办法
9380
查看次数

Haskell懒惰的I/O和关闭文件

我编写了一个小的Haskell程序来打印当前目录中所有文件的MD5校验和(递归搜索).基本上是Haskell版本的md5deep.一切都很好,花花公子,除非当前目录有大量的文件,在这种情况下,我收到如下错误:

<program>: <currentFile>: openBinaryFile: resource exhausted (Too many open files)
Run Code Online (Sandbox Code Playgroud)

似乎Haskell的懒惰导致它不会关闭文件,即使在相应的输出行已经完成之后也是如此.

相关代码如下.感兴趣的功能是getList.

import qualified Data.ByteString.Lazy as BS

main :: IO ()
main = putStr . unlines =<< getList "."

getList :: FilePath -> IO [String]
getList p =
    let getFileLine path = liftM (\c -> (hex $ hash $ BS.unpack c) ++ " " ++ path) (BS.readFile path)
    in mapM getFileLine =<< getRecursiveContents p

hex :: [Word8] -> String
hex = concatMap (\x -> printf "%0.2x" …
Run Code Online (Sandbox Code Playgroud)

haskell lazy-evaluation

20
推荐指数
3
解决办法
5010
查看次数

以下是否表示设计不良?

我想知道你是否认为以下代码通常表明设计不好......

class X
{
public:
  ...
private:
  Y y;
};

Class Y
{
public:
   Y( X& value ){ x = value; };
private:
   X& x;
}
Run Code Online (Sandbox Code Playgroud)

(即类X和Y之间存在某种循环依赖关系).

c++ dependencies class

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

ruby和python之间的语法区别?

我想知道是否有教程可以解决ruby和python的语法差异?

我已经看到ruby和php之间的比较,但不是ruby和python之间的比较.

我已经看过ruby和python,但是通过这种并排比较决定选择哪一个非常有用.

谢谢

ruby python

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

有关IEnumerable.GetEnumerator()的错误消息

我收到此错误消息,我无法弄清楚原因!

Error   1   'Exo5Chap12.ShortCollection<T>' does not implement interface member 
'System.Collections.IEnumerable.GetEnumerator()'. 
'Exo5Chap12.ShortCollection<T>.GetEnumerator()' cannot implement 
'System.Collections.IEnumerable.GetEnumerator()' because it does not have the matching 
return type of 'System.Collections.IEnumerator'.    
E:\MyFolders\Dev\c#\Chapter12\Exo5Chap12\Exo5Chap12\exo5.cs 9   18  Exo5Chap12
Run Code Online (Sandbox Code Playgroud)

以下是具有GetEnumerator()实现的代码.怎么了?

 public class ShortCollection<T> : IList<T>
{
    protected Collection<T> innerCollection;
    protected int maxSize = 10;
    public IEnumerator<T> GetEnumerator()
    {
        return (innerCollection as IEnumerator<T>).GetEnumerator();
    }
}
Run Code Online (Sandbox Code Playgroud)

c# ienumerable

8
推荐指数
2
解决办法
9369
查看次数

如何在c ++中绘制到屏幕?

我怎么在屏幕上画一些东西?不是控制台窗口而是整个屏幕,最好是控制台最小化.

它还会出现在版画屏幕上吗?我想要做的是在屏幕顶部创建一个类似于我和我的应用程序知道但仍能像往常一样使用应用程序的层.

这是一个例子:假设我想在屏幕中央出现2个黄色正方形,大小为5×5像素,位于所有其他应用程序的顶部,对于打印屏幕不可点击和不可见.

[编辑]

我忘了提到我在Windows XP上使用Visual Studio 2010.

c++ invisible screen draw

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

检查PHP中的方法可见性

有没有办法检查类方法是否已声明为私有或公共?

我正在使用一个控制器,其中url映射到类中的方法,我只想触发方法,如果它们被定义为public.

php oop methods visibility class

8
推荐指数
3
解决办法
1952
查看次数

如何在按键上实现上下文菜单而不是长按/点击

我有一个ListActivity,我想为每个列表元素实现上下文菜单.我知道这样做的常用方法是在长按/点击时显示上下文菜单.我想知道是否有办法在按键上显示每个元素的上下文菜单(最好是菜单键).要重新解释我的问题,如何通过按菜单键(或任何其他键)来触发上下文菜单而不是选项菜单.

android

10
推荐指数
2
解决办法
7989
查看次数