是否可以在"火与忘"方式之外使用Control.BeginInvoke?我想更改以下请求以委托回调方法,以便我可以在每个异步调用完成时执行某些操作.
this.BeginInvoke(new RefreshRulesDelegate(RefreshRules), new object[] { ctrl, ctrl.DsRules, ctrl.CptyId });
Run Code Online (Sandbox Code Playgroud)
我可以用普通的delegate.BeginInvoke这样做
RefreshRulesDelegate del = new RefreshRulesDelegate(RefreshRules);
del.BeginInvoke(ctrl, ctrl.DsRules, ctrl.CptyId, new AsyncCallback(RefreshCompleted), del);
Run Code Online (Sandbox Code Playgroud)
但因为我正在调用Control .BeginInvoke,因为我得到"跨线程操作无效"错误,所以无法执行此操作.
有人帮吗?
对于收到的一些答案,我将澄清"为什么".我需要在我的GUI上加载/刷新一个Control,而不需要锁定应用程序的其余部分.该控件包含许多控件(ruleListCtls),这些控件都需要检索数据集并将其传递给它们.即
public void RefreshAll()
{
foreach (LTRFundingRuleListControl ctrl in ruleListCtls)
{
this.BeginInvoke(new RefreshRulesDelegate(RefreshRules), new object[]{ctrl,ctrl.DsRules, ctrl.CptyId });
}
}
Run Code Online (Sandbox Code Playgroud)
我发现如果我提供一个委托回调方法并将修改控件的任何代码移回到创建它们的主GUI线程上(以避免跨线程错误),我可以这样做
public void RefreshAll()
{
IntPtr handle;
foreach (LTRFundingRuleListControl ctrl in ruleListCtls)
{
handle = ctrl.Handle;
RefreshRulesDsDelegate del = new RefreshRulesDsDelegate(RefreshRulesDs);
del.BeginInvoke(ctrl.DsRules, ctrl.CptyId, handle, out handle, new AsyncCallback(RefreshCompleted), del);
}
}
private void RefreshCompleted(IAsyncResult result) …Run Code Online (Sandbox Code Playgroud) 在myEclipse 8中调试我们的webapp时,我想使用maven-managed依赖项的源代码.
我已经设法将源附加到"Maven Managed Dependencies"类路径容器中的库,即当我从依赖项打开一个类文件时(例如使用Ctrl-Shift-T),我看到了源代码.
但是,当我为我的tomcat定义服务器连接器时,将wepapp部署到它,并以调试模式启动它,并且在同一个类的断点上执行暂停,编辑器窗格仅显示文本"source not found",以及按钮编辑"源查找路径".我试图手动添加"Maven Managed Dependencies"类路径容器,只是被告知"使用maven项目设置来配置依赖性解析".但是,我在该属性窗格中看不到有用的设置......
我该如何附上这些来源?我知道这适用于m2e插件和wtp,但我宁愿避免说服我的团队其他人切换插件......
为此,我需要使用LIKE关键字或其他类似的运算符:
在数据库中,名称和姓氏存储为一列,并且按顺序存储surname name(例如"Doe John").
我有一个搜索栏,让你输入你的姓名.当我要去搜索时,我要求你输入name surname而不是surname name(例如,如果你输入"John Doe"),我仍然希望看到相同的结果就像你写的一样surname name.
我怎样才能做到这一点?
我想从表中删除一组行.我可以决定哪些行需要删除.只有当行数大于5(基于条件)时,我才会从表中删除行.
考虑这个示例数据
ID--Col1--Col2--
1 A X
2 A X
3 A X
4 A X
5 A X
6 A X
7 A X
8 A X
9 A X
10 A X
11 B X
12 B X
13 B X
14 B X
15 C X
16 C X
17 C X
18 D X
19 D X
Run Code Online (Sandbox Code Playgroud)
我想删除5行{*,A,X},我需要保留5行(无论哪一行).我不会删除B,C&D,因为它们的数量小于5.
喜欢
delete from tableA
--- I can decide on the rows to delete based on two conditions.
where col1 …Run Code Online (Sandbox Code Playgroud) 我想这有点滥用这个功能,但我仍然很好奇它是否可以完成 - 我想做的事情如下:
with conditional(a):
print 1
Run Code Online (Sandbox Code Playgroud)
因此print 1只有在== True时才执行该部分.这可能吗?
编辑:像下面的人一样,这是一种可怕的风格.这只是一个谜语\问题.不要在家里试试,不要因为胆小的人等.
这让整个团队疯狂.IIS或我们的Web服务器必须有一些简单的错误配置部分,但每次我们尝试在IIS 7.5上运行ASP.NET Web应用程序时,都会出现以下错误...
这是完整的错误:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration
data for the page is invalid.
`Detailed Error Information`
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007000d
Config Error
Config File \\?\E:\wwwroot\web.config
Requested URL http://localhost:80/Default.aspx
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Config Source
-1:
0:
Run Code Online (Sandbox Code Playgroud)
该计算机正在运行Windows Server 2008 R2.我们正在使用Visual Studio 2008开发Web应用程序.
根据Microsoft的代码8007000d意味着我们的web.config中存在语法错误 - 除了项目构建并在本地运行良好.查看XML …
今天我被一位资深开发人员问到,如果我要为开放网络写一些东西(个人/非商业),我会使用哪种doctype.
我回答说,<!doctype html>我受到一阵震惊,恐惧和惊讶的欢迎,然后被要求解释自己.
在我看来,它是一个很好的候选者,因为当前的浏览器(IE,FF,Opera,Safari)会查看它并将内容切换到标准模式 - 即使它们没有实现HTML5.如果我想真正利用HTML5元素,我可以使用一些javascript来创建对那些不被IE(例如document.createElement('article');)识别的标签的引用,然后使用它们就好像它们是DOM的本机部分一样.
这真的是一个糟糕的答案吗?你会回答什么,为什么?
简单的问题.我有一个包含3个组件的面板.所有这些都有Align:= alRight.但问题是在运行时它们的顺序与设计时间不同.
我可以改为使用alCustom强制订购右边界吗?我用的是D2007.
我有一个Web表单,它使用Telerik RadAjaxManager(通过RadAjaxManager代理)根据过滤条件更新RadGrid.当标准改变时,我重新绑定网格,但现在我还想使用JavaScript在客户端上调整网格大小.当我重新绑定网格时,如何才能执行JavaScript?JS代码已经存在于页面上,只需要调用.
例如,当我增加RadGrid中的行数时,它会恢复到默认高度,远小于其容器的高度,直到我调整大小或重新加载页面时,网格的大小由下面的代码调整.我希望能够resizeChildren()在我的标准和行数发生变化时执行.
function resizeChildren() {
$("#ctl00_mainContentPlaceHolder_grid_GridData").height($(window).height() - 160);
}
$(document).ready(function() {
resizeChildren();
});
$(window).resize(function() {
resizeChildren();
});
Run Code Online (Sandbox Code Playgroud)
我知道我可以完全使用客户端代码执行此操作,但我想知道如何执行客户端代码作为对Ajax回调的响应的一部分.
我写了一些像这样的代码来启动我的应用程序中嵌入的ftp服务器.它基于apache ftpserver
我发现匿名用户无法登录.客户端保持530.
我是否为ftp添加了配置文件?我找不到任何API来创建要添加到UserManger的用户.
private void start_ftp() throws FtpException {
FtpServerFactory serverFactory = new FtpServerFactory();
ListenerFactory factory = new ListenerFactory();
// set the port of the listener
factory.setPort(DEF_FTP_PORT);
// replace the default listener
serverFactory.addListener("default", factory.createListener());
Ftplet fl = new MyFtplet();
Map<String, Ftplet> map_ftplest = new LinkedHashMap<String, Ftplet>();
map_ftplest.put("default", fl);
serverFactory.setFtplets(map_ftplest);
UserManagerFactory u_factory = new PropertiesUserManagerFactory();
UserManager u_manager = u_factory.createUserManager();
//u_manager.
Boolean b = u_manager.doesExist("anonymous");
serverFactory.setUserManager(u_manager);
// start the server
server = serverFactory.createServer();
server.start();
}
Run Code Online (Sandbox Code Playgroud)