最感人的诗篇
背儿背上走,
儿已破头亡。
廿里踉跄步,
接儿返故乡。
梦里青山在,
醉中绿水长。
那堪人不在,
未语泪双行。
葬儿黄土里,
埋儿山坡上,
人死万事空,
白发痛断肠。
悠悠小河水。
泛起明月光,
时有秋风语,
萤火自来往。
http://comment.news.163.com/reply/post.jsp?type=null&board=news_guonei7_bbs&threadid=4D11N7U30001124J&showdistrict=&pagex=3
标签: 随笔
标签: 随笔
Google Site可以让商务人士创建自己的“局域网”,管理团队
访问:Google Sites
访问:范例
http://news.csdn.net/n/20080523/116213.html
标签: google
2)
3)
4)
5)
6)
7)
8)
9)
10)
让我们看看内部细节。
再次强调我们并不处理静态网页和对应的URL,我们将会给你看CI如何分析URL请求和如何响应它。 首先,考虑一个正常的英特网请求。用户建立一个连接到你的网站: www.example.com,
然后经过端口发出一个如下的HTTP request:
GET /folder/file.html HTTP/1.0
GET是请求的类型, HTTP/1.0 指定 HTTP 协议的版本, 中间是相对路径和文件名。但是在你的网站上,找不到简单的静态 HTML 文件。取代它的,所有的收入请求被 index.php 文件拦截并进行处理。
如果使用者正在以正确的URL在你的网站上位置上请求页面-一般是通过点击你网页上的超级链接-request一般看起来象这样:
GET /index.php/tests/showall HTTP/1.0
如果使用者不知道精确的URL, CI 会设定一个默认页面(我们一会儿就告诉你怎么做.)
CI的处理步骤是:
+——————————–+
| internet request comes in: |
| "GET http://127.0.0.1" |
+——————————–+
|
v
+——————————–+
| Router:decides which controller|
| should handle this request |
+——————————–+
|
v
+——————————–+ +——————-+
| Controller: analyzes the | —–> | |
| request and responds:maybe | |Model:provides data|
| by getting data from the model | <—– | |
+——————————–+ +——————-+
|
v
+——————————–+
| View:formats the response |
| (in this case as an HTML page) |
+——————————–+
|
v
+——————————–+
| Page is served up to enquirer |
+——————————–+
一个从英特网到你的网站根目录的请求被 index.php 文件拦截,作用就象一个“站由器”。 换句话说, 它调用一个 ‘控制器’, 然后返回一个’视图’.
“路由器”怎么知道调用哪一个控制器? 就象我们已经见到的,有时候request本身包含的信息会告诉它调用哪个控制器。 举例来说,如果请求说:
GET http://127.0.0.1/index.php/welcome/index
并且如果你有一个控制器叫做welcome,这就是被调用的控制器。
welcome控制器
所以, 让我们看welcome控制器。 它被存放在如下路径:
system/application/controllers/welcome.php
它的内容是这样的:
class Welcome extends Controller {
function Welcome() {
parent::Controller();
}
function index() {
$this->load->view(‘welcome_message’);
}
}
?>
文件的第二行开始是一个类。 每个控制器从一个Controller类继承。 在类中包含二个函数或称为方法-welcome() 和incex().
注:CI 要求控制器名字从一个大写字母(class Welcome) 开始, 但文件名是小写字母:
/system/application/controllers/welcome.php
function Welcome() {
parent::Controller();
}
这三行组成构造函数。 注意到 CI 使用PHP 4 构造函数命名规则,兼容于 PHP 5.-CI在PHP 4 和PHP 5 两个版本中都能工作得很好。构造函数在类实例化时被调用,你可以做一些初始化的工作,比如调用函数库和模型层,或者对类的成员变量进行寝化。
这个例子中构造函数中仅一行,调用父类的构造函数。parent::Controller() 。这只是显式地使用父类功能的一种方法。如果你想要详细地了解CI框架中controller类,你可以研读文件 /system/libraries/controller.php 。
(可以放心的是你可以随时查看CI的源代码,它们已经保存在你机器上的某个目录内。)
标签: CodeIgnitor
另一方面,你必须认识到,MVC只是用来帮助你的一种设计方式,而不是用来约束你的。MVC可以有不同的实现方式。CI 论坛包含许多如何 ‘正确合理’地实现 MVC 的方式。 ( 我应该在控制器部分实现数据库查询功能吗?我能直接从视图发送数据到模型层吗?或者我必须通过控制器来访问?)
与其寻找理论上的正确方式,不如遵循二项有用的原则。 这些在 CI 用户手册上有相关描述:
。松藕合: 类之间尽可能不要彼此依赖。
。组件智能化: 智能化是组件独立实现特定目标的能力。在 CI框架中,每个类和它内部的函数高度地自治。
这些是Rick开发CI要实现的目标, 他们也会成为你开发你自己的网站时的目标。实现这些目标之后,你代码中使用这些类时就不需要担心有什么副作用了。
CI做到了这一点,我的经验是那助手类和类库中的其它类使用用起来十分容易,工作起来效果也不错。
因此, 如果你的控制器直接操作数据库, 或你的在模型层调用视图, CI 代码将会以适当的方式工作-通常没有技术上的问题-但是从MVC理论来看这样似乎是 ‘不正确的’. 不要烦恼,如果非要这样做,做吧!
CI 的网站结构: 控制器和视图
你的整个 CI 网站是动态的。 就是, 可能找不到制作 ‘静态’ 网页的简单的 HTML 代码。 (如果需要你可以添加,但是他们将会在 CI 结构之外.) 那么, 你的网站文件到底在哪里?
当我们安装 CI 的时候,我们注意到应用目录包括名为models、views和controllers的子目录。 每个 CI 框架应用都包含这三大类型。
标签: CodeIgnitor, HTML, MVC
转贴自CI中国
分析网站结构
既然我们已经安装 CI ,我们开始了解它如何工作。
读者已经知道 CI 实现了MVC式样。 通过对目录和文件的内容进行分类, 而不是让代码大块大块地纠集在一起。
这一章,我们将会对 MVC 理论做个简短的介绍, 然后再介绍 CI 的MVC实现方式。特别地,要了解那些目录和文件如何互相交换信息?网站结构是怎样的?以及CI是如何自如地动作于其中的?
这一章将会介绍:
。MVC 如何架构一个动态网站
。CI如何接收和分析request以及如何调配指定的代码来reponse
。这些指定的代码如何编制
。CodeIgniter 语法
。CI提供的各种类和函数,你自己编写的类和函数
。如控向controllers传递URL参数
。如何编写运行良好的视图并把动态内容传递给它们。
。如何返回信息给上网者
。文件和类如何传递信息和互相调用
。助手类文件有什么用?
。有助于网站设计的一些特别提示
MVC-到底有什么用?
MVC,在本文领域内,指的是一个动态网站的组织方法。 设计模式是1979年由挪威人,Trygve Reenskaug首次提出来的,这里是一些概要:
。模型是包含数据的对象,他们与数据库交互,对这些数据进行存取,使其在不同的阶段包含不同的值,不同的值代表了不同的状态,具有特定的含意。
。视图显示模型的状态,他们负责向使用者显示数据。(虽然他们通常是 HMTL 视图, 但是,他们可能是任何形式的接口。 比如PDA屏幕或WAP手机屏幕)
。控制器用来改变模型的状态,他们操作模型,提供动态的数据给视图。
CI框架包含模型、视图和控制器的子目录。 他们里面的每个文件都有.php文件后缀, 包含有特定命名约定的类。
CI 帮助你遵循MVC的约定, 使你更有效地组织代码。 CI允许你有最大的灵活性,你可以获得 MVC 结构的所有好处。
当你编程的時候,试着始终用 MVC 来思考问题。尽可能确保你的 ‘视图’ 聚焦于显示, ’控制器’纯粹地用来控制数据流。 把应用逻辑保留在数据模型和数据库中。
这样,如果你决定开发新的视图,你不必在任何一个控制器或模型中修改代码。 如果你需要更新 ‘商业规则’ ,你只需要在模型中修改代码。
标签: CodeIgnitor, MVC, PHP
标签: C/C++, CodeIgnitor, Delphi, Free Pascal, PHP, Python, UML, XHTML
# jet2sql.py - M.Keranen[07/12/2000]
# --------------------------------------------------------------------
# Creates ANSI SQL DDL from a MS Jet database file, useful for reverse
# engineering database designs in E/R tools.
#
# Requires DAO 3.6 library.
# --------------------------------------------------------------------
# Usage: python jet2sql.py infile.MDB outfile.SQL
import sys, string, pythoncom, win32com.client
const = win32com.client.constants
daoEngine = win32com.client.Dispatch('DAO.DBEngine.36')
class jetReverse:
def __init__ (self, infile):
self.jetfilename=infile
self.dtbs = daoEngine.OpenDatabase(infile)
return
def terminate(self):
return
def writeTable(self, currTabl):
self.writeLine('\ncreate table ' + chr(34) + currTabl.Name + chr(34),"",1)
self.writeLine('(',"",1)
# Write Columns
cn=0
for col in currTabl.Fields:
cn = cn +1
self.writeColumn(col.Name, col.Type, col.Size, col.Required, col.Attributes, col.DefaultValue, col.ValidationRule, currTabl.Fields.Count-cn)
# Validation Rule
tablRule = currTabl.ValidationRule
if tablRule <> "":
tablRule = " check(" + tablRule + ") "
self.writeLine("",",",1) # add a comma and CR previous line
self.writeLine(tablRule,"",0)
# Primary Key
pk=self.getPrimaryKey(currTabl)
if pk <> "":
self.writeLine("",",",1) # add a comma and CR previous line
self.writeLine(pk,"",0)
# End of table
self.writeLine("","",1) # terminate previous line
self.writeLine(');',"",1)
# Write table comment
try: sql = currTabl.Properties("Description").Value
except pythoncom.com_error: sql=""
if sql <> "":
sql = "comment on table " + chr(34) + currTabl.Name + chr(34) + " is " + chr(34) + sql + chr(34) +";"
self.writeLine(sql,"",1)
# Write column comments
for col in currTabl.Fields:
try: sql = col.Properties("Description").Value
except pythoncom.com_error: sql=""
if sql <> "":
sql = "comment on column " + chr(34) + currTabl.Name + chr(34) + "." + chr(34) + col.Name + chr(34) + " is " + chr(34) + sql + chr(34) + ";"
self.writeLine(sql,"",1)
# Write Indexes
self.writeIndexes(currTabl)
return
def writeColumn(self, colName, colType, length, requird, attributes, default, check, colRix):
# colRix: 0 based index of column from right side. 0 indicates rightmost column
if colType == const.dbByte: dataType = "Byte"
elif colType == const.dbInteger: dataType = "Integer"
elif colType == const.dbSingle: dataType = "Single"
elif colType == const.dbDouble: dataType = "Double"
elif colType == const.dbDate: dataType = "DateTime"
elif colType == const.dbLongBinary: dataType = "OLE"
elif colType == const.dbMemo: dataType = "Memo"
elif colType == const.dbCurrency: dataType = "Currency"
elif colType == const.dbLong:
if (attributes & const.dbAutoIncrField): dataType = "Counter"
else: dataType = "LongInteger"
elif colType == const.dbText:
if length == 0: dataType = "Text"
else: dataType = "char("+str(length)+")"
elif colType == const.dbBoolean:
dataType = "Bit"
if default == "Yes": default = "1"
else: default = "0"
else:
if length == 0: dataType = "Text"
else: dataType = "Text("+str(length)+")"
if default <> "":
defaultStr = "default " + default + " "
else: defaultStr = ""
if check <> "":
checkStr = "check(" + check + ") "
else:
checkStr = ""
if requird or (attributes & const.dbAutoIncrField):
mandatory = "not null "
else:
mandatory = ""
sql = " " + chr(34) + colName + chr(34) + " " + dataType + " " + defaultStr + checkStr + mandatory
if colRix > 0:
self.writeLine(sql,",",1)
else:
self.writeLine(sql,"",0)
return
def getPrimaryKey(self, currTabl):
# Get primary key fields
sql = ""
for idx in currTabl.Indexes:
if idx.Primary:
idxName = idx.Name
sql = " primary key "
cn=0
for col in idx.Fields:
cn=cn+1
sql = sql + chr(34) + col.Name + chr(34)
if idx.Fields.Count > cn : sql = sql + ","
return sql
def writeIndexes(self, currTabl):
# Write index definition
nIdx = -1
for idx in currTabl.Indexes:
nIdx = nIdx + 1
idxName = idx.Name
tablName = currTabl.Name
if idx.Primary:
idxName = tablName + "_PK"
elif idxName[:9] == "REFERENCE":
idxName = tablName + "_FK" + idxName[10:]
else:
idxName = tablName + "_IX" + str(nIdx)
sql = "create "
if idx.Unique: sql = sql + "unique "
if idx.Clustered: sql = sql + "clustered "
sql = sql + "index " + chr(34) + idxName + chr(34)
sql = sql + " on " + chr(34) + tablName + chr(34) + " ("
# Write Index Columns
cn=0
for col in idx.Fields:
cn = cn + 1
sql = sql + chr(34) + col.Name + chr(34)
if col.Attributes & const.dbDescending:
sql = sql + " desc"
else:
sql = sql + " asc"
if idx.Fields.Count > cn: sql = sql + ","
sql=sql + " );"
self.writeLine(sql,"",1)
return
def writeForeignKey(self, currRefr):
# Export foreign key
sql = "\nalter table " + chr(34) + currRefr.ForeignTable + chr(34)
self.writeLine(sql,"",1)
sql = " add foreign key ("
cn = 0
for col in currRefr.Fields:
cn = cn + 1
sql = sql + chr(34) + col.ForeignName + chr(34)
if currRefr.Fields.Count > cn: sql = sql + ","
sql = sql + ")"
self.writeLine(sql,"",1)
sql = " references " + chr(34) + currRefr.Table + chr(34) + " ("
cn = 0
for col in currRefr.Fields:
cn = cn + 1
sql = sql + chr(34) + col.Name + chr(34)
if currRefr.Fields.Count > cn: sql = sql + ","
sql = sql + ")"
if (currRefr.Attributes & const.dbRelationUpdateCascade) <> 0:
sql = sql + " on update cascade"
if (currRefr.Attributes & const.dbRelationDeleteCascade) <> 0:
sql = sql + " on delete cascade"
sql=sql+";"
self.writeLine(sql,"",1)
return
def writeQuery(self, currQry):
sql = "\ncreate view " + chr(34) + currQry.Name + chr(34) + " as"
self.writeLine(sql,"",1)
# Write Query text
sql=string.replace(currQry.SQL,chr(13),"") # Get rid of extra linefeeds
self.writeLine(sql,"",1)
# Write Query comment
try: sql = currQry.Properties("Description").Value
except pythoncom.com_error: sql=""
if sql <> "":
sql = "comment on table " + chr(34) + currQry.Name + chr(34) + " is " + chr(34) + sql + chr(34)
self.writeLine(sql,"",1)
return
def writeLine(self,strLine, delimit, newline):
# Used for controlling where lines terminate with a comma or other continuation mark
sqlfile.write(strLine)
if delimit: sqlfile.write(delimit)
if newline: sqlfile.write('\n')
return
if __name__ == '__main__':
if len(sys.argv)<2:
print "Usage: jet2sql.py infile.mdb outfile.sql"
else:
jetEng = jetReverse(sys.argv[1])
outfile = sys.argv[2]
sqlfile = open(outfile,'w')
print "\nReverse engineering %s to %s" % (jetEng.jetfilename, outfile)
# Tables
sys.stdout.write("\n Tables")
for tabl in jetEng.dtbs.TableDefs:
sys.stdout.write(".")
if tabl.Name[:4] <> "MSys" and tabl.Name[:4] <> "~TMP":
jetEng.writeTable(tabl)
# Relations / FKs
sys.stdout.write("\n Relations")
for fk in jetEng.dtbs.Relations:
sys.stdout.write(".")
jetEng.writeForeignKey(fk)
# Queries
sys.stdout.write("\n Queries")
for qry in jetEng.dtbs.QueryDefs:
sys.stdout.write(".")
jetEng.writeQuery(qry)
print "\n Done\n"
# Done
sqlfile.close()
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52267
jetEng.terminate()
为了找到一个好的模板引擎,我在互联网上进行搜索,目前已经整理出了以下名单:
Smarty
Smarty的特点是将模板编译成PHP脚本,然后执行这些脚本。很快,非常灵活。
Heyes Template Class
一个非常容易使用,但功能强大并且快速的模板引擎,它帮助你把页面布局和设计从代码中分离。
FastTemplate
一个简单的变量插值模板类,它分析你的模板,把变量的值从HTML代码中分离处理。
ShellPage
一个简单易用的类,可以让你的整个网站布局基于模板文件,修改模板就能改变整个站点。
STP Simple Template Parser
一个简单、轻量级并且易于使用的模板分析类。它可以从多个模板中组装一个页面,把结果页面输出到浏览器或者文件系统。
OO Template Class
一个你可以用在自己程序中的面向兑现的模板类。
SimpleTemplate
一个可以创建和结构化网站的模板引擎。它可以解析和编译模板。
bTemplate
短小但是快速的模板类,允许你把PHP逻辑代码从HTML修饰代码中分离。
Savant
一个强大且轻量级的PEAR兼容模板系统。它是非编译型的,使用PHP语言本身做为它的模板语言。
ETS - easy template system
可以使用完全相同数据重组模板的模板系统。
EasyTemplatePHP
适用于你的站点的一个简单但是强大的模板系统。
vlibTemplate
一个快速、全能的模板系统,它包含一个缓存和调试类。
AvanTemplate
多字节安全的模板引擎,占用很少系统资源。它支持变量替换,内容块可以设置显示或隐藏。
Grafx Software’s Fast Template
一个修改版本的Fast Template系统,它包括缓存功能,调试控制台以及沉默去除为赋值块。
TemplatePower
一个快速、简单、功能强大的模板类。主要功能有嵌套的动态块支持,块/文件包含支持以及显示/隐藏未赋值的变量。
TagTemplate
这个库的功能被设计来使用模板文件,同时允许你从HTML文件检索信息。
htmltmpl: templating engine
一个适用于Python和PHP的模板引擎。它面向希望在项目中分离代码和设计的web应用开发人员。
PHP Class for Parsing Dreamweaver templates
一个分析Dreamweaver模板的简单类,被用于Gallery 2 和WordPress的自定义模块中。
MiniTemplator (Template Engine)
针对HTML文件的一个紧凑型模板引擎。对于模板变量和块定义它具有简单的语法。其中块可以嵌套。
Layout Solution
简化网站开发和维护。它拥有常用的变量和页面元素使你不需要重复做页面布局工作。
Cached Fast Template
它已经纳入 FastTemplate ,允许你缓存模板文件,甚至可以在分离的块内容上缓存不同的规格。
TinyButStrong
一个支持MySQL, Odbc, Sql-Server和ADODB的模板引擎。它包含7个方法和两个属性。
Brian Lozier’s php based template engine
只有2K大小,非常快并且是面向对象设计。
PHP的下一个版本,V6,包含了很的新特性和语法改进,会使它在面向对象方面性更易用。其他重要的特性:比如在核心函数中对Unicode (统一编码)的支持,这意味着 PHP 6提供了更好的更可靠国际支持。
PHP已经很流行,被无数的站点使用,被大部分因特网接入商所支持,被Yahoo这样的大网络公司使用着。在即将来临的PHP版本中准备增加一些成功的新特性,使PHP在某些场合下更易用更安全。你准备好接受 PHP 6 了吗?如果你明天就升级了,你的程序会运行得很好吗?你该怎么办?这篇文章集合了PHP 6的改变,他们中的一些备份移植到版本的PHP v5.x,您目前的脚本可能需要进行一些调整。
如果你现在使用不是PHP,但是一直在考虑它,考虑一下它的新特性。这些特点,从Unicode的核心支持到XML支持,使它更容易为你写的功能填补PHP的应用。
PHP 6 新特性
PHP 6当前已经作为开发者快照使用,所以你可以下载和试用一下这篇文章列出很多特性,这些特性已经在当前的快照中实现了。见资源。
改进 Unicode 支持
在PHP的核心函数中,有很多对Unicode 字符串的支持的改进,这些新特性将产生巨大的影响因为它允许PHP为国际字符提供更多的支持。所以如果一个开发者或者架构师使用不同的语言,例如Java程序语言,是因为它具有超过PHP的国际化支持的话,当支持改进时他会花一点时间来考虑一下PHP。
因为今天你已经可以下载到开发者版本的 PHP V6,你将看到一些功能函数已经支持Unicode字符串。有一个函数清单已经被测试和验证了完全可以处理Unicode,参见资源。
命名空间
命名空间是一种避免因函数或者类之间的命名冲突而使你的函数和类以及方法无法读取,而不使用前缀命名惯例的一种方法。因此,通过使用命名空间,你可以命名别人可能已经使用的类名,而不用担心在运行时会出错。表一提供了一个在PHP中使用命名空间的示例。
您不用在源代码中做更新或更改,因为你写的任何PHP代码可以不包含命名空间而运行得很好。因为命名空间特性似乎会移植到PHP 5.3 X中,如果它可以使用,您可以在自己的程序中引用命名空间。
表一,命名空间示例
php
// I'm not sure why I would implement my own XMLWriter, but at least
// the name of this one won't collide with the one built in to PHP
namespace NathanAGood;
class XMLWriter
{
// Implementation here...
}
$writer = new NathanAGood::XMLWriter();
?>
Web 2.0 特性
依赖于你怎么使用PHP和你现在脚本的是什么样子的,现在的语言和语法差异,可能会或者不会最大程度的影响下面一些特性,这是指那些直接让你引用的Web 2.0功能到你的PHP应用程序。
SOAP
SOAP是一种网络服 务“说话”的协议,并且支持不少其他语言,例如Java和微软的.NET,虽然有其他的方法来驱动和使用网络服务,比如 表象化状态转变(Representational State Transfer )REST,SOAP仍然在使不同平台具有可操作性中是最常用的。此外,SOAP在PHP扩展和PEAR库中使用,SOAP在PHP中默认是不支持的,因 此你启用这个扩展或者叫你的ISP启用。此外,PEAR包允许你建立SOAP客户端和服务器,如SOAP包。
如果你改变了默认设置,SOAP将会在PHP 6中启用。这个扩展将提供你很容易的的实现SOAP客户端和SOAP服务,允许你编写的应用提供使用或者网络服务。
如果SOAP扩展是默认设置,那就意味着你不能在PHP中设置它们,如果您开发的PHP应用程序并且它们发布到一个ISP服务器上,您可能需要检查一下你的ISP,以验证SOAP并启用为他们升级。
在PHP 5.1中XMLReader 和XMLWriter已经变成PHP核心的一部分,这使你工作起来更轻松如果在你的PHP程序中需要使用到XML的话。和SOAP扩展一样,如果你使用SOAP或者XML这是个好消息因为PHP 6比已经出炉的PHP4 更适合你。
被删除的东西
除了具有的一些新功能,PHP 6引擎将删除一些在前面版本中已经有的功能。大部分这些功能,如register_globals 和safe_mode 在目前的PHP中被视为“破的”。因为他们可能会暴露一些安全风险。PHP在努力的清除中,在下一个版本中这些将从PHP中删除或者废弃。反对者认为大部分ISP或者企业会保留现在的脚本因为升级到PHP6会破坏现在的的脚本,但是支持者认为很高兴看到PHP团队修补了这些漏洞,并且提供了一个干净,安全的运行工具。
将从PHP删除的功能有:
magic_quotes register_globals register_long_arrays safe_mode
http://www.yeeyan.com/articles/view/muxi/7659
标签: PHP
Lazarus對Unicode的支援還需要進一步開發,尤其是在Windows平台上。以下提供一些基本的資訊,讓想要加強Lazarus對Unicode支援的人參考,如果您發現這些資訊有誤、不足或過時了,請您不吝修正、補充或更新它,謝謝。
如果您已經初步了解Unicode的標準,且您已經在Delphi上面有使用過WideString這個型別來撰寫程式,會有助於您理解Lazarus對Unicode支援的加強工作。如果您使用過非Latin編碼的字元集來撰寫腳本語言,也會有些幫助的。
請注意: 實作的細節部分目前還在討論中,這部分的文件隨時都有可能更新。
http://wiki.freepascal.org/LCL_Unicode_Support/zh_TW
标签: Delphi, Free Pascal, Lazarus, Unicode, WideString
rsCustomers.CursorLocation = adUseClientwill cause ADO to execute the following action query
rsCustomers.Open "SELECT * FROM Customers", cnNWind, _
adOpenStatic, adLockOptimistic, adCmdText
rsCustomers.Fields("CompanyName").Value = "Acme"
rsCustomers.Update
UPDATE Customers SET CompanyName = 'Acme'The WHERE clause contains information about the primary key and the original value for the field to update. This ensures that if another user has modified the value of the CompanyName field to a value other than the value that ADO originally retrieved, ADO will not update that row and will raise an error instead.
WHERE CustomerID = 'ALFKI' AND CompanyName = 'Alfreds Futterkiste'
rsCustomers.CursorLocation = adUseClientThis code will cause ADO to include every field in the WHERE clause. You would use this value for the "Update Criteria" property if you want to make sure that the update made by the current user will only succeed if no changes have been made to any fields in that row in the table.
rsCustomers.Properties("Update Criteria").Value = adCriteriaAllCols
rsCustomers.Open "SELECT * FROM Customers", cnNWind, _
adOpenStatic, adLockOptimistic, adCmdText
rsCustomers.Fields("CompanyName").Value = "Acme"
rsCustomers.Update
adCriteriaKey = 0NOTE: Specifying adCriteriaTimeStamp may actually use adCriteriaAllCols method to execute the Update if there is not a valid TimeStamp field in the table. Also, the timestamp field does not need to be in the recordset itself.
Uses only the primary key
adCriteriaAllCols = 1
Uses all columns in the recordset
adCriteriaUpdCols = 2 (Default)
Uses only the columns in the recordset that have been modified
adCriteriaTimeStamp = 3
Uses the timestamp column (if available) in the recordset
标签: ADO, Properties, Update
那本书(Advanced Visual Basic)中让vb能够函数指针的方法不错,但是要添加类型库,还要自己创建轻量com对象显得颇为麻烦.我想,不如直接利用vb自己建对象算了.
代码如下:
'建一class,如下
'---------------------------------------------------------------------------------------
' Module : cFucPtr
' DateTime : 2006-2-7 17:36
' Author : Lingll
' Email : lingll_xl@163.com
' HomePage : http://lingll.yeah.net/
' Purpose :
'---------------------------------------------------------------------------------------
Option Explicit
'存储加载dll后获得的函数地址
Private m_NewFucPtr As Long
Public Function DllGetClassObject( _
ByRef rclsid As UUID, ByRef riid As UUID, ByRef ppv As IClassFactory) As Long
End Function
Public Sub SetFunctionPtr(newptr&)
m_NewFucPtr = newptr
End Sub
'再建一module
Option Explicit
Public Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Public Declare Function FreeLibrary Lib "kernel32.dll" (ByVal hLibModule As Long) As Long
Public Declare Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Public Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
Public Type typAsm
code(1) As Long
End Type
Public asm As typAsm
'然后,初始化时,让asm为如下值,
asm.code(0) = &HFF515859
asm.code(1) = &H90003460
'这个是汇编代码,具体是
'pop ecx
'pop eax
'push ecx
'jmp DWORD PTR [eax + 52]
'这是抄回来的,具体原理我不太清楚,如下是原注释
'Here's the magic asm for doing the function pointer call.
'The stack comes in with the following:
'esp: return address
'esp + 4: this pointer for FunctionDelegator
'All that we need to do is remove the this pointer from the
'stack, replace it with the return address, then jmp to the
'correct function. In other words, we're just squeezing the
'this pointer completely out of the picture.
'The code is:
'pop ecx (stores return address)
'pop eax (gets the this pointer)
'push ecx (restores the return address)
'jmp DWORD PTR [eax + 4] (jump to address at this + 4, 3 byte instruction)
'The corresponding byte stream for this is: 59 58 51 FF 60 04
'We pad these six bytes with two int 3 commands (CC CC) to get eight
'bytes, which can be stored in a Currency constant.
'Note that the memory location of this constant is not executable, so
'it must be copied into a currency variable. The address of the variable
'is then used as the forwarding function.
'下面是调用代码:
Dim tadd As Long, vTab&
Dim tobj As cFucPtr
Dim tLib&
Dim tUn As olelib.IUnknown
Dim tDem As dllDemo.IDemo
Dim tFac As olelib.IClassFactory
Set tobj = New cFucPtr
'加载dll
tLib = LoadLibrary(App.Path & "\dllDemo.dll")
If tLib <> 0 Then
tadd = GetProcAddress(tLib, "DllGetClassObject")
End If
Dim asmadd&
If tadd <> 0 Then
'获取vtable地址
CopyMemory vTab, ByVal ObjPtr(tobj), 4
asmadd = VarPtr(asm)
'替换掉cFucPtr.DllGetClassObject地址
CopyMemory ByVal (vTab + (8 - 1) * 4), asmadd, 4
'设置函数地址
tobj.SetFunctionPtr tadd
tobj.DllGetClassObject ClsId_Obj, iid_iclassfactory, tFac
If Not tFac Is Nothing Then
tFac.CreateInstance Nothing, iid_iunknow, tUn
Set tFac = Nothing
Set tDem = tUn
Set tUn = Nothing
tDem.test
End If
End If
Set tDem = Nothing
If tLib <> 0 Then FreeLibrary tLib
'一定要在所有对象都释放掉了才能使用FreeLibrary,不然会出错
将上面的代码修改一下,就可以很方便的在vb中使用函数指针了,hoho,vb可以用函数指针咯,不写了.
http://www.xker.com/page/e2007/0116/9680.html
标签: ASM, delegate, DLL, FreeLibrary, VB
视觉享受是不是多余的?
为了佐证他的结论,庄海欧打开了微软开发的可从不同角度显示城市地理情况的三维地图
他又拿出自己的iPod Photo,“视觉的享受是不是多余的,如果你用过那些给你带来不同感受的产品,就不会有这种的疑问。早先人们听iPod只能按照艺人、唱片、歌曲名的方式选取曲。但现在苹果提供了按封面选取的
GPU挑战大型机
庄海欧用一个个不同的例子来佐证GPU的神奇。他说,在高性能计算中GPU的作用更加强大,以往以CPU为处理核心的大型计算机多台联网才而可以完成的计算,通过GPU处理只需很少的终端,其成本也只有原来的十分之一。
庄海欧表示,人们应该改变对
和英特尔AMD比速度
不过CPU
面对两家竞争对手的提出的整合概念,NVIDIA并不特别担心。庄海欧表示,CPU和GPU是两个完全不同,CPU是解决程序运行,GPU核心是解决并行计算,两者很难实现完全融合。而且独立显卡与集成显卡的优劣,犹如台式机和笔记本电脑在性能上差别,前者永远会好于后者。目前,NVIDIA与英特尔和AMD也都保持着良好的合作关系,他们也希望NVIDIA可以为其提供更好的GPU,实现更好的整机机能。
“条条大路通罗马,就看谁跑得快,所有的竞争都是在比速度。”庄海鸥说。
2008年5月7日,Thoma Cressey Bravo下的公司Embarcadero Technologies,宣布他们已经签署了一份对Borland Software Corporation (NASDAQ: BORL) 的资产收购协议, 收购其旗下的CodeGear公司。交易将会在30-60天内结束。公司合并后,将会在Embarcadero Technologies名下运作。
Thoma Cressey Bravo的合伙人Orlando Bravo说:“
整个收购额大约在2300万美元左右, 而Borland将继续拥有CodeGear大约700万的未收账款的权力。
CodeGear 所
两年前,Borland首席执行官Tod Nielson宣布计划卖掉这个工具部门,好让它能与应用生命周期管理产品线分开。工具部门难以生存是因为来自免费开放源代码产品的竞争,尤其是Eclipse IDE。
CodeGear产品主要是以个别程序
该消息宣布后,Borland迟迟无法找到买主。
这次出面买下的Embarcadero主要销售资料库管理与设计工具,年营收6000万美元。这项收购将可让这家公司接触到好几百万使用CodeGear软件的开发人员。
http://news.csdn.net/n/20080509/115826.html
标签: Borland, CodeGear, Embarcadero
旧金山消息-Borland公司已将其
Embarcadero称,这将合并开发工具市场和数据库工具市场上的领袖厂商。收购涉及金额高达3000万美金,将在30-60日内完成收购。
“CodeGear拥有忠实的开发者社区和全球渠道,是公认的市场领导者,”Embarcadero Technologies公司CEO Wayne Williamd在声明说。“通过对其强大产品线的整合,Embarcadero将扩展到新市场、开发先进产品、引领业界飞跃。两家公司的合并将为客户及
Embarcadero说,合并将把Embarcadero造就成全球最大的平台独立
“这对CodeGear客户、雇员、合作伙伴和社区是个大好消息,”CodeGear CEO Jim Douglas在声明中说。“我们将拥有更多资源,集中于核心产品及市场。”
CodeGear生产Java和Windows开发工具,例如JBuilder、Delphi等。该公司也在进入Ruby on Rails开发工具市场。
CodeGear于2006年从Borland公司独立出来,当时Borland决定将
合并后的机构将以Embarcadero Technologies的名义运作,不过还没决定是否完全放弃CodeGear的名称。
在2300万美元的收购价之外,Borland还将保有700万美元的CodeGear标签: Borland, CodeGear, Embarcadero
互联网带宽越来越宽,似乎让网页的加载速度得到了质的飞跃。其实不然,因为随着带宽的提高,网页上的对象也越来越多,因此加快网页打开速度还是一个重要的课题。加快网页的打开速度,有三个路径,一是提高网络带宽,二是用户在本机做优化,三是网站设计者对网页做一定的优化。这篇文章站在一个网站设计者的角度,分享一些优化网页加载速度的小技巧。
一、优化图片
几乎没有哪个网页上是没有图片的。如果你经历过56K猫的年代,你一定不会很喜欢有大量图片的网站。因为加载那样一个网页会花费大量的时间。
即使在现在,网络带宽有了很多的提高,56K猫逐渐淡出,优化图片以加快网页速度还是很有必要的。
优化图片包括减少图片数、降低图像质量、使用恰当的格式。
1、减少图片数:去除不必要的图片。
2、降低图像质量:如果不是很必要,尝试降低图像的质量,尤其是jpg格式,降低5%的质量看起来变化不是很大,但文件大小的变化是比较大的。
3、使用恰当的格式:请参阅下一点。
因此,在上传图片之前,你需要对图片进行编辑,如果你觉得photoshop太麻烦,可以试试一些在线图片编辑工具。懒得编辑而又想图片有特殊的效果?可以试试用过调用javascript来实现图片特效。
二、图像格式的选择
一般在网页上使用的图片格式有三种,jpg、png、gif。三种格式的具体技术指标不是这篇文章探讨的内容,我们只需要知道在什么时候应该使用什么格式,以减少网页的加载时间。
1、JPG:一般用于展示风景、人物、艺术照的摄影作品。有时也用在电脑截屏上。
2、GIF:提供的颜色较少,可用在一些对颜色要求不高的地方,比如网站logo、按钮、表情等等。当然,gif的一个重要的应用是动画图片。就像用Lunapic制作的倒映图片。
3、PNG:PNG格式能提供透明背景,是一种专为网页展示而发明的图片格式。一般用于需要背景透明显示或对图像质量要求较高的网页上。
三、优化CSS
CSS叠层样式表让网页加载起来更高效,浏览体验也得到提高。有了CSS,表格布局的方式可以退休了。
但有时我们在写CSS的时候会使用了一些比较罗嗦的语句,比如这句:
margin-top: 10px;
margin-right: 20px;
margin-bottom: 10px;
margin-left: 20px;
margin: 10px 20px 10px 20px;
A paragraph of decorated text
Second paragraph
Third paragraph
Forth paragraph
A paragraph of decorated text
Second paragraph
Third paragraph
Forth paragraph
<link rel="stylesheet" type="text/css" href="/body.css">
<link rel="stylesheet" type="text/css" href="/side.css">
<link rel="stylesheet" type="text/css" href="/footer.css">
<link rel="stylesheet" type="text/css" href="/style.css">
我是这样看的。在
换言之,诚如Google资深
Unicode是一种字元编码标准,能兼容数十种语文,以及标有读音识别符号的罗马字母。ASCII则是沿用数十年之久的标准,字元数目以128或256个字元为限,而且很难跨越原有的Remington打字机字元范围以外。
Davis指出,Unicode在去年12月上旬打败ASCII和西欧编码。
他说:不只是超越,更令人印象深刻的是,这么快就后来居上。他边说边指着一幅显示Unicode使用率扶摇直上的图表。
Google便非常喜爱Unicode网站,每当Google处理网站资料时,就会先转换成Unicode(如果该网站本来不是用Unicode的话),如此一来可加强国际搜索功能。
Davis说,目前Google只把资料转换成5.1版的Unicode,这样可让讲马来话等语言的人士,如今也可搜索内含这些新字元的文字。
不过,Unicode比ASCII差的一点是,所需的记忆空间至少比存储罗马拼音字元大一倍。

