我有一个日期选择器控制器,当用户触摸屏幕上不是日期选择器的某处时,我想使其模糊。林对此的问题是我不了解是什么触发了模糊事件。例如,如果用户触摸下个月,则触发模糊事件,所以我想说,好吧,如果relatedTarget是datepicker(下个月)内的一个类,则显示下个月而不隐藏datepicker,如果relatedTarget是不在日历上隐藏它。问题在于relatedTarget始终是未定义的。
所以我有两个问题:
我正在尝试使用stringFormat格式化{datetime?}属性,但我不知道为什么它不适用于.
这是我的代码
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Label Content="{Binding From, StringFormat='{}{0:dd.MM.yyyy}'}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
Run Code Online (Sandbox Code Playgroud)
难道我做错了什么?
如果textBox字段为空,我想将SQL Server 2008数据库表中的所有行返回到SQL数据源.所以我用一个if @date IS NULL子句创建了一个存储过程.
虽然存储过程似乎在Visual Studio 2008中正常工作,但实际网页没有显示任何结果.
我猜我必须向DBNull存储过程发送一个值if if textBox.Text == string.Empty.我试过了,SqlDataSource1.SelectParameters.Add但似乎我得到转换错误DBNull.Value到字符串.
这是我的问题的根源还是我错过了其他的东西?DBNull.Value如果文本字段为空,我将如何传递到存储过程?
如果我有一个无向图,我怎样才能获得所有周期的列表?
例如,从下图中,我想要循环:
(a,b,d,e,c)
(a,b,c)
(b,d,e)
Run Code Online (Sandbox Code Playgroud)

此问题的后续行动:在JQuery中设置选择选项的背景颜色
我有一个包含多个选择框的页面,如下所示:
<select name="item-0-status" id="id_item-0-status">
<option value="">---------</option>
<option value="1">Online</option>
<option value="2">Offline</option>
<option value="3">Unknown</option>
</select>
Run Code Online (Sandbox Code Playgroud)
这些是在django中自动生成的,因此无法将css类,id或属性直接应用于选项.select元素包含'item-0-status','item-1-status','item-2-status'等ID.
我通过以下JQuery代码为选项分配颜色:
$('select[id$=-status][id^=id_item-]').children().each(
function (){
if($(this).val() == 0){
$(this).css('backgroundColor','white');
}
if($(this).val() == 1){
$(this).css('backgroundColor','green');
}
if($(this).val() == 2){
$(this).css('backgroundColor','red');
}
if($(this).val() == 3){
$(this).css('backgroundColor','orange');
}
}
);
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.
我还希望select元素与所选选项具有相同的背景颜色,我试图使用以下内容实现:
$('select[id$=-status][id^=id_item-]').each(
function (){
$(this).css('backgroundColor',$('option:selected',this).css('backgroundColor'));
}
);
Run Code Online (Sandbox Code Playgroud)
但是,这只是将选择元素用蓝色着色(我认为它是从悬停属性而不是背景中获取颜色).这是在Firefox 3.6.8中,出于此问题的目的,它是唯一关注的浏览器.
知道如何解决这个问题吗?
我正在使用谷歌地图api v3.
使用javascript,我怎样才能打开标记的infowindow给出它的坐标?
我在图f(),g()和h()上有几个函数,它们为同一个问题实现了不同的算法.我想使用unittest框架对这些函数进行单元测试.
对于每种算法,若干约束应始终有效(例如空图,仅包含一个节点的图,等等).不应重复这些常见约束检查的代码.所以,我开始设计的测试架构如下:
class AbstractTest(TestCase):
def test_empty(self):
result = self.function(make_empty_graph())
assertTrue(result....) # etc..
def test_single_node(self):
...
Run Code Online (Sandbox Code Playgroud)
然后是具体的测试用例
class TestF(AbstractTest):
def setup(self):
self.function = f
def test_random(self):
#specific test for algorithm 'f'
class TestG(AbstractTest):
def setup(self):
self.function = g
def test_complete_graph(self):
#specific test for algorithm 'g'
Run Code Online (Sandbox Code Playgroud)
......对于每种算法都是如此
不幸的是,nosetests尝试在AbstractTest中执行每个测试并且它不起作用,因为实际的self.function是在子类中指定的.我尝试__test__ = False在AbstractTest Case中进行设置,但在这种情况下,根本没有执行任何测试(因为我认为这个字段是继承的).我尝试使用抽象基类(abc.ABCMeta)但没有成功.我已经阅读了关于MixIn而没有任何结果(我对此并不十分自信).
我非常有信心我不是唯一一个试图将测试代码分解的人.你是如何用Python做到的?
谢谢.
我在我的应用程序中使用"SharedPreferences"来保留从多个edittext框保存/检索字符串值的功能,这样就可以了.我的活动中还有一个Spinner,它有一个字符串数组,用于它的可用值.但我不清楚如何将微调器选择写入SharedPreferences,然后读取SharedPreferences以退出并设置它的值.
这是我对edittext的配置:
-Button激活保存值到SharedPreferences-
public void buttonSaveSendClick(View view) {
SharedPreferences.Editor editor = getPreferences(0).edit();
EditText editTextCallId = (EditText) findViewById(R.id.editTextCallId);
editor.putString("editTextCallIdtext", editTextCallId.getText().toString());
editor.putInt("selection-startCallId", editTextCallId.getSelectionStart());
editor.putInt("selection-endCallId", editTextCallId.getSelectionEnd());
editor.commit();
}
Run Code Online (Sandbox Code Playgroud)
-Button激活从SharedPreferences恢复上次保存的值 -
public void buttonRestoreLastClick(View view) {
SharedPreferences prefs = getPreferences(0);
EditText editTextCallId = (EditText) findViewById(R.id.editTextCallId);
String editTextCallIdtextrestored = prefs.getString("editTextCallIdtext", null);
editTextCallId.setText(editTextCallIdtextrestored, EditText.BufferType.EDITABLE);
int selectionStartCallId = prefs.getInt("selection-startCallId", -1);
int selectionEndCallId = prefs.getInt("selection-endCallId", -1);
editTextCallId.setSelection(selectionStartCallId, selectionEndCallId);
}
Run Code Online (Sandbox Code Playgroud)
有关如何在第一个按钮(保存)中构建微调器选定值的集合的任何建议?那么如何在按下"恢复"按钮时将保存的值返回到微调器视图?
我正在尝试找到语法来确定div是否具有包含data-role属性设置为的子div header.我试过这些东西没有运气:
$('div[data-role*="page"]').each(function(i) {
if($(this).children('div').attr('data-role')=='header';) {
alert("has header");
}
});
Run Code Online (Sandbox Code Playgroud)
$('div[data-role*="page"]').each(function(i) {
if($(this).children('div[data-role*="header"]').length!=0;) {
alert("has header");
}
});
Run Code Online (Sandbox Code Playgroud) 我们正在运行IIS7并启用了Windows身份验证.其他一切都被禁用了.当我们转到页面时,我们不会提示我们进行Windows登录,但是会被重定向到默认的表单身份验证登录页面(帐户/登录?ReturnUrl =%2f).
有任何想法吗?谢谢.
asp.net iis-7 forms-authentication windows-authentication windows-server-2008-r2
asp.net ×2
javascript ×2
jquery ×2
.net ×1
algorithm ×1
android ×1
attributes ×1
css ×1
dbnull ×1
google-maps ×1
graph-theory ×1
iis-7 ×1
ipad ×1
nosetests ×1
onblur ×1
oop ×1
python ×1
refactoring ×1
sql ×1
sql-server ×1
unit-testing ×1
wpf ×1
wpfdatagrid ×1