RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-266097

Dejsving's questions

Martin Hope
Dejsving
Asked: 2022-05-13 14:37:50 +0000 UTC

如何告诉 YamlDotNet 以俄语格式读取日期?

  • 2

从 YAML 文件中读取设置。在设置中有 InitialDateTime。

就我而言,它设置为 09/07/2020 09:00:00。

系统减去日期为 7 月 9 日,矿场需要告知 YamlDotNet 现在是 9 月 7 日。

告诉我如何让她清楚日期写为 day.month.year。

程序.cs

using System;

namespace YamlDotNet_stackoverflow_Example
{
    class Program
    {
        static void Main(string[] args)
        {
            var settings = Settings.GetFromYamlFile("Settings.yaml");
            settings.SaveToYamlFile("Settings_output.yaml");
        Console.WriteLine($"{settings.InitialDateTime:U}");
        }
    }
}

设置.cs

    using System;
using System.Globalization;
using System.IO;
using YamlDotNet.Serialization;

namespace YamlDotNet_stackoverflow_Example
{
    /// <summary>
    /// Настройки расчета солвера
    /// </summary>
    public class Settings
    {
        /// <summary>
        /// Начальная дата-время
        /// </summary>
        public DateTime InitialDateTime { get; set; }

        /// <summary>
        /// Чтение настроек из yaml-файла
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static Settings GetFromYamlFile(string fileName)
        {
            //CreateYamlFile(fileName);
            var deserializer = new DeserializerBuilder()
                .IgnoreUnmatchedProperties().Build();
            using var file = new StreamReader(fileName);
            var res = deserializer.Deserialize<Settings>(file);
            return res;
        }

        /// <summary>
        /// Сохранение настроек в yaml-файл
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public void SaveToYamlFile(string fileName)
        {
            var builder = new SerializerBuilder();
            builder = builder.EmitDefaults(); // Для принудительной сериализации 0-вых значений
            var serializer = builder.Build();
            using var file = new StreamWriter(fileName);
            serializer.Serialize(file, this);
            file.Flush();
        }

        /// <summary>
        /// Генератор для трафарета yaml-файла настроек при изменении структуры класса настроек
        /// </summary>
        /// <param name="fileName"></param>
        private static void CreateYamlFile(string fileName)
        {
            var builder = new SerializerBuilder();
            builder.EmitDefaults(); // Для принудительной сериализации 0 значений
            var serializer = builder.Build();
            var settings = new Settings
            {
                InitialDateTime = new DateTime(2020, 9, 7, 9, 0, 0)
            };
            using var file = new StreamWriter(fileName);
            serializer.Serialize(file, settings);
            file.Flush();
        }
    }
}

设置.yaml

InitialDateTime: 07.09.2020 9:00:00

示例数据和代码:https ://github.com/Dejsving/YamlDotNet-stackoverflow-Example

c#
  • 1 个回答
  • 10 Views
Martin Hope
Dejsving
Asked: 2020-11-14 16:03:01 +0000 UTC

Studio 在哪里存储 NuGet 包的字符串

  • 0

代码存储在单独的磁盘上。重装系统并恢复所有程序后,工作室报了一堆错误:

在 C:\Users\Artur\.nuget\packages 中找不到版本 3.5.2 的包 Autofac。运行 NuGet 包还原以下载包。

用户阿图尔已经不在了,怎么跟工作室解释现在路径不一样了?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Dejsving
Asked: 2020-01-10 18:46:34 +0000 UTC

解释tomcat端口的用途

  • 1

帮我弄清楚tomcat中的端口分配:tomcat中
有一个位于CentOS 7服务器上的应用程序,在webapps文件夹中有一个由该tomcat服务的应用程序。

 netstat -tlpn | grep 'pid_tomcat'

分发:

::ffff:127.0.0.0:8005
::8009
::8080
::45978

哪个端口负责什么?

我只知道8080这是为了从浏览器访问应用程序:http://ip:8080/app

但是为什么我们需要剩下的,我不明白。

tomcat
  • 1 个回答
  • 10 Views
Martin Hope
Dejsving
Asked: 2020-09-06 20:04:51 +0000 UTC

