小编mor*_*dew的帖子

ImagePullSecrets GCR

我在deployment.yaml文件中使用ImagePullSecrets配置GCR时遇到问题.由于许可,它无法下载容器

Failed to pull image "us.gcr.io/optimal-jigsaw-185903/syncope-deb": rpc error: code = Unknown desc = Error response from daemon: denied: Permission denied for "latest" from request "/v2/optimal-jigsaw-185903/syncope-deb/manifests/latest".
Run Code Online (Sandbox Code Playgroud)

我确信我做错了但我遵循了这个教程(和其他人一样),但仍然没有运气.

https://ryaneschinger.com/blog/using-google-container-registry-gcr-with-minikube/

pod日志同样没用:

"syncope-deb" in pod "syncope-deployment-64479cdcf5-cng57" is waiting to start: trying and failing to pull image
Run Code Online (Sandbox Code Playgroud)

我的部署如下:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  # Unique key of the Deployment instance
  name: syncope-deployment
  namespace: default
spec:
  # 3 Pods should exist at all times.
  replicas: 1
  # Keep record of 2 revisions for rollback
  revisionHistoryLimit: 2 …
Run Code Online (Sandbox Code Playgroud)

service-accounts kubernetes google-container-registry minikube

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

捕获RatingBar单击

抓住我的评级栏点击似乎有问题.评级栏显示正常,并具有默认值.唯一的问题是我无法更改任何值或未启用.我尝试了很多不同的东西(例如在布局中启用,完全用java构建).他们似乎没有任何影响.这是我最新的评级栏的化身.我必须做一些stooopid才能捕获点击.

Java代码:

  RatingBar showRatingBar = (RatingBar) findViewById(R.id.showRatingBar);
    showRatingBar.setEnabled(true);
    showRatingBar.setClickable(true);
    showRatingBar.setRating(0);
    showRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener(){
        @Override
        public void onRatingChanged(RatingBar ratingBar, float rating,
                boolean fromUser) {
            System.out.println("showRating.buildRatingBar:  " +rating);
            ratingBar.setRating(rating);

        }});
    showRatingBar.refreshDrawableState();
Run Code Online (Sandbox Code Playgroud)

布局:

         <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/showQualityLabel"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:text="@string/show_rating_label"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#E6E6E6"
            android:textSize="12sp" />

        <RatingBar
            android:id="@+id/showRatingBar"
            style="?android:attr/ratingBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:max="5"
            android:numStars="5"
            android:rating="0"
            android:stepSize="1"/>
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

先感谢您.

克雷格

android android-layout ratingbar

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

Golang 中的 GRPC 连接管理

我对 GRPC 比较陌生,希望确保我正在使用 golang 正确进行连接管理。我不想为每次调用都创建一个新连接,但我也不想在扩展时产生瓶颈。

我所做的是在 init 函数中创建一个连接:

var userConn *grpc.ClientConn
var userServiceName string

func init() {
    userServiceName := os.Getenv("USER_SERVICE_URL")
    if userServiceName == "" {
        userServiceName = "localhost"
    }
    logging.LogDebug("userClient:  Connecting to: "+userServiceName, "")
    tempConn, err := grpc.Dial(userServiceName, grpc.WithInsecure())
    if err != nil {
        logging.LogEmergency("account_user_client.Init()  Could not get the connection.  "+err.Error(), "")
        return
    }
    userConn = tempConn
}
Run Code Online (Sandbox Code Playgroud)

然后对于每个函数,我将使用该连接创建一个客户端:

c := user.NewUserClient(userConn)
// Contact the server and print out its response.
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
r, err …
Run Code Online (Sandbox Code Playgroud)

go grpc grpc-go

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

GRPC 消息结构

我正在将遗留应用程序(一些微服务和整体应用程序)迁移到使用 GRPC。目前整个代码库都在 GO 中。

