直接先参考下面的代码段,很简单很直白很方便 var currentTime:TSystemTime; year, month, day, hour, minute, second, millisecond: string; datetime: string;begin GetS...
临界资源即那些一次只能被一个线程访问的资源,典型例子就是打印机,它一次只能被一个程序用来执行打印功能,因为不能多个线程同时操作,而访问这部分资源的代码通常称之为临界区。1. 锁机制threading的Lock类,用该类的acquire函数进行加锁,用realease函数进行解锁import thre...
分类:
编程语言 时间:
2015-08-17 18:56:02
阅读次数:
198
protected DateTime GetFinish(DateTime start, int duration) { return start.AddDays(duration); } protected DateTime Ge...
程序应用场景:1、对数据表的增删改查中的增加数据时,对于主键值得自动生成2、银行的自动叫号系统 以下是程序代码:private void codechange() { //提前设置流水号的格式; string onecode = DateTime.Now.ToStr...
分类:
其他好文 时间:
2015-08-17 10:02:50
阅读次数:
116
import datetimeimport timestring转datetime str = '2012-11-19' date_time = datetime.datetime.strptime(str,'%Y-%m-%d') d...
分类:
其他好文 时间:
2015-08-17 00:56:49
阅读次数:
99
本文转自:http://www.cnblogs.com/lonelycatcher/archive/2012/02/09/2343463.html这几天要用python发送邮件,上网找到这篇文章感觉蛮全面的,故转载收藏之。1. 文件形式的邮件#!/usr/bin/env python3 #codin...
分类:
编程语言 时间:
2015-08-17 00:53:22
阅读次数:
178
1.使用列表综合>>> listone = [2, 3, 4]
>>> listtwo = [2*i for i in listone if i > 2]
>>> print(listtwo)
[6, 8]
这里我们为满足条件(if i > 2)的数指定了一个操作(2*i),从而导出一个新的列表。注意原 来的列表并没有发生变化。在很多时候,我们都是使用循环来处理列表中的每一个元素,而使 用列表综...
分类:
编程语言 时间:
2015-08-16 12:28:14
阅读次数:
149
HttpRuntime.Cache.Insert("缓存key", "缓存content", null, DateTime.Now.AddMinutes(3), TimeSpan.Zero);//存入本地服务端string cacheContent = string.Empty; if...
分类:
Web程序 时间:
2015-08-16 12:00:16
阅读次数:
207
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more info...
分类:
编程语言 时间:
2015-08-15 22:53:16
阅读次数:
162
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more info...
分类:
编程语言 时间:
2015-08-15 22:43:35
阅读次数:
127