LibreOffice 无法在 Windows 上编译

  • 0

人们正试图在 Windows 上编译 LibreOffice。我正在遵循这个指示。

这是命令

/cygdrive/c/sources/libreoffice-5.4.1.2/autogen.sh \
               --with-external-tar=/cygdrive/c/sources/lo-externalsrc \
               --with-junit=/cygdrive/c/sources/junit-4.10.jar \
               --with-ant-home=/cygdrive/c/sources/apache-ant-1.9.5 \
              --enable-pch --disable-ccache \
               --disable-activex --disable-atl

给出以下

Running ./configure with '--with-external-tar=/cygdrive/c/sources/lo-externalsrc --with-junit=/cygdrive/c/sources/junit-4.10.jar --with-ant-home=/cygdrive/c/sources/apache-ant-1.9.5 --enable-pch --disable-ccache --disable-activex --disable-atl --srcdir=/cygdrive/c/sources/libreoffice-5.4.1.2 --enable-option-checking=fatal'
configure: error: unrecognized options: --disable-activex, --disable-atl
Error running configure at /cygdrive/c/sources/libreoffice-5.4.1.2/autogen.sh line 293.

但是这个

/cygdrive/c/sources/libreoffice-5.4.1.2/autogen.sh \
               --with-external-tar=/cygdrive/c/sources/lo-externalsrc \
               --with-junit=/cygdrive/c/sources/junit-4.10.jar \
               --with-ant-home=/cygdrive/c/sources/apache-ant-1.9.5 \
               --enable-pch --disable-ccache

给出以下内容:

Running ./configure with '--with-external-tar=/cygdrive/c/sources/lo-externalsrc --with-junit=/cygdrive/c/sources/junit-4.10.jar --with-ant-home=/cygdrive/c/sources/apache-ant-1.9.5 --enable-pch --disable-ccache --srcdir=/cygdrive/c/sources/libreoffice-5.4.1.2 --enable-option-checking=fatal'
********************************************************************
*
* Running LibreOffice build configuration.
*
********************************************************************

checking build system type... x86_64-unknown-cygwin
checking host system type... x86_64-unknown-cygwin
checking for product name... LibreOfficeDev
checking for package version... 5.4.1.2.0+
checking for product version... 5.4
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for grep... (cached) /usr/bin/grep
checking for GNU Make... C:/cygwin64/opt/lo/bin/make
configure: Using a native Win32 GNU Make version.
checking for explicit COMSPEC... found: C:\Windows\system32\cmd.exe
checking for sed... /usr/bin/sed
checking whether to use link-time optimization... no
checking for explicit AFLAGS... no
checking for explicit CFLAGS... no
checking for explicit CXXFLAGS... no
checking for explicit OBJCFLAGS... no
checking for explicit OBJCXXFLAGS... no
checking for explicit LDFLAGS... no
checking whether build target is Release Build... no
checking whether to sign windows build... no
checking for gawk... gawk
checking for gawk... /usr/bin/gawk
checking for bash... /bin/sh
checking for GNU or BSD tar... tar
checking for tar's option to strip components... --strip-components
checking how to build and package galleries... internal src images for desktop
checking whether to build with Java support... yes
checking whether to treat the installation as read-only... no
checking whether to build a 64-bit LibreOffice... no
checking Visual C++... found: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
checking for short pathname of VC product directory... C:/PROGRA~2/MICROS~3/2017/COMMUN~1/VC
checking for UCRT location... cygpath: cannot create short name of Active code page
configure: error: path conversion failed for "Active code page: 65001
[ERROR:VsDevCmd.bat] Script "vsdevcmd\ext\Active" could not be found.
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***
C:\Program Files (x86)\Windows Kits\10".
Error running configure at /cygdrive/c/sources/libreoffice-5.4.1.2/autogen.sh line 293.

请让我知道是否有人遇到过这种情况以及如何解决该问题。

如果在 cmd 我要求你给我chcp ,活动代码页 65001 答案

我试图将 VS 重新排列到一个没有空格的文件夹(由同事建议) - 没有任何改变

windows-7
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5