在本教程中,以下值来自何处?
password
(OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
)keyPassword
(OBF:1u2u1wml1z7s1z7a1wnl1u2g
)trustPassword
(OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
)在玩F#代理后,我尝试使用它们来减少地图.
我使用的基本结构是:
我想知道的问题是:
非常感谢,
type Agent<'T> = MailboxProcessor<'T>
//This is the response the supervisor
//gives to the worker request for work
type 'work SupervisorResponse =
| Work of 'work //a piece of work
| NoWork//no work left to do
//This is the message to the supervisor
type 'work WorkMsg =
| ToDo of 'work //piles up work in the Supervisor queue
| WorkReq of AsyncReplyChannel<SupervisorResponse<'work>> //'
//The supervisor agent can be interacted …
Run Code Online (Sandbox Code Playgroud) open System.Runtime.Serialization
open System.Runtime.Serialization.Json
[<DataContract>]
type geo = {
[<field: DataMember(Name = "type")>]
t:string
[<field: DataMember(Name = "coordinates")>]
coordinates:string
}
let decode (s:string) =
let json = new DataContractJsonSerializer(typeof<geo>)
let byteArray = Encoding.UTF8.GetBytes(s)
let stream = new MemoryStream(byteArray)
json.ReadObject(stream) :?> geo
let tw = {"type":"Point","coordinates":[-7.002648,110.449961]}
decode tw
Run Code Online (Sandbox Code Playgroud)
这将从命名空间''expect返回 - > End元素'坐标'.从命名空间''找到元素'item'
如何定义DataMember坐标以便它理解?
非常感谢
我正在尝试按照本教程获取具有更长到期时间的令牌.Facebook连接在客户端完成(Js sdk).我采取的步骤是:
这总是返回相同的完全相同的访问令牌,有效期为2小时,是否应该返回有效60天的令牌(与access_token相同或不同)?
谢谢
这与此处的问题非常相关如何枚举F#中的枚举/类型.我定义了一个联合类型,然后我需要在静态方法中使用该类型的所有可能情况.例如:
type Interests =
| Music
| Books
| Movies
with
static member GetValue( this) = match this with
| Music -> 0
| Books -> 5
| Movies -> 0
static member GetSeqValues() = allCases|>Seq.map(GetValue)
Run Code Online (Sandbox Code Playgroud)
我如何获得allCases?
非常感谢
我想做一个模式匹配,看起来像:
sinceOp match {
case None |Some(lastUpdate) if lastUpdate<= update.time =>
Run Code Online (Sandbox Code Playgroud)
可悲的是,这不起作用.有任何想法吗 ?
谢谢
我想知道是否有可能从php调用一些F#代码.看起来Phalanger就是这样做的.有人用吗?对于这个解决方案和其他解决方案(如果有的话?),它对服务器运行代码有什么要求?
谢谢
在看了关于blobs的这个教程:第9频道之后,我正在考虑使用blob容器来保存一堆推文(存储每条推文的json).理想情况下,我想为一天中的每个小时创建一个blob引用,并在它们进入时向这个blob添加新的推文.问题是,方法UploadText(字符串)会覆盖blob的现有内容,是否容易将文本追加到现有blob的方法?
谢谢!
fun (json:string) ->
let account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"))
let blobs = account.CreateCloudBlobClient();
let tempBlob = blobs.GetBlobReference("tweets/2010-9-26/17/201092617.txt")
tempBlob.Properties.ContentType <- "text/plain"
tempBlob.UploadText(json)
Run Code Online (Sandbox Code Playgroud) 来自Don Syme博客(http://blogs.msdn.com/b/dsyme/archive/2010/01/10/async-and-parallel-design-patterns-in-f-reporting-progress-with-events-plus -twitter-sample.aspx)我试图实现一个twitter流监听器.我的目标是遵循twitter api文档的指导,该文档说"在构建高可靠性系统时,通常应该在处理之前保存或排队推文".
所以我的代码需要有两个组件:
我选择以下内容:
我还想将插入数据库中的任何错误转储到文本文件中.(我可能会为所有错误切换到主管代理).
两个问题:
代码看起来像:
let dumpToDatabase databaseName =
//opens databse connection
fun tweet -> inserts tweet in database
type Agent<'T> = MailboxProcessor<'T>
let agentDump =
Agent.Start(fun (inbox: MailboxProcessor<string>) ->
async{
use w2 = new StreamWriter(@"\Errors.txt")
let dumpError =fun (error:string) -> w2.WriteLine( error )
let dumpTweet = dumpToDatabase "stream"
while true do
let! msg = inbox.Receive()
try
let tw = decode msg
dumpTweet tw
with
| …
Run Code Online (Sandbox Code Playgroud)