小编lid*_*ang的帖子

Nodejs应用程序错误:使用pm2部署时绑定EADDRINUSE

使用pm2部署Express应用程序

数据库是mongodb

使用命令运行app时:

NODE_ENV=production pm2 start app.js -i max

aften有错误:绑定EADDRINUSE,这是日志,当出错时,

[app err (l0)] js:1073:26
[app err (l1)]     at Object.30:1 (cluster.js:587:5)
[app err (l2)]     at handleResponse (cluster.js:171:41)
[app err (l3)]     at respond (cluster.js:192:5)
[app err (l4)]     at handleMessage (cluster.js:202:5)
[app err (l5)]     at process.EventEmitter.emit (events.js:117:20)
[app err (l6)]     at handleMessage (child_process.js:318:10)
[app err (l7)]     at child_process.js:392:7
[app err (l8)]     at process.handleConversion.net.Native.got (child_process.js:91:7)Error: bind EADDRINUSE
[app err (l9)]     at errnoException (net.js:901:11)
[app err (l10)]     at net.js:1073:26
[app err (l11)]     at …
Run Code Online (Sandbox Code Playgroud)

deployment cluster-computing mongodb node.js express

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

如何在 apollo-client 中使用枚举?

枚举定义在 OrderTypesEnum.gql

enum OrderTypes {
  full_buy
  pink_buy
}
Run Code Online (Sandbox Code Playgroud)

导入 OrderTypesEnum.gql 文件

import OrderTypes from '@/graphql/OrderTypesEnum.gql'`
Run Code Online (Sandbox Code Playgroud)

但是,如何在代码中获取枚举?

我使用OrderTypes.full_buy 得到一些错误:

   self.$apollo.mutate({
        mutation: createOrder,
        variables: {
          subjectId: self.subject.id,
          types: OrderTypes.full_buy
        }
      })
Run Code Online (Sandbox Code Playgroud)
Mutation createOrderMutation error: Invariant Violation: Schema type definitions not allowed in queries. Found: "EnumTypeDefinition"
Run Code Online (Sandbox Code Playgroud)

OrderTypes 类型枚举的检查

在此处输入图片说明

apollo graphql apollo-client vue-apollo

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

苹果M1?安装 psycopg2 包符号未找到:_PQbackendPID

在此处输入图片说明

pg_config

venv ? which pg_config

/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config

Run Code Online (Sandbox Code Playgroud)
pip3 install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)

要求.txt

venv ? cat requirements.txt
-i https://mirrors.aliyun.com/pypi/simple/
alembic==1.4.2
amqp==2.6.0
billiard==3.6.3.0
celery==4.4.6
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
emoji==0.5.4
fastapi==0.59.0
future==0.18.2
h11==0.9.0
httptools==0.1.1 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
idna==2.10
kombu==4.6.11
mako==1.1.3
markupsafe==1.1.1
psycopg2-binary==2.8.5
pydantic==1.6
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2020.1
redis==3.5.3
requests==2.24.0
six==1.15.0
sqlalchemy==1.3.18
starlette==0.13.4
tenacity==6.2.0
urllib3==1.25.9
uvicorn==0.11.5
uvloop==0.14.0 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
vine==1.3.0
websockets==8.1
Run Code Online (Sandbox Code Playgroud)

完整的错误信息

Process SpawnProcess-1:
Traceback (most recent call …
Run Code Online (Sandbox Code Playgroud)

python psycopg2

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

Elixir解析二进制数据?

例如:

我有一个二进制看起来像这样:

 bin1 = "2\nok\n3\nbcd\n\n"?
Run Code Online (Sandbox Code Playgroud)

要么

 bin2 = "2\nok\n3\nbcd\n1\na\n\n"?
Run Code Online (Sandbox Code Playgroud)

等等...

格式是

 byte_size  \n  bytes \n byte_size  \n  bytes \n  \n 
Run Code Online (Sandbox Code Playgroud)

我想要解析二进制获取

  ["ok", "bcd"]
Run Code Online (Sandbox Code Playgroud)

如何在Elixir或Erlang中实现?

去版本

Go版本解析了这个

func (c *Client) parse() []string {
    resp := []string{}
    buf := c.recv_buf.Bytes()
    var idx, offset int
    idx = 0
    offset = 0

    for {
        idx = bytes.IndexByte(buf[offset:], '\n')
        if idx == -1 {
            break
        }
        p := buf[offset : offset+idx]
        offset += idx + 1
        //fmt.Printf("> [%s]\n", p);
        if len(p) == 0 || (len(p) …
Run Code Online (Sandbox Code Playgroud)

erlang elixir

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