小编Gop*_*opi的帖子

使用带分页和排序的ajax动态地将行添加到datatable

我正在尝试实现https://almsaeedstudio.com/themes/AdminLTE/pages/tables/data.html - "具有完整功能的数据表"

当我静态添加tbody时,分页和排序工作正常但是当我使用下面给出的jquery添加tbody时,会添加行但是分页和排序失败.

HTML

<table id="tblItems">
    <thead>
        <tr>
            <th>code</th>
            <th>Name</th>
            <th>Description</th>
            <th>Image</th>
            <th>Parent</th>
            <th>Location</th>
            <th>Category</th>
        </tr>
    </thead>
</table>
Run Code Online (Sandbox Code Playgroud)

jQuery的

$(document).ready(function() {
    $('#tblItems').DataTable({
        "paging": true,
        "lengthChange": false,
        "searching": false,
        "ordering": true,
        "info": true,
        "autoWidth": false,
        "sDom": 'lfrtip'
    });
    $('#tblItems').append('<tbody><tr><td>asdsa34id</td><td> asdsa34id </td><td>asdsa34id </td><td> asdsa34id</td><td>asdsa34id</td><td>asdsa34id</td><td>asdsa34id</td></tr></tbody>');
});
Run Code Online (Sandbox Code Playgroud)

https://jsfiddle.net/techjerk2013/vwpsxhaL/

更新的代码

尽管有来自响应的数据,但更新的代码不会填充表.虽然我将deferRender设置为true,但仍然是数据表为空.

$(document).ready(function() {
    PopulateItemsTable();
    BindTable();
});

function BindTable() {
    $("#tblItems").DataTable({
        "deferRender": true,
        "paging": true,
        "lengthChange": false,
        "searching": false,
        "ordering": true,
        "info": true,
        "autoWidth": false,
        "sDom": 'lfrtip'
    });
}

