问题列表 - 第13757页

AVR和Arduino有什么区别/关系?

我最近对硬件编程很感兴趣,但我还没有开始.

我做了一些搜索工作,并且有一个模糊的想法:

Arduino是芯片和面包板的组合.

AVR是单芯片,需要购买面包板才能上手.

该陈述是真是假?

hardware avr arduino

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

XSLT转换替换通过文档定期出现的标记

我有一个xml文档,我正在使用xslt转换为xsl-fo文档.我有这个棘手的问题,我一直试图追踪解决方案很长一段时间......

在我的源代码xml中,我有一些散布的标签.我想在结果文档中将这些格式设置为下划线,但是我无法这样做.

我正在尝试使用这样的代码:

<xsl:template match="//em">
  <fo:inline text-decoration="underline">
    <xsl:apply-templates select="*|text()"/>
  </fo:inline>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)

完整的XSLT看起来像这样:

<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
  version="1.0">



  <!-- match em tags -->
  <xsl:template match="//em">
    <fo:inline text-decoration="underline">
      <xsl:apply-templates select="*|text()"/>
    </fo:inline>
  </xsl:template>
  <xsl:template match="//u">
    <fo:inline text-decoration="underline">
      <xsl:apply-templates select="*|text()"/>
    </fo:inline>
  </xsl:template>

  <!-- match b tags -->
  <xsl:template match="//b">
    <fo:inline font-weight="bold">
      <xsl:apply-templates select="*|text()"/>
    </fo:inline>
  </xsl:template>

  <xsl:template match="//br">
    <fo:block><xsl:text>&#xA;</xsl:text></fo:block>
  </xsl:template>

  <xsl:template match="briefs">
    <fo:root>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="Evidence" page-width="8.5in" page-height="11in" margin="1in">
          <fo:region-body margin-bottom=".5in" margin-top=".5in" region-name="xsl-region-body" />
          <fo:region-before extent="1em" region-name="xsl-region-before" />
          <fo:region-after extent="1em" region-name="xsl-region-after" />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <xsl:for-each select="brief"> …
Run Code Online (Sandbox Code Playgroud)

xml xslt xsl-fo

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

使用C++向量而不是C数组的性能损失

使用C++中的标准库中的向量而不是C中的数组会有性能损失吗?

c++ arrays vector std

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

如何在android中启用传感器模拟器?

Intent intent = new Intent(Intent.ACTION_VIEW, 
Hardware.Preferences.CONTENT_URI); 
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

当我给上面的代码启用传感器....他们显示错误.... @ Hardware.Preferences.CONTENT_URI); ...说创建类硬件... PLZ帮助...我是初学者在android ...

android sensor

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

具有非参数模板类型的类构造函数

对于普通的C++函数,可以在参数列表中显示模板参数:

template<typename T>
T default_construct()
{
    return T();
}
Run Code Online (Sandbox Code Playgroud)

并称之为

some_type x = default_construct<some_type>();
Run Code Online (Sandbox Code Playgroud)

即使我使用的类型不在参数列表中,我仍然可以将它传递给函数.现在,我想在类构造函数中执行此操作:

struct Base;

template<typename T>
Base* allocate()
{
    return new T; //Assume T derives from Base...
}

struct factory {
    template<typename T>
    factory()
        : func(allocate<T>)
    {}

    std::tr1::function<Base*()> func;
};
Run Code Online (Sandbox Code Playgroud)

但是当我想构造一个实例时,我找不到一种方法来为构造函数提供参数factory.

有没有办法在将类转换为模板化类或将一些未使用的T对象发送到构造函数的情况下执行此操作?

c++ templates

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

Windows上的符号链接?

有没有人知道从Python的win32版本中创建/读取符号链接的方法?理想情况下,应该有最少量的平台特定代码,因为我需要我的应用程序是跨平台的.

python winapi symlink pywin32

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

让System.Net.Mail从app.settings读取?

在ASP.NET中,我可以将我的mailSettings放在web.config中,然后System.Net.Mail.SmtpClient的默认构造函数将读取它们.在常规的VB.NET项目中,不是ASP.NET,我想我可以将mailSettings放在app.config中.但是,SmtpClient()似乎没有从app.config读取设置.为了告诉VB.NET应用程序从app.config读取,我是否缺少一个步骤?

vb.net

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

如何从凌乱的用户输入中匹配/提取域名?

有一个表单字段,用户以"google.com"的形式输入域名.

但是,考虑到困惑的用户,我希望能够将输入清理为"google.com"的确切形式,以防他们输入以下情况:

http://www.google.com
http://google.com
google.com/blah
www.google.com
..and other incorrect forms
Run Code Online (Sandbox Code Playgroud)

完成此任务的最佳方法是什么?

提前致谢!

ruby regex ruby-on-rails

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

将对象上的事件路由到另一个对象

我希望将目标origTarget上发生的所有事件路由/重定向到另一个对象otherObject.我想完成这样的事情:

/* Magic binding (doesn't work!). */
$(origTarget).bind('*', function(e) {
    $(otherObject).trigger(e);
});
Run Code Online (Sandbox Code Playgroud)

这是否可以使用jQuery而不循环遍历每个可能的事件类型?

这个例子应该以'hello'警告:

var origTarget = { };
var otherObject = { };

/* Do magic binding here. */

$(otherObject).bind('alert', function() {
    alert('hello');
});

$(origTarget).trigger('alert');
Run Code Online (Sandbox Code Playgroud)

javascript jquery events

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

何时在Mac/iPhone上使用CALayer?

我有点困惑何时在iPhone或Mac上使用CALayer以及何时不使用它?CoreAnimation可以在我的基于UIView的对象上正常工作,而无需使用CALayer.何时适合挖掘这门课程?

iphone cocoa cocoa-touch core-animation objective-c

22
推荐指数
2
解决办法
6974
查看次数