»
S
I
D
E
B
A
R
«
爱心捐房银银
May 19th, 2007 by 一米六二

“我是去年《绝对唱响》冠军邓宁的粉丝,也很喜欢唱歌,希望等我病好了以后,能够站在《绝对唱响》的舞台上。”这是白血病患者房银银在报名中的话。
说实话我对”绝对唱响”之类的节目不感冒。但是我喜欢唱歌。我也理解人们爱做一件事情的执著,比如唱歌。不过有时候上天是如此不公平,站到舞台上唱歌对于房银银来说是如此之难。大好年华,却不幸遭遇如此劫难。
优酷推出的这个爱心捐助房银银,网友每观看一次房银银的视频,优酷网就为房银银捐出1分的活动,其实骨子里包含了一种炒的味道。我在想,如果真要支持房银银,以优酷的财力,一次划个几十百把万就直接解决了人家最大的压力。当然,任何一家公司追求更多盈利都是合情合理的,优酷绝对没有这个直接从经济上支持房银银的义务。人想帮一把也得董事会同意啊。社会的什么都是现实的,优酷能这样地帮助房银银,已经尽了很大的力啊。如果从经济上算的话真的没什么,一次点击一分钱,一百万点击,优酷才捐出1万块钱。如果病治好需要30万,那么这个视频需要被浏览3000万次。不少了。
我倒真希望这个视频能达到3000万的浏量,那么优酷为房银银捐出30万,(我们假设有30万足以治病),刚好优酷也拉了流量树立了形象。
当然其实可以从另外一个角度上去看,如果有100万人了解这个事件,也许优酷网才捐出1万块钱,但是由于有这么多人关注,毕竟这个社会上有很多好心人慈善家,也许就有其他人来捐助,房银银的经济难题就解决了。再说了,在看病的钱这个最大的问题解决的基础上,我们也能看到会有大量的人关注,探望病中的银银。病人都是脆弱的,需要关怀。多关心她,不也是一种捐助么?
我不由得想起大学时由师兄在博客网发起的一场慈善活动。同样的慈善目的,一个公司操作起来和个人操作起来,真是不一样啊。相比之下很不太喜欢优酷的方式,但我还是觉得优酷进步了。退一步,就算是有炒作成分,也比拿潜规则和黄色录像说事儿好啊。
但是不得不说的是,优酷的这个视频上,没有给出房银银的资料以及捐助方式,似有些不妥。如果其他人看了有这个捐助想法,怎么联系?

N早以前写的asp代码,曾广为流传的
May 17th, 2007 by 一米六二

就是adodb.strem那段流传最广,很神奇呢。我那么辛苦写了个模板类,居然只有几个台湾人用,怪。

<%

’*************************************************************
’转发时请保留此声明信息,这段声明不并会影响你的速度!
’*************************************************************

’*************************************************************
’@author: 面条
’@realname: 徐仁禄
’@email: xurenlu@sohu.com
’@QQ: 55547082
’@Homepage: http://www.ksdn.net
’@版权申明:
’ 非盈利性质团体或者个人可以免费使用.
’*************************************************************
’ 我敢担保 本程序由本人独立完成 ,没有参考他人的任何程序(参考了本人自己的php版本的template,不过那个也是本人独立完成的 .)同时本人声明 本class的所有示例版权均为本人所有,任何人或者单位实体不得随意更改
’ 本template可免费用于:
’ 1.个人的非商业性质应用。
’ 2.公益性质团体,如红十字会,孤儿院等等

’具体使用方法请看example.asp文件.

’adSaveCreateOverWrite

class template
dim adSaveCreateOverWrite
dim adSaveCreateNotExist
public starttag
public endtag
public filename
dim key_arr()
dim val_arr()
public content
public total
public contenta()
public BlockContent ’ 块的内容(解析后的)
public block_begin_delim
public block_end_delim
public block_begin_word
public block_END_word
public block_null

sub Class_Initialize()’ 类的初始化
redim key_arr(0)
redim val_arr(0)
redim contenta(0)
adSaveCreateOverWrite=2
adSaveCreateNotExist=1

starttag="{"
endtag="}"
total=0
block_begin_word="BEGIN"
block_end_word="END"
block_begin_delim="
block_null=” ” ’ begin 和end之间用空格隔开
end sub

sub echo (a)
response.write a
end sub

function readfile(filepath)
dim stm2
on error resume next
set stm2 =server.createobject(”ADODB.Stream”)
stm2.Charset = “gb2312″
stm2.Open
stm2.LoadFromFile filepath
readfile = stm2.ReadText
end function

function writefile(filepath,str)’ 写入文件的函数
dim stm
on error resume next
Set stm = server.createobject(”ADODB.Stream”)
stm.Charset = “gb2312″
stm.Open
stm.WriteText str
stm.SaveToFile filepath, adSaveCreateOverWrite
end function

