f = lambda x : 2*x
g = lambda x : x ** 2
h = lambda x : x ** x
funcTriple = ( f, g, h )
myZip = ( zip ( funcTriple, (1, 3, 5) ) )
k = lambda pair : pair[0](pair[1])
# Why do Output # 1 (2, 9, 3125) and Output # 2 ( [ ] ) differ?
print ("\n\nOutput # 1: for pair in myZip: k(pair) ...")
for pair in myZip :
print …Run Code Online (Sandbox Code Playgroud) 我们在单个Web服务器上运行一个ASP .NET应用程序(没有服务器场).目前,我们正在使用默认的"InProc"会话存储.是否值得考虑使用ASP .NET状态服务?如果我们走这条路线,我们可能只是在与应用程序相同的机器上运行服务,因此通过网络拨打电话来获取和设置会话信息不会成为问题.我们考虑这个问题的原因是为了避免在应用程序池回收时丢失会话数据.
此外,暂时使用SQL Server是不合适的,因此我们只讨论进程内与状态服务器.
在这种情况下,每种模式的优缺点是什么?
我们一直在使用Mercurial和Mercurial Queues(+补丁保护)来控制许多Windows ASP.Net项目.
我有兴趣为此建立一个持续集成环境但是在与CC/Trac等成功的相互矛盾的报告中迷失了方向.
我想知道还有谁在做这个以及你的工作堆栈的app/utils是什么?另外,如果你有关于工作流程的提示,我都是耳朵:)
提前欣赏!
我正在尝试使用Drupal为Apache Solr创建自定义搜索界面,我对结果有一些奇怪的问题.
当我从Solr的内置Web界面运行它时,我有相同的查询产生8次点击,当我通过Drupal运行它时有0次点击.有谁能解释为什么?
以下是来自Solr日志的查询:
Solr后端
INFO: [] webapp=/solr path=/select params={wt=standard&rows=10&start=0&explainOther=&hl.fl=&indent=on&q=ss_cck_field_goal:sell+AND+ss_cck_field_type:(own+OR+coop+OR+house+OR+commercial)+AND+is_price:[10000+TO+5560000]&fl=*,score&qt=standard&version=2.2} hits=8 status=0 QTime=2
Drupal ApacheSolr模块
09-Mar-2009 15:37:31 org.apache.solr.core.SolrCore execute INFO: [] webapp=/solr path=/select params={wt=json&rows=10&json.nl=map&start=0&q=ss_cck_field_goal:sell+AND+ss_cck_field_type:(own+OR+coop+OR+house+OR+commercial)+AND+is_price:[10000+TO+5560000]&version=1.2} hits=0 status=0 QTime=9
在我眼中唯一突出的是version=1.2参数,但我尝试删除它,这并没有改变行为.
经过大量的调整,我已经设法使用Drupal模块发送或多或少相同的参数,但它仍然给出0结果:
09-Mar-2009 17:47:43 org.apache.solr.core.SolrCore execute INFO: [] webapp=/solr path=/select params={wt=standard&rows=10&start=0&q=ss_cck_field_goal:sell+AND+ss_cck_field_type:(own+OR+coop+OR+house+OR+commercial)+AND+is_price:[10000+TO+5560000]} hits=0 status=0 QTime=13
有谁能解释一下?
我正在将Castle/Monorails应用程序转换为Unity/Asp.NET MVC,我不得不尝试转换此组件配置:
<component
id="ComponentBaseConfiguration"
service="MyFakeNamespace.BOL.IConfiguration, MyFakeAppDll"
type="MyFakeNamespace.BOL.ConfigurableConfiguration, MyFakeAppDll">
<parameters>
<!-- Setting Configuration (Dictionary<string,string>)-->
<Config>
<dictionary>
<entry key="localHost">#{LocalHost}</entry>
<entry key="contentHost">#{ContentHost}</entry>
<entry key="virtualDir">#{VirtualDir}</entry>
</dictionary>
</Config>
</parameters>
Run Code Online (Sandbox Code Playgroud)
似乎Unity支持Array但不支持Dictionary,我想做这样的事情:
<unity>
<containers>
<container>
<types>
<type name="ComponentBaseConfiguration" type="MyFakeNamespace.BOL.IConfiguration, MyFakeAppDll" mapTo="MyFakeNamespace.BOL.ConfigurableConfiguration, MyFakeAppDll">
<typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
<property name="Config" propertyType="System.Collections.Generic.Dictionary`2[[System.String, mscorlib], [System.String, mscorlib]],mscorlib">
<dictionary>
<entry key="localHost">127.0.0.1</keyedValue>
<entry key="contentHost">\\content</keyedValue>
<entry key="virtualDir">/</keyedValue>
</dictionary>
</property>
</typeConfig>
</type>
</types>
</container>
</containers></unity>
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现这样的目标?
我们都想让我们的网站更快,谷歌在这里展示了一些示例:http://code.google.com/speed/articles/html5-performance.html
我们使用OpenX来投放广告,因此,假设浏览器支持(FF3.6 +),我认为我们可以从以下位置修改OpenX广告代码:
<script type='text/javascript'> ... ad codes </script>
Run Code Online (Sandbox Code Playgroud)
成
<script type='text/javascript' async> ... ad codes </script>
Run Code Online (Sandbox Code Playgroud)
那可以吗?有没有更好的异步加载脚本的方法?
我想为脚本引擎验证一些C#源代码.我想确保只能引用System.Math类成员.我正在尝试创建一个正则表达式,它将匹配一个点,后跟一个大写字母,后跟任意数量的单词字符,以一个不在System.Math之前的单词边界结束.
我从这开始:
(?<!Math)\.[A-Z]+[\w]*
Run Code Online (Sandbox Code Playgroud)
哪个适用于:
return Math.Max(466.89/83.449 * 5.5); // won’t flag this
return Xath.Max(466.89/83.449 * 5.5); // will flag this
Run Code Online (Sandbox Code Playgroud)
它在没有Math之前正确匹配.Max.但是,现在我正在尝试将正则表达式扩展为包含System,我无法让它工作.
我已经尝试了正则表达式的这些排列以及更多:
((?<!System\.Math)\.[A-Z]+[\w]*)
((?<!(?<!System)\.Math)\.[A-Z]+[\w]*)
((?<!System)\.(?<!Math)\.[A-Z]+[\w]*)
((?<!System)|(?<!Math)\.[A-Z]+[\w]*)
((?<!System\.Math)|(?<!Math)\.[A-Z]+[\w]*)
Run Code Online (Sandbox Code Playgroud)
使用这些陈述:
return System.Math.Max(466.89/83.449 * 5.5);
return System.Xath.Max(466.89/83.449 * 5.5);
return Xystem.Math.Max(466.89/83.449 * 5.5);
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有我能想到的东西,但它总是匹配第二个元素(上面的.Math或.Xath),或者它与任何东西都不匹配.
如果有人会怜悯我并指出我做错了什么,我会非常感激.
先谢谢,韦尔顿
Scala新手在这里,我刚刚下载了Eclipse 3.6.2和Scala IDE 2.0.0-beta4(使用Scala 2.9.0.final).我创建了一个新的Scala项目来尝试分隔的延续:
package delimCCTests
import scala.util.continuations._
object Test extends App {
val result = reset {
1 + shift { k: (Int => Int) => k(k(5)) } + 1
}
println(result)
}
Run Code Online (Sandbox Code Playgroud)
编译好了,然后单击Run as - > Scala应用程序并获得此异常:
Exception in thread "main" java.lang.NoSuchMethodError: scala.util.continuations.package$.shift(Lscala/Function1;)Ljava/lang/Object;
at delimCCTests.Test$$anonfun$1.apply$mcI$sp(DelimCCTests.scala:7)
at delimCCTests.Test$$anonfun$1.apply(DelimCCTests.scala:7)
at delimCCTests.Test$$anonfun$1.apply(DelimCCTests.scala:7)
at scala.util.continuations.package$.reset(package.scala:20)
at delimCCTests.Test$delayedInit$body.apply(DelimCCTests.scala:6)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
at scala.App$class.main(App.scala:60)
at delimCCTests.Test$.main(DelimCCTests.scala:5)
at delimCCTests.Test.main(DelimCCTests.scala)
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我错过了一些配置吗?
BTW我以为编译器推断了延续的类型?本文 …
好吧,我在过去的两个小时内搜索过这个结果只给出了提示,甚至没有一个完整的代码来帮助救援(如果他们看不到一些样品,小便会怎么学?)
我创建了一个像这样的索引:
Directory directory = FSDirectory.Open(new System.IO.DirectoryInfo(Server.MapPath("/data/channels/")));
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_29);
IndexWriter writer = new IndexWriter(directory, analyzer, true, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED);
Document doc = new Document();
doc.Add(new Field("ID", "0", Field.Store.YES, Field.Index.NO));
doc.Add(new Field("parentID", "0", Field.Store.YES, Field.Index.NO));
doc.Add(new Field("Title", "Root", Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
writer.Optimize();
writer.Close();
Run Code Online (Sandbox Code Playgroud)
现在,我想搜索ID值等于的字段0(以获得我在那里的单个记录)....
但是,像这样的简单搜索:
Directory directory = FSDirectory.Open(new System.IO.DirectoryInfo(Server.MapPath("/data/channels")));
Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(Version.LUCENE_29);
Searcher searcher = new Lucene.Net.Search.IndexSearcher(IndexReader.Open(directory, true));
Query query = new Lucene.Net.QueryParsers.QueryParser(Version.LUCENE_29, "ID", analyzer).Parse("0");
Hits hits = searcher.Search(query);
Run Code Online (Sandbox Code Playgroud)
没有结果.我已经阅读过NumericRange,KeywordAnalyzer …
我正在学习F#,发现我写的是有用的,但我并不完全理解.这是一个例子
let processArgs args =
match args with
| null
| [||] -> [fun() -> getCredentials(); home 20; mentions 20; messages 20]
| [|"-h"|]
| [|"-?"|] -> [showHelp]
| [|"-reset"|] -> [clearAllSettings]
| _ -> [fun() -> printfn "%s" (String.Join(" ", args))]
[<EntryPoint>]
let main (args:string[]) =
try
let actions = processArgs args
List.iter (fun action -> action()) actions
0
finally
Console.ResetColor()
Console.CursorVisible <- true
Run Code Online (Sandbox Code Playgroud)
getCredentials,home,mentions,messages,showHelp和clearAllSettings方法都是简单的函数,可以满足您的期望.(是的,这是一个Twitter客户端,是不是新的'Hello World'演示?)
这条线:
[fun() -> getCredentials(); home 20; mentions 20; messages 20]
Run Code Online (Sandbox Code Playgroud)
像我想的那样工作.它调用getCredentials,然后调用home,然后提及消息
从我的角度来看,分号就像一个语句分隔符.我以前没见过这个.那是怎么回事?
是否有一种更惯用的写作方式(换句话说,一个经验丰富的F#程序员在他/她看到这个时会笑在地板上)? …