小编Old*_*vec的帖子

图像分析 - 光纤识别

我是图像分析的新手.你知道如何以这种方式将这种图像二值化以获得光纤吗?

液体中的纤维

我尝试了不同的门限技术等,但我没有成功.我不介意我应该使用什么工具,但我更喜欢.NETMatlab.

PS:我不知道在哪里提出答案,所以我把它放在StackOverflow上.

c# matlab f# wolfram-mathematica image-processing

7
推荐指数
3
解决办法
1012
查看次数

多个.NET进程的严格负载平衡

我有一个在Windows Server 2008 SE和64个处理器上运行的多进程.NET(F#)科学模拟.模拟的每个时间步长从1.5秒振荡到2秒.由于每个进程必须等待其他进程,因此总速度是最慢进程的速度(2秒*迭代次数).因此,我需要尽可能地减少过程的振荡.

有没有办法如何强制一组进程为他们的计算提供完全相同的"计算时间"?

.net windows f# hpc

7
推荐指数
1
解决办法
241
查看次数

在Visual Studio 2012中使用F#进行内联函数的代码覆盖

Visual Studio 2012中的代码覆盖工具将所有inline功能标记为未覆盖,即使它们被覆盖.

有什么方法可以使代码覆盖inline功能适用于函数吗?

f# code-coverage inline visual-studio-2012

7
推荐指数
2
解决办法
508
查看次数

struct中的内联加运算符抛出异常(F#)

为什么fail值会抛出异常?fine价值有效.如果我删除inline或如果我转换'tfloat然后它的工作原理.

[<Struct>]
type Test<'t> =
  val x: 't
  val y: 't
  new (x,y) = { x = x; y = y }

  static member inline (+) ((x,y), a: _ Test) = 0
  static member inline (-) ((x,y), a: _ Test) = 0

let a = 1.,2.
let b = Test(1.,2.)
let fine = a - b
let fail = a + b
Run Code Online (Sandbox Code Playgroud)

错误信息:

未处理的异常:System.TypeInitializationException:类型初始值设定项'AdditionDynamicImplTable 3' threw an exception. ---> System.NotSupportedExcep …

f# struct exception operators

7
推荐指数
1
解决办法
190
查看次数

在Xamarin Studio 4.0.3中调试F#会引发错误

我已经从http://monodevelop.com/Download在Windows 8 x64上安装了Xamarin Studio 4.0.1 .当我运行Xamarin时,它已更新到4.0.3.我已经安装了F#绑定.我创建了新的F#控制台项目.当我运行它,它工作正常.当我设置一个断点并运行它时,我得到以下错误.任何想法,为什么会这样?

System.Runtime.InteropServices.COMException(0x80070032):不支持该请求.(从HRESULT异常:0x80070032)在Microsoft.Samples.Debugging.CorDebug.NativeApi.ICorDebug.CreateProcess(字符串lpApplicationName,字符串lpCommandLine,SECURITY_ATTRIBUTES lpProcessAttributes,SECURITY_ATTRIBUTES lpThreadAttributes,的Int32 bInheritHandles,UInt32的dwCreationFlags,IntPtr的lpEnvironment,字符串lpCurrentDirectory,STARTUPINFO lpStartupInfo,PROCESS_INFORMATION lpProcessInformation,CorDebugCreateProcessFlags debuggingFlags,ICorDebugProcess&ppProcess)at Microsoft.Samples.Debugging.CorDebug.CorDebugger.CreateProcess(String applicationName,String commandLine,SECURITY_ATTRIBUTES processAttributes,SECURITY_ATTRIBUTES threadAttributes,Boolean inheritHandles,Int32 creationFlags,IntPtr environment,String currentDirectory,STARTUPINFO startupInfo,PROCESS_INFORMATION&processInformation ,CorDebugCreateProcessFlags debuggingFlags)在Microsoft.Samples.Debugging.CorDebug.CorDebugger.CreateProcess(String applicationName,String commandLine,String currentDirectory,ID 在Mono.Debugging.Client.DebuggerSession的MonoDevelop.Debugger.Win32.CorDebuggerSession.OnRun(DebuggerStartInfo startInfo)中的ictionary`2环境,Int32标志.<> c__DisplayClassc.b__a()

f# monodevelop xamarin xamarin-studio

7
推荐指数
1
解决办法
1329
查看次数

如何使用F#获取作为参数的函数名称?

在F#中有什么方法可以获取传递给函数的变量的名称吗?

例:

let velocity = 5
let fn v = v.ParentName
let name = fn velocity // this would return "velocity" as a string
Run Code Online (Sandbox Code Playgroud)

先感谢您

编辑:

为什么这段代码不起作用?它匹配为值,因此我无法检索"变量"名称.

type Test() =
  let getName (e:Quotations.Expr) =
    match e with
      | Quotations.Patterns.PropertyGet (_, pi, _) -> pi.Name + " property"
      | Quotations.Patterns.Value(a) -> failwith "Value matched"
      | _ -> failwith "other matched"
  member x.plot v = v |> getName |> printfn "%s"

let o = new Test()

let display () =
  let variable …
Run Code Online (Sandbox Code Playgroud)

parameters f# function quotations

6
推荐指数
1
解决办法
1002
查看次数

F#interactive与F#解决方案和WCF

尝试在F#interactive中运行它:

#r "System.ServiceModel"
#r "System.Runtime.Serialization"

open System.ServiceModel

[<ServiceContract>]
type IWCF =
  [<OperationContract>]
  abstract Ping: float -> unit

type WCF () =
  interface IWCF with
    member o.Ping a = printfn "Hello, %g" a

let svh = new ServiceHost (typeof<WCF>)
Run Code Online (Sandbox Code Playgroud)

你可能会成功.尝试制作新的解决方案.

参考:

  • System.Runtime.Serialization
  • System.ServiceModel

将以下代码粘贴到Program.fs:

open System.ServiceModel

[<ServiceContract>]
type IWCF =
  [<OperationContract>]
  abstract Ping: float -> unit

type WCF () =
  interface IWCF with
    member o.Ping a = printfn "Hello, %g" a

let svh = new ServiceHost (typeof<WCF>)
Run Code Online (Sandbox Code Playgroud)

并运行它.我收到以下错误:

构成服务合同的操作中使用的所有参数名称都不能为空.参数名称:名称 …

wcf f#

6
推荐指数
1
解决办法
623
查看次数

F#中度量单位的模式匹配

这个功能:

let convert (v: float<_>) =
  match v with
  | :? float<m> -> v / 0.1<m>
  | :? float<m/s> -> v / 0.2<m/s>
  | _ -> failwith "unknown"
Run Code Online (Sandbox Code Playgroud)

产生错误

类型'float <'u>'没有任何正确的子类型,不能用作类型测试或运行时强制的源.

有没有办法如何模式匹配度量单位?

f# pattern-matching units-of-measurement

5
推荐指数
1
解决办法
1264
查看次数

如何使Monodevelop和F#工作

我的电脑上有VS 2010 + NET 4.我为Windows下载了Monodevelop和Monodevelop 2.8.6.4的F#绑定.

https://github.com/fsharp/fsharpbinding

http://monodevelop.com/Download

我跑了install.bat其复制FSharpBinding.dllFSharpBinding.Gui.dllc:\Program Files (x86)\MonoDevelop\AddIns\BackendBindings\.

我在Monodevelop中打开了新的解决方案,但那里没有F#解决方案.你知道我应该做的下一步是让F#与Monodevelop一起工作吗?我还检查了加载项管理器,但我没有看到安装任何F#绑定.

f# monodevelop

5
推荐指数
1
解决办法
3631
查看次数

ES6模块-具有通用别名的命名导入

如果我正确理解ES6模块导入,则不允许以下操作:

import { background, border, foreground } as colors from "./colors";

use(colors.background);
use(colors.border);
use(colors.foreground);
Run Code Online (Sandbox Code Playgroud)

看到

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/import

有什么解释吗?

我喜欢明确列出要导入的内容的想法。所以我不喜欢,import * as colors from "./colors";因为它不清楚我使用的是什么。

另一方面,这对我来说太冗长了:import { background as backgroundColor, border as borderColor, foreground as foregroundColor } from "./colors";

有什么主意如何变得明确而不不必要地冗长吗?

javascript module typescript ecmascript-6

5
推荐指数
0
解决办法
494
查看次数