我有一个带有PID的记事本:2860
#include <iostream>
#include <windows.h>
#include <psapi.h>
using namespace std;
HWND SendIt (DWORD dwProcessID){
HWND hwnd = NULL;
do {
hwnd = FindWindowEx(NULL, hwnd, NULL, NULL);
DWORD dwPID = 0;
GetWindowThreadProcessId(hwnd, &dwPID);
if (dwPID == dwProcessID) {
cout<<"yay:"<<hwnd<<":pid:"<<dwPID<<endl;//debug
PostMessage(hwnd,WM_KEYDOWN,'A',1); //send
}
} while (hwnd != 0);
return hwnd; //Ignore that
}
int main()
{
SendIt(2680); //notepad ID
return 0;
}
Run Code Online (Sandbox Code Playgroud)
和记事本应该写信A但没有任何反应.
我尝试WM_DESTROY了它的消息,它正在工作,但WM_KEYDOWN没有工作.
我也做了GetLastError(),它打印错误2 ERROR_FILE_NOT_FOUND.
为什么这不起作用,是否可以修复它?
tomcat引擎中有一些我们想要访问运行时的信息,因此我们在应用程序上下文中有以下内容(从此博客文章中获取):
<bean id="tomcatEngineProxy" class="org.springframework.jmx.access.MBeanProxyFactoryBean">
<property name="objectName" value="Catalina:type=Engine" />
<property name="proxyInterface" value="org.apache.catalina.Engine" />
<property name="useStrictCasing" value="false" />
</bean>
Run Code Online (Sandbox Code Playgroud)
在控制器中,我们然后像这样自动装配它:
@Autowired
private MBeanProxyFactoryBean tomcatEngineProxy = null;
Run Code Online (Sandbox Code Playgroud)
我们无法org.apache.catalina.Engine像在博客文章中那样接线,因为在构建时我们无法使用该类.它仅在运行时可用,并且在不同的计算机上运行所有不同的tomcat版本.
我们能够使用反射从这个@Autowire获取我们需要的信息.现在,我们希望将此功能转移到服务中.我将此添加到我们的应用上下文中:
<bean id="myService" class="com.foo.bar.MyServiceImpl">
<constructor-arg ref="tomcatEngineProxy" />
</bean>
Run Code Online (Sandbox Code Playgroud)
这堂课看起来像这样:
public class MyServiceImpl implements MyService
{
public MyServiceImpl(MBeanProxyFactoryBean tomcatEngineProxy) throws Exception
{
//stuff with the proxy
}
.....
}
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我收到以下错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myService' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of …Run Code Online (Sandbox Code Playgroud) 我正处于将基于Word的文档转换为XML的非常痛苦的过程中.我遇到了以下问题:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<p>
<element>This one is taken care of.</element> Some more text. „<hi rend="italics">Is this a
quote</hi>?” (Source). </p>
<p>
<element>This one is taken care of.</element> Some more text. „<hi rend="italics">This is a
quote</hi>” (Source). </p>
<p>
<element>This one is taken care of.</element> Some more text. „<hi rend="italics">This is
definitely a quote</hi>!” (Source). </p>
<p>
<element>This one is taken care of.</element> Some more text.„<hi rend="italics">This is a
first quote</hi>” (Source). „<hi rend="italics">Sometimes there is a second quote …Run Code Online (Sandbox Code Playgroud) 我需要一个方法中的类名称,例如X.同时,我不想放弃类型安全,我不会允许其他开发人员将字符串(类名)传递给该方法.
像这样的东西:
void X( ??? class) // --> don't know how
{
var className = get the name of class // --> which I don't know how
Console.WriteLine(className);
}
X(tblEmployee); //--> usage of X, where tblEmployee is a POCO class
Run Code Online (Sandbox Code Playgroud) UILabels我的习惯中有三个UITableViewCell.可能有些UILabels会是空的(label.text == @"")
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"EventCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSString *key = [[keysArray objectAtIndex:indexPath.section] description];
UILabel *nameLabel = (UILabel *)[cell viewWithTag:100];
namelabel.text = @"Label 1";
UILabel *locationLabel = (UILabel *)[cell viewWithTag:101];
location.text = @"Label 2";
UILabel *timeLabel = (UILabel *)[cell viewWithTag:102];
timeLabel.text = @"";
return cell;
}
Run Code Online (Sandbox Code Playgroud)
如何UILabels使用自动布局将所有非空垂直居中放置在单元格中?
这是三个标签的外观

如果其中一个UILables是空的,它看起来如何

这就是我希望它看起来的样子:

