小编Rob*_*III的帖子

mysql:InnoDB:无法继续操作

我已经在 Windows 7 环境中安装了 mysql。当我尝试从命令行启动服务器时:mysqld --user=root

我收到以下消息:

120914 15:47:04 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.5\data\SFO1502128830A.lower-test
120914 15:47:04 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.5\data\SFO1502128830A.lower-test
120914 15:47:04 [Note] Plugin 'FEDERATED' is disabled.
120914 15:47:04 InnoDB: The InnoDB memory heap is disabled
120914 15:47:04 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120914 15:47:04 InnoDB: Compressed tables use zlib 1.2.3
120914 15:47:04 InnoDB: Initializing buffer pool, size = 128.0M
120914 15:47:04 InnoDB: Completed initialization of buffer pool …
Run Code Online (Sandbox Code Playgroud)

mysql

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

自主OWIN项目; http:// localhost:8080不起作用,http:// +:8080呢?

我有一个我正在尝试运行的自托管OWIN项目.它被配置为监听:

http://localhost:8080

每当我尝试访问该URL时,我都会收到HTTP错误503.服务不可用错误.

我已经运行netstat -a -b并且绝对确定在端口8080上没有运行其他应用程序.

当我将配置更改为http://+:8080项目工作正常.所以,唯一的变化是localhost+.

现在这里是奇怪的事情:

  • 我确信所有条目(localhost:8080+:8080在HTTP命名空间)是相同的(见,其中"iedereen"是荷兰语中是"大家"(是的,这只是我的测试站)).相关产出netsh http show urlacl:

    URL Reservations: 
    
    Reserved URL            : http://+:8080/ 
        User: \Everyone
            Listen: Yes
            Delegate: Yes
            SDDL: D:(A;;GAGXGWGR;;;WD) 
    
    Reserved URL            : http://localhost:8080/ 
        User: \Everyone
            Listen: Yes
            Delegate: Yes
            SDDL: D:(A;;GAGXGWGR;;;WD) 
    
    Run Code Online (Sandbox Code Playgroud)
  • 我在端口8081或其他端口上遇到同样的问题; " +"有效," localhost"没有.因此,为了确保没有与8080冲突的东西我已经尝试过8081(以及其他端口,当然还有正确的urlacl)

  • 当我使用+:8080该应用程序时可以达到罚款; 我得到了理想的回应.所以这不是防火墙问题.也不是我尝试过的8081端口或其他端口.此外,503它来自应用程序(毕竟它是一个应用程序错误,但是:当我停止应用程序时,我只是没有响应而不是503),所以,再次,没有防火墙问题.
  • 我尝试以管理员身份运行无效,同样以管理员身份运行VS.
  • localhost:8080 适用于同事的计算机(这首先出现在这个位置)
  • localhost解决好127.0.0.1::1.没有改变的主机文件.

我似乎无法调试此问题,我可以在我的控制器方法中设置断点,但它永远不会到达.申请开始很好. …

.net c# owin

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

更改 Swagger/Swashbuckle 导出的属性类型

我有一个带有嵌套对象的相当复杂的对象;请注意,在下面的示例中,我大大简化了这个对象。

假设以下示例对象:

public class Result {
    public string Name { get; set; }
    public IpAddress IpAddress { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我已经实现了一个JsonConverter<IPAddress>比(反)序列化 Ip 作为一个字符串:

public class IPAddressConverter : JsonConverter<IPAddress>
{
    public override IPAddress Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        => IPAddress.Parse(reader.GetString());

    public override void Write(Utf8JsonWriter writer, IPAddress value, JsonSerializerOptions options)
        => writer.WriteStringValue(value.ToString());
}
Run Code Online (Sandbox Code Playgroud)

所述IPAddressConverter然后“注册”作为在一个转换器AddJsonOptions(...)的方法。这很好地返回结果为:

{ "Name": "Foo", "IpAddress": "198.51.100.1" }
Run Code Online (Sandbox Code Playgroud)

并且,反之亦然,我的控制器“理解”指定为字符串的 IP 地址:

public IEnumerable<Result> FindByIp(IpAddress ip) {
    // ...
}
Run Code Online (Sandbox Code Playgroud)

但是,SwashBuckle 将其导出为: …

c# swagger .net-core swashbuckle

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

使用 XMS.Net 的 Websphere MQ 队列深度

由于我们使用 XMS.net(有时似乎放弃侦听队列消息的 Windows 服务)在 IBM 的 Websphere MQ 上遇到了一些麻烦,我们想创建一个简单的应用程序来监视某些队列的深度(或消息的数量)在队列中)能够在队列深度超过某个阈值时提醒某人。该应用程序将由任务调度程序以特定时间间隔启动,并会为 X 队列“读出”它们的队列深度(可能还有一些其他统计信息)。

我们的 Windows 服务正在使用以下代码,我希望我可以为我们的“监控”应用程序重用相同的“知识”。

    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

