问题列表 - 第10546页

在WPF应用程序中获取不活动/空闲时间

我正在寻找最好的方法来找出我的用户是否在我的WPF应用程序中空闲.目前,我从操作系统中获取这个空闲时间,如果它们最小化应用程序,并在Internet上搜索,则操作系统中有一个进程,因此操作系统不会将此视为非活动时间,即使它们没有进行应用程序内的任何内容 但是,我想知道他们是否没有点击或在我的申请中做任何事情.

这就是我现在的空闲时间.

myApplication.MainMethod()
    {
        System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
        myTimer .Interval = 1000;
        myTimer .Tick += new EventHandler(Timer_Tick);
        myTimer .Start();
    }

    void Timer_Tick(object sender, EventArgs e)
    {
        int idleTime= (int)Win32.GetIdleTime();
        if (idleTime<certainNumber)
        {
         //do this
         }
    }
Run Code Online (Sandbox Code Playgroud)

c# wpf

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

将Timer与DispatcherTimer进行比较

是什么区别between System.Windows.Forms.Timer()System.Windows.Threading.DispatcherTimer()?在哪些情况下,我们应该使用它们?任何最佳做法?

c# timer

97
推荐指数
2
解决办法
6万
查看次数

将varchar转换为smalldatetime会导致超出范围的值

代码:

strSql = "insert into table2 (transactiondate) values ('" & transactiondate & "')"
Run Code Online (Sandbox Code Playgroud)

好像给了我运行时错误:

The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value
Run Code Online (Sandbox Code Playgroud)

在代码中,strSql是一个String对象,transactiondate是一个Date对象.但是,在SQL数据库中,transactiondate是一个smalldatetime对象.

我已经尝试将smalldatetime更改为datetime(在数据库中),我尝试了transactiondate.toString()但没有成功.

怎么解决这个问题?

注意:我知道内联SQL的危险.我在这里寻找快速修复解决方案,而不是关于SQL注入的讨论.

vb.net smalldatetime

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

Subversion - 移动文件

是否可以将项目从SVN中的一个位置移动到另一个位置而不会丢失更改历史记录?

svn tortoisesvn

3
推荐指数
2
解决办法
4017
查看次数

什么是PowerShell cmdlet?

以概念的方式接近cmdlet,

  1. 它们是如何制作的?他们编译了吗?

  2. 它是否相当于PowerShell的批处理文件?它是脚本还是二进制文件?

  3. 用于存储这些cmdlet的结构是什么?

powershell cmdlets conceptual

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

为什么BeautifulSoup会抛出这个HTMLParseError?

我认为BeautifulSoup将能够处理格式错误的文档,但是当我发送页面的源代码时,会打印下面的回溯:


Traceback (most recent call last):
  File "mx.py", line 7, in 
    s = BeautifulSoup(content)
  File "build\bdist.win32\egg\BeautifulSoup.py", line 1499, in __init__
  File "build\bdist.win32\egg\BeautifulSoup.py", line 1230, in __init__
  File "build\bdist.win32\egg\BeautifulSoup.py", line 1263, in _feed
  File "C:\Python26\lib\HTMLParser.py", line 108, in feed
    self.goahead(0)
  File "C:\Python26\lib\HTMLParser.py", line 150, in goahead
    k = self.parse_endtag(i)
  File "C:\Python26\lib\HTMLParser.py", line 314, in parse_endtag
    self.error("bad end tag: %r" % (rawdata[i:j],))
  File "C:\Python26\lib\HTMLParser.py", line 115, in error
    raise HTMLParseError(message, self.getpos())
HTMLParser.HTMLParseError: bad end tag: u"", at line 258, column 34
Run Code Online (Sandbox Code Playgroud)

它应该不能处理这种东西吗?如果它可以处理它们,我怎么能这样做?如果没有,是否有一个可以处理格式错误的文件的模块? …

python parsing exception beautifulsoup malformed

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

创建文件时为8192个字节

在我的Java代码中,我有一个函数,它在http请求中从客户端获取文件并将其转换为文件.我有这条线:

byte[] buffer = new byte[8192];
Run Code Online (Sandbox Code Playgroud)

8192字节(8 kb)在这里意味着什么?

这是我得到的回复之一,并希望确保我理解该代码.

java bytearray

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

声音在AVAudioPlayer播放完成后执行操作?

我正在使用AVAudioPlayer框架,我有几个声音可以一次播放一个.声音播放结束后,我希望应用程序执行某些操作.我尝试使用audioPlayerDidFinishPlaying在第一个声音结束时执行操作,但我无法将其用于第二个声音,因为我遇到了重新定义错误.我可以使用NSTimeInterval来获取声音的持续时间吗?

//  ViewController.h
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVFoundation/AVAudioPlayer.h>

@interface ViewController : UIViewController {  
UIButton        *begin;
UIWindow        *firstTestWindow;
UIWindow        *secondTestWindow;
AVAudioPlayer   *player;
NSTimeInterval  duration;
}  

@property (nonatomic, retain) IBOutlet UIButton     *begin;
@property (nonatomic, retain) IBOutlet UIWindow     *firstTestWindow;
@property (nonatomic, retain) IBOutlet UIWindow     *secondTestWindow;
@property (nonatomic, retain)         AVAudioPlayer   *player;
@property (readonly)                   NSTimeInterval  duration;


- (IBAction)begin:(id)sender;
- (IBAction)doTapScreen:(id)sender;

@end



//ViewController.m
#import "ViewController.h"

@implementation ViewController

@synthesize begin, player, firstTestWindow, secondTestWindow;

//first sound
- (IBAction)begin:(id)sender; {

    [firstTestWindow makeKeyAndVisible];
    NSString *soundFilePath =
    [[NSBundle mainBundle] pathForResource: …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch nsdate avaudioplayer

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

如何防止ASP.NET事件的HTTP GET?或如何在所有事件上检查Request.Type?

在fiddler的帮助下,我使用以下HTTP GET请求进行了"重放攻击"

http://svr/Default.aspx__EVENTTARGET = LinkBut​​ton1&__ EVENTARGUMENT =&__ VIEWSTATE =%2snipg%3D%3D&__ EVENTVALIDATION =%2snip

令我惊讶的是,只要有有效的视图状态和事件验证,它就会起作用.以下停止GET我的点击事件,但......

protected void BtnUploadClick(object sender, EventArgs e)
{
   if(Request.RequestType == "GET") throw new HttpException(405, "GET not allowed for this.");
}
Run Code Online (Sandbox Code Playgroud)

我的代码遍布各个事件.有没有办法将此行为全局添加到通常是回发事件的事件中?

c# asp.net

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

散列连接和合并连接(Oracle RDBMS)之间有什么区别?

散列连接和合并连接之间的性能增益/损失是什么,特别是在Oracle RDBMS中?

sql oracle performance join

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