标签: Linux
标签: Cloud Computing, google, News
天天动听手机音乐盒是一款集播放、音效、搜索、下载等众多功能于一身,完全免费的手机音乐播放器。由于其支持最多手机机型和音频格式,支持丰富的皮肤下载 等功能,同时其与手机搭配和谐、操作简易、管理人性的特点,深受姆指一族的青睐。天天动听也力求以您的需求为主导,把您的思想融入其中。 |
Many of you have asked how your application can be a container for any Web-style content, including HTML resources and pictures that are part of your project.
This articles will show you how HTML and associated files (pictures) can easily be included within a Delphi application. As a result, you simply have to distribute an EXE file that includes HTML pages, as it would do with icons and cursors.
Creating a HTML page
For the start we have to assemble a (simple) html page. Use your favorite HTML editor and create one page with one associated picture. I'll name mine aboutindex.htm.
Note that when you add a picture tag inside a htm page it looks something like:
We have to alter the IMG tags so that the SRC attribute equals the name we are to give to a picture in a resource:
My HTML code looks like:
| HTML inside a Delphi exe This is a HTML Delphi resource test: |
Creating and compiling a resource file
Remember that to create a new resource script file, you have to:
1. Create a new text file in your projects directory.
2. Rename it to AHTMLDelphi.rc.
3. Write down the following two lines of text in the AHTMLDelphi.rc file.
| DELPHIINDEX HTML "c:\Delphi\projects\aboutindex.htm" ABOUTDP GIF "c:\library\graphics\adp.gif" |
Note: the resource type "HTML" is RT_HTML, predefined as the resource type "23". This is the default resource type for the RES protocol.
In this way we have prepared one HTML page and one GIF picture to be included in the binary code of our EXE module.
The next step is to compile the .rc file. To compile the AHTMLDelphi.rc file to a .res file execute this command at the command prompt (in the projects directory):
BRCC32 AHTMLDelphi.RC
The final step is to add the following compiler directive to a unit in your project. RES file must be included in the program's build by adding a line like this:
{$R AHTMLDelphi.RES} |
Displaying inside a Web browser
When you have the application's exe (let's call it: myhtmldelphi.exe) the HTML resource contained within can be accessed via the RES: protocol. Run Internet Explorer and, in the Address bar, type the following:
res://c:\myhtmldelphi.exe/RT_HTML/DELPHIINDEX
This should result in:
That's it. If you have any questions; like how use the HREF tag inside a html resource, or how to display the html page inside a Delphi form; please post them on the Delphi Programming Forum!
前面的这些都不足以让我心动直到google的app engine的出现,app engine是一个很诱人的服务,可惜没有抢到最初的试用用户名额。按照我粗浅的理解,app engine可以认为这是google提供的虚拟主机服务。而这“虚拟主机”的大致配置如下:
上面的配置是不是很诱人呢?并且还是免费的,但是如果要能使用上这个免费的平台,你还得要重新熟悉新的语言,新的数据库操作等等。但是能用上 google稳定的服务器,那也值得一试的。要知道google在全球各地有n多的分布式数据中心,所以它的稳定性和负载能力是其他服务商无法比拟的,用 它自己的话说就是:An App Engine application runs on many web servers simultaneously. Any web request can go to any web server, and multiple requests from the same user may be handled by different web servers. Distribution across multiple web servers is how App Engine ensures your application stays available while serving many simultaneous users.
希望这个服务能尽快被推出,到时候我们就可以用一系列google的API创建出丰富的应用了,不过吃人嘴短,互联网要是真被google统治了,那或许将会是一场灾难。
另外,在中国,使用google的服务还是有强大的风险的,要么冒着被封的危险使用google的服务,要么在那里左右为难,干巴巴的望着!
google code确实是一个好东西!
http://www.storyday.com/html/y2008/1534_google-is-creating-an-empire.html
谢谢兄弟,我加入了等待申请的行列。
标签: google
子目录中的指令会覆盖更高级目录或者主服务器配置文件中的指令。
.htaccess必须以ASCII模式上传,最好将其权限设置为644。
错误文档的定位
常用的客户端请求错误返回代码:
401 Authorization Required
403 Forbidden
404 Not Found
405 Method Not Allowed
408 Request Timed Out
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type
常见的服务器错误返回代码:
500 Internal Server Error
用户可以利用.htaccess指定自己事先制作好的错误提醒页面。一般情况下,人们可以专门设立一个目录,例如errors放置这些页面。然后再.htaccess中,加入如下的指令:
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/internalerror.html
一条指令一行。上述第一条指令的意思是对于404,也就是没有找到所需要的文档的时候得显示页面为/errors目录下的notfound.html页面。不难看出语法格式为:
ErrorDocument 错误代码 /目录名/文件名.扩展名
如果所需要提示的信息很少的话,不必专门制作页面,直接在指令中使用HTML号了,例如下面这个例子:
ErrorDocument 401 “你没有权限访问该页面,请放弃!”
文档访问的密码保护
要利用.htaccess对某个目录下的文档设定访问用户和对应的密码,首先要做的是生成一个.htpasswd的文本文档,例如:
zheng:y4E7Ep8e7EYV
这里密码经过加密,用户可以自己找些工具将密码加密成.htaccess支持的编码。该文档最好不要放在www目录下,建议放在www根目录文档之外,这样更为安全些。
有了授权用户文档,可以在.htaccess中加入如下指令了:
AuthUserFile .htpasswd的服务器目录
AuthGroupFile /dev/null (需要授权访问的目录)
AuthName EnterPassword
AuthType Basic (授权类型)
require user wsabstract (允许访问的用户,如果希望表中所有用户都允许,可以使用 require valid-user)
注,括号部分为学习时候自己添加的注释
拒绝来自某个IP的访问
如果我不想某个政府部门访问到我的站点的内容,那可以通过.htaccess中加入该部门的IP而将它们拒绝在外。
例如:
order allow,deny
deny from 210.10.56.32
deny from 219.5.45.
allow from all
第二行拒绝某个IP,第三行拒绝某个IP段,也就是219.5.45.0~219.2.45.255
想要拒绝所有人?用deny from all好了。不止用IP,也可以用域名来设定。
保护.htaccess文档
在使用.htaccess来设置目录的密码保护时,它包含了密码文件的路径。从安全考虑,有必要把.htaccess也保护起来,不让别人看到其中的内容。虽然可以用其他方式做到这点,比如文档的权限。不过,.htaccess本身也能做到,只需加入如下的指令:
order allow,deny
deny from all
URL转向
我们可能对网站进行重新规划,将文档进行了迁移,或者更改了目录。这时候,来自搜索引擎或者其他网站链接过来的访问就可能出错。这种情况下,可以通过如下指令来完成旧的URL自动转向到新的地址:
Redirect /旧目录/旧文档名 新文档的地址
或者整个目录的转向:
Redirect 旧目录 新目录
改变缺省的首页文件
一般情况下缺省的首页文件名有default、index等。不过,有些时候目录中没有缺省文件,而是某个特定的文件名,比如在pmwiki中是 pmwiki.php。这种情况下,要用户记住文件名来访问很麻烦。在.htaccess中可以轻易的设置新的缺省文件名:
DirectoryIndex 新的缺省文件名
也可以列出多个,顺序表明它们之间的优先级别,例如:
DirectoryIndex filename.html index.cgi index.pl default.htm
防止盗链
如果不喜欢别人在他们的网页上连接自己的图片、文档的话,也可以通过htaccess的指令来做到。
所需要的指令如下:
RewriteEngine on
RewriteCond %{ HTTP_REFERER } !^$
RewriteCond %{ HTTP_REFERER } !^http://(www.)?mydomain.com/.*$ [NC]
RewriteRule .(gif&line;jpg)$ - [F]
如果觉得让别人的页面开个天窗不好看,那可以用一张图片来代替:
RewriteEngine on内容摘要:不得不承认,将动态网页链接rewriting成静态链接是最保险和稳定的面向搜索引擎优化方式
此外随着互联网上的内容以惊人速度的增长也越来越突出了搜索引擎的重要性,如果网站想更好地被搜索引擎收录,网站设计除了面向用户友好(User Friendly)外,搜索引擎友好 (Search Engine Friendly)的设计也是非常重要的。进入搜索引擎的页面内容越多,则被用户用不同的关键词找到的几率越大。在Google的算法调查一文 中提到一个站点被Google索引页面的数量其实对PageRank也是有一定影响的。由于Google 突出的是整个网络中相对静态的部分(动态网页索引量比较小),链接地址相对固定的静态网页比较适合被Google索引(怪不得很多大网站的邮件列表归档和BLOG按日期归档的文档很容被搜的到),因此很多关于面向搜索引擎 URL设计优化(URI Pretty)的文章中提到了很多利用一定机制将动态网页参数变成像静态网页的形式:
比如可以将:
http://phpunixman.sourceforge.net/index.php?mode=man¶meter=ls
变成:http://phpunixman.sourceforge.net/index.php/man/ls
实现方式主要有2种:
最简单的是基于各种WEB服务器中的URL重写转向(Rewrite)模块的URL转换:
这样几乎可以不修改程序的实现将 news.asp?id=234 这样的链接映射成 news/234.html,从外面看上去和静态链接一样。Apache服务器上有一个模块(非缺省):mod_rewrite:URL REWRITE功能之强大足够写上一本书。
当我需要将将news.asp?id=234的映射成news/234.html时,只需设置:
RewriteRule /news/(\d+)\.html /news\.asp\?id=$1 [N,I]
这样就把 /news/234.html 这样的请求映射成了 /news.asp?id=234
当有对/news/234.html的请求时:web服务器会把实际请求转发给/news.asp?id=234
而在IIS也有相应的REWRITE模块:比如ISAPI REWRITE和IIS REWRITE,语法都是基于正则表达式,因此配置几乎和apache的mod_rewrite是相同的:
比对于某一个简单应用可以是:
RewriteRule /news/(\d+)\.html /news/news\.php\?id=$1 [N,I]
这样就把 http://www.chedong.com/news/234.html 映射到了 http://www.chedong.com/news/news.php?id=234
一个更通用的能够将所有的动态页面进行参数映射的表达式是:
把 http://www.myhost.com/foo.php?a=A&b=B&c=C
表现成 http://www.myhost.com/foo.php/a/A/b/B/c/C。
RewriteRule (.*?\.php)(\?[^/]*)?/([^/]*)/([^/]*)(.+?)?$1(?2$2&:\?)$3=$4?5$5: [N,I]
以下是针对phpBB的一个Apache mod_rewrite配置样例:
RewriteEngine On
RewriteRule /forum/topic_(.+)\.html$ /forum/viewtopic.php?t=$1 [L]
RewriteRule /forum/forum_(.+)\.html$ /forum/viewforum.php?f=$1 [L]
RewriteRule /forum/user_(.+)\.html$ /forum/profile.php?mode=viewprofile&u=$1 [L]
这样设置后就可以通过topic_1234.html forum_2.html user_34.html这样的链接访问原来的动态页面了。
通过URL REWRITE还有一些好处:
mod_rewrite和isapirewrite基本兼容,但是还是有些不同,比如:isapirewrite中"?"需要转义成"\?",mod_rewrite不用,isapirewrite支持 "\d+" (全部数字),mod_rewrite不支持
比如我们需要将应用从news.asp?id=234迁移成news.php?query=234时,前台的表现可以一直保持为 news/234.html。从实现应用和前台表现的分离:保持了URL的稳定性,而使用mod_rewrite甚至可以把请求转发到其他后台服务器上。
Url美化的另外一个方式就是基于PATH_INFO:
PATH_INFO是一个CGI 1.1的标准,经常发现很多跟在CGI后面的"/value_1/value_2"就是PATH_INFO参数:
比如:http://phpunixman.sourceforge.net/index.php/man/ls 中:$PATH_INFO = "/man/ls"
PATH_INFO是CGI标准,因此PHP Servlet等都有的支持。 比如Servlet中就有request.getPathInfo()方法。
注意:/myapp/servlet/Hello/foo的 getPathInfo()返回的是/foo,而/myapp/dir/hello.jsp/foo的getPathInfo()将返回的 /hello.jsp,从这里你也可以知道jsp其实就是一个Servlet的PATH_INFO参数。ASP不支持PATH_INFO
PHP中基于PATH_INFO的参数解析的例子如下:
//注意:参数按"/"分割,第一个参数是空的:从/param1/param2中解析出$param1 $param2这2个参数
if ( isset($_SERVER["PATH_INFO"]) ) {
list($nothing, $param1, $param2) = explode('/', $_SERVER["PATH_INFO"]);
}
如何隐蔽应用:例如 .php,的扩展名:
在APACHE中这样配置:
ForceType application/x-httpd-php
如何更像静态页面:app_name/my/app.html
解析的PATH_INFO参数的时候,把最后一个参数的最后5个字符“.html”截断即可。
注意:APACHE2中缺省是不允许PATH_INFO的,需要设置 AcceptPathInfo on
特别是针对使用虚拟主机用户,无权安装和配置mod_rewrite的时候,PATH_INFO往往就成了唯一的选择。
OK,这样以后看见类似于http://www.example.com/article/234这样的网页你就知道可能是 article/show.php?id=234这个php程序生成的动态网页,很多站点表面看上去可能有很多静态目录,其实很有可能都是使用1,2个程 序实现的内容发布。比如很多WIKIWIKI系统都使用了这个机制:整个系统就一个简单的wiki程序,而看上去的目录其实都是这个应用拿后面的地址作为 参数的查询结果。
利用基于MOD_REWRITE/PATH_INFO + CACHE服务器的解决方案对原有的动态发布系统进行改造,也可以大大降低旧有系统升级到新的内容管理系统的成本。并且方便了搜索引擎收录入索引。
PHP的ISAPI模式安装备忘:只试成 php-4.2.3-Win32
解包目录
========
php-4.2.3-Win32.zip c:\php
PHP.INI初始化文件
=================
复制:c:\php\php.ini-dist 到 c:\winnt\php.ini
配置文件关联
============
按照install.txt中的说明配置文件关联
运行库文件
==========
复制 c:\php\php4ts.dll 到 c:\winnt\system32\php4ts.dll
这样运行后:会发现php把PATH_INFO映射到了物理路径上
Warning: Unknown(C:\CheDong\Downloads\ariadne\www\test.php\path): failed to create stream: No such file or directory in Unknown on line 0
Warning: Unknown(): Failed opening 'C:\CheDong\Downloads\ariadne\www\test.php\path' for inclusion (include_path='.;c:\php4\pear') in Unknown on line 0
安装ariadne的PATCH
==================
停止IIS服务
net stop iisadmin
ftp://ftp.muze.nl/pub/ariadne/win/iis/php-4.2.3/php4isapi.dll
覆盖原有的c:\php\sapi\php4isapi.dll
注:
ariadne是一个基于PATH_INFO的内容发布系统,
PHP 4.3.2 RC2中CGI模式的PATH_INFO已经修正,照常安装即可。
参考资料:
URL Rewrite文档:
ISAPI REWRITE文档
IIS的ISAPI REWRITE下载(免费)
http://httpd.apache.org/docs/mod/mod_rewrite.html
http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html
搜索引擎友好的URL设计
http://www.sitepoint.com/article/485
说不定这个URL原来就是articel.php?id=485
一个基于PATH_INFO的开源内容管理系统
http://typo3.com/
Within the past few years, Google has become the far most utilized search engine worldwide. A decisive factor therefore was, besides high performance and ease of use, the superior quality of search results compared to other search engines. This quality of search results is substantially based on PageRank, a sophisticated method to rank web documents.
The aim of these pages is to provide a broad survey of all aspects of PageRank. The contents of these pages primarily rest upon papers by Google founders Lawrence Page and Sergey Brin from their time as graduate students at Stanford University.
It is often argued that, especially considering the dynamic of the internet, too much time has passed since the scientific work on PageRank, as that it still could be the basis for the ranking methods of the Google search engine. There is no doubt that within the past years most likely many changes, adjustments and modifications regarding the ranking methods of Google have taken place, but PageRank was absolutely crucial for Google's success, so that at least the fundamental concept behind PageRank should still be constitutive.
The PageRank Concept
Since the early stages of the world wide web, search engines have developed different methods to rank web pages. Until today, the occurence of a search phrase within a document is one major factor within ranking techniques of virtually any search engine. The occurence of a search phrase can thereby be weighted by the length of a document (ranking by keyword density) or by its accentuation within a document by HTML tags.
For the purpose of better search results and especially to make search engines resistant against automatically generated web pages based upon the analysis of content specific ranking criteria (doorway pages), the concept of link popularity was developed. Following this concept, the number of inbound links for a document measures its general importance. Hence, a web page is generally more important, if many other web pages link to it. The concept of link popularity often avoids good rankings for pages which are only created to deceive search engines and which don't have any significance within the web, but numerous webmasters elude it by creating masses of inbound links for doorway pages from just as insignificant other web pages.
Contrary to the concept of link popularity, PageRank is not simply based upon the total number of inbound links. The basic approach of PageRank is that a document is in fact considered the more important the more other documents link to it, but those inbound links do not count equally. First of all, a document ranks high in terms of PageRank, if other high ranking documents link to it.
So, within the PageRank concept, the rank of a document is given by the rank of those documents which link to it. Their rank again is given by the rank of documents which link to them. Hence, the PageRank of a document is always determined recursively by the PageRank of other documents. Since - even if marginal and via many links - the rank of any document influences the rank of any other, PageRank is, in the end, based on the linking structure of the whole web. Although this approach seems to be very broad and complex, Page and Brin were able to put it into practice by a relatively trivial algorithm.
标签: Apache
本教程涵盖了Lua5.1。在Lua的每一个版本中都有一些非常不同之处。下面的示例代码将不能在老版本的Lua下运行。如果你仍然在使用老版本而且不愿意升级,不用担心,我已经在文章底部提供了4.0和5.0教程的源代码下载连接。好了,让我们开始吧!
首先,你需要下载Lua。你需要从Lua下载页面去下载源代码。如果你需要编译好了的二进制库,你能在LuaBinaries 中找到你想要的库(lib or dll)。
现在,我们需要安装Lua。在Linux下,你应该先解压文件,然后以root 用户在命令行键入"make linux"和"make linux install"。如果你需要帮助,请参考源代码文件夹中的INSTALL文件。现在,我下载了windows平台下的二进制库包并把它们解压到"C:\ Program Files\lua5.1"。
在Linux下不需要我们做任何设置,但是在windows平台下我们必须配置Visual C++,以便让编译器和连接器找到Lua文件。
现在你可以开始编译你的第一个Lua应用了。
这个程序简短且直接,下面做一点说明:
保存文件为luatest.cpp。如果你直接使用C而不是C++,将文件名改为luatest.c,然后将extern "C"删除。
#include
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
/* Lua解释器指针 */
lua_State* L;
int main ( int argc, char *argv[] )
{
/* 初始化Lua */
L = lua_open();
/* 载入Lua基本库 */
luaL_openlibs(L);
/* 运行脚本 */
luaL_dofile(L, "test.lua");
/* 清除Lua */
lua_close(L);
/* 暂停 */
printf( "Press enter to exit…" );
getchar();
return 0;
}
下面是test.lua的内容。
-- simple test
print "Hello, World!" 在Linux下,在命令行键入:
g++ luatest.cpp -llua -ldl -o luatest 然后,键入下列命令运行:
./luatest 如果没有问题,程序将在终端输出Hello, World!
在Visual C++你将需要进行下列步骤:
此时,按F7构建程序。
如果你采用的是dll库,请确保将其放在应用程序的目录中或者windows系统能够找到它的地方。如果你采用的是静态连接库,则不需要。 (Groov0V翻译,转载自CSDN)
谢谢这么简洁清晰的表述
g++ luatest.cpp `pkg-config lua5.1 --libs --cflags` -o luates