    //Read config values
    string QueueManager = ConfigurationManager.AppSettings["queuemanager"];
    string Channel = ConfigurationManager.AppSettings["channel"];
    string Queue = ConfigurationManager.AppSettings["queue"];
    string HostIP = ConfigurationManager.AppSettings["host"];
    int Port = int.Parse(ConfigurationManager.AppSettings["port"]);

    //Create connection
    var factoryfactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
    var connectionfactory = factoryfactory.CreateConnectionFactory();

    connectionfactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, QueueManager);
    connectionfactory.SetStringProperty(XMSC.WMQ_HOST_NAME, HostIP);
    connectionfactory.SetIntProperty(XMSC.WMQ_PORT, Port);
    connectionfactory.SetStringProperty(XMSC.WMQ_CHANNEL, Channel);
    connectionfactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V2);
    connectionfactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);

    Console.WriteLine("Creating connection");
    var connection = connectionfactory.CreateConnection();
    connection.ExceptionListener = new ExceptionListener(OnXMSExceptionReceived);

    //Create a_session
    Console.WriteLine("Creating sessions");
    var session = …
Run Code Online (Sandbox Code Playgroud)

.net c# ibm-mq

4
推荐指数
2
解决办法
6114
查看次数

eventhandler抛出的WPF异常被吞了?

当我在事件处理程序中抛出异常时,异常处理程序没有被调用?

从以下开始的精简示例的示例代码:

应用程序.xaml

<Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml"
             DispatcherUnhandledException="App_DispatcherUnhandledException" >
    <Application.Resources/>
</Application>
Run Code Online (Sandbox Code Playgroud)

应用程序.xaml.cs

using System.Windows;
using System.Windows.Threading;

