我发现我"正在做WPF错误"并且令人沮丧地必须彻底检查我的代码.
我怎么能转换以下内容:
public static class SortName
{
public static int Compare(Person a, Person b)
{
return a.Name.CompareTo(b.Name);
}
}
Run Code Online (Sandbox Code Playgroud)
我称之为:
list.Sort(SortName.Compare);
Run Code Online (Sandbox Code Playgroud)
到ObservableCollection所需的格式.我怎么称呼它.到目前为止,我已经根据我在这里阅读的内容尝试了以下内容
class ObservableCollectionSortName<T> : ObservableCollection<T>
{
public int Compare (Person a, Person b)
{
return a.Name.CompareTo(b.Name);
}
}
Run Code Online (Sandbox Code Playgroud) 可能重复:
jQuery可以提供标签名称吗?
嗨!
这个问题是如此基本我感到惭愧,但我试图找到答案30分钟没有任何结果.
我如何找到下面代码中点击了哪种元素.
$('*').click(function (event) {
var this_element = $(this).???;
return false;
})
Run Code Online (Sandbox Code Playgroud)
我想要的是将this_element变量设置为'a'如果它是一个链接,'p'如果它是一个段'div'如果...
谢谢!
我们可以动态地在linq查询上的条件中放置吗?
例如:
class Result
{
string v1;
string v2;
string v3;
}
List<Result> result = (from r in results select r);
//i want to do something like the following....
if(conditionA)
{
result = result appened (or v1 = xxx)
}
else if(conditionB)
{
result = result appened (or v2 = xxx)
}
else if(conditionC)
{
result = result appened (or v3 == xxx)
}
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何处理Linq的情况????
钍
这是我的jquery代码:
$(document).ready(function() {
if ($('#login').length == 0) {
$('#login').css('background', "url('/css/login-bg.gif') 2px center no-repeat");
}
if ($('#password').length == 0) {
$('#password').css('background', "url('/css/password-bg.gif') 2px center no-repeat");
}
$('#login').focus(function() {
$(this).css('background', 'transparent');
});
$('#password').focus(function() {
$(this).css('background', 'transparent');
});
});
Run Code Online (Sandbox Code Playgroud)
它适用于Firefox但不适用于IE7或IE8.为什么?
此代码的目的:它应该在登录表单中显示用户友好的文本,以便用户知道填写用户名和密码输入字段的内容.这很重要,因为输入字段没有标签(我知道......但客户端只是不想要标签).
if($('#selector').length == 0)条件存在,因为如果用户在浏览器中保存他/她的用户名和密码,浏览器将自动填写保存的值,因此它确保了背景图像不重叠他们.
我有一个JSON字符串:
{"responseData":
{"results": [
{"GsearchResultClass": "GblogSearch",
"title":"\u003cb\u003eParis Hilton\u003c/b\u003e shops at Sydney Michelle boutique in the Beverly Glen \u003cb\u003e...\u003c/b\u003e",
"titleNoFormatting":"Paris Hilton shops at Sydney Michelle boutique in the Beverly Glen ...",
"postUrl":"http://www.celebrity-gossip.net/celebrities/hollywood/paris-hilton-sydney-michelle-stockup-215844/",
"content":"\u003cb\u003eParis Hilton\u003c/b\u003e shops at Sydney Michelle boutique in the Beverly Glen Mall - \u003cb\u003eParis Hilton\u003c/b\u003e: Sydney Michelle Stockup.",
"author":"The Gossip Girls at (c) gossipgirls.com",
"blogUrl":"http://www.celebrity-gossip.net/",
"publishedDate":"Tue, 23 Feb 2010 22:26:00 -0800"
},
{"GsearchResultClass":"GblogSearch",
"title":"\u003cb\u003eParis Hilton\u003c/b\u003e having wardrobe woes as she met with her lawyer",
"titleNoFormatting":"Paris Hilton having wardrobe woes …Run Code Online (Sandbox Code Playgroud) 我在Windows客户端和Linux服务器中使用X-Server远程使用Emacs.我注意到我可以使用ctrl-z暂停它,然后键入fg 1以使其再次工作.有没有办法可以让它停在我所在的机器上,然后登录到另一台机器并从我离开的地方开始?当我启动新的ssh会话时,emacs作业与我的终端没有关联.必须有一些"偷"它.
此外,也许有一个Emacs功能基本上会做同样的事情.但是,我认为关闭并重新打开所有文件和缓冲区需要相当长的时间.
我正在尝试动态托管WF4(RC)服务.我有一个包含两个项目的测试解决方案.第一个是声明性工作流服务库,其中包含一个根流程图活动,以及一个简单的自定义代码活动.工作流服务库不依赖于任何其他自定义程序集或引用.第二个是我的主机应用程序,在我的测试解决方案中只是一个控制台应用程序.
在我的主机应用程序中,我尝试使用ActivityXamlServices将工作流服务的Xaml加载到活动中,然后使用WorkflowServiceHost使用该活动启动工作流实例.
一旦我尝试新建WorkflowServiceHost对象,我就会遇到这个异常......
无法创建未知类型'{clr-namespace:DeclarativeServiceLibrary1} CodeActivity1'.
如果我从流程图设计器中删除CodeActivity1,一切运行正常.如果我从主机项目添加对工作流服务项目的直接引用,然后使用我的流程图活动的实例而不是从Xaml创建的活动创建WorkflowServiceHost,它也可以正常工作.
在动态加载时,似乎不喜欢使用我的CodeActivity.
任何人都有任何想法,为什么我不能动态创建我的工作流服务?
我的代码如下......
DeclarativeServiceLibrary1.Activity1.xaml ...
<Activity mc:Ignorable="sap" x:Class="DeclarativeServiceLibrary1.Activity1" sap:VirtualizedContainerService.HintSize="654,676" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:DeclarativeServiceLibrary1" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Flowchart sad:XamlDebuggerXmlReader.FileName="C:\dev\test\MyWorkflow\DeclarativeServiceLibrary1\Activity1.xaml" sap:VirtualizedContainerService.HintSize="614,636">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">False</x:Boolean>
<av:Point x:Key="ShapeLocation">270,2.5</av:Point>
<av:Size x:Key="ShapeSize">60,75</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 300,165</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Flowchart.StartNode>
<FlowStep x:Name="__ReferenceID0">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<av:Point x:Key="ShapeLocation">172.5,165</av:Point>
<av:Size x:Key="ShapeSize">255,90</av:Size>
<av:PointCollection x:Key="ConnectorLocation">300,255 300,285 300,299.5</av:PointCollection>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState> …Run Code Online (Sandbox Code Playgroud) 我一直听到微软VB.NET教程中使用的这两个词.当用于引用变量时,这两个单词之间有什么区别?
我有一个div设置为overflow: auto;.这个div的内容是可选择的(使用jQuery UI).
当div溢出并出现滚动条时,滚动条本身变为可选,因此滚动效果不佳.在FF/Chrome中,我可以滚动div但是我得到了可选择的轮廓.在Safari中,滚动条根本不会参与,因为可选择的处理程序会选择点击.
我可以使用选择器将滚动条添加到"取消"项目列表中吗?或任何其他方式来阻止滚动条可选?
这是我如何配置可选div的代码片段:
$(".mySelectable").selectable( {
cancel: '.myButton, .notSelectable',
filter: '.rowSelectable',
selecting: function(event, ui){
handleSelection(ui.selecting);
},
selected: function(event, ui) {
handleSelected(ui.selected);
},
unselected: function(event, ui) {
handleUnselected(ui.unselected);
}
});
Run Code Online (Sandbox Code Playgroud)
我的HTML看起来像:
<div class="mySelectable"> <!-- set to auto overflow -->
<div class="myButton">I can't be selected</div>
<div class="rowSelectable">I am a selectable row</div>
...
</div>
Run Code Online (Sandbox Code Playgroud)
理想情况下,我正在寻找可以添加到"取消"选项的内容,这有助于跳过滚动条.
管道参数是否仅适用于接受一个参数的功能?如果我们看看Chris Smiths页面上的例子,
// Using the Pipe-Forward operator (|>)
let photosInMB_pipeforward =
@"C:\Users\chrsmith\Pictures\"
|> filesUnderFolder
|> Seq.map fileInfo
|> Seq.map fileSize
|> Seq.fold (+) 0L
|> bytesToMB
Run Code Online (Sandbox Code Playgroud)
他的filesUnderFolder函数只期望rootFolder参数,如果函数期望两个参数,即
let filesUnderFolder size rootFolder
然后这不起作用:
// Using the Pipe-Forward operator (|>)
let size= 4
let photosInMB_pipeforward =
@"C:\Users\chrsmith\Pictures\"
|> filesUnderFolder size
|> Seq.map fileInfo
|> Seq.map fileSize
|> Seq.fold (+) 0L
|> bytesToMB
Run Code Online (Sandbox Code Playgroud)
因为我可以定义
let inline (>>) f g x y = g(f x y)
我认为我应该能够使用具有多个输入参数的函数的管道运算符,对吧?我错过了什么?