小编Dal*_*ane的帖子

将struct传递给函数

我是一名新的C程序员,我想知道如何struct将一个函数传递给函数.我收到错误,无法找出正确的语法来执行此操作.这是它的代码....

结构:

struct student{
    char firstname[30];
    char surname[30];
};

struct student person;
Run Code Online (Sandbox Code Playgroud)

呼叫:

addStudent(person);
Run Code Online (Sandbox Code Playgroud)

原型:

void addStudent(struct student);
Run Code Online (Sandbox Code Playgroud)

和实际功能:

void addStudent(person)
{
    return;
}
Run Code Online (Sandbox Code Playgroud)

编译器错误:

第21行:警告:可疑标签声明:struct student
line 223:参数#1与原型不兼容:

c struct function

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

VS Code C# - System.NotSupportedException:没有数据可用于编码1252

我试图使用ExcelDataReader读取Ubuntu上的.xls文件.我正在使用VS#和C#.这是代码:

var stream = File.Open(filePath, mode: FileMode.Open, access: FileAccess.Read);
var reader = ExcelReaderFactory.CreateReader(stream);
Run Code Online (Sandbox Code Playgroud)

我也试过这个:

var reader = ExcelDataReader.ExcelReaderFactory.CreateBinaryReader(stream);
Run Code Online (Sandbox Code Playgroud)

当我运行时,我收到以下异常:

未处理的异常:System.NotSupportedException:没有可用于编码的数据1252.有关定义自定义编码的信息,请参阅Encoding.RegisterProvider方法的文档.在System.Text.Encoding.GetEncoding(Int32代码页)

我已经安装了libmono-i18n-west4.0-cil(也试过libmono-i18n4.0-all),因为我发现有些人推荐这个,但问题仍然存在.还安装了包System.Text.Encoding.CodePages没有成功.

谁能帮忙解决这个问题?

c# xls exceldatareader visual-studio-code

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

防止鼠标点击事件

我在 Chrome、Firefox 和 IE 上尝试了以下代码:

var test = document.getElementById('test');

test.addEventListener( 'click', function ( e ) {
  alert( 'clicked' );
});

test.addEventListener( 'mousedown', function ( e ) {
  e.stopImmediatePropagation();
  e.stopPropagation();
});
Run Code Online (Sandbox Code Playgroud)

在 chrome 中,不会触发警报;在 Firefox 中,即,是的。哪个是正确的行为?如何防止点击事件被触发?

jsBin 示例

javascript cross-browser

9
推荐指数
1
解决办法
6835
查看次数

Azure IoT Edge 与协议网关(IoT 中心)

我们现有的物联网平台使用 Azure 协议网关并且运行良好。我刚刚意识到 MS Azure 推出了一个新版本的协议网关,称为IoT Edge。我只是在寻找 IoT Edge 中可用的新功能,现在我完全混淆了这两个组件:

  • IoT Edge 主要支持设备和网关之间的本地连接。如果这不是我的要求的一部分怎么办?我还应该升级到 IoT Edge 吗?
  • 我没有看到任何性能改进 - 协议网关与物联网边缘

我知道答案可能是一个更广泛的讨论,但谁能提供一个简单的解释?

azure iot windows-10-iot-core azure-iot-hub azure-iot-edge

8
推荐指数
1
解决办法
2753
查看次数

身份验证 OneDrive Python API

我正在尝试将我的 OneDrive 用于 Python 业务。

我已经安装了 onedrivesdk,现在我正在验证我的 OneDrive

提供的代码如下

import onedrivesdk

redirect_uri = 'http://localhost:8080/'
client_secret = 'your_client_secret'
client_id='your_client_id'
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']

http_provider = onedrivesdk.HttpProvider()
auth_provider = onedrivesdk.AuthProvider(
http_provider=http_provider,
client_id=client_id,
scopes=scopes)

client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
auth_url = client.auth_provider.get_auth_url(redirect_uri)
Run Code Online (Sandbox Code Playgroud)

我不确定应该提供的 client_secret 和 client_id 是什么才能访问我的 OneDrive

关于从哪里获得上述参数的帮助,我将不胜感激。

sdk oauth-2.0 python-3.x onedrive

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

我无法部署生产模式:命令返回非零退出代码 (magento 2.1)

我遇到了一个大问题,magento 部署命令失败。

php bin/magento deploy:mode:set production
Run Code Online (Sandbox Code Playgroud)

返回以下错误:

命令返回非零退出代码: /usr/bin/php7.0 -f bin/magento setup:static-content:deploy fr_FR en_US

提前致谢!

php deployment magento2

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

为什么此C ++函数定义不需要大括号?

我在阅读Stroustrup的“编程-使用C ++的原理和实践”时发现,他包含了一个没有花括号的函数,却没有解释自己,网上的人说这是不可能的。

我已经编译了代码,并且可以正常工作。

void f()
    try {} 
    catch(...) {}
Run Code Online (Sandbox Code Playgroud)

我希望从中得到一个编译器错误,但是我没有,并且它工作正常。我正在使用C ++ 17。

c++ syntax function

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

ClassNotFoundException:org.slf4j.impl.StaticLoggerBinder

我正在将 spring 应用程序转换为 spring-boot,使用 boot-starter-parent 版本:2.0.4.RELEASE。当我使用 mvn install 构建时,它运行良好,但是当我尝试使用命令运行应用程序时:mvn spring-boot:run -Dspring.profiles.active=dev,我收到此异常: ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder

以下是我的 pom 中的依赖项:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.4.RELEASE</version>
</parent>

<dependencies>
  <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
    <version>2.0.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.24</version>
  </dependency>
  <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.3.0-alpha4</version>
  </dependency>
  <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.3.0-alpha4</version>
  </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

我尝试遵循此问题的建议,并使用新旧版本的 logback(核心和经典)依赖项,并添加“slf4j-log4j12”和“slf4j-simple”,但仍然出现异常。堆栈跟踪是:

java.lang.NoClassDefFoundError:org/slf4j/impl/StaticLoggerBinder 在 org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext (LogbackLoggingSystem.java:285) 在 org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize (LogbackLoggingSystem) .java:102) 在 org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent (LoggingApplicationListener.java:191) 在 org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent (LoggingApplicationListener.java:170) 在 org. springframework.context.event.SimpleApplicationEventMulticaster.invokeListener (SimpleApplicationEventMulticaster.java:167) 在 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent (SimpleApplicationEventMulticaster.java:139) 在 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent (SimpleApplicationEventMulticaster. java:122)在org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68)在org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)在org.springframework.boot.SpringApplication .run (SpringApplication.java:316) 在 org.springframework.boot.SpringApplication.run (SpringApplication.java:1258) 在 …

logging slf4j spring-boot logback-classic spring-logback

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

如何使用 OpenSSL 生成 X509 证书的所有权证明?

我需要生成所有权证明,用我的私钥签署验证码。

我没有在 Stack Overflow 中找到与此相关的问题,也没有在 Internet 上找到一些参考资料。我正在关注本教程,但我想使用 OpenSSL。

我的验证码与X509证书有关,如下所示:

7A69A4702DA903A41C3A5BC5575A8E3F49BEC5E5BA2D4CE1
Run Code Online (Sandbox Code Playgroud)

openssl certificate ssl-certificate x509certificate x509

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

什么是类型推断?

它只存在于静态类型语言中吗?并且只有当语言不是强类型时才存在(即,Java 是否有强类型)?此外,它属于哪里 - 在编译阶段假设它是一种编译语言?

一般来说,类型不明确时的规则是由语言规范规定的还是由实现决定的?

types type-systems programming-languages type-inference

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