我想通过使用jquery做下面的步骤.有谁知道很好的解决方案?
获取"ul"元素的DOM对象.
<ul id="rows">
<li class="row1">
<a class="row1-1" href="/kensaku2/Page1" title="page1">
2011/11/16</a>
</li>
<li class="row2">
<a class="row1-2" href="/kensaku2/Page2" title="page2">
2011/11/15</a>
</li>
<li class="row3">
<a class="row1-3" href="/kensaku2/Page3" title="page3">
2011/12/21</a>
</li>
<li class="row4">
<a class="row1-4" href="/kensaku2/Page4" title="page4">
2011/12/05</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)找到"a"元素的内容等于'2011/12/21'.(这是"row3"li元素.)
将"li"元素移动到头部.(另见波纹管代码.)
<ul id="rows">
<li class="row3">
<a class="row1-3" href="/kensaku2/Page3" title="page3">
2011/12/21</a>
</li>
<li class="row1">
<a class="row1-1" href="/kensaku2/Page1" title="page1">
2011/11/16</a>
</li>
<li class="row2">
<a class="row1-2" href="/kensaku2/Page2" title="page2">
2011/11/15</a>
</li>
<li class="row4">
<a class="row1-4" href="/kensaku2/Page4" title="page4">
2011/12/05</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)我已经知道如何获得像这样的"ul"元素的DOM对象.
$("#rows").get(0)
Run Code Online (Sandbox Code Playgroud)
但我不知道第2步和第3步.所以,我想问专家.
我是WCF的初学者,我正在Essential WCF学习.
我在使用ServiceContract NameSpace和Name时遇到了问题.当我运行代码时,我发现了一个波纹管InvalidOperationException.但我无法理解清楚.
绑定实例已与侦听URI"http:// localhost:8080/NamespaceChange01"相关联.如果两个端点想要共享相同的ListenUri,则它们还必须共享相同的绑定对象实例.两个冲突的端点要么在AddServiceEndpoint()调用中,在配置文件中指定,要么在AddServiceEndpoint()和config的组合中指定.
有谁知道如何使用InvalidOperationException?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace NamespaceChange01
{
[ServiceContract(Name = "MyServiceName", Namespace = "http://ServiceNamespace")]
public interface IBurgerMaster
{
[return: MessageParameter(Name = "myOutput")]
[OperationContract(Name = "OperationName", Action = "OperationAction", ReplyAction = "ReplyActionName")]
double GetStockPrice(string ticker);
}
[ServiceBehavior(Namespace = "http://MyService")]
public class BurgerMaster : IBurgerMaster
{
public double GetStockPrice(string ticker)
{
return 100.99;
}
}
class Program
{
static void Main(string[] args)
{
ServiceHost host = new ServiceHost(typeof(BurgerMaster));
host.Open();
Console.ReadLine(); …
Run Code Online (Sandbox Code Playgroud) 我是一名WCF的大个子.我制作了一个简单的WCF服务和一个上传文件的客户端.但是当上传超过100KB时我收到了400个错误的请求.我在互联网上搜索并找到了一些关于修改max*Length或max**size的决议.但我还在苦苦挣扎.
所以,我想问专家如何解决问题.
服务代码在这里.
[ServiceContract]
public interface IService1
{
[OperationContract]
void SaveFile(UploadFile uploadFile);
}
[DataContract]
public class UploadFile
{
[DataMember]
public string FileName { get; set; }
[DataMember]
public byte[] File { get; set; }
}
public class Service1 : IService1
{
public void SaveFile(UploadFile uploadFile)
{
string str = uploadFile.FileName;
byte[] data = uploadFile.File;
}
}
Run Code Online (Sandbox Code Playgroud)
服务配置在这里.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="64000000"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors> …
Run Code Online (Sandbox Code Playgroud) 我正在Windows Phone 7应用程序上创建一个登录页面.当在异步线程上从服务器返回登录错误消息时,我想在登录页面上获取登录错误状态代码.
所以我的问题是:在下面的代码示例中,请告诉我你如何在Main方法中获得"responseString(string)"?
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetrequeststream.aspx
using System;
using System.Net;
using System.IO;
using System.Text;
using System.Threading;
class HttpWebRequestBeginGetRequest
{
private static ManualResetEvent allDone = new ManualResetEvent(false);
public static void Main(string[] args)
{
// Create a new HttpWebRequest object.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.contoso.com/example.aspx");
request.ContentType = "application/x-www-form-urlencoded";
// Set the Method property to 'POST' to post data to the URI.
request.Method = "POST";
// start the asynchronous operation
request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), request);
// Keep the main thread from continuing while the asynchronous
// operation …
Run Code Online (Sandbox Code Playgroud) 请告诉我如何在Window Phone 7的文本框中屏蔽密码等字符.
像这样:
用户名:okame100
密码:**************
我想从代码中更改DataTemplate中TextBlock的前景颜色(下面的TitleText和DateText).
<ListBox x:Name="listBox1" ItemsSource="{Binding}" ScrollViewer.ManipulationMode="Control" SelectionChanged="listBox1_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel x:Name="stackPanel1" HorizontalAlignment="Stretch" Orientation="Horizontal">
<TextBlock FontSize="35" x:Name="TitleText" Text="{Binding Title}" Width="386" Foreground="Black" />
<TextBlock FontSize="25" x:Name="DateText" Text="{Binding Date}" Width="78" Foreground="Black" />
<TextBlock x:Name="Id" Text="{Binding Id}" Visibility="Collapsed" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
我想在代码背后这样做.但它似乎无法访问DataTemplate中的x:Name属性.
this.TitleText.Foreground = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0);
Run Code Online (Sandbox Code Playgroud)
有谁知道这个很好的解决方案?