小编fat*_*fat的帖子

非阻塞套接字轮询与阻塞套接字

我需要同时发送接收。
哪个选项会更好:

  • 1 个线程使用非阻塞套接字处理发送和接收

或者

  • 2个线程,其中一个处理阻塞recv() + 一个处理send()?

或者还有其他解决方案吗?

我预计最多有大约 50 个双向连接。这导致选项 #1 中有 50 个线程,选项 #2 中有 100 个线程。

sockets networking client-server blocking

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

Rectangle作为QML中的根元素

我使用Qt 5.5.0 MSVC 2013,32bit.
我想创建最小的QtQuick应用程序.当我选择时,New Project - Qt Quick Application我得到了2个QML文件的项目:main.qmlMainForm.ui.qml.由于我不需要它们,我删除第二个并将以下内容粘贴到main.qml:

Import QtQuick 2.4

Rectangle{
    id: root
    visible: true
    color: "gray"
    width: 400
    height: 800
}
Run Code Online (Sandbox Code Playgroud)

但是当我运行项目时,我什么也没得到.我在任务管理器中看到应用程序,但没有应用程序窗口.
问题:是否可以使用Rectangle作为根元素创建.qml文件?

qt qml qtquick2

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

如何在QT构建期间禁用Qt Wayland模块?

我正在尝试使用jessie在我的覆盆子pi上构建Qt .

我提供的配置选项如下所示:

./configure -v -opengl es2 -device linux-rasp-pi-g''+ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -optimized-qmake -reduce-exports -release -qt-pcre -make libs -prefix /usr/local/qt5
Run Code Online (Sandbox Code Playgroud)

但是,我收到了与QtWayland有关的以下错误...

Project ERROR: wayland-client development package not found
Makefile:54: recipe for target 'sub-brcm-egl-install_subtargets' failed
make[5]: *** [sub-brcm-egl-install_subtargets] Error 3
make[5]: Leaving directory '/home/pi/packages/qt5/qt-everywhere-opensource-src-5.5.1/qtwayland/src/plugins/hardwareintegration/client'
Makefile:54: recipe for target 'sub-client-install_subtargets' failed
make[4]: *** [sub-client-install_subtargets] Error 2
make[4]: Leaving directory '/home/pi/packages/qt5/qt-everywhere-opensource-src-5.5.1/qtwayland/src/plugins/hardwareintegration'
Makefile:81: recipe for target 'sub-hardwareintegration-install_subtargets' failed
make[3]: *** [sub-hardwareintegration-install_subtargets] Error 2
make[3]: Leaving directory '/home/pi/packages/qt5/qt-everywhere-opensource-src-5.5.1/qtwayland/src/plugins'
Makefile:107: recipe …
Run Code Online (Sandbox Code Playgroud)

qt qtwayland

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

ModuleNotFoundError: pip install 后没有名为 <modulename> 的模块

我在 python 包分发中做了我的第一步。
不幸的是,我ModuleNotFoundError从 pip 成功安装后。

我的目录布局非常简单:

maindir
   |- setup.py
   |- pysoft
         |- __init__.py
         |- main.py
         |- pylib.py
Run Code Online (Sandbox Code Playgroud)

主要.py:

maindir
   |- setup.py
   |- pysoft
         |- __init__.py
         |- main.py
         |- pylib.py
Run Code Online (Sandbox Code Playgroud)

pylib.py:

import pylib


def main():
    print("main program")
    pylib.libfunc()


if __name__ == '__main__':
    main()

Run Code Online (Sandbox Code Playgroud)

设置.py:

def libfunc():
    print("lib func")
Run Code Online (Sandbox Code Playgroud)

我打包并上传到test.pypi.org

import setuptools


setuptools.setup(
    name='pysoft',
    version='0.0.21',
    author='als',
    author_email='als@gnail.com',
    description='deploy tester',
    py_modules=['pylib'],
    packages=setuptools.find_packages(),
    python_requires='>=3.6',
    entry_points={
        'console_scripts': [
            'pysoft = pysoft.main:main',
        ],
    },
)

Run Code Online (Sandbox Code Playgroud)

我设置并开始新的virtualenv并安装我的包:

python3 setup.py sdist …
Run Code Online (Sandbox Code Playgroud)

python setuptools virtualenv

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

自定义标题高于标准?

将标题标题中的自定义标题放在更高的位置是否合理include?例如包括以下部分someclass.hpp:

