在 docker 内部,由于此错误,我似乎无法编译我的 gRPC 微服务:
Step 4/9 : RUN make build
---> Running in ceb6e4d0e19b
protoc --version
libprotoc 3.12.4
protoc --proto_path=pkg/proto/notify/ --go_out=pkg/proto/notify/ --go-grpc_out=pkg/proto/notify/ --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative notify.proto
plugin versions reported in *.pb.go files:
./pkg/proto/notify/notify.pb.go:// protoc-gen-go v1.25.0-devel
./pkg/proto/notify/notify.pb.go:// protoc v3.12.4
go build -o notify-service *.go
go: downloading github.com/lib/pq v1.7.0
go: downloading google.golang.org/grpc v1.27.0
go: downloading github.com/jinzhu/gorm v1.9.14
go: downloading github.com/aws/aws-sdk-go v1.33.7
go: downloading github.com/go-kit/kit v0.10.0
go: downloading google.golang.org/protobuf v1.25.0
go: downloading github.com/go-co-op/gocron v0.2.1
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/golang/protobuf v1.4.2
go: …Run Code Online (Sandbox Code Playgroud) 我是SQLAlchemy的新手(但不是那么新).我正在使用0.9.3版本的项目.我想对SQLite数据库进行查询,过滤结果以获取那些没有时间戳的对象,或者自上次更新后超过24小时(在同一列上).
问题是,我没有确切知道如何实现时间过滤部分,我做了一个IPython Notebook会话,所以人们可以看看尝试寻找我的问题的答案有多长:
在[1]中:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Unicode, DateTime, Integer, create_engine
from sqlalchemy.orm import sessionmaker, relationship, backref
from datetime import datetime
engine = create_engine('sqlite:///:memory:')
Base = declarative_base()
Session = sessionmaker(bind=engine)
session = Session()
Run Code Online (Sandbox Code Playgroud)
在[2]中:
class Product(Base):
__tablename__ = "product"
id = Column(Integer, primary_key=True)
name = Column(Unicode(140), unique=True, nullable=False)
department = Column(Unicode(20))
added = Column(DateTime, default=datetime.now)
last_time_parsed = Column(DateTime)
def repr(self):
return "<Product(name=%s, department=%s, added=%s, last_time_parsed=%s)>" % (
self.name, self.department, self.added, self.last_time_parsed)
Run Code Online (Sandbox Code Playgroud)
在[3]中:
# create the …Run Code Online (Sandbox Code Playgroud) 我制作了一个docker镜像,将它与我在Wercker中的项目构建一起使用,我这样做是因为我认为已经在环境中安装了需要的包比在我的项目的每个版本中安装它们要好.
但是,现在Wercker每次都必须构建我的项目失败,原因是什么?超时,因为设置环境步骤需要超过5分钟.
Running wercker version: 1.0.405 (Compiled at: 2016-02-10T22:17:21Z, Git commit: b44ceb57f107c85dbaa619c6d89592b979f69b5b)
Using config:
box: shackra/latex-ebook
build:
steps:
- script:
name: Documento en formato PDF
code: |
xelatex --version
# twice, please
xelatex biblia.tex
xelatex biblia.tex
- script:
name: Subir documentos a Bitbucket
code: |
./upload-to-bitbucket.sh $BITBUCKET_U $BITBUCKET_P /straubingerdigital/biblia-platense/downloads biblia.pdf
Pulling from shackra/latex-ebook: latest
Pulling fs layer: e627a276e4dc
Pulling fs layer: 16c1e3a61000
Pulling fs layer: 80bc33a4179a
Pulling fs layer: d23822bfcf6d
Pulling fs layer: 4fdf7f1f2966
Pulling fs layer: f6a9cd9eb099 …Run Code Online (Sandbox Code Playgroud) 我在项目的前端使用 Axios,需要一种方法将用户重定向到登录页面,以防他想使用过期的令牌(刷新令牌对后端无效),我在web 看起来很容易适应我的技术堆栈(没有 Redux 的 ReactJS):
\n\nimport axios from \'axios\';\n\n// additional code that lives in its own module\nconst getToken = () => {\n return isAuth() ? window.localStorage.getItem("token") : "";\n};\n\nconst getRefreshToken = () => {\n return isAuth() ? window.localStorage.getItem("refresh_token") : "";\n};\n\nconst setTokens = (token, refresh) => {\n window.localStorage.setItem("token", token);\n window.localStorage.setItem("refresh_token", refresh);\n};\n// this is on my app.js file\naxios.interceptors.response.use(function (response) {\n return response;\n}, function (error) {\n const originalRequest = error.config;\n if (error.response.status === 401 && !originalRequest._retry) {\n originalRequest._retry = true;\n …Run Code Online (Sandbox Code Playgroud) 我正在处理以asyncio特定的相对时间间隔调用的调度方法。我决定将调度集中到我编写的类的一种方法中,以减少我的项目逻辑出错的机会。
每次计划方法完成时都应调用此类方法。我虽然在loop.call_soon每个方法的末尾添加,但我决定试一试装饰器。
我写了一个类装饰器,然后将它应用于我的主类的一些方法,编写其余的逻辑等等。但是当我尝试在我的项目上测试我的更改时,我得到了一个例外:
AttributeError: 'function' object has no attribute '__self__'
Run Code Online (Sandbox Code Playgroud)
不知何故,装饰我的方法使它成为一个功能。这是我无法理解的事情,为什么会发生这种情况?如何在不放弃装饰器的情况下解决这个问题?
这是我正在尝试做的一个最小、完整且可验证的示例:
import asyncio
from datetime import datetime
class thinkagain:
loop = asyncio.get_event_loop()
def __init__(self, f):
self.fun = f
self.class_ = f.__self__
def __call__(self):
self.fun(*args, **kwords)
# everything in Python is an object
setattr(self.fun, "called", datetime.utcnow())
self.loop.call_later(self.class_.think, 5 * 60)
class DoSomething:
loop = asyncio.get_event_loop()
@thinkagain
def think(self):
attr = getattr(self.dosomething, "called")
if attr:
elapsed = attr - datetime.utcnow()
seconds = elapsed.seconds
else:
seconds …Run Code Online (Sandbox Code Playgroud) 我正在观看一个Django的在线课程,老师在Sublime Text中用一个列表的两个值做了一个很好的技巧,它将每个值转换到另一个的位置,例如:
list = ("foo", "bar", "hello")
Run Code Online (Sandbox Code Playgroud)
标记foo并bar用鼠标然后进行转置,得到以下内容:
list = ("bar", "foo", "hello")
Run Code Online (Sandbox Code Playgroud)
如何在Emacs中实现?
编辑:为了遵守 Stackoverflow 指南并让我们所有人都轻松,我提交了一个可重现的小示例来重现我的错误:
\nhttps://github.com/shackra/stackoverflow-alias-bug
\n编辑2:如果这有帮助,我正在使用asdf版本v0.8.0-c6145d0来管理我的nodejs安装:
~ $ whereis node\nnode: /usr/bin/node /usr/include/node /home/jorge/.asdf/shims/node /usr/share/man/man1/node.1.gz\n~ $ node --version\nv14.2.0\n~ $ whereis yarn\nyarn: /home/jorge/.asdf/shims/yarn\n~ $ whereis npm\nnpm: /usr/bin/npm /home/jorge/.asdf/shims/npm /usr/share/man/man1/npm.1\nRun Code Online (Sandbox Code Playgroud)\n对于现有的 React 项目,我使用了 CRA,现在消除了大多数错误,但是在调试问题几个小时后我无法使我的别名正常工作:
\nnpm run build\n\n> frontend@0.1.0 prebuild /home/jorge/code/kue/fero/dev/frontend\n> nps generate-build-version\n\nnps is executing `generate-build-version` : nps genver\nnps is executing `genver` : deno run --allow-read --allow-write generate-build-version.ts\n\n> frontend@0.1.0 build /home/jorge/code/kue/fero/dev/frontend\n> nps build\n\nnps is executing `build` : craco build\ncraco: *** Cannot …Run Code Online (Sandbox Code Playgroud) 我有这个表单,我想根据其他已修复字段(它们从不隐藏)的值来显示或隐藏字段,但form.getFieldValue("some-field")始终使用 return undefined。
这是一个最小的功能示例,展示了我遇到的问题:
我对 antd 做错了什么以及如何实现我的用例?
python ×3
reactjs ×3
docker ×2
antd ×1
axios ×1
dlna ×1
emacs ×1
emacs24 ×1
go ×1
javascript ×1
orm ×1
python-3.x ×1
sqlalchemy ×1
streaming ×1
sublimetext2 ×1
time ×1
typescript ×1
upnp ×1
wercker ×1