小编A19*_*919的帖子

OxyPlot自动缩放

AutoScale OxyPlot图表。例如,我有这样的事情。

using OxyPlot;
using OxyPlot.Axes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using OxyPlot.Wpf;
using PlotControllerTest.Properties;
using System.Diagnostics;
namespace PlotControllerTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
/// 
public class Chart
{
    public PlotController myController { get; set; }
    private OxyPlot.Series.LineSeries LS;
    OxyPlot.Axes.LinearAxis LAY;
    OxyPlot.Axes.LinearAxis LAX;
    private int i = 0;
    public PlotModel PlotModel {get;set;}
    public Chart() …
Run Code Online (Sandbox Code Playgroud)

c# wpf oxyplot

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

确定每个向量元素是否超过所有先前元素

我需要将元素i与之前的所有元素进行比较i-1,i-2,...,如果i > i-1, i-2, ...返回1,否则返回0.

data <- c(10.3,14.3,7.7,15.8,14.4,16.7,15.3,20.2,17.1,7.7,15.3,16.3,19.9,14.4,18.7,20.7)
Run Code Online (Sandbox Code Playgroud)

比较的结果应如下.

0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 1
Run Code Online (Sandbox Code Playgroud)

r

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

Angularjs用html显示值

如何显示Html value?就像ASP.NET中的@ Html.Raw()一样.因为在当前示例中,我只获得带有标签的文本.

JS:

var app = angular.module('Demo', []);
app.controller('TestCtrl', function ($scope) {
    $scope.value = '<p>List</p><ul><li>Test 1</li><li>Test 2</li><li>Test 3</li><li>Test 4</li></ul>'
});
Run Code Online (Sandbox Code Playgroud)

观点:

<div ng-controller="TestCtrl">
    {{value}}
</div>
Run Code Online (Sandbox Code Playgroud)

html javascript asp.net angularjs

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

OCR TesseractEngine

我正在使用OCR识别图片上的数字

在此输入图像描述

var engine = new TesseractEngine(@"C:\Projects\tessdata", "eng", EngineMode.Default,);
var currentImage = TakeScreen();
var page = engine.Process(ScaleByPercent(currentImage, 500));
var text = page.GetText().Replace("\n", "");
Run Code Online (Sandbox Code Playgroud)

规模:

public Bitmap ScaleByPercent(Bitmap imgPhoto, int Percent)
    {
        float nPercent = ((float)Percent / 100);

        int sourceWidth = imgPhoto.Width;
        int sourceHeight = imgPhoto.Height;
        var destWidth = (int)(sourceWidth * nPercent);
        var destHeight = (int)(sourceHeight * nPercent);

        var bmPhoto = new Bitmap(destWidth, destHeight,
                                 PixelFormat.Format24bppRgb);
        bmPhoto.SetResolution(imgPhoto.HorizontalResolution,
                              imgPhoto.VerticalResolution);

        Graphics grPhoto = Graphics.FromImage(bmPhoto);
        grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;

        grPhoto.DrawImage(imgPhoto,
                          new System.Drawing.Rectangle(0, 0, destWidth, destHeight), …
Run Code Online (Sandbox Code Playgroud)

c# ocr

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

WPF XAML 传递给 ConverterParameter 枚举数组

我有枚举

public enum DocumentTypes
{
    First, Second, Third, Fourth
}
Run Code Online (Sandbox Code Playgroud)

如何传递的值enum<sys:Enum></sys:Enum>

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1.Converters"
xmlns:enums="clr-namespace:WpfApplication1.Enums"
xmlns:sys="clr-namespace:System;assembly=mscorlib"

       <Label Content="Test2">
            <Label.Visibility>
                <MultiBinding Converter="{StaticResource Converter}">
                    <MultiBinding.ConverterParameter>
                        <x:Array Type="{x:Type sys:Enum}">
                            <sys:Enum></sys:Enum>
                        </x:Array>
                    </MultiBinding.ConverterParameter>
                    <Binding ElementName="First" Path="IsChecked" />
                    <Binding ElementName="Second" Path="IsChecked" />
                    <Binding ElementName="Third" Path="IsChecked" />
                    <Binding ElementName="Fourth" Path="IsChecked" />
                </MultiBinding>
            </Label.Visibility>
        </Label>
Run Code Online (Sandbox Code Playgroud)

c# wpf enums xaml

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

具有模式匹配功能的F#分支逻辑

让我在C#上有这样的代码。如何用F#在函数样式中重写此早午餐逻辑?我应该使用什么模式匹配?主动模式匹配?区分工会?

public class DataBase
{
    public List<string> GetEmployees(string id, string email)
    {
        if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(email))
        {
            return GetByIdAndEmail(id, email);
        }
        else if (!string.IsNullOrEmpty(email))
        {
            return GetByEmail(email);
        }
        else if (!string.IsNullOrEmpty(id))
        {
            return GetById(id);
        }
        else
        {
            return new List<string>();
        }
    }

    private List<string> GetByIdAndEmail(string id, string email)
    {
        // request something in db
        return new List<string>() { "First" };
    }

    private List<string> GetByEmail(string email)
    {
        //request something in db
        return new List<string>() { "Second" };
    }

    private List<string> GetById(string …
Run Code Online (Sandbox Code Playgroud)

f#

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

异步任务同步

我有三个异步任务需要以这样的顺序完成首先,比如First完成,开始做第二个,当第二个完成时开始做第三个.但我认为我的解决方案并不是很好.你能提出更好的建议吗?

namespace WpfApplication215
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        DataContext = new AsyncWork();
    }
}
public class AsyncWork
{
    public List<int> Items { get; set; }
    public AsyncWork()
    {
        Action FirstPart = new Action(ComputeFirstpart);
        IAsyncResult result1 = FirstPart.BeginInvoke(null, null);
        if (!result1.AsyncWaitHandle.WaitOne(0, false))
        {
            Action SecondPart = new Action(ComputeSecondPart);
            IAsyncResult result2 = SecondPart.BeginInvoke(null, null);
            if (!result2.AsyncWaitHandle.WaitOne(0, false))
            {
                Action ThirdPart = new Action(ComputeThirdPart);
                IAsyncResult result3 = …
Run Code Online (Sandbox Code Playgroud)

c# multithreading asynchronous

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

Jquery单击隐藏元素

我有

<table width="60" height="60" cellpadding="0" 
cellspacing="0" border="0" style="float: left; margin: 1px" 
background="images/data/source_red.gif">
   <tbody>
      <tr>
         <td act1="7" act3="8" store="true" art_id="4949" cnt="1" div_id="AA_4949" 
         onmouseover="artifactAlt(this,event,2)" 
         onmouseout="artifactAlt(this,event,0)" 
         valign="bottom" 
         style="background-image: url(&quot;images/d.gif&quot;); cursor: pointer;">&nbsp;</td>
      </tr>
   </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我想点击onmouseover="artifactAlt(this,event,2)"发射时升起的元素,怎么做?

当我在做的时候 $('#body').contents().find('td[art_id="4949"]')[0].click();

我得到了undefined,没有发生.

html javascript jquery events

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

F# 该值不是函数

玩 F# 似乎我无法找出问题所在。

FS0003 该值不是函数,无法应用。您是否忘记终止声明?

蒸发器 25.0 10.0 10.0

let evaporator (volumeMl:double) (evapPerDaydouble:double) (threshold:double):int =
    let mutable counter = 0
    let mutable currentVolume = volumeMl
    while (currentVolume > (volumeMl * (threshold / 100.))) do
        currentVolume <- currentVolume - ((currentVolume * threshold / 100.))
        counter <- (counter + 1)
    counter

let result = evaporator 25.0 10.0 10.0

printfn "%f" result 
Run Code Online (Sandbox Code Playgroud)

更新

修改后的代码;;

let result = evaporator 25.0 10.0 10.0;;
Run Code Online (Sandbox Code Playgroud)

它正在按预期工作。奇怪的。

更新2

在此输入图像描述

f#

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

F# Seq&lt;Seq&lt;char&gt;&gt; 转换为字符串

使用 F# 并尝试从 string 中获取abcdefghijklmnop另一个 string aeimbfjncgkodhlp

let input ="abcdefghijklmnop"

let convertList (input:string)=
    input
    |> Seq.mapi(fun i ei->  i % 4, ei)
    |> Seq.groupBy (fst)
    |> Seq.map(fun (g,s)-> s |> Seq.map snd)

let result = convertList input

result
Run Code Online (Sandbox Code Playgroud)

在我的函数中,最终结果是seq<seq<char>>,如何转换seq<seq<char>>为字符串?

f#

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

标签 统计

c# ×4

f# ×3

html ×2

javascript ×2

wpf ×2

angularjs ×1

asp.net ×1

asynchronous ×1

enums ×1

events ×1

jquery ×1

multithreading ×1

ocr ×1

oxyplot ×1

r ×1

xaml ×1