小编use*_*963的帖子

如何从MinGW安装管理器安装perl 5.10?

当我尝试使用msys.bat在Windows上构建openssl时,./configure mingw shared报告错误.

需要Perl v5.10.0 - 这只是v5.8.8,在./configure第12行停止.

MinGW Installation Manager将5.8.8列为存储库版本. 在此输入图像描述

如何获得更新版的perl?我已经安装了草莓perl,但我不知道是否可以将它连接到msys.

windows perl mingw

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

派生类型的模式匹配是否为F#惯用?

我想以最惯用的方式实现以下内容

玩家在地图上.

  1. 如果他用箭头处于同一位置,他将获得1点伤害

  2. 如果他与一个生物处于相同的位置,他的伤害等于生物的hp

  3. 如果他用硬币处于同一位置,他就得到1美元

  4. 如果他与药物处于相同的位置,他会治愈1

这是为交互编写的存根:

open System
[<AbstractClass>]
type ActorBase(x,y,symbol)=
    member this.X:int=x
    member this.Y:int=y
    member this.Symbol:char=symbol

type Medication(x,y)=
    inherit ActorBase(x,y,'?')
type Coin(x,y)=
    inherit ActorBase(x,y,'$') 

type Arrow(x,y,symbol,targetX,targetY) =
    inherit ActorBase(x,y,symbol)
    member this.TargetX=targetX
    member this.TargetY=targetY

[<AbstractClass>]
type CreatureBase(x,y,symbol,hp) =
    inherit ActorBase(x,y,symbol)
    member this.HP:int=hp

type Player(x,y,hp, score) =
    inherit CreatureBase(x,y,'@',hp)
    member this.Score = score
type Zombie(x,y,hp,targetX,targetY) =
    inherit CreatureBase(x,y,'z',hp)
    member this.TargetX=targetX
    member this.TargetY=targetY

let playerInteraction (player:Player) (otherActor:#ActorBase):unit =
    printfn "Interacting with %c" otherActor.Symbol
    match (otherActor :> ActorBase) with
            | :? CreatureBase …
Run Code Online (Sandbox Code Playgroud)

f# types functional-programming idiomatic

4
推荐指数
1
解决办法
364
查看次数

使用电晕创建一个类和图像

我试图根据这个例子在电晕中创建我自己的类 它看起来像:

local car={};
local car_mt = { __index=car };
function car.new()
    local ncar=
    {
        img=display:newImage("test_car.png");
    }
    return setmetatable(ncar,car_mt);
end
return car;
Run Code Online (Sandbox Code Playgroud)

它被称为等级:

local pcar=require("car")
...
function scene:enterScene( event )
    local group = self.view
    physics.start();
    local car1=pcar.new();

end
Run Code Online (Sandbox Code Playgroud)

图像存在于同一文件夹中,但我得到:

坏参数#-2到newImage(代理预期,得到零)

我在网上看到了一些类似的问题,在我看来,newImage()它不知道在哪里放置图片.但是,如果将它用于任何阶段的课程怎么说呢?

lua coronasdk

3
推荐指数
1
解决办法
668
查看次数

Arduino结构未命名类型错误

在Arduino IDE中,我可以创建具有自定义类型的变量,但不能从函数返回自定义类型:

这样编译

struct Timer
{
  Timer()
  {
  }
};

Timer t;
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}
int main()
{
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

这会产生Timer does not name a type错误:

struct Timer
{
  Timer()
  {
  }
};

Timer get_timer()
{
  return Timer();
}

void setup() {
  // put your setup code here, to run once:

}

void loop() …
Run Code Online (Sandbox Code Playgroud)

c++ arduino

3
推荐指数
1
解决办法
1584
查看次数

非惯用全局运算符重载如何工作?

我想了解这个答案的代码

type Mult = Mult with
    static member inline ($) (Mult, v1: 'a list) = fun (v2: 'b list) -> 
        v1 |> List.collect (fun x -> v2 |> List.map (fun y -> (x, y))) : list<'a * 'b>
    static member inline ($) (Mult, v1:'a      ) = fun (v2:'a) -> v1 * v2 :'a

let inline (*) v1 v2 = (Mult $ v1) v2
Run Code Online (Sandbox Code Playgroud)

F#可以解决重载成员.(因为它不支持成员的currying).所以,我认为,它也适用于方法

但它没有:

type Mult = Mult with
        static member inline Do (Mult, v1: 'a list) …
Run Code Online (Sandbox Code Playgroud)

f# overloading operator-overloading operators

3
推荐指数
1
解决办法
92
查看次数

我可以在构造函数注释中引用属性注释吗?

如果我的类有一个注释的公共属性(通过构造函数赋值),我可以从具有相同名称的构造函数参数的描述中引用它的描述吗?

public class MyClass
{
    /// <summary>
    /// x description
    /// </summary>
    public int x { get; private set; }
    /// <summary>
    /// y description
    /// </summary>
    public int y { get; private set; }
    /// <summary>
    /// Constructor description
    /// </summary>
    /// <param name="x">How do I reference x description from here?</param>
    /// <param name="y">And y description?</param>
    public MyClass(int x, int y)
    {
        this.x = x;
        this.y = y;
    }
}
Run Code Online (Sandbox Code Playgroud)

c# xml comments

2
推荐指数
1
解决办法
1275
查看次数

Action的结果是什么?如何使用它?

Reactive Extensions有一个Observable.Start()功能.

Visual Studio告诉我它

通过可观察的序列异步调用结果.

它有返回类型 IObservable<Unit>

MDSN所说的Unit就是它

代表无效.

但为什么我需要代表void

为什么我需要将voids 流转换为list并从中获取第一个元素来替换并行ForEach

c# system.reactive

2
推荐指数
1
解决办法
452
查看次数

不能和NAudio.Midi一起玩

我读了这个答案并尝试用NAudio.Midi播放一个音符:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NAudio.Midi;
using System.Threading;

namespace SoundVision10
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Thread.Sleep inside GUI is just for example
            using (MidiOut midiOut = new MidiOut(0))
            {
                midiOut.Volume = 65535;
                midiOut.Send(MidiMessage.StartNote(60, 127, 0).RawData);
                MessageBox.Show("Sent");
                Thread.Sleep(1000);
                midiOut.Send(MidiMessage.StopNote(60, 0, 0).RawData);
                Thread.Sleep(1000);
            } …
Run Code Online (Sandbox Code Playgroud)

c# midi naudio

0
推荐指数
1
解决办法
1413
查看次数

结构在变量定义中意味着什么?C++

在这里,我发现了一个看起来像这样的变量定义:

struct sockaddr *ai_addr;    
Run Code Online (Sandbox Code Playgroud)

它似乎是定义一个指向类型变量的指针struct sockaddr,但是

1)struct是一个关键字

2)struct sockaddr test;产生错误

aggregate 'sockaddr test' has incomplete type and cannot be defined
Run Code Online (Sandbox Code Playgroud)

(我在gcc 4.7.1下工作)

c c++ struct

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