我想使用EditTextPreference显示2个输入字段而不是1.例如,应显示用户名和密码字段.我不想为每一个使用对话框.如何才能做到这一点?在WiFi设置中有一个可以执行此操作,当您想要连接到受保护的网络时,会出现一个对话框,显示为2个字段设置凭据存储的密码.
我有一个WCF服务,它在IIS中托管.我也有一个WCF客户端(一个控制台应用程序).我已经习惯于svcutil构建代理类和配置文件,然后将它们添加到我的客户端项目中.它建立得很好.但是当我试图运行该程序时,它抛出了以下异常
无法在ServiceModel客户端配置部分中找到引用合同"IService"的默认端点元素.这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素.
//我的客户端程序代码
namespace MyFirstWCFClient
{
class Program
{
static void Main(string[] args)
{
ServiceClient objClient = new ServiceClient();
Console.WriteLine("Client calling the service....");
string strName=Console.ReadLine();
Console.WriteLine(objClient.HelloWorld("Shyju"));
Console.Read();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的客户端的Output.config文件是
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" /> …Run Code Online (Sandbox Code Playgroud) 我构建了一个引用COM互操作DLL的程序集.如果我通过在Reference的属性(VS2010)中将Embed Interop Types设置为True来嵌入COM互操作类型,则在运行时会发生错误"对象不包含get_Range的定义".如果未嵌入COM互操作类型,则不会发生错误.
有谁知道为什么一个特定的方法,Worksheet.get_Range应该被省略或如何解决这个或有任何其他相关的见解?我应该感激任何帮助.
interop dll包含对Worksheet.get_Range(object,[object])的引用.在我的调用程序集中使用反射器,在工作表下没有提到get_Range.
我嵌入的互操作程序集是从Excel9.olb生成的.我没有使用PIA,因为该应用程序针对多个Excel版本.
我正在尝试使用以下方法将Django数据存储在MS SQL Server 2005上:
http://code.google.com/p/django-pyodbc/(pyodbc + FreeTDS)
只要我存储由ASCII字符组成的字符串,一切都可以.当我使用unicode(例如'\ xc5\x82')时,django会抛出ProgrammingError:
ProgrammingError at /admin/cli/punktrejestracji/add/
('42000', '[42000] [FreeTDS][SQL Server]The incoming tabular data stream (TDS) protocol stream is incorrect. The stream ended unexpectedly. (4002) (SQLExecDirectW)')
Run Code Online (Sandbox Code Playgroud)
跟踪的最后一个元素是:
params ('\xc5\x82',)
self <django.db.backends.sql_server.pyodbc.base.CursorWrapper object at 0x92ef8ec>
sql 'SELECT (1) AS [a] FROM [cli_punktrejestracji] WHERE [cli_punktrejestracji].[adres] = ? '
Run Code Online (Sandbox Code Playgroud)
BTW http://code.google.com/p/django-mssql/似乎不能在Linux下运行,django-mssql需要pythoncom库.我对吗?
我认为当你使用帖子时,帖子发送了HTTP标题中的所有信息(显然我没有充分了解这个主题),所以我很困惑为什么你必须将urlencode()数据转换为key=value&key2=value2格式.使用POST时,这种格式如何发挥作用?:
# Fail
data = {'name': 'John Smith'}
urllib2.urlopen(foo_url, data)
Run Code Online (Sandbox Code Playgroud)
但
# Success
data = {'name': 'John Smith'}
data = urllib.urlencode(data)
urllib2.urlopen(foo_url, data)
Run Code Online (Sandbox Code Playgroud) 我有一些函数,我在ready()事件中加载.这些基本上使列表可拖动,其他区域可放置/可排序.例如.您可以将克隆拖动到多个区域(div中的列表),并且在这些多个区域内,您可以对它们进行排序/重新排序(但仅限于每个区域内).这非常有效.
我有一个按钮,动态地为要放入的项目创建一个新区域,然后进行排序.它完美地创建了新区域,但是您不能将项目放入其中,或者甚至使它们可以排序.
我意识到这与我使用ready()事件在页面加载时使所有区域都可以删除/排序这一事实有关,并且实际上并没有动态地重新运行这些函数.
我尝试在按钮的单击功能中对这些元素使用'刷新'.例如.
$(".field > li").draggable('refresh');
$(".dragrow1, .dragrow2").droppable('refresh');
$(".dragrow1, .dragrow2").sortable('refresh');
Run Code Online (Sandbox Code Playgroud)
但这不起作用.如果我能提供帮助,我想避免以任何方式重复我的代码.有没有办法使这项工作?我认为,如果有类似'live()'函数的东西,你可以使用'ready()',那么这可能是一个解决方案,但不是......!
谢谢.
如何使用许多其他@properties对named元组进行扩展或子类化?
对于少数人,可以写下面的文字; 但是有很多,所以我正在寻找发电机或物业工厂.一种方法是从中生成文本_fields并执行它; 另一个是在运行时具有相同效果的add_fields.
(我的@props是为了让数据库中的行和字段分散在几个表中,所以rec.pname就是这样persontable[rec.personid].pname;但是,带有智能字段的namedtuples也有其他用途.)
""" extend namedtuple with many @properties ? """
from collections import namedtuple
Person = namedtuple( "Person", "pname paddr" ) # ...
persontable = [
Person( "Smith", "NY" ),
Person( "Jones", "IL" )
]
class Top( namedtuple( "Top_", "topid amount personid" )):
""" @property
.person -> persontable[personid]
.pname -> person.pname ...
"""
__slots__ = ()
@property
def person(self):
return persontable[self.personid]
# def add_fields( self, Top.person, Person._fields ) with the same …Run Code Online (Sandbox Code Playgroud) 我试图将我的字符串格式化值转换为格式的日期类型dd/MM/yyyy.
this.Text="22/11/2009";
DateTime date = DateTime.Parse(this.Text);
Run Code Online (Sandbox Code Playgroud)
问题是什么 ?它有一个要求的第二个覆盖IFormatProvider.这是什么?难道我还需要通过这个?如果是,如何在这种情况下使用它?
编辑
Parse和之间有什么区别ParseExact?
编辑2
Slaks和Sam的两个答案都适合我,目前用户正在提供输入,但我将确保使用maskTextbox它们是有效的.
考虑到类型安全性,性能或您想要的所有方面,哪个答案更好
如何编写类,以便在其他项目中引用dll的人可以看到属性和方法描述?
[Description("My age in years attribute")]
public int Age
{
get { return 0; }
set { }
}
Run Code Online (Sandbox Code Playgroud)
不起作用,也不起作用
/// <summary>
/// My age in years attribute
/// </summary>
public int Age
{
get { return 0; }
set { }
}
Run Code Online (Sandbox Code Playgroud) .net ×2
c# ×2
python ×2
.net-4.0 ×1
android ×1
attributes ×1
c++ ×1
casting ×1
class ×1
com-interop ×1
datetime ×1
django ×1
dll ×1
dynamic ×1
excel ×1
freetds ×1
hashtable ×1
iis ×1
interop ×1
jquery ×1
namedtuple ×1
odbc ×1
properties ×1
refresh ×1
sql-server ×1
stl ×1
types ×1
unicode ×1
urllib ×1
urllib2 ×1
wcf ×1
wcf-client ×1