在jsDoc我可以指定我的数组参数和成员,如下所示:
/**
* @constructor
* @param {Array.<string>} myArray
*/
function someFunction( myArray ){
this.firstArray = myArray;
/** @member {Array.<float>} */
this.secondArray = [];
}
Run Code Online (Sandbox Code Playgroud)
有没有还指定的方式length,或minLength与maxLength这些阵列的?
如何在实体中执行查询?
namespace Entities\Members;
/**
* @Entity(repositoryClass="\Entities\Member\MembersRepository")
* @Table(name="Members")
* @HasLifecycleCallbacks
*/
class Members extends \Entities\AbstractEntity
{
/**
* @Id @Column(name="id", type="bigint",length=15)
* @GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Column(name="userid", type="bigint", length=26, nullable=true)
*/
protected $userid;
/**
* @Column(name="fname", type="string", length=255,nullable=true)
*/
protected $fname;
/**
* @OneToMany(targetEntity="\Entities\Users\Wall", mappedBy="entry", cascade={"persist"})
*/
protected $commententries;
public function __construct()
{
$this->commententries = new \Doctrine\Common\Collections\ArrayCollection();
}
}
Run Code Online (Sandbox Code Playgroud)
示例我想在这个实体中有一个函数叫做:filter()
我希望能够过滤commententries集合.它应该返回具有某种条件的集合id=1.基本上它应该过滤从连接查询接收的数据.
所以像这样:
$this->commententries->findBy(array('id' => 1));
Run Code Online (Sandbox Code Playgroud)
但显然这不起作用.
我在Foo Controller中有一个Action方法,它需要参数:
public function fooAction($one, $two) {
$a = one;
$b = $two;
}
Run Code Online (Sandbox Code Playgroud)
我需要从一些Boo Controller 的其他方法转发到该方法.其中一个参数必须是参考参数.手册的唯一例子是:
$result = $this->forward()->dispatch('Boo\Controller\Boo', array('action' => 'boo'));
Run Code Online (Sandbox Code Playgroud)
没有任何其他参数.但他们写道:
$ params是一个可选的参数数组,用于查看此特定请求的RouteMatch对象.
所以,我尝试过:
$result = $this->forward()->dispatch('Boo\Controller\Boo', array(
'action' => 'boo',
'one' => &$one,
'two' => $two,
));
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
有没有办法将其他参数传递给前向控制器?
UPD:
这些也不起作用:
$result = $this->forward()->dispatch('Boo\Controller\Boo', array(
'action' => 'boo',
'params' => array(
'one' => &$one,
'two' => $two,
)));
$result = $this->forward()->dispatch('Boo\Controller\Boo', array(
'action' => 'boo',
'options' => array(
'one' => &$one,
'two' …Run Code Online (Sandbox Code Playgroud) php zend-framework-mvc zend-framework2 zend-framework-routing
我必须声明在应用程序中任何地方都可用的常量.在Zend Framework 1中,我们曾经声明application.ini如下:
constants.NAME_TITLE = "User Name",
Run Code Online (Sandbox Code Playgroud)
在Zend Framework 2中我们在哪里以及如何做到这一点?
我有一个ZF2项目,具有以下配置.它使用的是Doctrine ORM和SlmQueue.由于SlmQueue不支持我们的命名约定和oracle数据库,因此我们定制了SlmQueueDoctrine.
我怀疑我的工作不是使用ClearObjectManagerStrategy,并且在执行单个作业之前不清除ObjectManager.
它在队列启动后不反映数据库修改.但是如果我杀死队列守护进程并重新开始,它会选择新的值.
如何在执行单个作业之前实现ClearObjectManagerStrategy并清除ObjectManager?
我试过很多没有运气的人.
composer.json
{
"repositories": [
{
"url": "https://github.com/pradeep-sanjaya/doctrine-extensions.git",
"type": "git"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.3.3",
"doctrine/doctrine-orm-module": "0.7.*",
"pradeep-sanjaya/doctrine-extensions": "dev-master",
"spoonx/sxmail": "1.4.*",
"slm/locale": "dev-master",
"imagine/Imagine": "0.6.*",
"tecnick.com/tcpdf": "dev-master",
"slm/queue": "0.4.*",
"slm/queue-doctrine": "0.4.*"
}
}
Run Code Online (Sandbox Code Playgroud)
配置/自动加载/ slm_queue.local.php
<?php
return array(
'slm_queue' => array(
'queue_manager' => array(
'factories' => array(
'doctrineQueue' => 'SlmQueueDoctrine\Factory\DoctrineQueueFactory'
),
),
'job_manager' => array(
'factories' => array(
'Report\Job\Rank' => 'Report\Job\RankFactory',
),
'shared' => array(
'Report\Job\Rank' => false
),
),
'queues' => …Run Code Online (Sandbox Code Playgroud) Dlib C++可以很好地检测地标和估计面部姿势.但是,如何获得头部姿势的3D坐标轴方向(x,y,z)?
在Three.js中,我有一个3d对象,我使用局部剪切平面来渲染对象的一部分.
但是,由于3d对象是"空心的"(意味着只渲染外表面),当我们从该表面剪切任何东西时,我们可以"看到"该对象.这是我的意思的一个例子,从立方体上剪下一个角落.注意我们如何看到对面角落的背面.
我想让对象的外观坚固.基于这个问题,似乎最好的方法是在剪切区域上创建一个表面,从而限制孔并使对象看起来像不是空心的.
我的问题是,我怎么知道在哪里建造这个表面?Three.js是否提供了一种获取平面和任意曲面之间相交的顶点列表的方法?如果没有,我如何自己解决这个问题?
我发现了这个问题,但作者没有描述他们是如何解决我在这里遇到的问题的.
我正在研究Three.js的这个例子:http://threejs.org/examples/#canvas_geometry_panorama_fisheye
在这个例子中,我使用5个图像和一个视频作为纹理(视频格式为.ogv),而不是使用6个图像.我已按如下方式编辑上述示例以实现我的目标:
video = document.createElement('video');
video.autoplay = true;
video.src = "textures/videos/Row1Col1.ogv";
var videoTexture = new THREE.Texture(video);
videoTexture.needsUpdate = true;
var materials = [
videoTexture, // right
loadTexture( 'textures/cube/Park2/negx.jpg' ), // left
loadTexture( 'textures/cube/Park2/posy.jpg' ), // top
loadTexture( 'textures/cube/Park2/negy.jpg' ), // bottom
loadTexture( 'textures/cube/Park2/posz.jpg' ), // back
loadTexture( 'textures/cube/Park2/negz.jpg' ) // front
];
mesh = new THREE.Mesh(
new THREE.BoxGeometry( 300, 300, 300, 32, 32, 32 ),
new THREE.MultiMaterial( materials )
);
Run Code Online (Sandbox Code Playgroud)
其余代码与上述示例完全相同.
我没有得到想要的结果(有五个图像渲染到球体上,一个视频在'侧面'上播放),我得到了这个:
图像渲染得很好,但我没有看到视频播放.它的位置只有白色文字.没有其他的.
我是Three.js的新手,我第一次尝试将视频用作纹理.请告诉我如何在指定区域播放视频,请帮助我.
我正在使用Zend Framework 2创建一个应用程序.我正在使用它来验证输入InputFilter.是否可以Input有条件地制作一些必需品?我的意思是我有这样的代码:
$filter = new \Zend\InputFilter\InputFilter();
$factory = new \Zend\InputFilter\Factory();
$filter->add($factory->createInput(array(
'name' => 'type',
'required' => true
)));
$filter->add($factory->createInput(array(
'name' => 'smth',
'required' => true
)));
Run Code Online (Sandbox Code Playgroud)
我希望这个领域something是必需的,只有在type平等的时候1.有没有内置的方法来做到这一点?或者我应该创建自定义验证器?
我们遇到了一个问题,WebStorm 抱怨某些命名路径。不过,使用 webpack 一切都构建得很好。
这是我们的文件结构:
apps
app1
tsconfig.e2e.json
src
tests
testsuite1
file.po.ts
libs
lib1
src
index.ts
libs
Run Code Online (Sandbox Code Playgroud)
我们的 lib 的 index.ts:
export * from './lib';
Run Code Online (Sandbox Code Playgroud)
tsconfig.e2e.json 中的路径:
{
"compilerOptions": {
...
"paths": {
"@a/lib1": ["../../libs/lib1/src"],
}
}
}
Run Code Online (Sandbox Code Playgroud)
我们的导入在 file.po.ts 中被标记为在 WebStorm 中未找到
import { Mo } from '@a/lib1';
Run Code Online (Sandbox Code Playgroud)
我们已经在 WebStorm 中启用了 TypeScript 语言服务,并且其他一些类似的导入正在运行。我们对 TypeScript 和 WebStorm 很陌生,所以也许我们遗漏了一些东西。