为简单起见,我会在这里将我的问题描述为理论问题.
想象一下,你有两个表 - MATCHES和FIGHTERS.'战士'有一个战士列表(pk_fighter_id,战斗机名称),其中任何两个都可以安排互相攻击.'匹配'可能是一个三字段表(pk_fight_num,fk_fighter_id1,fk_fighter_id2),它跟踪这些配对.Fighter1和Fighter2是引用Fighters表中条目的外键.
我需要获得所有战斗的清单,以显示谁在战斗谁,即"23123 | Pacquaio | Marquez." 我如何构建我的查询呢?
我想象的是:
select fk_fighter_id1, fk_fighter_id2
from matches
inner join fighters on matches.fk_fighter_id1=fighters.pk_fighter_id
inner join fighters on matches.fk_fighter_id2=fighters.pk_fighter_id;
Run Code Online (Sandbox Code Playgroud)
当我尝试在Access中嘲笑它时,我将它拼凑在一起,但它不起作用:
SELECT matches.match_no, fighters.fighter_name, fighters.fighter_name
FROM fighters
INNER JOIN matches ON (fighters.fighter_id = matches.fighter2) AND (fighters.fighter_id = matches.fighter1);
Run Code Online (Sandbox Code Playgroud)
那么,有什么想法吗?我只是不知道从哪里开始.
我的问题很简单.但无法解决执行我的Perl脚本后收到的"不适当的I/O控制操作"错误.
#!C:/Perl/bin/perl.exe -w
use strict;
my $file = "D:/file.csv";
open(my $data, '<', $file) or die "Could not open '$file' $!\n";
while (my $line = <$data>) {
chomp $line;
my @fields = split "," , $line;
print $fields[1]."\n";
}
Run Code Online (Sandbox Code Playgroud)
任何想法,我做错了什么?我在Windows7上的ActiveState perl上运行此脚本
我的IIS应用程序(.NET 4.0,IIS7)在内存中不断增长,并最终坍塌,就像我有内存泄漏一样.
所以当它上升到大约1.7GB时我拿了一个DMP并在WinDbg中打开它.
dumpheap -stat命令显示,虽然我在堆中有相当数量的对象,但大多数(以及在查看顺序DMP时增长的位)被标记为"Free"(> 800MB):
000007feef55b768 46091 2212368 System.Data.DataRowView
000007fe9739dda8 10355 2236680 Newtonsoft.Json.Serialization.JsonProperty
000007fef4260610 33062 2644960 System.Signature
000007fef4242250 41809 4682608 System.Reflection.RuntimeMethodInfo
000007fef424f058 69232 8847997 System.Byte []
000007fef4241b28 11 9437680 System.Double []
000007fef4237ca0 15 9505176 System.DateTime []
000007fef424c168 32559 11009308 System.Char []
000007fef424dc30 17271 11795376 System.Int32 []
000007feef555c48 908 17936672 System.Data.RBTree`1 + Node [[System.Int32,mscorlib]] []
000007feef554f58 853 22056952 System. Data.RBTree`1 + Node [[System.Data.DataRow,System.Data]] []
000007feef5514b0 541444 51978624 System.Data.DataRow
000007fef424aee0 1550958 132599872 System.String
000007fef422f1b8 183607 178409288 System.Object []
0000000000d8b2d0 234017 844500226免费 …
我在toArray()这里阅读文档并在控制台中测试它.我找不到调用toArray()选择器和调用选择器本身之间的区别.
我得到了完全相同的结果,这是一个与选择器匹配的DOM元素数组.我甚至做了另一次测试
$("element").toArray()[0] === $("element")[0]
Run Code Online (Sandbox Code Playgroud)
根据w3schools
toArray()方法将jQuery选择器匹配的元素作为数组返回.
但是,看起来只是查询元素本身就完全一样.而且写起来也容易多了.
有谁知道这两者之间的区别?如果没有,我不明白这个功能的目的.
我知道let是声明块范围局部变量,但为什么它不支持重新声明和挂起var呢?
这个限制的设计目的是什么?
(function(){
'use strict';
alert(a); // undefined
var a;
})();
(function(){
'use strict';
alert(a); // error
let a;
})();
(function(){
'use strict';
var a;
var a;
alert(a); // undefined
})();
(function(){
'use strict';
let a;
let a; // error
alert(a);
})();
Run Code Online (Sandbox Code Playgroud) javascript ×2
arrays ×1
autolayout ×1
c# ×1
c++ ×1
class ×1
cocoa-touch ×1
ecmascript-6 ×1
heap ×1
ios ×1
ios6 ×1
java ×1
join ×1
jquery ×1
memory-leaks ×1
mysql ×1
perl ×1
proxy ×1
sendkeys ×1
sendmessage ×1
spring ×1
sql ×1
syntax-error ×1
type-safety ×1
w3wp.exe ×1
winapi ×1
windows ×1
xcode ×1
xml ×1
xslt ×1
xslt-2.0 ×1