在将项目从vs2008更新到vs2010后尝试编译我的asp.net站点时出现以下错误
名称空间"System.ServiceModel"中不存在类型或命名空间名称"Syndication"(您是否缺少程序集引用?)
我有asp.net网站定位3.5框架(就像它在vs2008中所做的那样)我还添加了对System.ServiceModel.Web的引用
我在类的顶部也有这些using语句:using System.ServiceModel; 使用System.ServiceModel.Description; 使用System.ServiceModel.Syndication; 使用System.ServiceModel.Web;
最后2个抱怨上面的错误,评论它们会产生错误(找不到WebGet等),就像它的触发器一样.
有人有主意吗?
来自OO背景,我在试图避免变异时如何解决FP的简单问题时遇到了麻烦.
let mutable run = true
let player1List = ["he"; "ho"; "ha"]
let addValue lst value =
value :: lst
while run do
let input = Console.ReadLine()
addValue player1List input |> printfn "%A"
if player1List.Length > 5 then
run <- false
printfn "all done" // daz never gunna happen
Run Code Online (Sandbox Code Playgroud)
我知道在某些情况下使用变异是可以的,但我正在努力训练自己以避免突变作为默认值.有了这个说,有人可以告诉我一个上面没有使用F#突变的例子吗?
最终的结果应该是player1List继续增长,直到项目的长度为6,然后退出并打印'all done'
在 F# 中根据另一个列表中的项目删除一个列表中的项目的最有效方法是什么?
例子:
seq1 = ["blue"; "green"; "red"; "green" ...]
seq2 = ["soda"; "green"; "pop" ...]
seq1 最初有 50,000 个项目,seq2 有 12 个项目,并且随着时间的推移,其规模不断增长
我想要做的是删除 seq1 的所有实例(如果该值在 seq2 中)
我有以下代码,它是我能做到的最慢的代码 - 这不是我想要的。
let result = seq1 |> Seq.filter(fun a -> (Seq.exists(fun name -> name = a) seq2) = false)
Run Code Online (Sandbox Code Playgroud)
我正在尝试找到快速的方法来实现这一功能(无循环等)
谢谢 :-)
如何在使用后台线程时有效地显示文件的状态?
例如,假设我有一个100MB的文件:
当我通过一个线程(仅作为一个例子)执行下面的代码时,它运行大约1分钟:
foreach(byte b in file.bytes)
{
WriteByte(b, xxx);
}
Run Code Online (Sandbox Code Playgroud)
但是......如果我想更新用户我必须使用委托从主线程更新UI,下面的代码需要 - 永远 - 字面上我不知道我还在等待多久,我创建了这个帖子,它甚至没有完成30%.
int total = file.length;
int current = 0;
foreach(byte b in file.bytes)
{
current++;
UpdateCurrentFileStatus(current, total);
WriteByte(b, xxx);
}
public delegate void UpdateCurrentFileStatus(int cur, int total);
public void UpdateCurrentFileStatus(int cur, int total)
{
// Check if invoke required, if so create instance of delegate
// the update the UI
if(this.InvokeRequired)
{
}
else
{
UpdateUI(...)
}
}
Run Code Online (Sandbox Code Playgroud) 我刚刚学习LISP而且我在执行以下操作时遇到了麻烦:
; return ":h :i"
(defun get-char()
(loop for char across "ab"
collect (concatenate 'string ":" (string char))))
; plist
(defun get-list() (list :a "1" :b "2"))
; I cannot get this to work
; <-- returns all null, cannot get plist values :-(
(loop for x in (get-char)
collect (getf (get-list) x))
; this works fine...
(loop for x in '(:a :b)
collect (getf (get-list) x))
Run Code Online (Sandbox Code Playgroud)
我知道我很接近,但我只是遗漏了一些东西.
非常感谢 :-)
在没有第三方的情况下处理这个2DArray的更高效的方法是什么?
#time
let ar = array2D[[5.0; 6.0; 7.0; 8.0]; [1.0; 2.0; 3.0; 4.0]]
[0..5000000]
let a2 = ar |> Array2D.mapi(fun rowi coli value -> (value + 1.6) * double(coli + 6) * double(rowi + 7))
Run Code Online (Sandbox Code Playgroud) 我可以发誓我已经在某个地方做过这件事 - 我现在正在使用2.0 - 这是我在更高版本中找到的东西吗?IE:在构造函数中传递Literal的内容
我记得自己说'嗯,这一次我创造了一个新的实例,然后设置了文本属性' - 或者我那晚睡醉了吗?如果没有,为什么不!
c# ×3
f# ×3
.net ×1
.net-2.0 ×1
asp.net ×1
common-lisp ×1
lisp ×1
mutation ×1
performance ×1
statusbar ×1
syndication ×1