I'm building a website at this moment, and before starting this small project, my greatest fear was to implement some sort of a chatting system in the website. So the functionality of this chat should be very simple, for example if 2 users are online they can chat with each other, if a user is not online, but someone sents him a message, next time he logs in, he should be able to read and r
我现在正在建设一个网站,在开始这个小型项目之前,我最担心的是在网站上实施某种聊天系统。 因此,这种聊天的功能应该非常简单,例如,如果2个用户在线,他们可以相互聊天,如果用户不在线,但有人向他发送消息,下次登录时,他应该能够阅读并回复邮件。 所以它应该是像Facebook聊天等等... 我的朋友劝我检查一下Jabber。 我在寻找,但没有找到任何有关这方面的好消息。 也许任何人有任何良好的信息链接? 或者任何示例
I have the following ServiceContract and DataContract classes: [ServiceContract] public interface IWcfService { [OperationContract] Response GetData(); } [DataContract] public class Response { [DataMember] public Dictionary<string, object> Data { get; set; } } When the value of Response.Data dictionary is of type int, string, double or any other 'simple'
我有以下ServiceContract和DataContract类: [ServiceContract] public interface IWcfService { [OperationContract] Response GetData(); } [DataContract] public class Response { [DataMember] public Dictionary<string, object> Data { get; set; } } 当Response.Data字典的值类型为int,string,double或任何其他“简单”基元类型时,WCF可以成功序列化该对象。 但是,当Response.Da
This is the exception I am getting System.ArgumentException was unhandled HResult=-2147024809 Message=Parameter is not valid. Source=System.Drawing StackTrace: at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height) at System.Drawing.Graphics.FillRectangle(Brush brush
这是我得到的例外 System.ArgumentException was unhandled HResult=-2147024809 Message=Parameter is not valid. Source=System.Drawing StackTrace: at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height) at System.Drawing.Graphics.FillRectangle(Brush brush, Rectangle rect)
In validating email addresses I have tried using both the EmailAddressAttribute class from System.ComponentModel.DataAnnotations : [EmailAddress(ErrorMessage = "Invalid Email Address")] public string Email { get; set; } and the MailAddress class from System.Net.Mail by doing: bool IsValidEmail(string email) { try { var addr = new System.Net.Mail.MailAddress(email); return a
在验证电子邮件地址时,我尝试使用System.ComponentModel.DataAnnotations的EmailAddressAttribute类: [EmailAddress(ErrorMessage = "Invalid Email Address")] public string Email { get; set; } 和System.Net.Mail的MailAddress类执行以下操作: bool IsValidEmail(string email) { try { var addr = new System.Net.Mail.MailAddress(email); return addr.Address == email; } catch {
Just I want to clarify one thing. Per client request we have to create a regular expression in such a way that it should allow apostrophe in email address. My Question according to RFC standard will an email address contain aportrophe? If so how to recreate regular expression to allow apostrophe ? The regular expression below implements the official RFC 2822 standard for email addresses. U
只是我想澄清一件事。 根据客户端请求,我们必须创建一个正则表达式,以便在电子邮件地址中允许使用撇号。 根据RFC标准,我的问题是电子邮件地址是否包含一个端口? 如果是的话如何重新创建正则表达式以允许撇号 ? 下面的正则表达式实现了电子邮件地址的官方RFC 2822标准。 不推荐在实际应用中使用这个正则表达式。 它表明,通过正则表达式,确切和实际之间总是有一个折衷。 (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a
This question already has an answer here: How to validate an email address using a regular expression? 74 answers 尝试这个string strRegex = @"[A-Za-z0-9_-+]+@[A-Za-z0-9-]+.([A-Za-z]{2,3})(?:.[a-z]{2})?"; Regex myRegex = new Regex(strRegex, RegexOptions.None); string strTargetString = @"wjeqklejqwek myEmail@hotmail.com a;lekqlwe anothermail@mail.ru"; foreach (Match myMatch in myRegex.Matches(
这个问题在这里已经有了答案: 如何使用正则表达式验证电子邮件地址? 74个答案 尝试这个string strRegex = @"[A-Za-z0-9_-+]+@[A-Za-z0-9-]+.([A-Za-z]{2,3})(?:.[a-z]{2})?"; Regex myRegex = new Regex(strRegex, RegexOptions.None); string strTargetString = @"wjeqklejqwek myEmail@hotmail.com a;lekqlwe anothermail@mail.ru"; foreach (Match myMatch in myRegex.Matches(strTargetString)) { if (myMatch.Succe
What is the difference between driver and provider in database? Is there are any explanation will be grateful. sample : ADO.NET driver for MySQL vs providerName="System.Data.EntityClient" From the MSDN Forum: Driver is a program installed on a workstation or a server; it allows programs to interact with a Database Management System (DBMS). Such as, JDBC driver provides database
数据库中的驱动程序和提供程序有什么区别? 是否有任何解释将不胜感激。 示例: ADO.NET driver for MySQL vs providerName="System.Data.EntityClient" 来自MSDN论坛: 驱动程序是安装在工作站或服务器上的程序; 它允许程序与数据库管理系统(DBMS)交互。 例如,JDBC驱动程序通过J2EE中提供的标准JDBC应用程序接口(API)提供数据库连接。 数据提供者是一组用来与数据源通信的库。 如SQL的SQL数据提供者
How can I see if a byte array contains a gzip stream? My application gets files from other applications through http post with Base64 encoding. Depending on the implementation of the application that delivers the files, the byte array that comes out of the Base64 string can be gzipped. How can I recognize the gzipped arrays? I have found some method, but I think that it will go wrong when som
如何查看字节数组是否包含gzip流? 我的应用程序通过使用Base64编码的http post来从其他应用程序获取文件。 根据提供文件的应用程序的实现,可以对Base64字符串输出的字节数组进行gzip压缩。 我如何识别gzipped数组? 我找到了一些方法,但我认为当某人上传一个zip文件或准备好“坏”zip文件时会出错 这是我找到并且工作的东西,但是它可以以某种方式被利用吗? C# public static bool IsGZip(byte[] arr) { return a
I was having a discussion with a teammate about locking in .NET. He's a really bright guy with an extensive background in both lower-level and higher-level programming, but his experience with lower level programming far exceeds mine. Anyway, He argued that .NET locking should be avoided on critical systems expected to be under heavy-load if at all possible in order to avoid the admittedly
我正在和一个队友讨论关于锁定.NET的问题。 他是一个非常聪明的人,在低级和高级编程方面有广泛的背景,但他在低级编程方面的经验远远超过我的。 无论如何,他争辩说,为了避免“僵尸线程”出现系统崩溃的可能性很小,在可能的情况下尽可能在重负载的关键系统上应该避免使用.NET锁定。 我经常使用锁定,我不知道什么是“僵尸线程”,所以我问。 我从他的解释中得到的印象是,僵尸线程是终止的线程,但仍以某种方式持有某些资源。
Possible Duplicate: Why Dictionary is preferred over hashtable in C#? What is the difference between Dictionary and Hashtable. How to decide which one to use? Simply, Dictionary<TKey,TValue> is a generic type, allowing: static typing (and compile-time verification) use without boxing If you are .NET 2.0 or above, you should prefer Dictionary<TKey,TValue> (and the other ge
可能重复: 为什么词典比C#中的散列表更受欢迎? Dictionary和Hashtable有什么区别。 如何决定使用哪一个? 简单地说, Dictionary<TKey,TValue>是一个通用类型,允许: 静态类型(和编译时验证) 没有拳击使用 如果你是.NET 2.0或更高版本,你应该更喜欢Dictionary<TKey,TValue> (和其他通用集合) 一个微妙但重要的区别是Hashtable支持多个阅读器线程,只有一个写入器线程,而Dictionary提供线程