function SetFile(file)’ 设置文件,读取文件内容
filename=file
content=readfile(file)
end function

function inarray(val,arr)’val是否在数组arr中
dim tmp,i,rr,re,pt,tt
for i =0 to ubound(arr)
if arr(i)=val then
inarray=i
exit function
end if
next
inarray=-1 ’不在数组中.
end function

function listarray(arr,str)
dim tmp,i,rr,re,pt,tt
str=” ” & str

for i=0 to ubound(arr)
echo str & i & “:” & arr(i) & vbcrlf
next
end function

function NewKey(key,val) ’添加新的键值.
dim tmp,i,rr,re,pt,tt,pos
i=total
pos=inarray(key,key_arr)

if pos=-1 then ’//如果这个键值不存在.

redim Preserve key_arr(i)
redim Preserve val_arr(i)

’echo “key_arr(” & i & “)=” & key & vbcrlf

key_arr(i)=key
val_arr(i)=val
total=total+1
else
key_arr(pos)=key
val_arr(pos)=val
end if
end function

function resetKeys()’ 初始化键名数组
redim key_arr(0)
redim val_arr(0)
total=0
end function

function getTextContent(Tcontent)
dim tmp,i,rr,re,pt,tt
’ 得到把某一个文本段的{}内容替换后的块.
tmp=Tcontent
for i=0 to total -1
tmp=replace(tmp & “”,starttag & key_arr(i) & endtag, val_arr(i)& “” ) ’ 替换各个键值.
next
’ 替换{***}类似的东西。
’ 目前暂时先放一放把。

’’
’’
set re=new RegExp
re.Global=True
re.Ignorecase=True
pt=”{([a-zA-Z0-9_]{0,100})}”
re.Pattern=pt
set tt=re.Execute(tmp)

