小编Ale*_*lex的帖子

ORM和持久性框架之间有什么区别?

我正在阅读OOP设计模式和框架设计,发现自己对术语ORMPersistence framework之间的区别不太了解。ORM是PF的一种吗?您可以期望这两种功能有哪些不同?

orm object-persistence

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

ping 大量 IP 地址的最快方法是什么?

我在数据表中有一个很大的 IP 地址列表,我必须如此快速地对它们执行 ping 操作,我使用了以下代码:

public bool PingIP(string IP)
{
    bool result = false;
    try
    {                
        Ping ping = new Ping();
        PingReply pingReply = ping.Send(IP);
        if (pingReply.Status == IPStatus.Success)
            result = true;
    }
    catch
    {
        result = false;
    }
    return result;
}
Run Code Online (Sandbox Code Playgroud)

然后我在 while 循环中调用它:

private void CheckNetworkState()
{
    while (rowindexping > -1)
    {
        if (rowindexping == tbl_ClientInfo.Rows.Count)
        {
            rowindexping = -1;
            return;
        }

        string ip = tbl_ClientInfo.Rows[rowindexping]["clientip"].ToString();
        if (!PingIP(ip))
        {
           do something
        }
        rowindexping++;
        Thread.Sleep(100);
    }
}
Run Code Online (Sandbox Code Playgroud)

因为我想在项目的后台完成这项工作,所以我在线程中调用该类:

threadping …
Run Code Online (Sandbox Code Playgroud)

c# multithreading thread-safety visual-studio-2010 visual-studio

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

为什么 TypeScript 没有缩小这个类型保护中的 any-type 的范围?

下面的例子让我困惑:

class MyClass
{
    public MyProp = "";
}

var object: any = null;

if (object instanceof MyClass)
    console.log(object.MyProp, object.NonExistant); // <-- No error, no intellisense
Run Code Online (Sandbox Code Playgroud)

为什么类型保护没有在检查的上下文中给我正确的类型?

typescript

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

使用C#获取SharePoint 2010中列表项的查找字段值

我是sharepoint的新手,我正在尝试编写一个Web服务来将我们的sharepoint库存数据作为xml返回.除了其中一个列表包含查找字段并且生成的xml包含"Microsoft.SharePoint.Client.FieldLookupValue"而不是查找字段的预期字符串值之外,它的工作正常.

这是我用来生成xml的代码:

resultList = remoteWeb.Lists.GetByTitle("Cam Devices");
context.Load(resultList);
context.ExecuteQuery();
//Now its time to reach list's items
items = resultList.GetItems(new CamlQuery());
context.Load(items);
context.ExecuteQuery();
foreach (ListItem item in items)
{
    rootNode.AppendChild(doc.CreateElement("ID")).InnerText = "pcat:401824";
    rootNode.AppendChild(doc.CreateElement("Category")).InnerText = "Cam Devices";
    rootNode.AppendChild(doc.CreateElement("Kimlik")).InnerText = Convert.ToString(item["ID"]);
    rootNode.AppendChild(doc.CreateElement("Isim")).InnerText = Convert.ToString(item["Location0"]) + " >> " + Convert.ToString(item["Brand"]) + " >> " + Convert.ToString(item["ID"]);
}
Run Code Online (Sandbox Code Playgroud)

item ["Location"]是查找字段,它有一个类型的值FieldLookupValue,如何将查找值作为字符串?

sharepoint-2010

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

这个语法是什么,初始化一个接口,因为它是一个类数组?(新的IItemTransform [0])

在System.Web.Optimization.Bundle中找到新的IItemTransform [0].我试图谷歌搜索有关此语法的任何内容,但由于过于通用的单词的搜索查询而没有成功.

public virtual Bundle IncludeDirectory(string directoryVirtualPath, string searchPattern, bool searchSubdirectories)
    {
      if (ExceptionUtil.IsPureWildcardSearchPattern(searchPattern))
        throw new ArgumentException(OptimizationResources.InvalidWildcardSearchPattern, "searchPattern");
      PatternType patternType = PatternHelper.GetPatternType(searchPattern);
      Exception exception1 = PatternHelper.ValidatePattern(patternType, searchPattern, "virtualPaths");
      if (exception1 != null)
        throw exception1;
      Exception exception2 = this.Items.IncludeDirectory(directoryVirtualPath, searchPattern, patternType, searchSubdirectories, new IItemTransform[0]);
      if (exception2 != null)
        throw exception2;
      else
        return this;
    }
Run Code Online (Sandbox Code Playgroud)

IItemTransform:

namespace System.Web.Optimization
{
  public interface IItemTransform
  {
    string Process(string includedVirtualPath, string input);
  }
}
Run Code Online (Sandbox Code Playgroud)

这种感觉真的不直观,有没有人认识到语法?

c# syntax initialization interface

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

HTML语法高亮显示Sublime 3打字稿

我在Sublime 3中使用TypeScript。如何在模板属性中添加HTML高亮显示:[注意:我已经在使用Microsoft TypeScript Package]

看一下现在没有突出显示的内容:

在此处输入图片说明

html syntax-highlighting typescript sublimetext3

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

Warning on certificate keyUsage

I have created a certificate using MMC console and assigned it to a website. However, when I view the certificate there is a warning icon on the KeyUsage part. You can see this in the below screenshot:

在此输入图像描述

Also, I'm getting error in one of the applications that - KeyUsage does not allow digital signatures.

Why is the Microsoft certificate tool warning on keyUsage? What is wrong with it or what should I do to fix it?

ssl certificate mmc digital-signature

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