ring

Detect rings/circuits of connected voxels

China☆狼群 提交于 2019-11-30 09:38:44
问题 I have a skeletonized voxel structure that looks like this: The actual structure is significantly larger than this exampleIs there any way to find the closed rings in the structure? I tried converting it to a graph and using graph based approaches but they all have the problem that a graph has no spatial information of node position and hence a graph can have multiple rings that are homologous. It is not possible to find all the rings and then filter out the ones of interest since the graph

Set Ring-Anti-Forgery CSRF header token

﹥>﹥吖頭↗ 提交于 2019-11-30 07:25:54
问题 I'm attempting to implement the Ring-Anti-Forgery library via setting the X-CSRF-Token in the header. Since I am using static html files I found the built-in hiccup helper, which sets the token in the form, to be useless. This is my first stab at using Clojure for web development so I'm guessing that I am completely missing what should be obvious to someone with experience. The instructions from the README state: The middleware also looks for the token in the X-CSRF-Token and X-XSRF-Token

How to run an arbitrary startup function in a ring project?

99封情书 提交于 2019-11-30 01:29:26
问题 I've got a compojure/ring application I currently run with lein ring server that I'd like to compile to a .war so I can deploy it. I've got a definition, however, just like (def foo (start-scheduler)) That blocks the compilation and the generation of the .war. To circumvent this, I thought about moving the call to a startup function, but how would I call it when the server launches? If I put the call inside the handler, I'd end up with the same problem as before. Thanks! 回答1: In your project

查看网络丢包的命令

前提是你 提交于 2019-11-29 08:07:40
查看网络丢包 $ sudo tcpdump -i eth0 port 22 and "tcp[tcpflags] & (tcp-syn) != 0" 网络丢包的原因 防火墙拦截 查看iptables filter表,确认是否有相应规则会导致此丢包行为: $ sudo iptables-save -t filter 连接跟踪表溢出 通过dmesg可以确认是否有该情况发生: $ dmesg |grep nf_conntrack 如果输出值中有“nf_conntrack: table full, dropping packet”,说 明服务器nf_conntrack表已经被打满。 通过/proc文件系统查看nf_conntrack表实时状态: # 查看nf_conntrack表最大连接数 $ cat /proc/sys/net/netfilter/nf_conntrack_max 65536 # 查看nf_conntrack表当前连接数 $ cat /proc/sys/net/netfilter/nf_conntrack_count 7611 如何解决 如果确认服务器因连接跟踪表溢出而开始丢包,首先需要查看具体连接判断是否正遭受DOS攻击,如果是正常的业务流量造成,可以考虑调整nf_conntrack的参数: nf_conntrack_max决定连接跟踪表的大小,默认值是65535

聊聊rocketmq的AllocateMessageQueueConsistentHash

随声附和 提交于 2019-11-29 05:46:00
序 本文主要研究一下rocketmq的AllocateMessageQueueConsistentHash AllocateMessageQueueStrategy rocketmq-client-4.5.2-sources.jar!/org/apache/rocketmq/client/consumer/AllocateMessageQueueStrategy.java public interface AllocateMessageQueueStrategy { /** * Allocating by consumer id * * @param consumerGroup current consumer group * @param currentCID current consumer id * @param mqAll message queue set in current topic * @param cidAll consumer set in current consumer group * @return The allocate result of given strategy */ List<MessageQueue> allocate( final String consumerGroup, final String currentCID, final

Set Ring-Anti-Forgery CSRF header token

岁酱吖の 提交于 2019-11-29 03:42:43
I'm attempting to implement the Ring-Anti-Forgery library via setting the X-CSRF-Token in the header. Since I am using static html files I found the built-in hiccup helper, which sets the token in the form, to be useless. This is my first stab at using Clojure for web development so I'm guessing that I am completely missing what should be obvious to someone with experience. The instructions from the README state: The middleware also looks for the token in the X-CSRF-Token and X-XSRF-Token header fields. This behavior can be customized further using the :read-token option: (defn get-custom

How to block external http requests? (securing AJAX calls)

雨燕双飞 提交于 2019-11-28 12:18:38
I want to use post to update a database and don't want people doing it manually, i.e., it should only be possible through AJAX in a client. Is there some well known cryptographic trick to use in this scenario? Say I'm issuing a GET request to insert a new user into my database at site.com/adduser/<userid> . Someone could overpopulate my database by issuing fake requests. There is no way to avoid forged requests in this case, as the client browser already has everything necessary to make the request; it is only a matter of some debugging for a malicious user to figure out how to make arbitrary

Compojure/Ring: Why doesn't a session with cookie-store survive a server restart?

ⅰ亾dé卋堺 提交于 2019-11-27 23:50:57
问题 I have a compojure app that uses the ring session wrapper to store the OAuth token associated with the current user. I would like for this token to remain available when the server restarts, so that I don't have to go through the auth process each time. I assumed that using the cookie-store instead of the default memory-store would help, but it does not. What am I missing? This is the relevant part of the code: (defn auth-callback-handler [session {code :code}] (let [token (retrieve-token

How to block external http requests? (securing AJAX calls)

霸气de小男生 提交于 2019-11-27 06:55:29
问题 I want to use post to update a database and don't want people doing it manually, i.e., it should only be possible through AJAX in a client. Is there some well known cryptographic trick to use in this scenario? Say I'm issuing a GET request to insert a new user into my database at site.com/adduser/<userid> . Someone could overpopulate my database by issuing fake requests. 回答1: There is no way to avoid forged requests in this case, as the client browser already has everything necessary to make

Serving static files with ring/compojure - from a war

醉酒当歌 提交于 2019-11-26 20:55:10
问题 Using ring (and the lein-ring tools) - I am able to serve up static files from "resources" etc as per the docs when running in development - however - when I package things up via lien uberwar I have no idea how to make it serve those files when running in a container. I see conflicting docs on wrap-resource, or setting :resource-path but none seem to work. 回答1: As per Compojure's Getting Started Wiki, put route/resources below your paths: (defroutes main-routes (GET "/" [] "<h1>Hello World