Lua 是一个扩展式程序设计语言,它被设计成支持通用的过程式编程,并有相关数据描述的设施。 Lua 也能对面向对象编程,函数式编程,数据驱动式编程提供很好的支持。 它可以作为一个强大、轻量的脚本语言,供任何需要的程序使用。 Lua 以一个用 clean C 写成的库形式提供。(所谓 Clean C ,指的 ANSI C 和 C++ 中共通的一个子集)
作为一个扩展式语言,Lua 没有 "main" 程序的概念:它只能 嵌入 一个宿主程序中工作,这个宿主程序被称作 embedding program 或简称为 host 。 宿主程序可以通过调用函数执行一小段 Lua 代码,可以读写 Lua 变量,可以注入 C 函数让 Lua 代码调用。 这些扩展的 C 函数,可以大大的扩展了 Lua 可以处理事务的领域,这样就可以订制出各种语言, 而它们共享一个统一的句法格式的框架。 Lua 的官方发布版就包含了一个叫做 lua 的简单的宿主程序,它用 Lua 库提供了一个保证独立的 Lua 解释器。
Lua 是一个自由软件,它的使用许可决定了对它的使用过程一般没有任何保证。 这份手册中描述的东西的实现,可以在 Lua 的官方网站 www.lua.org 找到,
跟其它的许多参考手册一样,这份文档有些地方比较枯燥。 关于 Lua 的设计想法的探讨,可以看看 Lua 网站上提供的技术论文。 有关用 Lua 编程的细节介绍,可以读一下 Roberto 的书,Programming in Lua (Second Edition) 。
标签: ADO, SQL Server, 远程访问
I've recently come across a great utility for taking screen shots of either your entire desktop or an application window. This program,ZScreen , is packed with features! I find I always need to take screen shots but I find it's always been a pain because not only do I have to take the screen shot, I have to open it in a graphic editor to grab what I need from it, then upload it somewhere. All in all a good screen shot takes me about 2 minutes. I was really excited when i came across this.
Features
Full Screen or Window Screen Shots - With ZScreen you can take either full screen or screens shots of your active window. This comes in handy if you don't want to waste space or image area with unnecessary content. You can currently do this with Windows' build in screen shot feature (Print Screen Key).
Screen Shot Cropping - You also have the ability to crop your screen shots with ZScreen. Using hot keys, your able to take a screen shot then, using your mouse, highlight the area you wish to capture instead of the entire screen or application window. Further giving you freedom to grab just the parts you want.

