时间:2022-07-13 08:26:16
论文 关键词:移动博客 wap标准 手机 rss xml
论文摘要:目前,博客在互联网中的应用极其普遍,随着手机上网用户数量的不断上升,为了满足移动用户对信息的便捷性、广泛性、实时性、交互性的强烈需求,面向移动用户的在线blog系统的课题研究十分必要。
面向移动用户的在线blog系统,是以手机为媒介、以个人信息为散发点的移动用户沟通平台。本系统依托于“河南中医学院记忆年轮系统”,并增加在线blog阅读器的功能,为移动用户搭建一个“随时随地记录心情、时时刻刻关注好友”的友好服务平台。
该系统按照wap2.0标准,采用rss聚合、xml、数据库等技术获得数据载体,借助移动开发相关技术通过移动设备把内容展现给移动用户。
该课题完成后,移动用户就可以通过手机享受文字、阅览、评论 、收藏等移动服务,真正体验到“永不掉线”的感觉。
1 引言
1.1 课题的背景
业界人士认为, 与单一的移动增值业务不同, 移动博客的出现开辟了 网络 社区交流和信息传播的新途径。网络社区形成的关键在于用户的广泛参与和互动。应当看到, 时下流行的彩信和wap 等移动增值业务大都采用定制、下载的模式, 用户能够上传和参与的业务应用十分有限, 用户间的互动性不足, 而移动博客给人们提供了一个实时交流并能实现互动的平台。通过移动博客, 手机用户在自我愉悦的同时, 还可以吸引志同道合者参与其中, 与自己一起分享; 手机用户也可以随时随地通过多种方式阅读到其他博友的日志, 进行实时沟通。总之, 移动博客使得每个人都可以成为信息和新闻的制造者, 即使不会短信输入的手机用户也可以用照片、声音、录像等业务形式为移动博客提供信息内容。移动博客鼓励个人对信息内容的创作和, 鼓励个人成为媒体中心, 这将对“第五媒体”的 发展 产生巨大的推动作用。[1-5]
1.2 课题的目标
旨在开发一个面向移动用户的在线blog系统,其依托于“河南中医学院记忆年轮系统”,并增加在线blog阅读器的功能,为移动用户搭建一个“随时随地记录心情、时时刻刻关注好友”的友好服务平台。用户可以通过支持上网的移动设备访问该系统,随时随地记录心情、时时刻刻关注好友,还可以订阅自己感兴趣的博客。
1.3 课题的意义
该课题充分体现了移动互联网的移动性、用户定制性、随时性。该课题的研究,可以满足信息时代移动用户对信息的便捷性、广泛性、强实时性、强交互性的强烈需求,进一步推动移动互联网的发展。随着 中国 3g通信的启动,多媒体业务所倡导的“娱乐无限”内容将大行其道,现在,博客在互联网上的内容已经占据了相当大的比例,不久的将来,移动博客将作为“第二博客”出现,更符合随时随地拍照、上传照片、声音等自由秀的特点,更能诠释博客自由、个性化的一面。
2 系统分析
2.1 可行性分析
移动博客除了很好的继承传统博客的开放性、草根性、互动性、原创性、个人性等特点,还具备了自身更强的新特点:便捷性、广泛性、强实时性、强交互性。这些优势使其具备了广泛的、符合时代需要的应用前景。[6-7]
2.2 用户需求分析
根据用户类型的不同,可以将移动用户分为个人用户、 企业 用户和媒体用户,下面从这3类不同用户的角度对移动用户需求进行分析:
(1)个人用户分析
根据cnnic 的最新统计,我国网民数量已经达到了1.23 亿人,经常写博客的人已经达到了2800 万。随着用户服务要求的多样性和个性化越来越明显,一种随时随地写博客的需求逐渐浮出水面,最适合的最方便的途径就是移动手机,移动博客作为互联网博客的一种拓展应用逐渐发展起来了。目前,在专业移动博客网站 上,移动博客正以每天1 万名新增用户的速度增加,其中有3000 人是纯手机用户,这些移动博客用户正在为能够时时上传自己的见闻而兴奋不已。
(2)企业用户分析
作为一种企业形象推广的补充手段,移动博客的企业推广效果的性价比相对较高。企业使用的移动博客从容量、稳定性、速度、以及提供的个性化功能等各种参数来讲要比个人移动博客高出一个级别。为此移动博客服务提供商可以向企业收取服务费用,企业也会很乐意支付相对比较低的推广费用。目前,移动博客这一媒体还没有得到国内企业的广泛关注,这可能和移动博客整体发展情况有关。
(3)媒体用户分析
国外的许多主流媒体已经开始介入移动博客这个新的领域。以纽约时报为例,他们就找了许多,以博客的形式为他们做报道,有的人将他们称作“商业博客”。这种微内容在一定程度上得到商业媒体的认可,因为移动博客让他们看到了微内容的商业价值,而在微内容的丰富性方面,商业媒体有很大的优势。[8-11]
2.3 系统的主要技术分析
该系统按照wap2.0标准,采用rss聚合、xml、数据库、api等技术获得数据载体,借助移动开发相关技术通过移动设备把内容展现给移动用户。技术具体分析如下:
2.3.1 wap2.0标准
⑴ wap 2.0主要采用的技术:
= 1 \* gb3 ① xhtmlmp。
采用xhtmlmp来扩展xhtml的基本用户简介,并能够按需要增加其他语言元素。
= 2 \* gb3 ② tcp/ip传送协议移动简本。wap 2.0 将推动业界为无线链路开发tcp移动简本。
= 3 \* gb3 ③ internet上运行的通用tcp互操作。
= 4 \* gb3 ④ 移动友好技术:包括xhtml的简本; 层叠样式表(css)移动简本; 用户个性喜好和设备能力介绍等。
⑵ 与wap 1.2相比,wap 2.0主要体现在:
① 采用最新的internet标准和协议,能优化网络带宽的利用以及基于数据包的全球无线网络的连接。
② 能对已有的wap内容、应用和业务提供可管理的向后兼容性。
③ wap 2.0xhtml mp,并支持wap 1.x内容的wml。这些标记语言在发挥其独特优点的同时,为移动设备提供合适的内容业务。
④ 支持对wml 1.0的完全向后兼容。wml 2.0在wml 1.0增加了向后兼容的具体特性后对xhtml mp的扩展,可实现从wml 1.0到xhtml mp的名称、属性的转换。
⑤ 支持的图片格式有:gif,jpeg,png,bmp、wbmp等。
⑥ 按照wap2.0标准化组织提出的标准开发规范进行页面开发,例如:支持xhtml的简本,层叠样式表(css)移动简本,多媒体信息服务(mms),wap push等。
⑦ 支持语言:支持内容标记语言、www consortium(w3c)以xml(extensible markup language)为基础规定的兼容html的“xhtml basic”,和css(cascading style sheets)样式单。
⑧ 支持协议:因特网标准的tcp/ip。
2.3.2 wap网站技术
我所使用的服务器软件是微软的iis6.0,操作系统是microsoft windows server 2003。在iis平台创建一个新的mime类型。先选择wap站点的属性,然后选择“'
--3、检查tagdesc是否存在,并获得其tagid
if exists(select name from sysobjects where name='gettagidpro' and type='p')
drop procedure gettagidpro
create procedure gettagidpro(@tagid int output,@tagdesc nvarchar(50))
as
begin
if exists(select tagid from tag where tagdesc=@tagdesc)
begin
update tag set tusedcount=tusedcount+1 where tagdesc=@tagdesc
select @tagid=tagid from tag where tagdesc=@tagdesc
end
else
begin
insert into tag (tagdesc) values (@tagdesc)
select @tagid=tagid from tag where tagdesc=@tagdesc
end
return @tagid
end
--4、判断该用户是否用过该标签,如果用过的话,utusedcount加一,否则向usertag表中插入一条新记录
if exists(select name from sysobjects where name='checkusertagpro' and type='p')
drop procedure checkusertagpro
create procedure checkusertagpro(@userid int,@tagid int)
as
begin
if exists(select * from usertag where userid=@userid and tagid=@tagid)
update usertag set utusedcount=utusedcount+1 where userid=@userid and tagid=@tagid
else
insert into usertag (userid,tagid) values (@userid,@tagid)
end
exec checkusertagpro 29,5
--5、分离出tagid,更新tag、usertag表中的统计信息
if exists(select name from sysobjects where name='updatetagpro' and type='p')
drop procedure updatetagpro
create procedure updatetagpro(@userid int,@tagid int)
as
begin
update tag set tusedcount=tusedcount-1 where tagid=@tagid
update usertag set utusedcount=utusedcount-1 where userid=@userid and tagid=@tagid
end
--6、用户删除收藏的文章
if exists(select name from sysobjects where name='cancelcollectpro' and type='p')
drop procedure cancelcollectpro
create procedure cancelcollectpro(
@uid int,
@bid int,
@iid nvarchar(100)
)
as
begin
declare @str nvarchar(50)
declare @pos int
declare @needstr nvarchar(50)
select @str=tagidset from collect where userid=@uid and blogid=@bid and itemguid=@iid
select @pos=patindex('%,%',@str)
while(@pos>0)
begin
select @needstr=left(@str,@pos-1)
-- print @needstr
exec updatetagpro @uid,@needstr
select @str=right(@str,len(@str)-@pos)
select @pos=patindex('%,%',@str)
end
select @needstr=@str
-- print @needstr
exec updatetagpro @uid,@needstr
-- 删除collect表中的这条收藏记录
delete from collect where userid=@uid and blogid=@bid and itemguid=@iid
end
exec cancelcollectpro 29,3,''[18]
附录三 功能流程图
(1)随便看看功能 (2)好友功能
(3)私信功能 (4)消息功能
(5)删除标签功能 (6)添加标签功能
(7)文章收藏功能 (8)文章推荐功能
(9)博客订阅功能
附录四 核心代码 <%
function getsourceinfo(url)
dim xmlhttp,xmlget
on error resume next
set xmlhttp=createobject("microsoft.xmlhttp")
with xmlhttp
.open "get",url,false
.send
if .status<>200 then
xmlget="false"
else
xmlget=bin2str(.responsebody)
end if
end with
set xmlhttp=nothing
getsourceinfo=xmlget
end function
function bin2str(binstr)
const adtypebinary=1
const adtypetext=2
dim bytesstream,stringreturn
set bytesstream=server.createobject("adodb.stream")
with bytesstream
.type=adtypetext
.open
.writetext binstr
.position=0
.charset="gb2312"
.position=2
stringreturn=.readtext
.close
end with
set bytesstream=nothing
bin2str=stringreturn
end function[19]
function rexexpfunc(pat,str)
dim num,temparr,i
set regex = new regexp
regex.pattern = pat
regex.ignorecase = true
regex.global = true
set matches = regex.execute(str)
num=matches.count
if num=0 then
redim temparr(1)
temparr(0)="0"
else
redim temparr(num)
i=0
for each match in matches
temparr(i)=match.value
i=i+1
next
end if
rexexpfunc=temparr
end function
function getrssurl(pat,str)
dim linkarr,b,hrefarr,hrefstr
linkarr=rexexpfunc(pat,str)
redim hrefarr(ubound(linkarr))
for b=0 to ubound(linkarr)-1
if linkarr(0)="0" then
hrefarr(0)="0"
else
hrefstr=rexexpfunc("href=\".*?\"",linkarr(b))
hrefarr(b)=mid(hrefstr(0),12,len(hrefstr(0))-16)
end if
next
getrssurl=hrefarr
end function[20]
sub showchadesc(url)
set http=server.createobject("microsoft.xmlhttp")
http.open "get",url,false
http.send
set xml=server.createobject("microsoft.xmldom")
xml.async=false
xml.validateonparse=false
xml.load(http.responsexml)
set title=xml.getelementsbytagname("title")
set desc=xml.getelementsbytagname("description")
response.write("标题:"&title.item(0).text&"<br/>描述:"&desc.item(0).text&"<br/>rss地址:"&url)
end sub
'取得远程文档并保存到本地
function getremotefiles(remotepath,localpath,filename)
dim strbody
dim filepath
on error resume next
strbody = getbody(remotepath)
if right(localpath, 1) <> "\" then localpath = localpath & "\"
filepath = localpath & filename
if savetofile(strbody, filepath) = "true" and err.number = 0 then
getremotefiles ="true"
else
getremotefiles ="false"
end if
end function
'远程获取内容
function getbody(url)
dim retrieval
set retrieval = createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false, "", ""
.send
getbody = .responsebody
end with
set retrieval = nothing
end function
'重组文档名
function getfilename(remotepath, filename)
dim arrtmp
dim strfileext
arrtmp = split(remotepath, ".")
strfileext = arrtmp(ubound(arrtmp))
getfilename = filename & "." & strfileext
end function
'将流内容保存为文档
function savetofile(stream, filepath)
dim objstream
on error resume next
set objstream = server.createobject("adodb.stream")
objstream.type = 1 '以二进制模式打开
objstream.open
objstream.write stream
objstream.savetofile filepath, 2
objstream.close()
set objstream = nothing
if err.number <> 0 then
savetofile = "false"
else
savetofile = "true"
end if
end function
'重写本地保存的rss文档
sub overwritelocalrssfile(remotepath,localpath)
dim strbody
dim filepath
filepath = localpath
on error resume next
strbody = getbody(remotepath)
call savetofile1(strbody, filepath)
end sub
sub savetofile1(stream, filepath)
dim objstream
on error resume next
set objstream = server.createobject("adodb.stream")
objstream.type = 1 '以二进制模式打开
objstream.open
objstream.write stream
objstream.savetofile filepath, 2
objstream.close()
set objstream = nothing
end sub
'获得博客标题
function getblogtitle(localpath)
set xmlobj= server.createobject("microsoft.xmldom")
xmlobj.async=false
xmlobj.load(localpath)
set title=xmlobj.getelementsbytagname("title")
getblogtitle=title.item(0).text
end function
'对博客文章内容进行处理
function formatdesc(desc)
dim result
result=replace(desc,"<a href="http://,"")
formatdesc=result
end function
'去掉所有的html标签
function replacehtmltags(str)
dim re,match,matches,retstr,rep
rep=""
retstr=str
set re = new regexp
re.pattern = "(<[^{><}]*>)"
re.ignorecase = true
re.global = true
set matches = re.execute(retstr)
for each match in matches
retstr=replace(retstr,match.value,"")
next
replacehtmltags=retstr
end function
'测试是否有符合匹配
function rexexpcheck(pat,content)
set re=new regexp
re.pattern=pat
re.ignorecase=true
re.global=true
rexexpcheck=re.test(content)
end function
<, , p>'获得博客的文章信息
function getiteminfor(localpath,itemguid,content)
dim a,lpath,str
' lpath=server.mappath("blogxmldata")&"\"&localpath
' 因为server.mappath("blogxmldata")所得的路径不一致,所以把从相对路径到物理路径的转化工作放到函数外边
lpath=localpath
set xmlobj= server.createobject("microsoft.xmldom")
xmlobj.async=false
xmlobj.load(lpath)
set items=xmlobj.getelementsbytagname("item")
' author=xmlobj.selectsinglenode("author")
for a=0 to items.length-1
set link=items.item(a).getelementsbytagname("link")
if link.item(0).text=itemguid then
set title=items.item(a).getelementsbytagname("title")
set desc=items.item(a).getelementsbytagname("description")
if content="0" then
str=title.item(0).text
elseif content="1" then
str=desc.item(0).text
' elseif content="2" then
' if author is not nothing then
' set auth=items.item(a).getelementsbytagname("author")
' str=auth.item(0).text
' else
' str=""
' end if
'' str=isnull(author)
end if
exit for
end if
next
getiteminfor=str
end function
%>
<%
dim objxmlhttp
dim message
dim user,pwd
dim url
url="/api/"
user=session("user")
pwd=session("pwd")
message=request.form("mydo")
' response.write(message)
set objxmlhttp = server.createobject("msxml2.serverxmlhttp")
objxmlhttp.open "post", url+"update.php","false",user,pwd
objxmlhttp.setrequestheader "content-type","application/x-www-form-urlencoded"
objxmlhttp.send "status="+message
if objxmlhttp.readystate=4 then
if objxmlhttp.status=200 then
if objxmlhttp.responsetext<>"false" then
' response.write(objxmlhttp.responsetext)
response.redirect("myindex.asp")
else
response.write("发送失败")
end if
else
response.write("发送失败")
end if
end if
%>
附录五 系统截图
(1)登录截图 (2)我的首页截图
(3)我的空间截图 (4)我的频道截图
(5)我的收藏截图 (6)我的好友截图
(7)随便看看截图
附录六 开发调试测试流程
第一步:
第二步:
图5.3还原wm6镜像文件
第三步:
第四步:
第五步:
第六步: