如果您对php–转换Zend_Rest_Route代码来处理2个参数?感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于php–转换Zend_Rest_Route代码来处理2个
如果您对php – 转换Zend_Rest_Route代码来处理2个参数?感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于php – 转换Zend_Rest_Route代码来处理2个参数?的详细内容,我们还将为您解答php str replace的相关问题,并且为您提供关于cancan 里的 load_and_authorize_resourceend、Oracle EBS fnd_request.submit_request 与 Fnd_concurrent.wait_for_ruqest、PCIe Max_Payload_Size 和 Max_Read_Request_Size、php output_add_rewrite_var的有价值信息。
本文目录一览:- php – 转换Zend_Rest_Route代码来处理2个参数?(php str replace)
- cancan 里的 load_and_authorize_resourceend
- Oracle EBS fnd_request.submit_request 与 Fnd_concurrent.wait_for_ruqest
- PCIe Max_Payload_Size 和 Max_Read_Request_Size
- php output_add_rewrite_var
php – 转换Zend_Rest_Route代码来处理2个参数?(php str replace)
$this->bootstrap('Request'); $front = $this->getResource('FrontController'); $restRoute = new Zend_Rest_Route($front,array(),array( 'default' => array('version') )); $front->getRouter()->addRoute('rest',$restRoute);
我正在试图像这里指定的那样:http://wdvl.com/Authoring/PHP/Zend_Routes/Jason_Gilmore04282010.html
并让系统响应网址,例如:
www.site.com/version/param1/param2
如何更改上面的工作代码来做2个参数?我将实现其他命令,例如:/ retrieve /,/ put /等.
解决方法
/* * ReWrite Rules and Routes */ protected function _initRoutes() { $router = Zend_Controller_Front::getInstance ()->getRouter (); $router->addRoute('rest_url',new Zend_Controller_Router_Route('version/:param1/:param2/',array( 'module'=>'ModuleName','controller' => 'ControllerName','action' => 'ActionName','param1' => 'default here if you want','param2' => 'can leave param1 and param2 blank here'))); }
这是我一直有路线工作的方式.
cancan 里的 load_and_authorize_resourceend
使用
class BooksController < ApplicationController
load_and_authorize_resourceend
end
对应
|
|
这是对应
# File ''lib/cancan/controller_resource.rb'', line 24
def load_and_authorize_resource
load_resource
authorize_resource
end
分为两部分:
一,
# File ''lib/cancan/controller_resource.rb'', line 29
def load_resource
unless skip?(:load)
if load_instance?
self.resource_instance ||= load_resource_instance
elsif load_collection?
self.collection_instance ||= load_collection
end
end
end
这又再次为分两部分:
# File ''lib/cancan/inherited_resource.rb'', line 4
def load_resource_instance
if parent?
@controller.send :association_chain
@controller.instance_variable_get("@#{instance_name}")
elsif new_actions.include? @params[:action].to_sym
resource = @controller.send :build_resource
assign_attributes(resource)
else
@controller.send :resource
end
end
和
def load_collection
resource_base.accessible_by(current_ability, authorization_action)
end
def current_ability
@controller.send(:current_ability)
end
def authorization_action
parent? ? :show : @params[:action].to_sym
end
---------
- (Object) accessible_by(ability, action = :index)
Returns a scope which fetches only the records that the passed ability can perform a given action on.
@articles = Article.accessible_by(current_ability)
@articles = Article.accessible_by(current_ability, :update)
另一部分:
# File ''lib/cancan/controller_resource.rb'', line 39
def authorize_resource
unless skip?(:authorize)
@controller.authorize!(authorization_action, resource_instance || resource_class_with_parent)
end
end
Oracle EBS fnd_request.submit_request 与 Fnd_concurrent.wait_for_ruqest
1、关于fnd_request.submit_request的用法
fnd_request.submit_request的用法:
FND_REQUEST.SUBMIT_REQUEST函数是用来提交一个请求的,它返回一个NUMBER值.具体调用如下
program CHAR,-- 应用程序 description CHAR,242)">请求说明 ( 可选 )
start_time CHAR,--RUN 时间 )
sub_request BOOLEAN,-- 立刻提交请求 argument1 CHAR,242)">参数 1
argument2 CHAR,242)">2
argument3 CHAR,242)">3
argument4 CHAR,242)">4
argument5 CHAR,242)">5.......
argument100 CHAR);
英文说明(zt oracle) :
Parameters are as follows:
application - Short name of the application associated with the concurrent
request to be submitted.
program - Short name of the concurrent program (not the executable) for which
the request should be submitted.
description - Description of the request that is displayed in the Concurrent
Requests form (Optional.)
start_time - Time at which the request should start running,formatted as HH24:
MI or HH24:MI:SS (Optional.)
sub_request - Set to TRUE if the request is submitted from another request and
should be treated as a sub-request.
argument1...100 - Arguments for the concurrent request; up to 100
arguments are permitted. If submitted from Oracle Forms,you must specify all
100 arguments.
补充说明:
在用fnd_request.submit_request的时候,第五个参数用false,不要被参数名称误导;这个函数有105个参数,前面五个定义请求本身,后面100个是传递给请求的具体参数,都是Char类型,我们需要转换,默认值是chr(0),代表这个参数不用传递给调用的请求;
在Package里面调用只需要传递需要的参数个数,因为它有默认值指示结束;
在form里面则不行,要写满105个,而且我们参数结束之后要用一个chr(0)来表示结束
例
fnd_request.submit_request('AR',
'SVAINEX_P',
'',
FALSE,
:parameter.invoice_store,
chr(0),'','');
例如:
1--submittherequest
2l_req_id_fee:=fnd_request.submit_request('PO',
3REQIMPORT4''56FALSE,245)">7POP_REQUEST8to_char(SYSDATE,YYYYMMDD),245)">9ALL1011N12);
1314if(l_req_id_feeisnull)or(l_req_id_fee0)then15raisel_submit_req;
16else17提交请求18COMMIT;
19更新状态(只有请求成功,状态才更改)20UPDATEhek_om_pop_headers_all
21SETflow_statusreg_purchase22select*fromhek_om_pop_headers_all23WHEREheader_idIN(SELECTh.header_id
24FROMhek_om_pop_headers_vh
25h.flow_statuswait2627end2829
2、Oracle Erp等待报表运行机制
主要是用到了Fnd_concurrent.wait_for_ruqest这个function.
Fnd_concurrent.wait_for_request返回Boolean值,主要参数如下:
function FND_CONCURRENT.WAIT_FOR_REQUEST
(request_id IN number default NULL,--请求ID
interval IN number default 60,--检查时间间隔
max_wait IN number default 0,--最大等待时间
phase OUT varchar2,
status OUT varchar2,
dev_phase OUT varchar2,--请求运行阶段
dev_status OUT varchar2,--各个阶段状态
message OUT varchar2 --运行完成后输出信息)
return boolean;
dev_phase有Pending,Running,Complete,Inactive等几种,每种对应不同的Dev-Status,比如Complete阶段后就有normal,Error,Warning,Cancelled,Terminated等几种状态。
例如:
l_request_status:Fnd_Concurrent.Wait_For_Request(l_request_id,245)">25l_phase,245)">l_status,245)">l_dev_phase,245)">l_dev_status,245)">l_message);
IFl_request_statusTHENl_dev_statusnorMALNULLELSEFnd_Message.Debug(请求运行不成功:'||l_dev_status);
RETURNEND18请求未完成,无法查看报表内容!20Editor_Pkg.Report(l_request_id,245)">Y23
总结:FND_REQUEST.SUBMIT_REQUEST是一种通过后台方式提交请教的方法,可以在pkg和form中使用,在中使用要将参数写全。FND_CONCURRENT.WAIT_FOR_REQUEST是一个等待当前请求运行完毕的程序,可以利用这个等待当前的请求程序运行完毕再运行下面的程序。
3、有时候提交请求一直会返回0的情况:检查是否有初始化环境:
3.1、在PLsql中设定初始的方法
SELECT user_id
INTO l_num_user_id
FROM applsys.fnd_user
WHERE user_name ='user_name';
SELECT responsibility_id
INTO l_num_resp_id
FROM apps.fnd_responsibility_vl
WHERE responsibility_name ='responsibility_name';
SELECT application_id
INTO l_num_resp_appl_id
FROM applsys.fnd_application
WHERE application_short_name = 'app_short_name';
fnd_global.apps_initialize (user_id => l_num_user_id,
resp_id => l_num_resp_id,
resp_appl_id => l_num_resp_appl_id);
3.2、在Form设定初始的方法
-- 可直接引用全局变量
fnd_global.apps_initialize (user_id =>FND_GLOBAL.APPS_INITIALIZE(FND_GLOBAL.USER_ID,
resp_id =>FND_GLOBAL.RESP_ID,242)"> resp_appl_id =>FND_GLOBAL.RESP_APPL_ID);
PCIe Max_Payload_Size 和 Max_Read_Request_Size
最近PCIe在SSDFans上镜率挺高,那我们来聊两句MAX_READ_REQUEST_SIZE 和MAX_PAYLOAD_SIZE。
这两个东西都在PCIe Capability Structure 08h (Device Control Register)里
Maximum Payload Size (简称MPS)
控制一个TLP可以传输的最大数据长度。作为接收方,必须能处理跟MPS设定大小相同的TLP数据包,作为传输方,不允许创建超过MPS设定的TLP数据包。
PCIe协议允许最大一个Payload可以到4K,但是规定了在整个传输路径上的所有Device,都必须使用相同的MPS设置,同时不能超过该路径上一个设备的MPS能力值。也就是说,MPS capability高的设备要迁就低的设备。以PCIe SSD来说,插到一块老掉牙的主板上(MPS只有128 Byte),你的Payload size再大,也是没有用的。
系统的MPS值设置是在上电以后的设备枚举配置阶段完成的, 以主板上的PCIe RC和PCIe SSD为例,他们都在Device Capability Register里声明自己能支持的各种MPS,OS的PCIe驱动侦测到他们各自的能力值,然后挑低的那个设置到两者的Device Control register中。
PCIe SSD自身的MPS capability则是在其PCIe core初始化阶段设置的。
Maximum Read Request Size
在配置阶段,OS的PCIe驱动也会配置另外一个参数maximum read request size,用于控制一个Memory read的最大size,最大4K(以128 Byte为单位)
Read request size是可以大于MPS滴,比如给一个MPS=128 Byte的PCIe SSD发一个512 Byte的read request,PCIe SSD可以通过返回多个4个128 Byte的 Cpld,或者8个64 Byte的Cpld,完成这个request的响应。OS 层面可以通过控制PCIe SSD的maximum read request size参数,平衡多个PCIe SSD之间的吞吐量,避免系统带宽(总共40个lane)被某些个SSD霸占。
同时,Read request size也对PCIe SSD的Performance有影响,这个size太小,意味着同样的data,需要发送更多的request去获取,而read request的TLP是不带任何data payload的。
举例来说,要传64K的数据,如果read request=128 byte, 需要512个read TLP,512个TLP的浪费那是不小滴。
为了提高特别是大Block Size data的传输效率,尽量把read request size设的大一点,用更少的次数传递更多的数据,那是很好的。
原文链接
http://china.xilinx.com/support/answers/36596.html
php output_add_rewrite_var
添加 URL 重写器的值
我们今天的关于php – 转换Zend_Rest_Route代码来处理2个参数?和php str replace的分享已经告一段落,感谢您的关注,如果您想了解更多关于cancan 里的 load_and_authorize_resourceend、Oracle EBS fnd_request.submit_request 与 Fnd_concurrent.wait_for_ruqest、PCIe Max_Payload_Size 和 Max_Read_Request_Size、php output_add_rewrite_var的相关信息,请在本站查询。
本文标签: