小编use*_*136的帖子

构建@com_google_protobuf//:protobuf_lite 时缺少依赖项

当尝试:protochttps://github.com/google/protobuf/(3.4.1版本)在 OS X上构建时,我得到以下信息:

$ bazel build @com_google_protobuf//:protobuf_lite

ERROR: <...>/external/com_google_protobuf/BUILD:93:1: undeclared inclusion(s) in rule '@com_google_protobuf//:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/com_google_protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc':
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/stddef.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/__stddef_max_align_t.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/stdint.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/stdarg.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/limits.h'.
```
Run Code Online (Sandbox Code Playgroud)

但是,当构建目标而不是作为外部存储库时,它会成功。

$ cd <...>/external/com_google_protobuf/
$ bazel build :protobuf_lite
Run Code Online (Sandbox Code Playgroud)

列出的标题是系统标题,所以我遗漏了一些非常明显的内容。

有任何想法吗?

macos protocol-buffers bazel

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

gRPC + Bazel + Envoy Json 代理 - 如何导入 google/api/annotations.proto

我有一个非常简单的 gRPC 服务,定义为:

syntax = "proto3";
package helloworld;
import "annotations.proto";

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello(HelloRequest) returns (HelloReply) {
    option (google.api.http) = {
      post: "/api/v1/hello"
      body: "*"
    }
  }
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}
Run Code Online (Sandbox Code Playgroud)

有趣的是,我使用 Envoy gRPC <> JSON 转码过滤器在 HTTP2/Protobuf <> HTTP1/JSON 之间进行“翻译”。有关更多详细信息,请参阅https://www.envoyproxy.io/docs/envoy/latest/api-v1/http_filters/grpc_json_transcoder_filter …

java json protocol-buffers grpc bazel

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

在Matlab中使用透明像素填充数组

我在matlab中编写了一段代码,将图像大小调整到一定的大小(不会扭曲它们),并在必要时应用填充.

但是,填充是黑色的,我希望它是透明的.我不知道该怎么做.这是我的代码:

% global variables
inputFolder = 'input/images/';
outputFolder = 'input/resized/';
extension = 'jpg';
x = 1000;
y = 1000;

% list all the files in the input folder
fileList = dir([inputFolder '*.' extension]); 

% loop through all the files in the input folder, resize, pad and save
for i=1:length(fileList)
    % get filename and load image
    fname = fileList(i).name;
    container = imread([inputFolder fname]);

    % calculate local variables
    containerY = size(container,1);
    containerX = size(container,2);
    containerProp = containerX / containerY;
    canvasProp = …
Run Code Online (Sandbox Code Playgroud)

matlab transparency

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

将Java gRPC服务器绑定到Unix域套接字

我有以下代码,它将创建一个Java gRPC服务器并尝试将其绑定到USD / tmp / foo:

  EpollEventLoopGroup group = new EpollEventLoopGroup();
  Server server =
      NettyServerBuilder.forAddress(new DomainSocketAddress("/tmp/foo"))
          .channelType(EpollServerSocketChannel.class)
          .bossEventLoopGroup(group)
          .workerEventLoopGroup(group)
          .addService(new Impl())
          .build()
          .start();
  server.awaitTermination();
Run Code Online (Sandbox Code Playgroud)

但是,此操作失败bind(..) failed: Invalid argument

Exception in thread "main" java.io.IOException: Failed to bind
        at io.grpc.netty.NettyServer.start(NettyServer.java:231)
        at io.grpc.internal.ServerImpl.start(ServerImpl.java:151)
        at io.grpc.internal.ServerImpl.start(ServerImpl.java:75)
        at com.google.devtools.javatools.jade.pkgloader.GrpcLocalServer.main(GrpcLocalServer.java:60)
Caused by: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Invalid argument
        at io.netty.channel.unix.Errors.newIOException(Errors.java:117)
        at io.netty.channel.unix.Socket.bind(Socket.java:291)
        at io.netty.channel.epoll.AbstractEpollChannel.doBind(AbstractEpollChannel.java:714)
        at io.netty.channel.epoll.EpollServerSocketChannel.doBind(EpollServerSocketChannel.java:70)
        at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1283)
        at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
        at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
        at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:989)
        at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254)
        at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:364)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
        at …
Run Code Online (Sandbox Code Playgroud)

sockets bind unix-socket netty grpc-java

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

数字流的统计信息

我有一个包含多行的文件,每行包含30,000个整数.我有兴趣计算各种统计量,例如每行的均值/媒体/方差等.

例如,给定一个内容为的文件

1 2 3 4 5
6 8 9 0 10 11 12
Run Code Online (Sandbox Code Playgroud)

我想要一个类似的输出

(std = 1.4142135623730951, mean = 3.0, median = 3.0)
(std = 3.7416573867739413, mean = 8.0, median = 9.0)    
Run Code Online (Sandbox Code Playgroud)

除了自己写东西(通过数字获得幸福)之外,我还有什么选择?这有什么单行吗?

一个bash/python/perl /等.解决方案是优选的,因为简单.

python bash perl

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