我正在从一个我已经定义的数组中生成对象(它不仅限于这三个):
var links = [['Linkedin','img/linkedin.png','-300','-230', '600'],
['Google+', 'img/google.png', '0', '-230', '600'],
['Twitter', 'img/twitter.png', '300', '-230', '600']];
Run Code Online (Sandbox Code Playgroud)
现在它通过每个循环来创建Three.JS并将对象添加到场景中,如下所示:
$.each(links, function(i, item) {
var thisItemTexture = THREE.ImageUtils.loadTexture(item[1]);
thisItemGeo = new THREE.CubeGeometry(60, 60, 60,1 ,1 , 1);
thisItemMat = new THREE.MeshBasicMaterial({map: thisItemTexture });
thisItem = new THREE.Mesh(thisItemGeo, thisItemMat);
scene.add(thisItem);
thisItem.position.x = item[2];
thisItem.position.y = item[3];
thisItem.position.z = item[4];
thisItem.castShadow = true;
thisItem.receiveShadow = true;
});
Run Code Online (Sandbox Code Playgroud)
问题是:
如何访问我在上面每个循环中创建的对象?
我有以下代码:
$sql3 = "update news set date='$time' where id='2'";
$sql3 = $connect->exec($sql3);
if(!$sql3)
{
print_r($connect->errorInfo());
$error = $connect->errorInfo();
die ("Error: (".$error[0].':'.$error[1].') '.$error[2]);
}
Run Code Online (Sandbox Code Playgroud)
当我运行脚本时,有时我得到错误号'00000'.我的意思是它介绍了IF.这一切都是随机的.输出(有时):
Array ( [0] => 00000 [1] => [2] => )
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个问题?
PS:脚本每次都正确执行.
几天前我开始使用laravel,我正面临这个问题:
将NO永远不会回来了!
这是Controller,你知道为什么吗?
Class TestController extends BaseController {
public function __construct()
{
if (!Auth::check()) return 'NO';
}
public function test($id)
{
return $id;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在研究Three.js的一些个人项目.我正在使用requestAnimationFrame功能.我想每2秒调用一次函数.我搜索但我找不到任何有用的东西.
我的代码是这样的:
function render() {
// each 2 seconds call the createNewObject() function
if(eachTwoSecond) {
createNewObject();
}
requestAnimationFrame(render);
renderer.render(scene, camera);
}
Run Code Online (Sandbox Code Playgroud)
任何的想法?
我正在尝试在我的localhost上创建的虚拟网站上执行SQL注入,以进行安全测试项目.
我尝试将字符串输入" OR "='用户名和密码字段,因此它应绕过它并显示Login Correct - 但它显示登录失败
帮助理解为什么SQL注入不起作用
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('test');
if(isset($_POST['username'])&&isset($_POST['password'])){
$username =$_POST['username'];
$password = $_POST['password'];
echo $username;
echo $password;
if(!empty($username)&&!empty($password)){
$query ="SELECT id FROM users WHERE username = '$username' AND password = '$password'";
$query_run = mysql_query($query);
if(mysql_num_rows($query_run)>=1){
echo 'Login Correct';
}else{
echo 'Login Failed';
}
}
}
?>
<form action="test.php" method="POST">
Username: <input type="text" name="username">
Password: <input type="text" name="password">
<input type="submit" value="Submit">
</form>
Run Code Online (Sandbox Code Playgroud) 我知道如何设置包含路径:
set_include_path('/path');
Run Code Online (Sandbox Code Playgroud)
但是如何设置多个包含路径?例如:在两个不同的目录中.
我想实现一种根据 graphql 查询中设置的上下文切换不同链接的方法。到目前为止我所做的就是这样的事情,它运行良好,但随着时间的推移似乎并不是一个很好的解决方案。
const link = ApolloLink.from([
HandlerLink1,
HandlerLink2,
ApolloLink.split(
operation => operation.getContext().service === "x",
LinkX,
ApolloLink.split(
operation => operation.getContext().service === "y",
LinkY,
ApolloLink.split(
operation => operation.getContext().service === "z",
LinkZ,
LinkN
)
)
)
]);
Run Code Online (Sandbox Code Playgroud)
除了嵌套之外,还有其他更好的方法吗?
我有一个大的(400K*400K)稀疏矩阵,我需要计算A'*A的最大特征值.
问题是由于内存问题,Matlab甚至无法计算A'.
我也试过[a,b,c] = find(A),然后通过创建一个转置稀疏矩阵进行转置,但虽然find()有效,但是创建的sprase却没有.
有一个很好的解决方案吗?它可以是matlab函数或另一种技术来计算这种乘法的最大特征值.
谢谢.
有谁知道如何autoselect在selectbox?我想做的是,即使有一个blank option选择框仍然会显示具有值的选项。
有谁知道如何在 jquery 中做到这一点?
html代码:
<select name="name">
<option></option>
<option>Mark</option>
</select>
<select name="age">
<option></option>
<option>16</option>
</select>
Run Code Online (Sandbox Code Playgroud) 我有问题laravel 4.我想处理发生的错误,404 Not Found或任何其他错误.但我想在发生此类错误时调用控制器.我试过这个:
App::missing(function($exception)
{
return Response::view('errors.404', array('error'=>$exception), 404);
});
Run Code Online (Sandbox Code Playgroud)
但实际上代码不是我的目的,我想要这样的东西:
//I know this code doesn't work, I've just wanted to show the claim
App::missing('HomeController@error');
App::error('HomeController@error');
// or ...
Run Code Online (Sandbox Code Playgroud)
有没有办法在调用特定控制器的方法时处理错误?
php ×5
javascript ×3
laravel ×2
three.js ×2
apollo-link ×1
database ×1
html ×1
include-path ×1
jquery ×1
laravel-4 ×1
matlab ×1
mysql ×1
pdo ×1
react-apollo ×1
sql ×1