小编Cod*_*ezk的帖子

IOS通过ipv6网络提升asio连接

我正在尝试使用ios中的boost asio库连接dvr.该应用程序在ipv4网络中的模拟器中运行良好.但是当我在Appstore上提交应用程序时,苹果拒绝了该应用程序,因为它在ipv6网络上无效.我可以在苹果网站上看到应用程序应该支持ipv6网络.https://developer.apple.com/news/?id=05042016a

所以我认为问题出现在我试图使用升级库连接到DVR的部分,其中DVR的IP地址是从DB(硬编码)中提取的,下面是代码的相关部分.

        boost::asio::io_service io_service_;
        tcp::resolver::iterator endpoint_iter_;
        tcp::resolver resolver_; //to healp resolving hostname and ip

        stringstream strstream;//create a stringstream
        strstream << port;//add number to the stream

        endpoint_iter_ = resolver_.resolve(tcp::resolver::query(ip.c_str(),strstream.str()));
        start_connect(endpoint_iter_);

        // Start the deadline actor. You will note that we're not setting any
        // particular deadline here. Instead, the connect and input actors will
        // update the deadline prior to each asynchronous operation.
        deadline_timer_.async_wait(boost::bind(&dvr_obj::check_deadline, this));
        //starting thread for dvr connection
        io_service_.reset();
        thread_ =  new boost::thread(boost::bind(&boost::asio::io_service::run, &io_service_));
Run Code Online (Sandbox Code Playgroud)

start_connect方法

