小编Sam*_*amB的帖子

CSS background color not working

I set the background color of the outer div to blue but it is not displayed. Why?

A demo of it:

.question-template {
    width: auto;
    height: auto;
    background-color: blue;
}
.question {
    float: left;
    margin: 10px;
}
.participants {
    background-color: green;
    float: left;
    margin: 10px;
}
Run Code Online (Sandbox Code Playgroud)
<body>
<div class="question-template">
    <div class="participants">234</div>
    <div class="question">Some lorem ipsum text</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)

jsFiddle

css

9
推荐指数
2
解决办法
5万
查看次数

致命错误:找不到类'数据库' - PHP

当我尝试使用问题类时,我收到以下错误:

Fatal error: Class 'database' not found in path/problem.php on line 25
Run Code Online (Sandbox Code Playgroud)

我不明白为什么我得到这个错误,在problem.php的顶部我需要database.php.怎么了?

problem.php

<?php
require("common.php");
require("database.php");
...
?>
Run Code Online (Sandbox Code Playgroud)

为database.php

<?php
class database
{
    ...
}
?>
Run Code Online (Sandbox Code Playgroud)

php

6
推荐指数
1
解决办法
4万
查看次数

加快保存图像 - iOS

我正在研究更多的迷你项目,后来将其纳入一个新项目.它基本上是一个测试单元.

我正在做的是创建一个AVCaptureSession然后创建一个方法OutputSampleBufferDelegate.在方法中,我将转换sampleBuffer为a UIImage并保存UIImage.当我在iPhone 4上运行应用程序时,它每秒只能保存2-3张图像.必须有一种更有效的方法来保存图像.

有人可以帮助我加快速度吗?

谢谢!

很多代码来自这里

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{   
    UIImage *resultUIImage = [self imageFromSampleBuffer:sampleBuffer];

    NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(resultUIImage)];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path = [paths objectAtIndex:0];

    CMTime frameTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);

    NSString *filename =  [NSString stringWithFormat:@"%f.png", CMTimeGetSeconds(frameTime)];

    NSString *finalPath = [path stringByAppendingString:filename];

    [imageData writeToFile:finalPath atomically:YES];
}

// Create a UIImage from sample buffer data
- (UIImage *)imageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer 
{
    // Get a CMSampleBuffer's Core …
Run Code Online (Sandbox Code Playgroud)

performance objective-c ios

6
推荐指数
2
解决办法
6875
查看次数

redirect_uri的参数值无效:缺少方案:/ auth/google_auth_code/callback

编辑:这是一个最小的可行项目

我正在尝试从服务器端流程的授权代码中获取Google的访问权限和刷新令牌.我在此处按照Google指南操作:https://developers.google.com/identity/sign-in/web/server-side-flow.

我使用的是护照和护照-google-authcode.

以下是节点应用的路由:

router.get('/auth/google_auth_code',
    passport.authenticate('google_authcode', {
        scope:
        [
            'https://www.googleapis.com/auth/calendar',
            'profile',
            'https://www.googleapis.com/auth/userinfo.email'
        ]
    }),
    function () {
        res.end();
    })

router.get('/auth/google_auth_code/callback',
    passport.authenticate('google_authcode', {
        failureRedirect: '/error'
    }), 
    function (req, res) {
        // do something with req.user
        res.send('hello');
    }
);
Run Code Online (Sandbox Code Playgroud)

这是此策略的护照配置.

passport.use('google_authcode', new GoogleAuthCodeStrategy({
    clientID: 'my client id',
    clientSecret: 'my secret',
    callbackURL: '/auth/google_auth_code/callback',
    // passReqToCallback: true
},
    function (accessToken, refreshToken, rawResponse, profile, done) {
            // unable to get here
    }
));
Run Code Online (Sandbox Code Playgroud)

发出身份验证请求时,Google会响应以下错误:

{
  "error" : …
Run Code Online (Sandbox Code Playgroud)

node.js oauth-2.0 google-oauth2 passport-google-oauth

5
推荐指数
1
解决办法
2361
查看次数

错误错误 - iOS开发

我正在尝试创建一个AVCaptureSession.我的代码基于WWDC 2011视频,编号419.

我有以下行与WWDC 2011视频中的代码完全相同,它也与此处的代码相同http://www.bardecode.com/en/knowledge-base/214-detailed-description-of-work -around换avcapturevideopreviewlayer-问题在-IOS-41.html

    // Create a device input with the device and add it to the session.
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device
                                                                    error:&error];
Run Code Online (Sandbox Code Playgroud)

但Xcode表示&错误是使用未声明的标识符.

video xcode ios4

2
推荐指数
1
解决办法
1842
查看次数

Javascript图像onload

我每次加载以前加载的图像时都会尝试加载新图像.create_photo_list函数可以正常工作.它会创建一个需要加载的照片数组.如果不需要加载则数组为空.问题是,当没有更多项加载时,它会一直调用load_next_photo函数.

我每次在函数中调用registerEventHandler的原因是因为如果不这样做,则在下一张照片加载时不会调用该函数.

    function registerEventHandler(node, event, handler) {
    if (typeof node.addEventListener == "function")
        node.addEventListener(event, handler, false);
    else
        node.attachEvent("on" + event, handler);
}

// Remove an HTML element event handler such as onclick
// ex: unregisterEventHandler($("textfield"), "keypress", showEvent);
function unregisterEventHandler(node, event, handler) {
if (typeof node.removeEventListener == "function")
    node.removeEventListener(event, handler, false);
else
    node.detachEvent("on" + event, handler);
}

function load_next_photo() {
    var loading_list = create_photo_list();
    alert(loading_list.length);
    if (loading_list.length > 0) {
        img[loading_list[0]]['loaded'] = 1;
        registerEventHandler($("load_img"), "onload", load_next_photo());
        $("load_img").src = img[loading_list[0]]['img'];
    }
    else { …
Run Code Online (Sandbox Code Playgroud)

javascript dom javascript-events

0
推荐指数
1
解决办法
9380
查看次数