这可能是一个简单的问题,但我无法让它发挥作用.我正在使用jQuery对话框来显示从我网站上的另一个页面加载的表单.用户单击链接,该链接将激活对话框.我想要做的是在将HTML加载到对话框后运行一个函数.这是加载对话框的代码:
$(document).ready(function () {
$(".openDialog").live("click", function (e) {
e.preventDefault();
$("#dialogBox").dialog({
title: $(this).attr("data-dialog-title"),
close: function() { $(this).remove() },
modal: true
})
.load(this.href);
});
$(".close").live("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
});
Run Code Online (Sandbox Code Playgroud)
我有一个函数myFunction(),我想在HTML加载到对话框时调用.在环顾四周之后,我尝试在.load中指定函数,如下所示:
.load(this.href, myFunction());
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用open事件,如下所示:
open: myFunction(),
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
用户在单独的文本框中输入日期和时间.然后我将日期和时间合并到一个日期时间.我需要将此日期时间转换为UTC以将其保存在数据库中.我将用户的时区ID保存在数据库中(他们在注册时选择它).首先,我尝试了以下方法:
string userTimeZoneID = "sometimezone"; // Retrieved from database
TimeZoneInfo userTimeZone = TimeZoneInfo.FindSystemTimeZoneById(userTimeZoneID);
DateTime dateOnly = someDate;
DateTime timeOnly = someTime;
DateTime combinedDateTime = dateOnly.Add(timeOnly.TimeOfDay);
DateTime convertedTime = TimeZoneInfo.ConvertTimeToUtc(combinedDateTime, userTimeZone);
Run Code Online (Sandbox Code Playgroud)
这导致了一个例外:
The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly. For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local
然后我尝试设置Kind属性,如下所示:
DateTime.SpecifyKind(combinedDateTime, DateTimeKind.Local);
Run Code Online (Sandbox Code Playgroud)
这没用,所以我尝试了:
DateTime.SpecifyKind(combinedDateTime, DateTimeKind.Unspecified);
Run Code Online (Sandbox Code Playgroud)
这也不起作用.任何人都可以解释我需要做什么吗?我甚至会以正确的方式解决这个问题吗?我应该使用DateTimeOffset吗?
性能方面,哪个更快?
新操作符分配的对象指针的向量?
std::vector<Object *> array;
Run Code Online (Sandbox Code Playgroud)
还是在构造函数中分配了new的数组?
Object[] objects;
objects = new objects[64];
Run Code Online (Sandbox Code Playgroud)
想法是,在每个帧中,程序都会循环遍历每个元素,以读取/写入每个元素的值。
编辑:
第二段摘自XNA书。我没有使用XNA编写框架,而是试图找出在需要速度的应用程序中使用容器的最佳方法。