void start_connect(tcp::resolver::iterator …
Run Code Online (Sandbox Code Playgroud)

boost objective-c boost-asio ios

10
推荐指数
1
解决办法
366
查看次数

Bootstrap日期时间选择器

我想实现的日期时间选择器按此处的说明https://eonasdan.github.io/bootstrap-datetimepicker/#minimum-setup,我已经下载了该js文件,css文件的目录jscss.但单击图标时不会弹出日历.

 $(function() {
   $('#datetimepicker1').datetimepicker();
 });
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker-standalone.css">
<script type="text/javascript" src="js/bootstrap-datetimepicker.min.js"></script>

</head>


<body>

  <div class="container">
    <div class="row">
      <div class='col-sm-6'>
        <div class="form-group">
          <div class='input-group date' id='datetimepicker1'>
            <input type='text' class="form-control" />
            <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
Run Code Online (Sandbox Code Playgroud)

html javascript css twitter-bootstrap

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

Qt 与 webRTC 如何实现

我需要将实时桌面屏幕数据(如远程桌面)传输到客户端应用程序浏览器,并且用户可以在浏览器中查看远程桌面,我正在考虑使用 webRTC 和 Qt 来实现它。我可以使用 webRTC 数据通道来传输桌面数据。唯一的问题是如何将其与QT接口。当我在互联网上查找时,我的方法很少。

  1. 使用原生c++ webRTC实现并与浏览器通信。我进行了大量搜索以获得一个可用的 C++ webRTC 应用程序,但无法成功运行。

  2. 使用 Qt webengine 和 java 脚本实现。我阅读了有关 Qt webkit 桥的文档,我希望我可以在 Qt C++ 部分和 Javascript 部分之间传递数据,而不会造成太多延迟。

而且我不确定是否存在任何好的方法。请建议我正确的方法。

c++ qt qwebkit webrtc

7
推荐指数
0
解决办法
2222
查看次数

目录的安全范围书签

我需要为应用程序将一些文件写入该目录的目录授予完全读/写权限。我读到使用沙盒应用程序需要启用安全范围书签和 URL 访问以在重新启动应用程序后访问文件夹。

所以我试图根据这里的代码进行一些小的修改来实现它处理陈旧的 NSURL 书签的正确方法是什么?

     NSOpenPanel* openDlg = [NSOpenPanel openPanel];
    [openDlg setCanChooseDirectories:YES];
    [openDlg setCanCreateDirectories:YES];
    [openDlg setAllowsMultipleSelection:FALSE];
    if ( [openDlg runModal] == NSOKButton )
    {
        NSArray *files = [openDlg URLs];

        NSString* dirPath =[[files objectAtIndex:0] path];// absoluteString];
        BOOL isDirectory;
        NSFileManager* manager = [NSFileManager defaultManager];



        NSString *Dir = [dirPath stringByAppendingPathComponent:@"ScreenCaptures"];
        if (![manager fileExistsAtPath:Dir isDirectory:&isDirectory] || !isDirectory)
        {
            NSError *error = nil;

            [manager createDirectoryAtPath:Dir
               withIntermediateDirectories:NO
                                attributes:nil
                                     error:&error];
            if (error)
                NSLog(@"Error creating directory snap path: %@", [error localizedDescription]);

        }


            NSURL *url …
Run Code Online (Sandbox Code Playgroud)

macos objective-c nsurl nsopenpanel appstore-sandbox

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

Text God sms API在Godaddy共享主机上获取错误

我尝试使用来自godaddy的Textmagic使用php发送短信.我使用官方的git-hub页面来获取API https://github.com/textmagic/textmagic-rest-php

以上设置可以在我当地的Ubuntu PC上正常工作并能够发送短信,当我将这个API托管到Godaddy Windows共享主机,并执行相同的PHP代码时,我得到了以下错误.

[ERROR- ] error setting certificate verify locations: CAfile: c:\cgi\php56\curl-ca-bundle.crt CApath: none
Run Code Online (Sandbox Code Playgroud)

可能是什么原因.

Php版本:5.6

php http certificate php-curl

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

php ini设置upload_max_filesize不起作用

我需要在 php 7.2 Ubuntu 16.04 上将上传限制更改为 2GB。

作为第一步,当我检查/etc/php/7.2文件夹时,我可以看到clifpm文件夹。

因此,为了确保我使用的 ini 位置打印了 php 信息

 echo phpinfo()
Run Code Online (Sandbox Code Playgroud)

我得到了输出

Server API                         :   FPM/FastCGI
Virtual Directory Support          :   disabled
Configuration File (php.ini) Path  :   /etc/php/7.2/fpm
Loaded Configuration File          :   /etc/php/7.2/fpm/php.ini 
Run Code Online (Sandbox Code Playgroud)

我已经编辑/etc/php/7.2/fpm/php.ini

upload_max_filesize = 2048M

并重新启动 apache 但使用 phpinfo() 仍然打印

  upload_max_filesize   2M
Run Code Online (Sandbox Code Playgroud)

所以我尝试使用命令 php -i | grep -i "loaded configuration file"但它打印不同的配置文件,

 Loaded Configuration File => /etc/php/7.2/cli/php.ini
Run Code Online (Sandbox Code Playgroud)

在这个文件上,我也将 upload_max_filesize 更改为 2048 并重新启动了 Apache,结果仍然相同。

可能是什么问题,任何帮助将不胜感激。

php apache ubuntu-16.04

3
推荐指数
2
解决办法
3863
查看次数

Python 将秒添加到时间对象

我需要使用 python datetime 将秒添加到字符串时间,我有以下代码,但出现错误

from datetime import datetime,timedelta

time = "13-15-12"
duration = 15
time_object = datetime.strptime(time, '%H-%M-%S').time()
time_object_end = time_object + timedelta(seconds=duration)
Run Code Online (Sandbox Code Playgroud)

但得到了错误

time_object_end = time_object + timedelta(seconds=duration)
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'datetime.timedelta'
Run Code Online (Sandbox Code Playgroud)

python datetime timedelta python-3.x

3
推荐指数
1
解决办法
41
查看次数

FCM Android 通知声音问题

我正在尝试使用 php 向 Android 应用程序发送通知,并且它在没有声音的情况下工作正常。我按预期收到了前台和后台的通知。

这是PHP代码,

<?php


$token = $_GET['token'];
$action = $_GET['action'];
$msgTitle = $_GET['msgTitle'];
$msgDescription = $_GET['msgDescription'];
$notificationTitle = $_GET['notificationTitle'];


require './google-api-php-client-2.2.2/vendor/autoload.php';
$client = new Google_Client();
$client->useApplicationDefaultCredentials(); 
$client->setAuthConfig('./testPrjoectAPP-firebase-adminsdk-9hn21-22c1b3f426.json');
$client->addScope('https://www.googleapis.com/auth/firebase.messaging');
$httpClient = $client->authorize();
$project = "testPrjoectAPP";
$message = [
    "message" => [
        "notification" => [
            "body"  => "Message FCM",
            "title" => $notificationTitle
        ],
        "token" => $token,

       "data" => [
                "action" => $action,
            "msgTitle" => $msgTitle,
            "msgDescription" => $msgDescription 
         ]


    ]
];
$response = $httpClient->post("https://fcm.googleapis.com/v1/projects/{$project}/messages:send", ['json' => $message]);
echo$response->getReasonPhrase(); // …
Run Code Online (Sandbox Code Playgroud)

php android firebase firebase-cloud-messaging

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

ajax发送数据到php无法正常工作

我正在尝试使用ajax将一些数据发送到服务器,使用ajax到服务器,下面是js代码.

   var username = document.getElementById("username_id").value;

   var array = ["p","c"];    
   var jsonString = JSON.stringify(selectedLocation);
    if(!jsonString) jsonString = "";
    var url = "http://anotherserver/createNewUser.php";
    url = 'proxy.php?url='+url;
    $.ajax({ url: url,type: "POST",data: {username:username,datas:jsonString}, dataType: "json",
    success: function (jsonStr) { 
         var username = jsonStr.Username;
    },

     error: function(jqXHR, textStatus, errorThrown){

     }

     });
Run Code Online (Sandbox Code Playgroud)

在PHP中,我得到这个变量,像

<?php
$username=$_GET["username"];
$datas = json_decode(stripslashes($_POST['datas']));
$u= array('Username'=>$username);
echo json_encode($u);
return;
?>
Run Code Online (Sandbox Code Playgroud)

我成功地获得了响应,但 username始终为null.

可能是什么问题.

编辑:

proxy.php

<?php
header('Content-type: application/json');
$url=$_GET['url'];
//echo $url;
if (is_string($url)) {
    $url = urldecode($url);
}
$json=file_get_contents($url);
echo $json; …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax

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