牙膏厂有个难题:由于生产线的设计原因,有时会把空盒子当作装有牙膏的货物而装箱出售。有经验的生产线设计者会告诉你:为了保证每个车间分秒不差地完成生 产,就得让每个工序有条不紊地在规定时间内准确地进行,这个目标很困难。周围环境小的变化所引起的失误在有成本效益的方式下是控制不了的。要避免这种失 误,就必须让质检站巧妙地分布在整个生产线上,使消费者可以一路到超市,毫不犹豫地恰好买下通过质检的商品而非不合格商品。
JavaScript一种直译式脚本语言,是一种动态类型、弱类型、基于原型的语言,内置支持类型。它的解释器被称为JavaScript引擎,为浏览器的一部分,广泛用于客户端的脚本语言,最早是在HTML(标准通用标记语言下的一个应用)网页上使用,用来给HTML网页增加动态功能。
不仅如此,JavaScript还是很多新手踏入编程世界的第一个语言。既可以用来显示浏览器中的简单提示框,也可以通过nodebot或nodruino来控制机器人。能够编写结构清晰、性能高效的JavaScript代码的开发人员,现如今已成了招聘市场最受追捧的人。
在这篇文章中,小编将为大家分享一些JavaScript的技巧、秘诀和最佳实践。不管是浏览器的JavaScript引擎,还是服务器端JavaScript解释器,均适用。
1. 如何设置选择的日期大于当天?
dateEdit1.Properties.MinValue = DateTime.Now.AddDays(1)
2. 如何做到只显示年、月?
var formatString = "yyyy.MM"; var dateEdit=new DateEdit(); dateEdit.Properties.Mask.EditMask = formatString; dateEdit.Properties.VistaCalendarInitialViewStyle =
C#: Pop3 pop = new Pop3(); |
VB.NET: Dim pop As Pop3 = New Pop3() |
C#: pop.Connect("mail.domain.com"); |
VB.NET: pop.Connect("mail.domain.com") |
C#: pop.Connect("127.0.0.1"); |
VB.NET: pop.Connect("127.0.0.1") |
C#: pop.Login("login", "password"); |
| VB.NET: pop.Login("login", "password") |
C#: MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount); |
| VB.NET: Dim msg As MailMessage = pop.DownloadEntireMessage(pop.InboxMessageCount) |
C#: pop.Disconnect(); |
| VB.NET: pop.Disconnect() |
C#: using System; using MailBee; using MailBee.Pop3Mail; using MailBee.Mime; namespace EmailApp { class Class1 { [STAThread] static bool IsNewMessage(string UID) { return true; } static void Main(string[] args) { Pop3 pop = new Pop3(); try { pop.Connect("mail.domain.com"); pop.Login("login", "password"); Console.WriteLine("Successfully logged in."); } catch(MailBeePop3LoginNegativeResponseException) { Console.WriteLine("POP3 server replied with a negative response at login."); } string[] arrIDs = pop.GetMessageUids(); int n = pop.InboxMessageCount; if (IsNewMessage(arrIDs[n])) { MailMessage msg = pop.DownloadEntireMessage(n); if (msg.BodyHtmlText != "") Console.WriteLine(msg.BodyHtmlText); else if (msg.BodyPlainText != "") Console.WriteLine(msg.BodyPlainText); else Console.WriteLine("The body of this message is empty."); } try { pop.Disconnect(); Console.WriteLine("Disconnected successfully."); } catch { Console.WriteLine("Disconnection failed."); } } } } |
| VB.NET: Imports System Imports MailBee Imports MailBee.Pop3Mail Imports MailBee.Mime Namespace EmailApp Class Class1 _ Shared Function IsNewMessage(ByVal UID As String) As Boolean Return True End Function Shared Sub Main(ByVal args() As String) Dim pop As Pop3 = New Pop3() Try pop.Connect("mail.domain.com") pop.Login("login", "password") Console.WriteLine("Successfully logged in.") Catch Console.WriteLine("POP3 server replied with a negative response at login.") End Try Dim arrIDs() As String = pop.GetMessageUids() Dim n As Integer = pop.InboxMessageCount If IsNewMessage(arrIDs(n)) Then Dim msg As MailMessage = pop.DownloadEntireMessage(n) If msg.BodyHtmlText <> "" Then Console.WriteLine(msg.BodyHtmlText) Else If msg.BodyPlainText <> "" Then Console.WriteLine(msg.BodyPlainText) Else Console.WriteLine("The body of this message is empty.") End If End If End If Try pop.Disconnect() Console.WriteLine("Disconnected successfully.") Catch Console.WriteLine("Disconnection failed.") End Try End Sub End Class End Namespace |
