我想动态更改setInterval的间隔值.由于setInterval回调函数中存在循环,我正在努力.我在stackoverflow上看到了太多问题.但是没有任何解决方案可以帮助我.如果有人知道答案,那么请举例说明.谢谢.这是我的代码.
<html>
<head>
<script type="text/javascript">
var speed = 10;
function updateSlider(slideAmount) {
speed = slideAmount;
}
function load() {
downloadUrl("points.xml", function (data) {
/* code */
abc();
});
function abc() {
function track() {
/* code */
downloadUrl("points.xml", function (data) {
var xml = data.responseXML;
var points = xml.documentElement.getElementsByTagName("point");
var i = 0;
setInterval(function () {
if (i != points.length) {
alert(speed);
}
i++;
}, 100 * speed);
});
}
track();
}
}
function downloadUrl(url, callback) {
var request = …Run Code Online (Sandbox Code Playgroud) 我必须在Laravel 5.2中实现登录功能.我使用官方的Laraval文档成功完成了这项工作,除了我不知道如何使用不同的数据库表列名称验证用户,即st_username和st_password.
我在互联网上寻找线索,但无济于事.我不知道我需要使用哪个类(比如,使用Illuminate .......)来验证.如果有人知道答案,请告诉我.
这是我的代码:
登录视图
@extends('layouts.app')
@section('content')
<div class="contact-bg2">
<div class="container">
<div class="booking">
<h3>Login</h3>
<div class="col-md-4 booking-form" style="margin: 0 33%;">
<form method="post" action="{{ url('/login') }}">
{!! csrf_field() !!}
<h5>USERNAME</h5>
<input type="text" name="username" value="abcuser">
<h5>PASSWORD</h5>
<input type="password" name="password" value="abcpass">
<input type="submit" value="Login">
<input type="reset" value="Reset">
</form>
</div>
</div>
</div>
</div>
<div></div>
@endsection
Run Code Online (Sandbox Code Playgroud)
AuthController
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
protected $redirectTo = …Run Code Online (Sandbox Code Playgroud) 我正在为某些点击事件设置cookie.然后在cookie中存储值后,我想
我通过参考Laravel官方文档开发了一个函数.控制台显示已设置cookie.但在那之后,我无法解决视图(Blade Template)中的两点(在上面的列表中提到).它总是显示(Cookie::get('cookie.clients'))'null'.但浏览器控制台显示该cookie.如果有人知道答案,我们将不胜感激.
这是我的代码.
调节器
use App\Client;
use App\Http\Requests;
use Illuminate\Http\Request;
use Validator;
use App\Http\Controllers\Controller;
use App\Repositories\ClientRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
class ClientController extends Controller
{
public function cookieadd(Request $request, Client $client)
{
$clients = [];
if (Cookie::get('cookie.clients') != null)
{
$clients = Cookie::get('cookie.clients');
}
array_push($clients, $client);
Cookie::forever('cookie.clients', $clients);
return redirect('/client');
}
}
Run Code Online (Sandbox Code Playgroud)
视图
@if (Cookie::get('cookie.clients') != null)
<p>cookie is set</p>
@else
<p>cookie isn't set</p>
@endif
Run Code Online (Sandbox Code Playgroud) 我已经在Ubuntu 14.04中安装了Elasticsearch 5.1。我在Elasticsearch中执行了一些操作,例如创建索引,删除索引等。然后,我安装了Kibana 5.1。现在,我想使用邮递员(使用PUT的localhost:9200 / my_index)在elasticsearch中创建新索引。但是我遇到了这个错误。
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "unknown setting [index.country] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.country] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
我记得我曾经用作country索引或类型。但是后来我清除了elasticsearch和kibana(也删除了与之相关的目录)。都重新安装。但是仍然出现此错误。如果有人知道解决方案,将不胜感激。
这是一些您可能需要解决的查询的输出。
GET localhost:9200 / _mapping
{“ .kibana”:{“映射”:{“服务器”:{“属性”:{“ uuid”:{“类型”:“关键字”}}}},“ config”:{“属性”:{“ buildNum “:{” type“:”关键字“}}}}}}
(获取)localhost:9200 …
elasticsearch elasticsearch-plugin elasticsearch-indices elasticsearch-5
我在我的项目中第一次使用onesignal 。我必须在某些事件上向特定用户(无论用户在 Chrome 或 Android 设备上登录)发送通知,例如 Whatsapp 也会在移动设备和网站上发送通知,并且仅当用户登录时才发送。我已成功向所有人发送通知用户。经过对 OneSignal 的一些研发后,我发现我必须为此目的向特定的玩家 ID 发送通知。但这里有一些我的问题/疑问。
如果有人可以解释这些要点并描述在我的数据库中存储playerid(何时以及如何)的工作流程,我们将不胜感激。
我正在使用cakePHP 3.我在mysql数据库中有一个用户定义的函数(UDF或Routine).该函数接受一个参数并返回一个整数值.我必须在MySQL order子句中订购返回的值.
我知道mysql查询使用该功能.即
SELECT customer_id FROM table_name ORDER BY routine_name(param1); //param1 is 'customer_id' which I have written after SELECT
Run Code Online (Sandbox Code Playgroud)
但我不知道如何在cakePHP 3中构建此查询.如果有人知道解决方案,答案将是欣赏.
这是我的cakePHP 3代码.
$purchasesTable = TableRegistry::get("Purchases");
$query = $purchasesTable->find();
$sf_val = $query->func()->routine_name(['Purchases.customer_id' => 'literal']);
$query->select();
$query->order(
// Routine/Function call should be here as per MySQL query.
// So, I think here I have to do something.
);
Run Code Online (Sandbox Code Playgroud) 我在div中有一个带有ng-if条件的表单.最初表格已关闭.单击按钮,将显示表单.但在提交表格时,我收到了Cannot read property '$valid' of undefined错误.如果我将ng-if更改为ng-show,它将完美无缺.但我必须使用ng-if.我找不到错误的原因.还有一件事,在获取错误时,我也将表单对象变为null.如果有人知道答案,我们将不胜感激.
这是我的代码
HTML
<div id="addCommentDiv" ng-if="showAddCommentForm == true">
<form id="formAddComment" name="formAddComment" novalidate>
<textarea id="taAddComment" name="taAddComment" placeholder="Add a comment.." ng-model="new_comment" ng-maxlength="1000" ng-required="true"></textarea>
<button type="button" ng-click="addComment()" ng-disabled="addCommentDisabled">Ok</button>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
$scope.addCommentDisabled = false;
$scope.addComment = function () {
if ($scope.formAddComment.$valid) {
console.log('valid');
}
}
Run Code Online (Sandbox Code Playgroud) 我从android端获得了一个base64字符串.我必须将其转换为音频文件,并将其保存到文件夹中.我以为我必须先把它转换成字节数组.然后,我必须将其转换为mp3文件.但不知道如何.我已经在base64中完成了图像工作.如果有人知道答案,那么请举例说明.谢谢.
我有一个 php 变量。我想检查它是否位于 mysql 表任何行的两列值之间。但我不想将该变量与表的确切值匹配。即,独占 BETWEEN 子句。如果有人知道答案,请举例说明。谢谢。这是我的代码。
$var = '15:00:00';
//Mysql Table (datatype of columns are TIME)
first last
row1 13:00:00 15:00:00
row2 17:00:00 19:00:00
Run Code Online (Sandbox Code Playgroud) 我必须在我的项目中使用邮件功能.当我在hostgator上托管我的项目时,它不起作用.但是当我在其他服务器上托管时,它工作正常.我无法理解问题.如果有人知道答案,请解释或建议我从一开始就能理解的链接.谢谢.这是我的代码.
$to_address = "test@somedomain.com";
$subject = "This goes in the subject line of the email!";
$message = "This is the body of the email.\n\n";
$message .= "More body: probably a variable.\n";
$headers = "From: test@somedomain.com\r\n";
mail("$to_address", "$subject", "$message", "$headers");
Run Code Online (Sandbox Code Playgroud) 我必须创建一个自定义的fabricjs 对象(比如fabric.Demo),它扩展了fabric.Group对象。fabric.Demo 对象将用于对另外两个 fabric.Group 对象进行分组。我在 Internet 上进行了搜索,发现只有这些链接有用。
但我收到此错误“this._objects 未定义”。我知道我还没有写 _render()。但我不明白在 _render() 中要编码什么。如果有人知道答案,将不胜感激。
这是我的代码。
(function (global) {
var fabric = global.fabric || (global.fabric = {}),
extend = fabric.util.object.extend,
clone = fabric.util.object.clone;
var stateProperties = fabric.Text.prototype.stateProperties.concat();
stateProperties.push(
'top',
'left'
);
fabric.Demo = fabric.util.createClass(fabric.Group, {
type: 'demo',
initialize: function () {
this.grp = new fabric.Group([], {
selectable: false,
padding: 0
});
this.grp.add([
new fabric.Group([
new fabric.Text('A', {top: 200, left: 200}),
new fabric.Text('B', {top: …Run Code Online (Sandbox Code Playgroud) 我第一次使用信号.我已经花了太多时间研发.但产量几乎为零.所以我在这里遵循我的要求.
我已成功开发了信号演示.但它与用户无关.如果我触发通知,则所有设备都会收到通知.所以这是我的问题.
如果有人能告诉我基本的例子,我们将不胜感激.我来自PHP方面.如果我从PHP开发人员的视图中得到答案,那将对我有好处.我已经在stackoverflow上问了这个问题.但答案来自Android视图.但我认为他不知道在服务器端,我们必须管理所有设备.所以我从那个答案中得不到更多.
php ×8
laravel ×4
javascript ×2
laravel-5.2 ×2
onesignal ×2
web-push ×2
angularjs ×1
audio ×1
base64 ×1
between ×1
cakephp ×1
cakephp-3.0 ×1
callback ×1
email ×1
fabricjs ×1
forms ×1
host ×1
laravel-5 ×1
mp3 ×1
mysql ×1
server ×1
setinterval ×1
web-hosting ×1