小编sem*_*d3r的帖子

如何自动执行自制程序安装?

我正在某些Unix机器上部署东西,我需要在没有任何用户提示的情况下安装自制软件。目前,我发现安装home-brew的唯一方法是运行以下ruby脚本:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Run Code Online (Sandbox Code Playgroud)

但这具有用户提示,不能完全自动化。谁能在没有用户提示的情况下建议安装此软件的方法?

ruby unix homebrew

5
推荐指数
2
解决办法
2253
查看次数

如何使用javascript将OLE自动化日期转换为可读格式?

您必须知道.NET方法"DateTime.FromOADate(double d)".我需要在javascript中实现相同的功能.即给出像"40967.6424503935"这样的双倍值,它必须转换为"2/28/2012 3:25:07 PM"有人可以帮帮我吗?

提前致谢!

javascript ole date

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

如何将xsl变量作为参数传递给脚本标记中的javascript函数?

我试过以下代码:

<xsl:variable name="xx" select="'40967.6424503935'"/>
<script type="text/javascript">
   time({$xx});
</script>
Run Code Online (Sandbox Code Playgroud)

我的目的是通过time()中的document.write()显示文本.但它没有给出任何结果.

javascript xslt

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

如何在项目下获取文件夹?

我正在尝试获取其下的项目和文件夹列表.我可以使用以下方式获取项目和项目项目:

DTE2 dte2;
dte2=(DTE2)System.Runtime.InteropServices.Marshal.
GetActiveObject("VisualStudio.DTE.10.0");
Projects projects = dte2.Solution.Projects;
Run Code Online (Sandbox Code Playgroud)

然后,我正在遍历项目项目并获得项目的"种类".但它只显示GUID.我需要知道该项目是否是文件夹.我怎么做?

参考:

var item = projects.GetEnumerator();
while (item.MoveNext())
{
  var project = item.Current as Project;
  for(i=1;i<project.ProjectItems.Count;i++)
  {
     string itemType = project.ProjectItems.Item(i).Kind;
  }
}
Run Code Online (Sandbox Code Playgroud)

编辑:

目前,我正在使用一种解决方法:

string location = project.ProjectItems.Item(i).get_FileNames(1);
if (location.EndsWith(@"\"))
        {
            // It is a folder E.g C:\\Abc\\Xyz\\
        }
Run Code Online (Sandbox Code Playgroud)

c# envdte

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

rdtsc计时器在linux中是不准确的吗?

 __inline__ uint64_t rdtsc() {
    uint32_t low, high;
    __asm__ __volatile__ (
        "xorl %%eax,%%eax \n    cpuid"
        ::: "%rax", "%rbx", "%rcx", "%rdx" );
    __asm__ __volatile__ (
                          "rdtsc" : "=a" (low), "=d" (high));
    return (uint64_t)high << 32 | low;
}
Run Code Online (Sandbox Code Playgroud)

我在程序中使用了上面的rdtsc函数作为计时器:以下代码导致312-344个时钟周期:

 start = rdtsc();
 stop = rdtsc();

 elapsed_ticks = (unsigned)((stop-start));
 printf("\n%u ticks\n",elapsed_ticks);
Run Code Online (Sandbox Code Playgroud)

每次运行上面的代码我都会得到不同的值.这是为什么?

我在Visual C++中运行相同的代码,它在"intrin.h"中使用了rdtsc函数.我得到了18个时钟的恒定值.是的,每次运行都是恒定的!有人可以解释一下吗?谢谢!

c++ linux

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

使用pytest并行运行多个配置的单个测试

我必须并行地对不同的主机运行相同的测试.目前,我正在进行一堆pytest.main()调用.但这不是并行运行的,结果不会聚合.这是runtest.py的内容:

pytest.main('--conf=c1.txt')
pytest.main('--conf=c2.txt')
pytest.main('--conf=c3.txt')
Run Code Online (Sandbox Code Playgroud)

我只有一个test_host.py,它看起来像:

test_pinghost(conf):
    # pings a host in config
Run Code Online (Sandbox Code Playgroud)

有没有办法并行运行并汇总结果?PS:配置文件只包含主机IP

python testing pytest

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

如何将ComObject转换为ENVDTE.Project?

我使用以下代码:

Object projObj = htProjects[selectedNode]; // htProjects is a Hashtable:key-project Name,value-ENVDTE.Project
Project selectedProject = (Project)projObj; 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Run Code Online (Sandbox Code Playgroud)

我尝试注册这里提到的DLLS,但似乎还有其他一些问题.

c# envdte

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

使用XSLT独立插入打开和关闭HTML标记

我习惯了以下变量:

<xsl:variable name="openTag">
<![CDATA[
<div>
]]>
</xsl:variable>

<xsl:variable name="closeTag">
<![CDATA[
</div>
]]>
</xsl:variable>
Run Code Online (Sandbox Code Playgroud)

并按以下方式实施:

<div class="root">
      <xsl:variable name="ownerid" select="Prp[@name='owner id']/@value" />
      <xsl:variable name="nextownerid" select="preceding-sibling::Node[1]/Prp[@name='owner id']/@value"/>

      <xsl:choose>
        <xsl:when test="$ownerid = '-1'">
          <xsl:copy-of select="$LogText"/>
        </xsl:when>
        <xsl:when test="$ownerid &lt; $nextownerid">
          <xsl:copy-of select="$openTag"/>
          <xsl:copy-of select="$LogText"/>
        </xsl:when>

        <xsl:when test="$ownerid &gt; $nextownerid">
          <xsl:copy-of select="$openTag"/>
          <xsl:copy-of select="$LogText"/>
          <xsl:copy-of select="$closeTag"/>
          <xsl:copy-of select="$closeTag"/>
        </xsl:when>

        <xsl:otherwise>
          <xsl:copy-of select="$openTag"/>
          <xsl:copy-of select="$LogText"/>
          <xsl:copy-of select="$closeTag"/>
        </xsl:otherwise>
      </xsl:choose>
    </div>
Run Code Online (Sandbox Code Playgroud)

问题是div标签作为文本输出而不被识别为HTML标签.有没有解决方法?

html tags xslt variables

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

对于带有属性的标签,在 document.write 中使用的正确语法是什么?

我在 JavaScript 的document.write方法中使用以下代码:

<script type="text/javascript">
    document.write("<font color="blue">["+time()+"]</font>");
</script>
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用。我该如何修复它?

javascript document.write

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

标签 统计

javascript ×3

c# ×2

envdte ×2

xslt ×2

c++ ×1

date ×1

document.write ×1

homebrew ×1

html ×1

linux ×1

ole ×1

pytest ×1

python ×1

ruby ×1

tags ×1

testing ×1

unix ×1

variables ×1