namespace WpfApplication1
{
    public partial class App : Application
    {
        //This method is called when ButtonA is clicked, but not when ButtonB is
        //clicked (and a (random) file is selected ofcourse).
        void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message, "An exception occurred", MessageBoxButton.OK, MessageBoxImage.Error);
            e.Handled = true;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

主窗口.xaml

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Button Content="Button A" HorizontalAlignment="Left" Margin="10,10,0,0" …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf xaml exception-handling

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

在字节数组中以UTF8 XML文档编码ASCII字符串

我有一些以下要求:

... 文档必须以UTF-8编码... Lastname字段仅允许(扩展)ASCII ... City仅允许ISOLatin1 ...消息必须作为IBytesMessage放在(IBM Websphere)MessageQueue上

为简单起见,XML文档看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<foo>
  <lastname>John ÐØë</lastname>
  <city>John ÐØë</city>
  <other>UTF-8 string</other>
</foo>
Run Code Online (Sandbox Code Playgroud)

"ÐØë"部分分别是(或应该是)ASCII值 208,216,235 .

我也有一个对象:

public class foo {
  public string lastname { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

所以我实例化一个对象并设置姓氏:

var x = new foo() { lastname = "John ÐØë", city = "John ÐØë" };
Run Code Online (Sandbox Code Playgroud)

现在,这是我的头痛设置(或开始,如果你会... ...):

  • Visual Studio /源代码采用Unicode格式
  • 因此:Object具有Unicode姓氏
  • XML Serializer使用UTF-8对文档进行编码
  • 姓氏应仅包含(扩展)ASCII字符; …

c# encoding ascii utf-8

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

如何存储汇编 68K CCR 的进位位?

我确实在手册中找到了 MOVE from CCR 指令... http://www.freescale.com/files/archives/doc/ref_manual/M68000PRM.pdf

但我不断收到“无效寻址模式”错误。我尝试了不同形式的语法,无论如何我只想存储进位位,而不是整个 CCR。这些都是我尝试过的语法,但没有成功。它非常明确地指出大小必须是单词。

MOVE.W CCR,D6
MOVE.W CCR,CARRY
MOVE   CCR,D6
MOVE   CCR,CARRY
MOVE.B CCR,D6
MOVE.B CCR,CARRY
Run Code Online (Sandbox Code Playgroud)

没什么。我究竟做错了什么?有没有更好的方法来专门存储进位位(C)?

assembly 68000 ccr

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

MySQL - LEFT JOIN并从表中选择行而不是另一个

好的,所以这里有一个现有的查询我做了我需要的.

SELECT C1.id AS id, C1.title AS title, C1.instructor_id AS instructor_id, 
  C1.description AS description, C1.date AS date, C1.starttime AS starttime, 
  C1.endtime AS endtime, C1.training_id AS training_id, C2.name AS name, 
  C2.id AS instructors_id 
FROM trainings C1 
LEFT JOIN instructors C2 ON C1.instructor_id = C2.id
Run Code Online (Sandbox Code Playgroud)

但是,我需要添加一些东西.除了我所拥有的,我还需要比较两个表.

表'培训'有一个培训课程列表,用'id'索引.我还有另一个表"注册",其中包含用户注册哪些培训课程有3列的信息:'id' - 索引,'user_id' - 注册培训的用户的ID,以及'course_id' - 培训课程的ID.

除了我现有的查询之外,我还需要做的是,仅选择那个用户已经没有"注册"行的培训课程.

我希望这是有道理的.感谢谁能提供帮助.我试了几个小时.查询对我来说太大了,无法保持井井有条,并且正确地思考如何做到这一点.

mysql select compare join

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

在ConfigureServices中使用DI?

我已经实现了一个自定义的InputFormatter(MyInputFormatter):

public class MyInputFormatter : SystemTextJsonInputFormatter
{
    private readonly IMyDepenency _mydependency;

    public CustomInputFormatter(
        JsonOptions options, 
        ILogger<SystemTextJsonInputFormatter> logger, 
        IMyDependency myDependency
     ) : base(options, logger)
    {
        _mydependency = myDependency ?? throw new ArgumentNullException(nameof(myDependency));
    }

    public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
    {
        //...
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,根据文档我需要按如下方式使用它:

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllers(options =>
    {
        options.InputFormatters.Insert(0, new MyInputFormatter(...));
    });
}
Run Code Online (Sandbox Code Playgroud)

但是,正如您所看到的,我CustomInputFormatter需要一些构造函数参数并且需要一些服务,但我不清楚如何使用 DI 来解析这些服务。我已经阅读了很多像这样的答案/博客/页面,但是输入格式化程序没有任何构造函数参数(因此不需要 DI,只需内联新建一个新实例)或者建议以下内容:

public void ConfigureServices(IServiceCollection services)
{
    var sp = services.BuildServiceProvider();
    services.AddControllers(options =>
    { …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection .net-core asp.net-core-webapi

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

PHP中奇怪的闭包行为

在JavaScript中给出此代码:

function getFunc(){
    var myVar = 1;
    function inc(var1) {
        myVar = myVar + 1;
        return var1 + myVar;
    }
    return inc;
}
var inc = getFunc();
console.log(inc(5));
console.log(inc(6));
Run Code Online (Sandbox Code Playgroud)

如果您在浏览器控制台中运行此代码,则会为您提供7和9.我在C#中编写了相同的代码,它给了我相同的结果:

static void Main(string[] args)
{
    var inc = GetAFunc();
    Console.WriteLine(inc(5));
    Console.WriteLine(inc(6));

    Console.ReadKey();
}

public static Func<int, int> GetAFunc()
{
    var myVar = 1;
    Func<int, int> inc = delegate(int var1)
    {
        myVar = myVar + 1;
        return var1 + myVar;
    };
    return inc;
}
Run Code Online (Sandbox Code Playgroud)

但为什么不在PHP中给出相同的结果呢?

function getFunc() {
    $myVar = 1; …
Run Code Online (Sandbox Code Playgroud)

php closures scope

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