#include "someclass.h"
#include "global.h"

#include <iostream>
#include <string>
Run Code Online (Sandbox Code Playgroud)

这是最佳做法吗?如果是,它的利润是多少?

c++ header

4
推荐指数
2
解决办法
291
查看次数

更改图表中图例的文字?

请参阅我的示例图表

在此输入图像描述

现在,我想更改图例的文本(不显示百分比值)与系列数据的xValues相同,例如:伦敦,东京,巴黎......(仍然保留饼图中的百分比值).

你知道怎么做吗 ?

我使用以下代码:

int[] yValues = { 50, 20, 10, 20 }; 
string[] xValues = { "London", "Paris", "Newyork", "Tokyo"};

myChart.Series["Default"].Points.DataBindXY(xValues, yValues);
myChart.Series[0].Label = "#PERCENT{P2}";
Run Code Online (Sandbox Code Playgroud)

.net c# charts visual-studio-2010

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

定义动态数组

如何在C#中定义动态数组?

.net c# arrays

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

c#,ListBox中有OnChange事件吗?

我一直在寻找类似的东西,但我找不到它.我希望我的程序在有任何变化时执行某些操作ListBox(例如,更改所选项目,添加新项目,删除一项等等)

c# events onchange

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

设置现有直线的Zedgraph线宽

是否可以设置现有Zedgraph线的宽度?我看到的大多数示例演示了以下方法

LineItem myCurve1 = myPane.AddCurve("Sine Wave", spl1, Color.Blue, SymbolType.None);
myCurve1.Line.Width = 3.0F;
Run Code Online (Sandbox Code Playgroud)

但正如我所看到的那样,只有在添加新曲线时才能完成.最明显的解决方案是创建List并在那里添加所有曲线以便以后访问它们.我不知道这是正确的方式还是我走错了路?

更新
我的情况如下.我在listBox中有几条线条曲线和列表.我想让当前选中的曲线变粗.这就是我需要访问现有曲线的原因.

c# charts zedgraph

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

在RichTextBox C#中插入数据

我的代码:

private void timer4_Tick(object sender, EventArgs e)
{
    for (int a = 0; a < 10; a++)
    {
        var infos = webBrowser1.Document.GetElementsByTagName("img")[a].GetAttribute("src");
        richTextBox1.Text = infos;
    }
    timer4.Stop();
}
Run Code Online (Sandbox Code Playgroud)

我想在RichTextBox中插入所有10个src值,而我的代码只执行一次.

c#

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

C#指定客户端端口

我有以下有关异步套接字编程的代码:

    public void ServerBeginAceept(ushort ServerPort)
    {
        try
        {
            ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, ServerPort);
            ServerSocket.Bind(ipEndPoint);
            ServerSocket.Listen(MAX_CONNECTIONS);
            IAsyncResult result = ServerSocket.BeginAccept(new AsyncCallback(ServerEndAccept), ServerSocket);
        }
    }


    public void ServerEndAccept(IAsyncResult iar)
    {
        try
        {
            ServerSocket = (Socket)iar.AsyncState;
            CommSocket = ServerSocket.EndAccept(iar);
        }
    }

    public void ClientBeginConnect(string ServerIP, ushort ServerPort)
    {
        try
        {
            CommSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(ServerIP), ServerPort);
            IAsyncResult result = CommSocket.BeginConnect(ipEndPoint, new AsyncCallback(ClientEndConnect), CommSocket);

        }
    }


    public void ClientEndConnect(IAsyncResult iar)
    { …
Run Code Online (Sandbox Code Playgroud)

c# sockets port client

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

我应该使用哪种跨平台应用构建工具?

我需要建立一个工程上的应用程序IPhone,Android并且Blackberry它包括发送短信的(或预装的联系人和邮件打开本地短信服务),访问联系人和推送通知.

该应用程序很容易构建,但我从来没有构建过应用程序,这就是我正在研究跨平台工具的原因.我目前使用煎茶触摸的用户界面和我已经看了成PhonegapMosync.

Phonegap不支持推送通知和发送短信.Mosync使用PIM 获取联系人的速度很慢,我没有用c/c ++编程.Phonegap确实有插件,但它们是不同的插件Android,iOS并且Blackberry它们挫败了跨平台应用程序的重点.

所以我很困惑如何构建这个应用程序,任何其他工具或一般建议的建议都会有所帮助,谢谢.

android cross-platform ios cordova mosync

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