function PopulateItemsTable() {
    var txt …
Run Code Online (Sandbox Code Playgroud)

jquery pagination datatables twitter-bootstrap

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

删除foreach - c#code-optimization

如何优化此代码?

ParentDoglist,ChildDoglistis - Ilist.dogListBox - 列表框

foreach (Dog ParentDog in ParentDoglist)
{
 foreach (Dog ChildDog in ChildDoglist)
 {
  if(ParentDog.StatusID==ChildDog.StatusID)
  dogListBox.Items.Add(new ListItem(ParentDog.Name, ParentDog.Key));
 }
}
Run Code Online (Sandbox Code Playgroud)

编辑: ParentDogTypeList,DogTypeList被重命名为ParentDoglist,ChildDoglist,其中两者彼此无关

if(ParentDog.Key==ChildDog.Key)
Run Code Online (Sandbox Code Playgroud)

被改为

if(ParentDog.StatusID==ChildDog.StatusID)
Run Code Online (Sandbox Code Playgroud)

完整故事:

我需要填充一个下拉菜单,这将回应父子关系.有些狗可能没有任何孩子,这将被称为看门狗.而且我还需要显示该特定类别中的狗的数量

DD看起来像

Parent1
  Child11 (10)
  Child12 (12)
Parent2
  Child21 (23)
  Child22 (20)
Leaf1 (20)
Leaf2 (34)
Run Code Online (Sandbox Code Playgroud)

因此,ParentDoglist将带来所有Child和leaf元素以及count和ChildDogList将具有Parent和leaf ID,因此我可以将相应的Child填充到其Parent并直接绑定叶子.

Parent,Child和Leaf Dog将保存在一个表中,并通过statusid进行区分,计数将在另一个表中.

没有父母会有任何计数,只有孩子和叶子才算数

表格架构:

替代文字

c# optimization foreach ilist

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

批量使用消息-RabbitMQ

使用上面的代码,我能够使用不同的路由键来使用多个生产者发送到同一交换机的多个消息,并且能够将每个消息插入数据库。

但这会消耗过多的资源,因为消息将一个接一个地插入到数据库中。所以我决定去批量插入,发现我可以设置BasicQos

在BasicQos中将消息限制设置为10后,我的期望是Console.WriteLine必须写入10条消息,但它没有达到预期。

我的期望是从队列中消耗N个消息,然后进行大容量插入,并在成功发送ACK的情况下进行,否则将没有ACK

这是我使用的代码。

using (var connection = factory.CreateConnection())
{
    using (var channel = connection.CreateModel())
    {
        channel.QueueBind(queue: "queueName", exchange: "exchangeName", routingKey: "Producer_A");
        channel.QueueBind(queue: "queueName", exchange: "exchangeName", routingKey: "Producer_B");

        channel.BasicQos(0, 10, false);

        var consumer = new EventingBasicConsumer(channel);
        channel.BasicConsume(queue: "queueName", noAck: false, consumer: consumer);

        consumer.Received += (model, ea) =>
        {
            try
            {
                var body = ea.Body;
                var message = Encoding.UTF8.GetString(body);

                // Insert into Database

                channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
                Console.WriteLine(" Recevier Ack  " + ea.DeliveryTag);
            }
            catch (Exception e) …
Run Code Online (Sandbox Code Playgroud)

c# message-queue rabbitmq

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

在AddThis中自定义URL

如何访问addthis中生成的URL并在通过电子邮件发送给其他人之前附加查询字符串?

谢谢

addthis

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

如何使用 Ajax 将文件和表单数据一起发布到 MVC 控制器?

我正在尝试使用 jquery Ajax 将文件与其他表单数据一起发布到 MVC 控制器。

jQuery Ajax 调用

function SaveStundent () {
    var formData = new FormData();

    var file = document.getElementById("studImg").files[0];
    formData.append("studImg", file);

    var studentDetails = {
    Name: $('#txtName').val().trim()
    };

    formData.append("studentDetails", studentDetails);

        $.ajax({
        type: "POST",
        url: "@(Url.Action("CreateStudent", "Student"))",          
        data: formData,
        processData: false,
        contentType: false,
            success: function (response) {
            }
        });
}
Run Code Online (Sandbox Code Playgroud)

MVC控制器

[HttpPost]
public ActionResult CreateStudent(Student studentDetails)
{
// ...
}
Run Code Online (Sandbox Code Playgroud)

学生模特

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

虽然我能够在请求中获取文件,但studentDetailsMVC 控制器中的参数始终为空。

c# ajax asp.net-mvc jquery

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

Visual Studio 安装程序缺少选项值:InstallPath - Visual Studio 2019

我安装了带有有效许可证(Visual Studio 订阅)的 Visual Studio 2019 企业版(VS 2019 16.1.4)并且运行良好。

突然间,当我尝试打开一个项目或该项目的任何文件时,我收到以下错误。

在此处输入图片说明

所以我尝试使用 Visual Studio Uninstaller 卸载,当我选择卸载程序时,它会自动更新,当我现在打开卸载程序时,它说

在此处输入图片说明

当我单击“确定”时,它说您还没有安装任何东西,它只有安装 VS 2019 16.2.0 的选项。

即使我尝试安装 VS 2019 16.2.0 ,我也会看到错误

“无法将 Visual Studio 安装到非空目录 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise'。”

请帮助我解决错误。

更新

=====================
12-08-2019 06:31:09 PM
Recoverable
System.AggregateException: One or more errors occurred. ---> System.Runtime.InteropServices.COMException: Element not found. (Exception from HRESULT: 0x80070490)
   at Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration.GetInstanceForCurrentProcess()
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<IsPrereleaseAsync>d__44.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at …
Run Code Online (Sandbox Code Playgroud)

installation corrupt visual-studio visual-studio-2019

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

使用 Microsoft Graph API 创建“活动作为在线会议”或仅在线会议

在特定租户下登录我们系统的任何用户(作为身份验证的身份服务器)都应该能够创建一个在线会议(MS Teams)活动。

我们遵循了使用 Microsoft GraphCreate构建 ASP.NET Core MVC 应用程序并启用事件作为在线会议来创建一个应用程序,该应用程序对组织AD 用户进行身份验证并允许他将事件创建为在线会议。

我们能够成功实施它,并且能够将活动创建为在线会议。

但这里的确切情况是,在我们的 Web 应用程序中通过身份验证的任何用户(不是 AD 用户)都应该能够创建 MS Teams 会议事件并与应该能够加入会议的其他参与者共享。

我不确定如何实现这一目标。

编辑

或者至少我如何创建 onlineMeeting?我尝试使用客户端凭据提供程序如下

IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
    .Create("<<App_Id>>")
    .WithTenantId("<<Tenant_Id>>")
    .WithClientSecret("<<Client_Secret>>")
    .Build();


ClientCredentialProvider authenticationProvider = new ClientCredentialProvider(confidentialClientApplication);

GraphServiceClient graphClient = new GraphServiceClient(authenticationProvider);

var onlineMeeting = new OnlineMeeting
{
    StartDateTime = DateTimeOffset.Parse("2020-01-15T21:30:34.2444915+05:30"),
    EndDateTime = DateTimeOffset.Parse("2020-01-15T22:00:34.2464912+05:30"),
    Subject = "User Token Meeting"
};

var meeting = graphClient.Me.OnlineMeetings
.Request() …
Run Code Online (Sandbox Code Playgroud)

c# microsoft-graph-teams microsoft-graph-api

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

基于堆栈的内存分配

参考Stack Based Memory Allocation,它被表述为“......每个线程都有一个保留的内存区域,称为它的堆栈。当一个函数执行时,它可能会将它的一些状态数据添加到堆栈的顶部;当函数退出时,它负责从堆栈中删除该数据”“……当函数退出时,堆栈上的内存会自动且非常有效地回收”

第一个引用的句子表示当前线程负责,第二个引用的句子表示它自动完成。

问题1:是自动完成还是由当前运行的线程完成?

问题 2:堆栈中的内存释放是如何发生的?

stack garbage-collection memory-management

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

处理您的请求时发生异常.此外,执行自定义错误页面时发生另一个异常

'/'应用程序中的服务器错误.

运行时错误

描述:处理您的请求时发生异常.此外,执行第一个异常的自定义错误页面时发生另一个异常.请求已终止.

上面的错误现在发生在我的PROD上.回收应用程序池可以解决问题,但几天之后,同样的错误再次出现.我确实浏览了这个主题的其他帖子相关,但似乎总是为他们发生这个错误,这对我来说是不一样的.

asp.net iis-7 runtime-error

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

RTMP与HLS对比HDS

我想使用JW播放器在以下平台上传输VOD/Live,但不确定哪种流媒体最适合每个平台

  1. 桌面
  2. iOS版
  3. Android的

我知道RTMP不会在移动设备上播放.

那么我是否需要针对桌面和移动设备的HLS进行RTMP,或者我是否只能在所有3个平台上使用HLS流?

或者还有其他方法来有效地传输VOD/Live吗?

android rtmp jwplayer http-streaming ios

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