有没有命令在emacs中选择整个文件内容?
例如,Control+ a在记事本,Notepad ++等中选择文件的全部内容.
我知道stackoverflow中有很多类似的问题,如下所示:
......还有几十个,我研究过它们.
问题是一些已接受的答案已将MAC地址建议为唯一标识符,这完全不正确.其他一些答案建议使用各种组件的组合,这似乎更合乎逻辑.但是,在使用组合的情况下,应该考虑哪些组件自然不可能经常更换.几天前,我们为软件许可问题开发了一个密钥生成器,我们使用CPUID和MAC的组合来唯一地识别一台Windows PC,直到实际测试我们认为我们的方法已经足够好了.具有讽刺意味的是,当我们进行测试时,我们发现有三台计算机使用我们的密钥生
那么,真的有任何方法可以唯一地识别任何计算机吗?现在我们只需要让我们的密钥生成器在windows pc上运行.使用c#的某种方式(如果可能的话)会很好,因为我们的系统是在.net上开发的.
更新:
很抱歉造成一些混乱和明显错误的警报.我们在检索HW信息的方法中发现了一些不正确之处.主要是我想删除这个问题,因为现在我自己的困惑已经消失,我确实认为两个或更多组件的组合足以识别计算机.然而,然后我决定保留它,因为我认为我应该澄清导致问题的原因,因为同样的事情可能会伤害其他人.
这就是我们正在做的事情(不包括其他代码):
我们使用getManagementInfo
函数来检索MAC和处理器ID
private String getManagementInfo(String StrKey_String, String strIndex)
{
String strHwInfo = null;
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from " + StrKey_String);
foreach (ManagementObject share in searcher.Get())
{
strHwInfo += share[strIndex];
}
}
catch (Exception ex)
{
// show some error message
}
return strHwInfo;
}
Run Code Online (Sandbox Code Playgroud)
然后在需要的地方我们使用该函数来检索MAC地址
string strMAC = getManagementInfo("Win32_NetworkAdapterConfiguration", "MacAddress");
Run Code Online (Sandbox Code Playgroud)
并检索ProcessorID
string strProcessorId = getManagementInfo("Win32_Processor", "ProcessorId");
Run Code Online (Sandbox Code Playgroud)
此时,strMAC …
我们使用以下代码检索Windows PC的活动MAC地址.
private static string macId()
{
return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled");
}
private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
{
string result = "";
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
if (mo[wmiMustBeTrue].ToString() == "True")
{
//Only get the first one
if (result == "")
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
}
}
return result;
}
//Return a hardware identifier
private static string identifier(string …
Run Code Online (Sandbox Code Playgroud) 我读程序员修炼:从中级到主由安德鲁·亨特,大卫·托马斯.当我读到一个叫做正交性的术语时,我在想我正确的做法.我很了解它.然而,在本章的最后,提出了一些问题来衡量对该主题的理解程度.当我试图回答这些问题时,我意识到我并没有完全理解它.所以为了澄清我的理解,我在这里问这些问题.
C++支持多重继承,Java允许类实现多个接口.使用这些设施对正交性有何影响?使用多重继承和多个接口之间的影响是否存在差异?