我设法写了一些打开相机并预览视频的代码.我现在想要从输出捕获帧以发送到理想编码为H.264的服务器
这是我得到的:
import UIKit
import AVFoundation
class ViewController: UIViewController {
let captureSession = AVCaptureSession()
var previewLayer : AVCaptureVideoPreviewLayer?
// If we find a device we'll store it here for later use
var captureDevice : AVCaptureDevice?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
captureSession.sessionPreset = AVCaptureSessionPresetHigh
let devices = AVCaptureDevice.devices()
// Loop through all the capture devices on this phone
for device in devices {
// Make sure this particular …Run Code Online (Sandbox Code Playgroud) 我有一个php应用程序,它调用一个名为Client的类.每隔一段时间我就会有一段时间错误.我认为它最初是SQL,但它转向指向类本身.
致命错误:第3行的C:\ Program Files(x86)\ Apache Software Foundation\Apache2.2\htdocs\ClientPortal\classes\Connections.php超出了30秒的最大执行时间
<?php
session_start();
class Connections { //line 3
Run Code Online (Sandbox Code Playgroud)
有谁知道这里发生了什么?
谢谢,
比利
我有一个项目的控制器/模型.所以这控制了项目模型等等.我有一个由pages_controller控制的主页.我想在主页上显示项目列表.这样做很简单:
function index() {
$this->set('projects', $this->Project->find('all'));
}
Run Code Online (Sandbox Code Playgroud)
我猜不是因为我得到了:
Undefined property: PagesController::$Project
Run Code Online (Sandbox Code Playgroud)
有人可以指引我朝正确的方向,
Jonesy
我正在使用ui-router进行状态管理,但我认为我的.htaccess重写规则有问题.使用/#/ account样式网址时,我的所有州都有效.现在我启用了html5模式,但我的应用程序没有像之前一样呈现.它似乎加载我的index.html和我所有的js和css文件等,但实际上并没有初始化任何状态.
这是我的文件夹结构:
root/
app/
components/
angular/
...
images/
scripts/
controllers/
directives/
...
app.js
styles/
views/
.htaccess
...
Run Code Online (Sandbox Code Playgroud)
我的vhosts DocumentRoot指向我的 app/
这是我的app.js与我的状态:
'use strict';
angular.module('appointeddPortalApp', ['ngResource', 'ui.state', 'ui.compat', 'fundoo.services', 'ui.date', 'ngCookies'])
.config(function ($stateProvider, $routeProvider, $locationProvider, $httpProvider) {
var access = routingConfig.accessLevels;
delete $httpProvider.defaults.headers.common["X-Requested-With"];
$httpProvider.defaults.useXDomain = true;
$locationProvider.html5Mode(true);
$stateProvider
.state('root', {
abstract: true,
url: '',
views: {
'header': {
templateUrl: 'views/partials/header.html'
},
'search': {
templateUrl: 'views/partials/search.html',
controller: 'SearchCtrl'
},
'main': {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
},
'footer': {
templateUrl: …Run Code Online (Sandbox Code Playgroud) 我有一个cakephp应用程序在我的本地机器(mac osx)上运行了一段时间然后突然我意识到我无法连接到mysql.sock.
我收到这个错误:
Warning (2): mysql_connect() [http://php.net/function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 540]
Run Code Online (Sandbox Code Playgroud)
dbo_mysql.php的第540行读取:
$this->connection = mysql_connect($config['host'] . ':' . $config['port'], $config['login'], $config['password'], true);
Run Code Online (Sandbox Code Playgroud)
我已经检查过,没有文件//var/mysql/mysql.sock.它实际上在/tmp/mysql.sock中
我尝试更改我的php.ini.default以匹配上面的内容,但它已经设置为在/ tmp /中查找本地连接.为什么,错误来自何处?
有没有人遇到过类似的错误?
谢谢,
Jonesy
我有一个很长的字符串,我想分成多行,所以它更容易阅读.但我不确定语法是什么
$xml = array('sXML' =>"<queryxml><entity>Ticket</entity><query><field>Status<expression op=\"$condition1\">$complete</expression></field><condition operator=\"AND\"><field>AccountID<expression op=\"equals\">$userid</expression></field></condition><condition operator=\"AND\"><condition><field>QueueID<expression op=\"NotEqual\">$routine</expression></field></condition><condition operator=\"OR\"><field>QueueID<expression op=\"NotEqual\">$recurring</expression></field></condition><condition operator=\"OR\"><field>QueueID<expression op=\"NotEqual\">$clientmanagement</expression></field></condition></condition></query></queryxml>");
Run Code Online (Sandbox Code Playgroud)
有人可以帮帮我吗?
我需要能够在我的表中存储像3.5这样的数字.所以我使用了十进制类型字段.但是如果我输入3.5它会将它四舍五入到4.我是愚蠢还是小数点不是小数点?
我是Java新手,只是进入查询数据库.到目前为止,我在ResultSetMetaData中得到了我的结果.我认为对于数据集中的每一行,我应该将它添加到某种形式的集合中?谁能告诉我这方面的最佳做法?
谢谢,
琼西
希望标题不要太神秘.我有一个带有DATETIME对象的数组,我只想弄清楚如何将它回显到页面.
["created"]=> object(DateTime)#3 (3) { ["date"]=> string(19) "2010-10-22 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London"
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?
试过date()但得到:
Warning: date() expects parameter 2 to be long, object given in C:\
Run Code Online (Sandbox Code Playgroud)
任何最感谢的帮助,
Jonesy
我一直在研究一个我现在想要扩展的Angular.js教程.这是一个简单的CRUD应用程序,它有一个模板列表:list.html(只是带有标题和内容的数据库中的记录),创建表单:new.html和编辑表单:edit.html.
刚才list.html从我的REST应用程序加载一组模板并将它们显示在表格中.有一个搜索表单和一些排序功能.
New.html有一个用于创建新模板的表单.
这两个.html文件通过转到不同的路由加载.#/和#/new
我现在要做的是有一个文件index.html,它在一个div中加载list.html,然后在另一个div中加载new.html.我们的想法是,记录列表将始终显示在左侧,然后其他部分将加载到右侧区域.因此,单击列表中的模板将在列表旁边的区域中打开它,但列表保持不变.然后,如果我单击新模板按钮,新模板表单将重新出现在内容区域中,但列表将保持不变.
这是我的代码:
app.js
var MailStash = angular.module("MailStash", ["ngResource"]).
config(function($routeProvider){
$routeProvider.
when('/', {controller: ListCtrl, templateUrl: '/js/partials/list.html'}).
when('/new', {controller: CreateCtrl, templateUrl: '/js/partials/new.html'}).
when('/edit/:editId', {controller: EditCtrl, templateUrl: '/js/partials/edit.html'})
});
MailStash.factory('Template', function($resource){
return $resource('/api/v1/template/:id', {id: '@id'}, { update: { method: 'PUT' } });
});
var EditCtrl = function($scope, $location, $routeParams, Template) {
$scope.action = "Update";
var id = $routeParams.editId;
$scope.template = Template.get({id: id});
$scope.save = function () {
Template.update({id: id}, $scope.template, function () {
$location.path('/'); …Run Code Online (Sandbox Code Playgroud)