小编Mey*_*sam的帖子

qmake:如何将库链接两次?

我需要libA.a在我的qmake文件中链接库两次:

LIBS = -lA \
       -lB \
       -lA \
       -lC \
       -lD
Run Code Online (Sandbox Code Playgroud)

qmake正在-lA运行时删除第一个g++。我该怎么办?

c++ qmake circular-dependency

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

如何使用PJSIP库解码SIP字节流?

我试图使用pjsip库来解码以下SIP字节流,但我得到分段错误.我的代码出了什么问题?

#include <pjsip.h>

int main()
{

    char __MSG[] = {
        0x49, 0x4e, 0x56, 0x49, 0x54, 0x45, 0x20, 0x73, 0x69, 0x70,
        0x3a, 0x40, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e,
        0x31, 0x20, 0x53, 0x49, 0x50, 0x2f, 0x32, 0x2e, 0x30, 0x0d,
        0x0a, 0x54, 0x6f, 0x3a, 0x20, 0x3c, 0x73, 0x69, 0x70, 0x3a,
        0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x2e, 0x34, 0x35, 0x3e,
        0x0d, 0x0a, 0x56, 0x69, 0x61, 0x3a, 0x20, 0x53, 0x49, 0x50,
        0x2f, 0x32, 0x2e, 0x30, 0x2f, 0x55, …
Run Code Online (Sandbox Code Playgroud)

c++ decode sip pjsip

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

如何使用 freediameter 为直径信用控制应用程序配置和启动直径客户端和服务器

到目前为止,我已经在 linux centOS 5.8 中安装并运行了 freediameter。CER 和 CEA 消息在客户端和服务器之间成功交换。

我希望在 freediameter 客户端和服务器中嵌入直径信用控制应用程序。客户端应该发送 CCR,服务器应该用 CCA 响应。

我经历过 freediameter DCCA 扩展,但不知道如何使用此扩展来发送和接收 CCR 和 CCA。我用谷歌搜索了很多,但没有得到任何帮助。

所以我只想用 DCCA 配置 freediameter 客户端和服务器。

任何帮助将不胜感激。

提前致谢。

diameter-protocol free-diameter

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

应该使用什么选项来使用 astyle 删除多余的空格?

如何使用 删除代码中的多余空格astyle?例如我想转换以下代码:

void foo (     int  a  ,  int   c )
{
d   = a+      c;
}
Run Code Online (Sandbox Code Playgroud)

对此:

void foo (int a, int c)
{
    d = a + c;
}
Run Code Online (Sandbox Code Playgroud)

但是 astyle 目前正在将其转换为:

void foo (int  a  ,  int   c)
{
    d   = a +      c;
}
Run Code Online (Sandbox Code Playgroud)

c++ formatting coding-style code-formatting astyle

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

docker中的nginx如何禁用http重定向到https

我正在尝试使用 docker 容器在 digitalocean 中部署 Meteor 应用程序。我已经在两个 Web docker 和一个 nginx docker 中完成了设置应用程序。我分叉了这个镜像仓库来构建 docker。你可以在lib目录下看到nginx配置。这里 nginx 配置了 SSL 并向 web docker 请求。我在生成 IP 地址的 SSL 证书时遇到了一些问题。应用程序正在开发中,因此计划暂时删除 SSL。所以改变了Nginx配置。

daemon off;
error_log /dev/stdout notice;
worker_processes  1;

events {
    worker_connections  4096;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    upstream site{
      server backend1:80;
      server backend2:80;
    }

    sendfile        on;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen              80 default_server;
        server_name         mup-ssl; //tried mup-ssl; and _;
        client_max_body_size 10M;


        location / {
          proxy_pass http://site/;
          proxy_redirect      off;
          proxy_set_header …
Run Code Online (Sandbox Code Playgroud)

curl nginx docker

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

如何在MaterialiseCSS中更改容器的默认宽度?

的缺省宽度container设定为70%MaterializeCSS:

容器类不是网格的严格组成部分,但在布局内容时很重要.它允许您将页面内容居中.容器类设置为窗口宽度的~70%.它可以帮助您集中和包含您的页面内容.我们使用容器来包含我们的身体内容.

怎么会改变?

css gridview materialize

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

python 2和3中的UTF-8字符串

以下代码适用于Python 3:

people = [u'Nicholas Gyeney', u'Andr\xe9']
writers = ", ".join(people)
print(writers)
print("Writers: {}".format(writers))
Run Code Online (Sandbox Code Playgroud)

并产生以下输出:

Nicholas Gyeney, André  
Writers: Nicholas Gyeney, André
Run Code Online (Sandbox Code Playgroud)

但是,在Python 2.7中,我收到以下错误:

Traceback (most recent call last):
  File "python", line 4, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' 
in position 21: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

我可以通过更改", ".join(people)为修复此错误", ".join(people).encode('utf-8'),但如果我这样做,Python 3中的输出将更改为:

b'Nicholas Gyeney, Andr\xc3\xa9'  
Writers: b'Nicholas Gyeney, Andr\xc3\xa9'
Run Code Online (Sandbox Code Playgroud)

所以我尝试使用以下代码:

if sys.version_info < (3, 0):
    reload(sys)
    sys.setdefaultencoding('utf-8')

people = [u'Nicholas Gyeney', u'Andr\xe9']
writers = ", …
Run Code Online (Sandbox Code Playgroud)

python string utf-8 python-2.7 python-3.x

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

重新启动应用程序后,App.config中的更改不会反映出来

我正在使用app.config文件来存储我的应用程序的动态参数.问题是,当我更改app.config文件中的值并启动应用程序时,它不会从配置文件加载新值.似乎app.config文件中的值只在编译时被读取并嵌入到exe文件中!

这是我读取配置文件的方式:

public class Helper
{
    static Helper()
    {
        Foo = ConfigurationManager.AppSettings["Foo"];
    }
    public static string Foo { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?

c# app-config appsettings

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

在c ++中将时间附加到字符串时出现访问冲突错误

请使用以下代码:

#inlcude <iostream>
#include <time.h>
using namespace std;

int main(int argc, char* argv[])
{
    time_t t;
    time(&t);

    string s = "file" + t;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

在线

string s = "file" + t
Run Code Online (Sandbox Code Playgroud)

我收到访问冲突错误.

如果我改为:#inlcude using namespace std;

int main(int argc, char* argv[])
{
    time_t t;
    time(&t);
    int x = t;

    string s = "file" + x;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我仍然得到同样的错误.怎么了?当然将int附加到字符串不能抛出访问冲突?

c++ string initialization append

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

CMake:是否可以在每次制作后运行 CONFIGURE_FILE?

我的 CMake 文件中有以下一段脚本:

CONFIGURE_FILE(
    ${CMAKE_CURRENT_SOURCE_DIR}/version.hpp.cmake
    ${CMAKE_CURRENT_SOURCE_DIR}/version.hpp
)
Run Code Online (Sandbox Code Playgroud)

但它只在执行后运行cmake,而不是make. 是否可以version.hpp在每次制作后创建文件?

以下是内容version.hpp.cmake

#ifndef _VERSION_HPP_
#define _VERSION_HPP_

#define MAJOR_VERSION "${MAJOR}"
#define MINOR_VERSION "${MINOR}"
#define PATCH_VERSION "${PATCH}"
#define RELEASE_VERSION "${RELEASE}"

#endif //_VERSION_HPP_
Run Code Online (Sandbox Code Playgroud)

MAJORMINORPATCHRELEASE变量已在定义CMakeLists.txt文件。

PS这篇文章显然与我的问题有关,但我无法理解。

makefile cmake

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