如果我的动作有一条路径,/controller/action/{id}
我可以id
通过这样做获得AuthorizeAttribute httpContext.Request.RequestContext.RouteData.Values["id"]
.
相反,如果它像/controller/action?id={id}
我可以做到的那样httpContext.Request.QueryString["id"]
.
如果它是来自POST的表单数据,我还需要另一种方式.
有没有办法说"无论路由是如何指定的,都要在名称为'id'的参数中输入内容?"
我有两个线程,一个运行类似的东西update t set ColA=foo
,另一个运行update t set ColB=foo
.如果他们正在执行原始SQL语句,则不存在争用,但由于Django获取并保存整行,因此可能发生竞争条件.
有没有办法告诉Django我只想保存某个列?
考虑以下:
foo = 1:10
bar = 2 * foo
glm(bar ~ foo, family=poisson)
Run Code Online (Sandbox Code Playgroud)
我得到结果
Coefficients:
(Intercept) foo
1.1878 0.1929
Degrees of Freedom: 9 Total (i.e. Null); 8 Residual
Null Deviance: 33.29
Residual Deviance: 2.399 AIC: 47.06
Run Code Online (Sandbox Code Playgroud)
从本页的说明看,似乎foo的系数应该是log(2)
,但不是。
更一般而言,我认为此输出应该表示lambda = 1.187 + .1929 * foo
其中lambda是泊松分布的参数,但似乎与数据不符。
我应该如何解释此回归的输出?
我想绘图foo ~ bar
.但是,我不想查看确切的数据,我宁愿分解bar
为分位数,并绘制mean(foo)
每个分位数(因此我的最终绘图将有5个数据点).这可能吗?