我已经开始对我的消息进行建模,它们看起来与我在应用程序代码中使用的结构非常相似。我定义了两次相同的对象似乎很奇怪,但使用消息对象作为核心结构也似乎很奇怪。不过,似乎我会有大量的内存密集型数据整理。下面是消息和结构的示例以及它们的相似之处。

对于决定如何对我的消息进行建模,是否有任何建议/最佳实践?它们应该与我的核心结构保持一致吗?我是否应该不关心从 Golang 结构到消息的所有编组?

如果我问这样一个基本问题,请原谅我,因为我对协议缓冲区和 GRPC 非常陌生。

消息原型定义:

message Profile {
    string UID = 1;
    string ContactEmail = 2;
    google.protobuf.Timestamp DateOfBirth = 3;
    float WeightInKilos = 4;
    string Gender = 5;
    string Unit = 6;
    string CurrentStatus = 7;
    string Country = 8;
    string ExperienceType = 9;
    google.protobuf.Timestamp DateJoined = 10;
    repeated Ability Abilities = 11;
    repeated Role Roles = 12;
    repeated TermsAndConditionsAcceptance TermsAndConditionsAcceptances = 13;
    string TimeZone = 14;
    repeated BaselineTestResults BaselineTests =15;
    //Excluded UpdatedDate …
Run Code Online (Sandbox Code Playgroud)

go protocol-buffers grpc grpc-go

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

VSCode 找不到单元测试

由于某种原因,我的 VSCode 在“测试资源管理器”中找不到我的单元测试。它能够找到该类,但找不到该类中的任何方法。我认为我的 vscode 设置中肯定有一些配置错误,但不确定是什么。

下面是我正在尝试运行的课程的存根。

/**
 * Unit test for simple App.
 */
public class AppTest 
    extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public AppTest( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( AppTest.class );
    }

    /**
     * Rigourous Test :-)
     */
    public void testApp()
    {
        assertTrue( true ); …
Run Code Online (Sandbox Code Playgroud)

java junit visual-studio-code

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

FFMPEG 没有按预期“切割”

我正在通过一个简单的 system.process 使用 FFMPEG(来自 Java 应用程序)并尝试将视频切成块。我试图将其切成 10 秒的增量。我的 FFMPEG 命令如下所示:

ffmpeg -i SampleVideo.mp4 -ss 00:00:00.00 -t 00:00:10.00 -strict -2 1438458522836/1438458522836_0.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:10.01 -t 00:00:20.00 -strict -2 1438458522836/1438458536306_1.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:20.01 -t 00:00:30.00 -strict -2 1438458522836/1438458546042_2.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:30.01 -t 00:00:40.00 -strict -2 1438458522836/1438458561165_3.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:40.01 -t 00:00:50.00 -strict -2 1438458522836/1438458577187_4.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:50.01 -t 00:01:00.00 -strict -2 1438458522836/1438458587935_5.mp4
Run Code Online (Sandbox Code Playgroud)

他们看起来对我来说是正确的,但我的视频没有以 10 秒的增量出现。他们似乎在随机地点“分裂”。关于我做错了什么的任何想法?

以供参考:

video 0 == 10 seconds
video …
Run Code Online (Sandbox Code Playgroud)

java video ffmpeg video-processing

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

存储会话ID的推荐方法是什么?

我正在构建一个Android应用程序,我很好奇什么是会话管理的"最佳实践".

我将我的应用程序设置为进行身份验证(以google-play-services).我想存储会话ID并在用户离开应用程序时使其过期.cookie是最好的方法吗?还有更好的选择吗?任何示例代码都非常有用.

谢谢,克雷格

session android setcookie

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

将帧插入视频中间

我有一个案例,我需要在视频中间插入一帧(或多帧)。我看着做 ffmpeg 切割,插入,然后连接,但不幸的是我有很多切割,“缝合”有很多波动。我的想法是我可以让视频“完整”,然后插入帧作为我需要这样做的确切位置。这样我就可以解决断断续续的问题。

我目前正在使用 ffmpeg,并没有真正看到使用该工具完成此任务的任何方法。谷歌似乎也没有提供太多帮助。

以前有人这样做过吗?你做了什么在特定位置插入帧。

仅供参考 - 我正在用 Java 进行处理,使用 FFMPEG,我的视频文件是 mp4(虽然我可以转换)。

先感谢您。

video mp4 ffmpeg video-processing xuggler

5
推荐指数
0
解决办法
469
查看次数

Postgresql通过Helm没有安装

我正在尝试使用最新的稳定版通过helm安装postgres ,而不是正确安装持久卷.我在Minikube中安装它,由于某种原因它似乎无法正确地hostMount.

错误(在部署,窗格和副本集上)

PersistentVolumeClaim未绑定:"postgres-postgresql"错误:lstat/tmp/hostpath-provisioner/pvc-c713429d-e2a3-11e7-9ca9-080027231d54:没有此类文件或目录错误同步窗格

当我查看持久性卷时,它似乎正在正常运行.如果它有帮助,这是我的持久卷yaml:

{
  "kind": "PersistentVolume",
  "apiVersion": "v1",
  "metadata": {
    "name": "pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
    "selfLink": "/api/v1/persistentvolumes/pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
    "uid": "c71850e1-e2a3-11e7-9ca9-080027231d54",
    "resourceVersion": "396568",
    "creationTimestamp": "2017-12-16T20:57:50Z",
    "annotations": {
      "hostPathProvisionerIdentity": "8979806c-dfba-11e7-862f-080027231d54",
      "pv.kubernetes.io/provisioned-by": "k8s.io/minikube-hostpath"
    }
  },
  "spec": {
    "capacity": {
      "storage": "8Gi"
    },
    "hostPath": {
      "path": "/tmp/hostpath-provisioner/pvc-c713429d-e2a3-11e7-9ca9-080027231d54",
      "type": ""
    },
    "accessModes": [
      "ReadWriteOnce"
    ],
    "claimRef": {
      "kind": "PersistentVolumeClaim",
      "namespace": "default",
      "name": "postgres-postgresql",
      "uid": "c713429d-e2a3-11e7-9ca9-080027231d54",
      "apiVersion": "v1",
      "resourceVersion": "396550"
    },
    "persistentVolumeReclaimPolicy": "Delete",
    "storageClassName": "standard"
  },
  "status": {
    "phase": "Bound"
  }
}
Run Code Online (Sandbox Code Playgroud)

持续量索赔Yaml:

{
  "kind": "PersistentVolumeClaim", …
Run Code Online (Sandbox Code Playgroud)

postgresql kubernetes persistent-volumes minikube kubernetes-helm

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

未找到 Protobuf 时间戳

GRPC 相对较新,并且在我的 proto 文件中出现了一个我似乎无法理解的错误。我想使用“google.protobuf.Timestamp”在消息中发送时间。我似乎无法导入它。我究竟做错了什么?

    syntax = "proto3";

    import "google/protobuf/timestamp.proto";

    service ProfileService {
        rpc ConstructProfileStructFromUser (ConstructProfileStructFromUserRequest) returns (ConstructProfileStructFromUserResponse);
    }

    message ConstructProfileStructFromUserRequest {
        string transactionID    = 1;
        string User         = 2;
    }

    message ConstructProfileStructFromUserResponse {
        string UID = 1;
        string ContactEmail = 2;
        google.protobuf.Timestamp DateOfBirth = 3;
    }
Run Code Online (Sandbox Code Playgroud)

在我的 IDE 和我的编译器(使用下面的命令)然后我得到错误

google/protobuf/timestamp.proto: File not found.
profile.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
profile.proto:21:5: "google.protobuf.Timestamp" is not defined.
Run Code Online (Sandbox Code Playgroud)

运行命令:

protoc -I profile/ profile/profile.proto --go_out=plugins=grpc:profile
Run Code Online (Sandbox Code Playgroud)

协议 --version

libprotoc 3.0.0
Run Code Online (Sandbox Code Playgroud)

protocol-buffers proto grpc

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