我在我的开发盒上运行一个ASP.NET网站(Vista/IIS7上的.NET 2.0).global.asax.cs中的Session_Start方法记录对文件的每次调用(log4net).Session_End方法还记录每个调用.
我正在使用InProc会话状态,并将会话超时设置为5分钟(以避免等待20分钟).
我点击网站,等待5分钟单位我看到Session_End记录.然后我F5网站.浏览器仍然具有会话cookie并将其发送到服务器.调用Session_Start并使用相同的会话ID创建新会话(顺便说一句:我需要将其作为相同的会话ID,因为它用于在数据库中存储数据).
结果:每次在先前结束的会话中按F5时,都会调用Session_Start方法,执行请求并立即调用Session_End方法.
当我打开另一个浏览器时,Session_Start方法只调用一次.然后在5分钟后,Session_End每个F5使Session_Start/request/Session_End序列执行.
web.config相关部分:
<system.web>
<compilation debug="true" />
<sessionState timeout="2" regenerateExpiredSessionId="false" />
</system.web>
Run Code Online (Sandbox Code Playgroud) 我正在使用带有计数器的表来确保子元素上的唯一id.
我知道使用序列通常更好,但我不能使用它,因为我有很多计数器(客户可以创建几个桶,每个都需要有自己的计数器,他们必须从1(这是一项要求,我的客户需要"人类可读的"键).
我正在创建具有prikey的记录(让我们称之为项目)(bucket_id,num = counter).
我需要保证bucket_id/num组合是唯一的(因此使用序列作为prikey不会解决我的问题).
在pl/sql中不会发生行的创建,因此我需要声明数字(顺便说一下:它不符合要求有间隙).
我的解决方案是:
UPDATE bucket
SET counter = counter + 1
WHERE id = param_id
RETURNING counter INTO num_forprikey;
Run Code Online (Sandbox Code Playgroud)
PL/SQL返回var_num_forprikey,因此可以创建项记录.
题:
即使用户同时要求存储桶中的新项目,我是否总能获得唯一的num_forprikey?
我想创建一个IRouteConstraint,它根据枚举的可能值过滤值.我试图为自己谷歌,但这并没有导致任何结果.
有任何想法吗?
我想做与Scala Macros类似的事情:检查某个注释 我的注释看起来像:
class extract(val name: String) extends StaticAnnotation
Run Code Online (Sandbox Code Playgroud)
而我正在使用它:
case class MainClass(@extract("strings") foo: String, bar: Int)
Run Code Online (Sandbox Code Playgroud)
我正在尝试获取foo参数,Symbol因为它有一个@extract注释:
val extrList = params.map { param: Symbol =>
param.annotations.collect {
case extr if extr.tpe <:< c.weakTypeOf[extract] =>
val args = extr.scalaArgs
if (args.size != 1)
abort("@extract() should have exactly 1 parameter")
getExtractValue(args.head) -> param
}
}
Run Code Online (Sandbox Code Playgroud)
该getExtractValue方法如下所示:
def getExtractValue(tree: Tree): String = ???
Run Code Online (Sandbox Code Playgroud)
我如何获得价值name的的@extract注解
更新
我从scalaArgs得到的树似乎太缺乏c.eval()
param: Symbol => …Run Code Online (Sandbox Code Playgroud) 我正在使用OTHER_HOME环境变量指向不同的SBT项目目录.我将把外部目录放在maven存储库中或通过github.com #tag项目引用,但是现在我想将一个基于文件的依赖项添加到Play项目中.
我的Build.scala风格是这样的:
val otherProjectDir = Option(System.getenv("OTHER_HOME"))
.getOrElse("Set environment OTHER_HOME to your 'other' git clone")
// take the core sublibrary from other project
val otherCore = ProjectRef(file(otherProjectDir), "core")
val main = play.Project(appName, appVersion, appDependencies)
.dependsOn(otherCore)
Run Code Online (Sandbox Code Playgroud)
我想切换到build.sbt,但我不知道如何做到这一点.请指教.
我正在制作一个自定义的ListCellRenderer.我知道每个单元格可以有不同的尺寸.但现在我想为所选单元格设置不同的维度.不知何故,JList在第一次计算每个单元格的边界时,为每个单独的单元格缓存维度.这是我的代码:
public class Test {
static class Oh extends JPanel {
public Oh() {
setPreferredSize(new Dimension(100, 20));
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.WHITE);
g.fillRect(0, 0, getWidth(), getHeight());
}
}
static class Yeah extends JPanel {
private boolean isSelected;
public Yeah(boolean isSelected) {
setPreferredSize(new Dimension(100, 100));
this.isSelected = isSelected;
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
//setSize(100, 100); // doesn't change the bounds of the component
//setBounds(0, 0, 100, 100); // this doesn't do any good either.
if (isSelected) …Run Code Online (Sandbox Code Playgroud) 考虑这个typedef:
case class Outer(someVal: Int) {
case class Inner(someOtherVal: Int)
}
Run Code Online (Sandbox Code Playgroud)
我如何构造一个类型的对象Inner,(即如何编写有效的scala语法)?
我希望使用Innerscoped来Outer避免在同一个包中使用Outer的不同实例进行名称冲突.
我正在研究一个 Scala 宏,我想将 a 的类型与 aSymbol相匹配List[T],其中 theT是给定的Type。我已经有了类型参数的Type对象T。
很容易得到 的 Type 对象List[_]:
val listType = c.weakTypeOf[List[_]]
Run Code Online (Sandbox Code Playgroud)
有了这个,我已经可以检查 typeSignature
sourceParam.typeSignature match {
case paramType if paramType <:< listType =>
....
}
Run Code Online (Sandbox Code Playgroud)
但是我想用 来检查 paramType List[T],那么我如何制作一个类型,我可以在其中获取List[_]和某个Type对象并使其成为新类型?
在角度$http.get(url, {cache:true})将很好地缓存服务器响应.但是当对服务器的GET请求失败时,缓存会做什么?这可能是临时连接问题或服务器响应(如超时).
假设我处理错误并显示重试按钮,后续调用是否会$http.get(url, {cache:true})重试服务器,还是会从缓存中给出失败的承诺?
scala ×4
scala-macros ×2
angularjs ×1
annotations ×1
asp.net ×1
asp.net-mvc ×1
caching ×1
case-class ×1
concurrency ×1
height ×1
java ×1
jlist ×1
oracle ×1
plsql ×1
promise ×1
sbt ×1
session ×1
swing ×1
url-routing ×1