我刚刚开始一个使用infinitered/ignite的新项目。我已将我的getUserToken
函数添加到APITestScreen
所以我知道该函数按预期工作,但我无法将该方法与该onPress
函数连接到我添加到 LaunchScreen的按钮。
我已将其导入到视图中,但单击按钮时没有任何反应。我添加了一个警报和一个 console.log,但它们没有被触发。我应该怎么做才能在单击按钮时运行fetchUserToken?
整个项目发布在 Github 上。
我的看法
import getUserToken from '../Sagas/AuthSagas.js';
<RoundedButton text="Fetch token" onPress={ getUserToken } />
Run Code Online (Sandbox Code Playgroud)
应用程序/Redux/AuthRedux.js
import { createReducer, createActions } from 'reduxsauce'
import Immutable from 'seamless-immutable'
/* ------------- Types and Action Creators ------------- */
const { Types, Creators } = createActions({
tokenRequest: ['username'],
tokenSuccess: ['token'],
tokenFailure: null
})
export const AuthTypes = Types
export default Creators
/* ------------- Initial State ------------- …
Run Code Online (Sandbox Code Playgroud) 我以 postgres 用户身份连接到我正在使用的数据库。例如app_production
。然后我运行了这些命令,如在 PostgreSQL中创建只读用户中所述:
app_production=> GRANT USAGE ON SCHEMA public TO "data-studio";
GRANT
app_production=> GRANT SELECT ON users TO "data-studio";
ERROR: permission denied for relation users
Run Code Online (Sandbox Code Playgroud)
看起来 postgres 用户没有足够的权限。如何授予我的“data-studio”用户对“users”表的读取权限?
适用于我新创建的 martins_testing 表
$ psql -h $HOST -U postgres app_production
app_production=> create table martins_testing (id int);
CREATE TABLE
app_production=> GRANT SELECT ON martins_testing TO "data-studio";
GRANT
Run Code Online (Sandbox Code Playgroud)
但不是在旧的用户表上通过rake db:create
珍贵运行创建的。
$ psql -h $HOST -U postgres app_production
app_production=> GRANT SELECT ON users TO "data-studio"; …
Run Code Online (Sandbox Code Playgroud) 我\xe2\x80\x99m 测试我的一个http 处理程序。\n像这样的curl 可以工作:curl localhost:8080/v1/parts/2bb834c9-8e17-4e2c-80b9-a20b80732899
。\n但是相应的测试失败,因为处理程序无法从URL 中提取id。
请看一下这个测试文件。我不\xe2\x80\x99不明白为什么我的curl命令有效但第17行的newRequest失败。
\n 1 package part\n 2\n 3 import (\n 4 "net/http"\n 5 "net/http/httptest"\n 6 "testing"\n 7\n 8 "github.com/labstack/echo/v4"\n 9 "github.com/stretchr/testify/assert"\n 10 )\n 11\n 12 var handler *Handler\n 13\n 14 func TestGetPart(t *testing.T) {\n 15 e := echo.New()\n 16\n 17 req := httptest.NewRequest("GET", "/v1/parts/2bb834c9-8e17-4e2c-80b9-a20b80732899", nil)\n 18 rec := httptest.NewRecorder()\n 19 c := e.NewContext(req, rec)\n 20\n 21 if assert.NoError(t, handler.handleGetPart(c)) {\n 22 assert.Equal(t, http.StatusOK, rec.Code)\n 23 }\n 24 }\n\n
Run Code Online (Sandbox Code Playgroud)\n去测试 -v ./internal/handler/part …
我刚刚开始玩Google Compute Engine.我可以使用Web界面创建实例,但控制台无效:
gcloud compute instances create example-instance \
> --machine-type n1-standard-1 \
> --image debian-7 \
> --zone europe-west1-b
ERROR: (gcloud.compute.instances.create) Failed to find image for alias [debian-7] in public image project [debian-cloud].
- Invalid value for project: myproject
Run Code Online (Sandbox Code Playgroud)
看起来图像可用.
$ gcloud compute images list --project debian-cloud --no-standard-images
NAME PROJECT ALIAS DEPRECATED STATUS
backports-debian-7-wheezy-v20150929 debian-cloud debian-7-backports READY
beta-accounts-backports-debian-7-wheezy-v20150930 debian-cloud READY
beta-accounts-debian-8-jessie-v20150930 debian-cloud READY
debian-7-wheezy-v20150929 debian-cloud debian-7 READY
debian-8-jessie-v20150929 debian-cloud debian-8 READY
Run Code Online (Sandbox Code Playgroud)
错误:(gcloud.compute.images.list)有些请求没有成功: - 项目的值无效:myproject
我得到一个- 项目的值无效:myproject消息几乎每个我尝试的gcloud命令.
当我访问 …
使用重新创建设置所需的所有文件更新帖子。——还是同样的问题。无法访问在容器中运行的服务。
FROM python:3
RUN apt-get update
RUN apt-get install -y ruby rubygems
RUN gem install sinatra
WORKDIR /app
ADD . /app/
EXPOSE 4567
CMD ruby hei.rb -p 4567
Run Code Online (Sandbox Code Playgroud)
hei.rb
require 'sinatra'
get '/' do
'Hello world!'
end
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml
version: '2'
services:
web:
build: .
ports:
- "4567:4567"
Run Code Online (Sandbox Code Playgroud)
我通过运行docker-compose up --build .
docker ps返回开始派对:
0.0.0.0:4567->4567/tcp
仍然没有来自端口 4567 的响应。在主机上使用 curl 进行测试。
$ curl 127.0.0.1:4567 # and 0.0.0.0:4567
Run Code Online (Sandbox Code Playgroud)
localhost:4567 在容器内回复
$ docker-compose exec web curl localhost:4567
Hello world!%`
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能访问在端口 4567 上运行的 …
我无法让nginx返回我放入的文件/var/www/letsencrypt
。
nginx /站点可用/mydomain.conf
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name my-real-domain.com;
include /etc/nginx/snippets/letsencrypt.conf;
root /var/www/mydomain;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Run Code Online (Sandbox Code Playgroud)
nginx /代码段/letsencrypt.conf
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/letsencrypt;
}
Run Code Online (Sandbox Code Playgroud)
我运行以下命令: certbot certonly --webroot -w / var / www / letsencrypt / -d my-real-domain.com
但是certbot尝试访问的页面始终是404。
调试
$ echo hi > /var/www/letsencrypt/hi
$ chmod 644 /var/www/letsencrypt/hi
Run Code Online (Sandbox Code Playgroud)
现在我应该可以了curl localhost/.well-known/acme-challenge/hi
,但是那行不通。仍然是404。知道我缺少了什么吗?
如何将一些额外的变量传递给 Echo mux 处理程序?
我在 main.go 中注册了这样的路线:
e.GET("/search/:query", handlers.Search(*kindex, app.infoLog))
Run Code Online (Sandbox Code Playgroud)
正如您可能看到的,这不是处理程序的正确签名。它应该在没有任何争论的情况下通过。IEhandlers.Search
如何从我的搜索处理程序访问 kindex 和 infoLog?
func Search(c echo.Context, kindex string, infoLog *log.Logger) error {
# Should I access a global variable from here?
infoLog.Printf("Kendra Index: %v\n", kindex)
# cut..
}
Run Code Online (Sandbox Code Playgroud) 我收到这个tslint错误,我不明白为什么。该界面确实以大写字母开头。
29 col 11 error| interface name must start with a capitalized I (interface-name) [typescript/tslint]
S> 29 interface Props {
30 answerQuestion: (answerQuestion: AnswerQuestion) => void;
Run Code Online (Sandbox Code Playgroud) 此样式仅左对齐,字体不是粗体。
\n\n bold_italic = styles.add_style :b => true, :i => true \n bold = styles.add_style :b => true\n yellow_bg = styles.add_style :b => true, :bg_color => \'FFF60B\',\n\n sheet.add_row [\'\xc3\x85r:\', Time.now.year, "P\xc3\xa5g\xc3\xa5r"], \n :style => [bold_italic, yellow_bg, bold]\n
Run Code Online (Sandbox Code Playgroud)\n\nYellow_bg 样式也有效。是否有新的语法可以使字体加粗?
\ngo ×2
axlsx ×1
certbot ×1
docker ×1
dockerfile ×1
go-echo ×1
javascript ×1
lets-encrypt ×1
nginx ×1
postgresql ×1
react-native ×1
redux-saga ×1
ruby ×1
spreadsheet ×1
styling ×1
testing ×1
tslint ×1