Editing Your Screen Shot - ZScreen also has the great option to automatically open your favorite graphic editing program to modify or notate the screen shot. This is handy if you need something to be highlighted, pointed out, or easily visibly in anyway. Complete freedom to manipulate your screen shot quickly. Closing / Saving the image automatically saves the screen shot as you've modified it.

Automatic FTP of Your Screen Shot - This is my favorite feature by far. ZScreen allows you to input your settings in the back end control panel for FTP access. If you set this up, your screen shots will be instantly FTP'd to your server of choice. The advanced configuration allows you to set it up to make it as easy as possible allowing you to specify the domain and path that the link will then be created with.

Links Placed In Clipboard - The next great feature is the clipboard addition. With every screen shot you take that is automatically FTP'd to your server / hosting, a link is placed in your clipboard for easy pasting over instant message, IRC, email or wherever you may need it. This allows who ever you send it to the ability to instantly see what you want to show them on your screen.
Hot Keys - You can also setup hot keys for your screen capturing which helps keep things simple by being able to specify between an active window shot or a full screen shot with the ability to crop. For instance, I've mine setup as Shift + Alt+ i

There are many more features that I haven't listed. If you are a person that takes screen shots as often as I do, definitely check this out. It's 100% free and open source. Very good work by my standards and highly recommended.
I absolutely love this application. Since I do the majority of my graphics work in Windows this is a perfect addition to the tools I can't live without. Big thanks to Brandon at BrandonZ.net for creating this.
You can find more information, screen shots, features, and downloads by visiting the ZScreen Page at BrandonZ.net
http://www.alfredfox.com/blog/Software/44/ZScreen_-_A_Great_New_Open_Source_Screen_Shot_Utility
标签: Open Source, Screen Shot, ZScreen
Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text. The flex program reads user-specified input files, or its standard input if no file names are given, for a description of a scanner to generate. The description is in the form of pairs of regular expressions and C code, called rules. Flex generates a C source file named, "lex.yy.c", which defines the function yylex(). The file "lex.yy.c" can be compiled and linked to produce an executable. When the executable is run, it analyzes its input for occurrences of text matching the regular expressions for each rule. Whenever it finds a match, it executes the corresponding C code.
Bison (1.875):
ftp://ftp.gnu.org/gnu/bison/
Bison Attribute Patch:
http://www.linuxfromscratch.org/patches/lfs/cvs/bison-1.875-attribute.patch
bison 是替代yacc的语法分析程序生成器. yacc是 Yet Another Compiler Compiler(又一个编译器的编译器)的缩写.
yacc是bison的包装脚本,实际上是以-y的参数调用bison. 这个是为了和那些用yacc而不是bison的程序兼容.
liby.a 是 Yacc 库,包含了与Yacc兼容的 yyerror 和主要函数。通常这个库没什么用,但 POSIX 要求有它.
Bison 依赖于: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, Sed.
http://man.chinaunix.net/linux/lfs/htmlbook/appendixa/bison.html
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open(this.src);}" onmousewheel="return imgzoom(this);" alt="" border="0">标签: 游戏
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://pic.yupoo.com/tualatrix/699625767893/medium.jpg');}" onmousewheel="return imgzoom(this);" alt="" border="0">
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://pic.yupoo.com/tualatrix/9772857b4475/vcq9r8e0.jpg');}" onmousewheel="return imgzoom(this);" alt="" border="0">默认情况下,你会将应用程序放入system/application/中,并且可能用 CodeIgniter 只管理这一个应用程序。当然,多个应用程序共享一个 CodeIgniter, 甚至对 application 文件夹进行重命名或更换路径也是可行的。
如果你要对 application 进行重命名, 你可能还要打开 index.php 文件,对变量 $application_folder 也要进行更改:
$application_folder = "application"; 你可以将 application文件夹从system 文件夹中挪放到服务器的其他的位置。但是你还要更改 index.php 文件里将$application_folder变量设置为服务器的全路径。
$application_folder = "/Path/to/your/application"; 如果你想要多个应用程序共享同一个 CodeIgniter, 你要将 application 下所有的文件夹放在不同的应用程序的文件夹内。
例如,你要建立两个应用程序 "foo" 和 "bar",你的应用程序文件夹的结构可能会像下面的这样:
system/application/foo/
system/application/foo/config/
system/application/foo/controllers/
system/application/foo/errors/
system/application/foo/libraries/
system/application/foo/models/
system/application/foo/views/
system/application/bar/
system/application/bar/config/
system/application/bar/controllers/
system/application/bar/errors/
system/application/bar/libraries/
system/application/bar/models/
system/application/bar/views/ 要选择使用某个应用程序,你需要打开主 index.php 文件,并且设置 $application_folder 变量为目标路径。例如,通过如下设置,就可以选择使用 "foo" 应用程序:
$application_folder = "application/foo"; 注意: 每一个应用程序都会需要它自己的index.php文件来调用他的目标程序。你可以随意对 index.php 文件进行命名。
http://codeigniter.org.cn/user_guide/general/managing_apps.html
标签: CodeIgnitor, PHP