所以,经过一番思考后,我写了以下内容:
# In repository we don't need to have: # Compiled object files *.o # Generated MOC, resource and UI files moc_*.cpp qrc_*.cpp ui_*.h # Debug and Release directories (created under Windows, not Linux) Debug/ Release/ # .log files (usually created by QtTest - thanks to VestniK) *.log # Built windows .exe and linux binaries # NOTE: PROJECT is a your project's name, analog of PROJECT.exe in Linux *.exe *.dll PROJECT # Windows-specific files Thumbs.db desktop.ini # Mac-specific things (thanks …
我有一个有很多连接的查询,我eager_load当时正在进行一些关联.我需要计算一些值作为其中一个模型的属性.
所以,我正在尝试这段代码:
ServiceObject
.joins([{service_days: :ou}, :address])
.eager_load(:address, :service_days)
.where(ous: {id: OU.where(sector_code: 5)})
.select('SDO_CONTAINS(ous.service_area_shape, SDO_GEOMETRY(2001, 8307, sdo_point_type(addresses.lat, addresses.lng, NULL), NULL, NULL) ) AS in_zone')
Run Code Online (Sandbox Code Playgroud)
其中SQL函数调用select操作来自关联addresses和ous表的数据.
我正在获得下一个SQL(因此我的in_zone列计算并在所有eager_loaded模型的其他列之前作为第一列返回):
SELECT SDO_CONTAINS(ous.service_area_shape, SDO_GEOMETRY(2001, 8307, sdo_point_type(addresses.lat, addresses.lng, NULL), NULL, NULL) ) AS in_zone, "SERVICE_OBJECTS"."ID" AS t0_r0, "SERVICE_OBJECTS"."TYPE" AS t0_r1, <omitted for brevity> AS t2_r36 FROM "SERVICE_OBJECTS" INNER JOIN "SERVICE_DAYS" ON "SERVICE_DAYS"."SERVICE_OBJECT_ID" = "SERVICE_OBJECTS"."ID" INNER JOIN "OUS" ON "OUS"."ID" = "SERVICE_DAYS"."OU_ID" INNER JOIN "ADDRESSES" ON …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序可以处理不同货币的产品和销售。因此,数据库中同一表中的每一行都可以存储不同货币的价格。如何正确地做到这一点?
最直接的方法是定义一个数字price_amount列和varchar price_currencyoolumn,但我觉得本质上单值(price)的两个技术上独立的列是错误的。就像物理测量是没有单位的毫无意义的数字一样,货币的数量如果没有其单位——货币,也是毫无意义的。
在我看来,money 应该是一个包含数量和货币的单一值。
我开始搜索并惊讶地发现搜索结果中没有现成的解决方案或好的文章。有pg-currency扩展可以做我想要的,但它在大约 10 年前被放弃了。
我创建了以下复合数据类型作为起点:
CREATE TYPE true_money AS (
currency varchar,
amount numeric
);
Run Code Online (Sandbox Code Playgroud)
然后开始为它编写支持性的东西:验证、算术、聚合……并意识到这个兔子洞真的很深。
可以在此处找到我对这种复合类型的所有当前(部分)结果以供参考:https : //gist.github.com/Envek/780b917e72a86c123776ee763b8dd986?fbclid=IwAR2GxGUVPg5FtN3SSPhQv2uFA7oPNNixFRZJBZij5oPNNixFRJbZije-
现在我可以做以下事情:
INSERT INTO "products" ("title", "price") VALUES ('?????????', ('RUB',100500));
INSERT INTO "products" ("title", "price") VALUES ('???? ? ????????', ('RUB',12100.42));
INSERT INTO "products" ("title", "price") VALUES ('Gravizapa', ('USD',19999.99));
-- You can access its parts if you need to extract them or do filtering or grouping
SELECT SUM(price) …Run Code Online (Sandbox Code Playgroud) 我们正在为不同的客户端安装一些在 Nginx 后面运行 Tomcat 6 的应用程序。其中一些安装仅适用于 HTTP,有些仅适用于 HTTPS,或者两者兼而有之。由于缺少公共 IP,其中一个安装的 HTTP 和 HTTPS 在非标准端口(8070 和 8071)上运行。手头的应用程序在另一个应用程序中显示为 iframe。
Tomcat 将所有 HTTPS 请求重定向到 HTTP(因此由于浏览器对混合内容的限制,iframe 中不会显示任何内容)。
框架代码:
<iframe src="/saiku-ui">
Run Code Online (Sandbox Code Playgroud)
Tomcat的server.xml:
<Connector port="8080" protocol="HTTP/1.1"/>
<!-- A bit later... -->
<Valve className="org.apache.catalina.valves.RemoteIpValve"
remoteIpHeader="x-forwarded-for"
protocolHeader="x-forwarded-proto"
/>
Run Code Online (Sandbox Code Playgroud)
Nginx虚拟主机:
server {
listen 80;
listen 443 ssl spdy;
location /saiku-ui {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://saiku-server; # This is upstream name
proxy_redirect off;
}
}
upstream …Run Code Online (Sandbox Code Playgroud) 我正在尝试生成指向 API 网关(使用 IAM 身份验证)的预签名链接,因此客户端可以访问我在此 API 网关后面的 Lambda 函数之一,而无需对请求进行身份验证。这主要是为了方便客户端,因此它可能会透明地使用响应中的一些链接,无论它们指向同一个经过身份验证的 API 网关、某个 S3 存储桶还是 Internet 中的任意 URL。
为此,我使用查询参数制作 API 签名 v4(请参阅文档和示例)
因此,如果我尝试签署以下针对us-west-2区域和execute-api服务范围的链接:
https://example.com/some/path?some=params
Run Code Online (Sandbox Code Playgroud)
我将得到以下结果(使用 Node.jsaws4库,但在这里无关紧要):
https://example.com/some/path?some=params&
X-Amz-Security-Token=<Session Token Removed>
X-Amz-Date=20210330T180303Z&
X-Amz-Algorithm=AWS4-HMAC-SHA256&
X-Amz-Credential=<Access Key Removed>%2F20210330%2Fus-west-2%2Fexecute-api%2Faws4_request&
X-Amz-SignedHeaders=host&
X-Amz-Signature=884f132ad6f0c7a850e6b1d22b5fed169c13e2189b6e0d0d568d11f967f4a8bd
Run Code Online (Sandbox Code Playgroud)
它有效!但只有在一代后的前 5 分钟......
五分钟过去后,我将收到以下错误响应:
https://example.com/some/path?some=params
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请参阅对此问题的回复。
我尝试X-Amz-Expires使用各种值(小于和大于 300 秒)添加文档中提到的查询参数,但没有运气:行为不会改变。
对于由 IAM 实例凭证生成的链接,我至少需要几个小时,最多需要6 个小时,因为链接正在由另一个 Lambda 函数签名。
有没有办法增加 API Gateway 访问的预签名链接有效期?
currency ×1
git ×1
gitignore ×1
nginx ×1
postgresql ×1
qt ×1
qt-creator ×1
sigv4 ×1
tomcat ×1
types ×1