for i= 0 to tt.count -1
tmp=replace(tmp & ” “, tt.item(i) & “” ,”")
next
set re=nothing
set tt=nothing
’’
’’

getTextContent=tmp
end function

function getText()
dim tmp,i,rr,re,pt,tt
’ 得到把某一个文本段的{}内容替换后的块.
tmp=content
for i=0 to total -1
tmp=replace(tmp & “”,starttag & key_arr(i) & endtag & “”, val_arr(i) & “” ) ’ 替换各个键值.
next
’ 替换{***}类似的东西。
’ 目前暂时先放一放把。

’’
’’
set re=new RegExp ’ 这里是模式匹配的应用 有正规表达式应用高手的指导一下!
re.Global=True
re.Ignorecase=True
pt=”{([a-zA-Z0-9_]{0,100})}”
re.Pattern=pt
set tt=re.Execute(tmp)
for i= 0 to tt.count -1
tmp=replace(tmp & “”, tt.item(i) & “”,”")
next
set re=nothing
set tt=nothing
’’
’’

getText=tmp
content=tmp
end function

function getBlockContent(block)’ 得到模板内容中某一个块的内容
dim i,pos1,pos2,firststr,secondstr,tempstr
firstStr=”
secondStr=”
pos1=instr(content,firststr)
pos2=instr(content,secondstr)

if (pos2-pos1)<=0 then

else

tempstr=mid(content,pos1,pos2-pos1)
tempstr=replace(tempstr,firststr,"")
tempstr=replace(tempstr,secondstr,"")
’response.write replace(tmpstr,"<--","")
end if
’response.end

getBlockContent=tempstr ’ 返回该字符串.
end function

sub tofile(file)’ 输出到某个文件
dim tmp
tmp=gettext()
writefile file,content’ 输出到文件
end sub

function ParseBlock(block) ’ 到到某一个块的解析后的内容.
dim b,tmp
dim firststr,secondstr,tempstr
b=GetBlockContent(block) ’得到某一个块解析前的内容
tmp=getTextContent(b)’得到这个块解析后的内容.
BlockContent=BlockContent & tmp ’ 保存起来拉 哈哈。这样就实现了重复显示某一个块.
firstStr="
secondStr=”
tmp=replace(tmp,firststr,”")
tmp=replace(tmp,secondstr,”")
ParseBlock=tmp
end function

function replaceBlock(block)’ 把解析了几次的块的内容给替换解析了.
dim con,tmp
dim firststr,secondstr,tempstr

con=GetBlockContent(block) ’得到这个块解析前的内容.
tmp=replace(content & “”,con & “”,Blockcontent & “”)
blockcontent=”"

firstStr=”
secondStr=”

tmp=replace(tmp,firststr,”")
tmp=replace(tmp,secondstr,”")

content=tmp
end function

function replaceBlockforNUll(block)’ 把解析了几次的块的内容给替换解析了.
dim tmp,con
con=GetBlockContent(block) ’得到这个块解析前的内容.
tmp=replace(content & “”,con & “”,”")
blockcontent=”"
content=tmp
end function

function replaceBlockfor(block,deStr)’ 把解析了几次的块的内容给替换解析了.
dim tmp,con
con=GetBlockContent(block) ’得到这个块解析前的内容.
tmp=replace(content & “”,con & “”,Dstr)
blockcontent=”"
content=tmp
end function
end class

%>

2、数据库结果集合操作类

程序代码 程序代码
<%

’*************************************************************
’转发时请保留此声明信息,这段声明不并会影响你的速度!
’*************************************************************

’*************************************************************
’@author: 面条
’@realname: 徐仁禄
’@email: xurenlu@sohu.com
’@QQ: 55547082
’@Homepage: http://www.ksdn.net
’@版权申明:
’ 非盈利性质团体或者个人可以免费使用.
’*************************************************************

’*************************************************************
’*************************************************************
’*************************************************************
class Rsclass
private iRs
private isql
private iconn
private closeConn
private openConn

’*************************************************************
’ 进行初始化,建立iconn和irs对象.
’*************************************************************
Private Sub Class_initialize()
set iconn=server.createobject("adodb.connection")
set irs=server.createobject("adodb.recordset")
End Sub

public sub connect(connstr)
err.clear
on error resume next
iconn.open connstr
if err.number<>0 then response.write “数据联接出错了.”
end sub

public property let conn(connection)
set iconn=connection ’通过外界传入一个数据库联接.
end property

Private Sub Class_Terminate()
on error resume next
irs.close
iconn.close
set iconn=nothing
set irs=nothing
End Sub

’*************************************************************
’ 内容:实现统计功能,一般用select count(*) from table where id>54类似的sql语句.
’*************************************************************
public function getCountBysql(sql)
on error resume next
dim count
count=iconn.execute(sql)(0)
getCountBysql=count
iconn.close
end function

’*************************************************************
public function deleteBySql(sql)
err.clear
on error resume next
iconn.execute(sql)
if err.errcode<>0 then
deleteBysql=false
exit function
end if
deleteBySql=true
end function

’*************************************************************
public function deleteByid(table,column,value)
err.clear
on error resume next
iconn.execute(”delete from “&table & ” where “&column & “=’”&value & “’”)
if err.errcode<>0 then
deleteByid=false
exit function
end if
deleteByid=true
end function

’*************************************************************
’ 返回一个词典,用这个词典来装载要添加的对象.
public function getdict()
set getdict=server.createobject(”scripting.dictionary”)
end function

’*************************************************************
’ 增加新的记录.
public function add(obj,table)
dim item
isql=”select * from ” & table
response.write isql
iRs.open isql,iconn,1,3
irs.addnew
for each item in obj
irs(item)=obj(item)
next
irs.update
irs.close
end function

’*************************************************************
’ 得到查询得返回值
public function getquery(sql)
iRs.open sql,iconn,1,1
if irs.eof and irs.bof then
getquery=null
else
set getquery=irs
end if
end function

public function getqueryPage(sql,pageNum,PageSize)
on error resume next
iRs.pageSize=pageSize
iRs.open sql,iconn,1,1
iRs.AbsolutePage=pageNum
if irs.eof and irs.bof then
getqueryPage=null
else
set getqueryPage=irs
end if

response.write ““& err.number & err.description &”
end function

’*************************************************************
’ 让结果集移动到第n页.
public function setPage(pageNum,PageSize)
on error resume next
iRs.moveFirst
iRs.move((pageNum-1)*PageSize)
end function

end class

’*************************************************************
用法示例:
dim cstr
dim path
path=server.mappath(”2data.mdb”)
cstr= “DBQ=”+path+”;DefaultDir=;DRIVER={ Microsoft Access Driver (*.mdb)};”
dim rec
set rec=new RsClass
rec.connect(cstr)

response.write “************************”
set tt=rec.getqueryPage(”select top 8 * from help”,2,4)
response.write tt.recordcount & “

do while not tt.eof
response.write tt(0) &”

tt.movenext
loop
tt.movefirst
tt.close
%>

数据库操作类

程序代码 程序代码
<%
’────────────────────────────────
’功能说明:db类是实现数据库连接的类,里面留有数据库连接字符串接口
’包括模块:无,一般都是被其他模块包括
’调用方法:1、如果使用原有数据库连接,则不用更改数据库连接字符串ConnStr
’ 具体操作为:Set DBC=New DataBaseClass
’ DBC.ConnStr="其他连接字符串"
’ 2、方法使用:Set Conn=DBC.OpenConnection()得到一个连接对象
’────────────────────────────────
Class dbclass
’────────────────────────────────
’定义变量
Private IConnStr
’────────────────────────────────
’ ConnStr属性
Public Property Let ConnStr(Val)
IConnStr = Val
End Property
’────────────────────────────────
’ ConnStr属性
Public Property Get ConnStr()
ConnStr = IConnStr
End Property
’────────────────────────────────
’ 类初始化
Private Sub Class_initialize()
End Sub
’────────────────────────────────
’ 类注销
Private Sub Class_Terminate()
ConnStr = Null
End Sub
’────────────────────────────────
’ 建立一个连接
Public Function OpenConnection()
Dim TempConn
’On Error Resume Next
Set TempConn = Server.CreateObject("ADODB.Connection")
TempConn.Open ConnStr
Set OpenConnection = TempConn
Set TempConn = Nothing
if Err.Number <> 0 then
Response.Write (”“)
Response.End
end if
End Function
End Class

%>

基于adodb.stream的文件操作类

程序代码 程序代码
<%

’*************************************************************
’转发时请保留此声明信息,这段声明不并会影响你的速度!
’*************************************************************

’*************************************************************
’@author: 面条
’@realname: 徐仁禄
’@email: xurenlu@sohu.com
’@QQ: 55547082
’@Homepage: http://www.ksdn.net
’@版权申明:
’ 非盈利性质团体或者个人可以免费使用.
’*************************************************************

’*************************************************************
’ 类名称: files
’ 类功能: 实现文件读写功能,利用adodb.stream实现,在不支持fso的主机上也可以读写文件.
’*************************************************************

class files

private adSaveCreateOverWrite ’创建文件的时候可以覆盖已经存在的文件.
private adSaveCreateNotExist ’保存文件的时候如果文件不存在,可以创建文件.

’*************************************************************
’ 事件名称: Class_Initialize()
’ 事件发生条件: 类创建时候产生该事件
’ 事件内容: 给私有变量赋值
’ 事件传入参数: 无
’*************************************************************

sub Class_Initialize()
adSaveCreateOverWrite =2
adSaveCreateNotExist = 1
end sub

’*************************************************************
’ 函数名称: function readfile(filepath)
’ 函数内容: 读出文件
’ 传入参数: filepath:要读的文件的绝对路径
’ 返回参数: 要读的文件的内容.
’*************************************************************
function readfile(filepath)

on error resume next

dim stm2

set stm2 =server.createobject("ADODB.Stream")
stm2.Charset = "gb2312"
stm2.Open
stm2.LoadFromFile filepath
readfile = stm2.ReadText
end function

’*************************************************************
’ 函数名称: function writefile(filepath,str)
’ 函数内容: 写入文件
’ 传入参数: filepath:要读的文件的绝对路径
’ str: 要写入的内容
’ 返回参数: 无返回
’*************************************************************

function writefile(filepath,str)

on error resume next

Set stm = server.createobject("ADODB.Stream")
stm.Charset = "gb2312"
stm.Open
stm.WriteText str
stm.SaveToFile filepath, adSaveCreateOverWrite
end function

’*************************************************************
’ 函数名称: function copy(filepath_s,filepath_d)
’ 函数内容: 读出文件
’ 传入参数: filepath_d:目的文件的绝对路径
’ filepath_s:源文件路径
’*************************************************************
function copy(filepath_s,filepath_d)
on error resume next
dim stm2
set stm2 =server.createobject("ADODB.Stream")
stm2.Charset = "gb2312"
stm2.Open
stm2.LoadFromFile filepath_s
stm2.SaveToFile filepath_d, adSaveCreateOverWrite
end function

end class

%>

回到Windows的怀抱
May 14th, 2007 by 一米六二

用了半年linux,现在又回到了Windows的怀抱。
我一直支持国货,支持正版,支持开源。
我的两个手机,头一个是台湾产的,后一个是内地产的。电脑也买的Haier的,装的Fedora的系统。
装完自己挺得瑟的,觉得我可以跟人说我的电脑上全是开源软件了。
不过现在上班后,交流很不爽。首先是Gaim下的QQ和Gtalk老登不上。看看碟什么的也痛苦,别说P2p下载了,我自己买碟都看得不痛。虽然装了Realplayer,但以我1.5G的内存仍然反应缓慢,后来千辛万苦地装上了Mplayer,但是不能拖动。也就是说跟用DVD机看一样的效果,只能快进。
所以现在我又回到Win时代了。
win也不错,还能玩游戏。这是一大便利。虽然笔记本音响效果差一点,感觉也很爽了。
要跑Linux,就让公司的台式机跑吧。在公司不能玩游戏。

»  Substance: WordPress   »  Style: Ahren Ahimsa
28842 页面访问次数, 600 今天
11180 访问数, 171 今天
FireStats icon 由FireStats提供支持