我有一个Java程序,它读取一个System属性
System.getProperty("cassandra.ip");
Run Code Online (Sandbox Code Playgroud)
我有一个Gradle构建文件,我开始
gradle test -Pcassandra.ip=192.168.33.13
Run Code Online (Sandbox Code Playgroud)
要么
gradle test -Dcassandra.ip=192.168.33.13
Run Code Online (Sandbox Code Playgroud)
但是System.getProperty将始终返回null.
我找到的唯一方法是在我的Gradle构建文件中添加它
test {
systemProperty "cassandra.ip", "192.168.33.13"
}
Run Code Online (Sandbox Code Playgroud)
我如何通过-D来做到这一点
如何通过外部Dockerfile开始配置Docker?我的Vagrantfile目前看起来像这样
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.define :server_infrastructure do |t|
end
config.vm.provision "docker" do |d|
d.pull_images "ubuntu"
#how does the below work?
#d.build "new-container-name" "local-docker-file-name"
end
end
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助
胖箭头可以在不同的设置中使用,但它不会总是绑定到我想要的实例.
我想创建一个DSL,其中可以连续调用2(foo
和bar
)函数,以便
initialize()
|> foo 10
|> bar "A"
|> foo 20
|> bar "B"
|> transform
Run Code Online (Sandbox Code Playgroud)
这通过定义非常完美
type FooResult = FooResult
type BarResult = BarResult
let foo param (result_type:BarResult, result) = (FooResult, transform param result)
let bar param (result_type:FooResult, result) = (BarResult, transform param result)
Run Code Online (Sandbox Code Playgroud)
现在我想要允许多个bar
调用可以连续执行,但是foo
仍然只需要调用一次
initialize()
|> foo 10
|> bar "A"
//OK
|> bar "B"
|> transform
initialize()
|> foo 10
|> bar "A"
|> foo 20
//should yield an …
Run Code Online (Sandbox Code Playgroud) 我已经将运行VistualBox的Vagrant(1.2.2)VM设置为:private_network,我已经启动了一个Sinatra服务器.但是我无法连接到那个Sinatra实例.然而,VM运行并响应ping.
这是我的Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.network :private_network, ip: "192.168.33.10"
end
Run Code Online (Sandbox Code Playgroud)
所以我启动了Vagrant VM并将其添加到其中
prodserv$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This …
Run Code Online (Sandbox Code Playgroud) 我怎样才能(如果有的话)模拟可变参数函数(而不是方法)以便我可以编写
sum 1 2 3
sum 1 2 3 4 5
sum 1 2 3 4 5 6 7
// etc.
Run Code Online (Sandbox Code Playgroud)
上面的代码只是作为一个例子 - 显然如果我必须总结一个列表
[ 1; 2 ; 3] |> List.sum
Run Code Online (Sandbox Code Playgroud)
是一个更好的方式.
但是,我正在寻找像Haskell解决方案这样的结构相似的解决方案
同样重要的是函数调用和参数值的正常语法保持不变.所以
sum 1 2 3
Run Code Online (Sandbox Code Playgroud)
VS
sum(1, 2, 3)
Run Code Online (Sandbox Code Playgroud)
这实际上意味着
let sum ([<ParamArray>] arr) = ...
Run Code Online (Sandbox Code Playgroud)
在这个特定的情况下不需要.
所有这一切的动机:我正在探索F#的类型系统和语法的外边缘.而且我完全意识到我可能已经越过了可能已经存在的边界.
PS:我的具体想法(我在这里没有描述)也可以完全不同的方式解决 - 所以我知道,所以我已经完成了.因此我的问题不是:如何以不同的方式解决这个问题,但如何在结构上像Haskell一样解决这个问题.
PPS:Double Karma-Points如果你可以使整个解决方案递归.
是否可以通过类型提供程序创建泛型类型
[<TypeProvider>]
type SampleTypeProvider(config: TypeProviderConfig) as this =
...
//the below would be the generated type
type A<'b> () =
member this.C() : 'b = ...
member this.D() : 'b = ...
//
...
[<assembly:TypeProviderAssembly>]
do()
....
Run Code Online (Sandbox Code Playgroud)
所以在使用场景中看起来会有所作为
#r @".\bin\Debug\SampleTypeProvider.dll"
type A = SampleTypeProvider.A
type intA = A<int>
type strA = A<str>
Run Code Online (Sandbox Code Playgroud)
如果可能的话 - 我该如何处理它.
因为它还没有(还)可以使用Storyboard来生成类和粘合代码.我有想法自己编写F#类并自己粘贴.
所以我写了这个Storyboard命名空间的加载
open System
open MonoTouch.UIKit
open MonoTouch.Foundation
[<Register("AppDelegate")>]
type AppDelegate() =
inherit UIApplicationDelegate()
member val window = null with get, set
override this.FinishedLaunching(app, options) =
this.window <- new UIWindow(UIScreen.MainScreen.Bounds)
let Storyboard = UIStoryboard.FromName("MainStoryboard", null)
this.window.RootViewController <- Storyboard.InstantiateInitialViewController() :?> UIViewController
this.window.MakeKeyAndVisible()
true
module Main =
[<EntryPoint>]
let main args =
UIApplication.Main(args, null, "AppDelegate")
0
Run Code Online (Sandbox Code Playgroud)
和以下控制器类
open System
open System.Drawing
open MonoTouch.UIKit
open MonoTouch.Foundation
[<Register("HomeController")>]
type HomeController() =
inherit UIViewController()
override this.ViewDidLoad() =
base.ViewDidLoad()
System.Console.WriteLine("FOO!")
Run Code Online (Sandbox Code Playgroud)
然后我创建了故事板(见附图).
AND - 一切都被加载,故事板工作正常 - 一个例外:ViewDidLoadnever被调用.显然我没有成功连接我的手动编码控制器. …
Typescript会支持类似于CoffeeScript的解构分配吗?
foo = {x: 1, y: 2, z: 3}
{x, z} = foo
# which will yield
x == 1 && z == 3
Run Code Online (Sandbox Code Playgroud) f# ×4
vagrant ×2
coffeescript ×1
connection ×1
docker ×1
dsl ×1
elixir ×1
gradle ×1
ios ×1
java ×1
sinatra ×1
testing ×1
this ×1
typescript ×1
virtualbox ×1
xamarin ×1