摘要: 1、declare @sql as varchar(8000)select @sql=''Select @sql=@sql+UserName【字段名】+','from dbo.b_NewGrant【表名】select @sql2、declare @mytable table (Col1 varchar(10))insert into @mytable values ('AA'),('BB'),('CC') declare @Colstring varchar(50)select @Colstring = isnul 阅读全文
posted @ 2012-04-19 15:54 wyixin 阅读(116) 评论(0) 推荐(0) 编辑
摘要: import sysdef is_substring(actual_str,pattern_str): if actual_str is None or pattern_str is None: print 'empty string' return if len(pattern_str)>len(actual_str): print 'substring pattern is longer than catual string' return indexes=[] for i in range(len(actua... 阅读全文
posted @ 2011-12-20 14:48 wyixin 阅读(519) 评论(2) 推荐(0) 编辑
摘要: def mergesort(L): print L if len(L)<2: return L[:] else: middle=len(L)/2 left=mergesort(L[:middle]) right=mergesort(L[middle:]) together=merge(left,right) print 'left' ,left print 'right',right print 'merge',together return toge... 阅读全文
posted @ 2011-12-16 16:05 wyixin 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 我喜欢户外,然后常常去逛户外装备的店子,一般买了自行车等大件,再买登山包,登山鞋等配件就会有优惠。比如买了辆Giant的车,然后买个bag就有优惠,本案例将配件作为装饰者,简单的实现装饰者模式,对于继承,多态掌握的还是很迷惑。有错误还请各位看官帮忙指出,仪器共同进步!首先定义一个超类Buybike public abstract class Buybike { protected string description="To Get a Bike"; public virtual string getDescription() { ... 阅读全文
posted @ 2011-12-13 15:32 wyixin 阅读(684) 评论(0) 推荐(1) 编辑
摘要: def bubbleSort(L): for j in range(len(L)): print L print j for i in range(len(L)-1): if L[i]>L[i+1]: temp=L[i+1] L[i+1]=L[i] L[i]=temp厉害点的冒泡排序def bubbleSort(L): sort=True while sort: print L sort=Fals... 阅读全文
posted @ 2011-12-12 23:37 wyixin 阅读(425) 评论(3) 推荐(0) 编辑
摘要: 首先实现两个接口:Subject(用于发布信息) Observer(信息接受者)Subject中:registerObserver(Observer observer); 用于登记需要推送的用户removeObserver(Observer observer); 将用户剔除出推送列表notifyObserver(); 推送服务Observer中:update(string news); 当Subject信息发送时,用于更新然后用 Newsstand类和Commenpeolpe类分别实现Subject,Observer________________________... 阅读全文
posted @ 2011-12-11 23:22 wyixin 阅读(406) 评论(0) 推荐(0) 编辑