标签: directive

gfortran:非法预处理器指令和无效字符/非数字字符编译错误

因此,我尝试使用 NAS 基准测试对特定 MPI 实现进行性能测试。所以我去编译 Fortran 代码,但遇到了障碍。每当我输入此命令进行编译时:

gfortran -O0 -Wall -I/home/stephen/trunk/include -I.  -c ./TestData/common/timers.f
Run Code Online (Sandbox Code Playgroud)

我收到这些编译器错误:

Warning: mpif.h:2: Illegal pdreprocessor directive
Warning: mpif.h:3: Illegal preprocessor directive
Warning: mpif.h:4: Illegal preprocessor directive
Warning: mpif.h:5: Illegal preprocessor directive
Warning: mpif.h:6: Illegal preprocessor directive
Warning: mpif.h:7: Illegal preprocessor directive
Warning: mpif.h:8: Illegal preprocessor directive
Warning: mpif.h:9: Illegal preprocessor directive
Warning: mpif.h:12: Illegal preprocessor directive
Warning: mpif.h:13: Illegal preprocessor directive
Warning: mpif.h:14: Illegal preprocessor directive
Warning: mpif.h:2: Illegal preprocessor directive
Warning: mpif.h:3: Illegal preprocessor directive …
Run Code Online (Sandbox Code Playgroud)

preprocessor fortran compilation directive gfortran

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

Angular 5 - 指令中的生命周期钩子

我是 Angular 5 的新手。
我已经为外部 JS 库创建了指令。
但是在同一个指令中,我将值绑定到属性。

我试图起诉ngAfterViewInit以检测是否所有值都绑定到该属性,然后调用 jQuery 插件。

但是我只找到了组件的生命周期钩子。我可以在指令中使用那些吗?这是一个不错的选择吗?

<div *ngFor="let item of easypiechartOptions"
    [option]="item"
    appEasyPieChart
    [attr.data-percent]="item.percent">
</div>
Run Code Online (Sandbox Code Playgroud)

如果我不使用ngAfterViewInit,那么当我调用 jQuery 插件时,这些值不会被绑定。
如果我使用它,当我调用 jQuery 插件时,属性值就准备好了。

javascript jquery directive angular5

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

编译器生成的汇编文件中的“#APP”是什么意思?

我写了以下代码:

// a.c
#include <stdlib.h>
#include <sys/syscall.h>
#include <unistd.h>

_Noreturn void _start()
{
    register int syscall_num asm ("rax") = __NR_exit;
    register int exit_code   asm ("rdi") = 0;

    // The actual syscall to exit
    asm volatile ("syscall"
        : /* no output Operands */
        : "r" (syscall_num), "r" (exit_code));
}
Run Code Online (Sandbox Code Playgroud)

然后使用clang-7 -Oz -pipe -flto -c a.c并使用llc-7 -filetype=asm a.o将其编译为人类可读的汇编文件a.o.s

    .text
    .file   "a.c"
    .globl  _start                  # -- Begin function _start
    .type   _start,@function
_start:                                 # @_start
    .cfi_startproc
# %bb.0: …
Run Code Online (Sandbox Code Playgroud)

c assembly gcc directive inline-assembly

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

Angular:从另一个指令获取主机上一个指令实例的引用

我的模板:

<div myDirective myOtherDirective>Hello World</div>
Run Code Online (Sandbox Code Playgroud)

我的指令:

@Directive({
    selector: '[myDirective]',
})
export class MyDirective {
  private readonly otherDirective: MyOtherDirective; // How to instantiate this?
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能myOtherDirective从内部获得参考MyDirective

directive angular

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

如何在不更改标记的情况下仅使用相同的指令定位某些元素?

我现在已经研究了几个小时了.

假设我有一个jQuery选择器$('#bottom .downloads .links a').点击.....

如何在Angular指令中执行相同类型的操作?

这是我到目前为止所做的工作,但适用于页面上的所有标签.

angular.module('directives', []).directive('a', function(mongoDB){ //Don't need ['customServices'], it can just be [] to use mongoDB
return {
    restrict : 'E',
    link : function(scope, element, attrs){     
    element.on('click', function(){
        //But this gets called for all links on the page
                //I just want it to be links within the #bottom .downloads .links div
                //I wanted to use a directive instead of ng-click="someMethod()"
    });
}
Run Code Online (Sandbox Code Playgroud)

});

有没有办法将此指令仅针对某个div?我想我可以将限制更改为'C'或'A'并为链接添加属性,但我想知道我是否仍然可以像我目前习惯使用jQuery选择器一样布局前端.

directive angularjs

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

使用宏检查宏名称的预先存在

我编写了一个包含几个包含数十个宏的头文件(.h).在每个宏之前我编写了这个:

#if defined (MACRO_NAME)
#warning "Macro name MACRO_NAME is already in use. Please rename the macro"
#endif
Run Code Online (Sandbox Code Playgroud)

为了提高代码的可读性,有一个宏可以完成所有检查工作,这将是很棒的,但宏内部不允许使用指令.

我想要这样的东西:

#define CHECK_MACRO_NAME(MACRO_NAME) \
    #if defined (MACRO_NAME) \
    #warning "Macro name "MACRO_NAME" is already in use. Please rename the macro" \
    #endif
Run Code Online (Sandbox Code Playgroud)

你知道其他(更好)的方式吗?

c macros directive c-preprocessor

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

添加指令使角度js代码中的控制器未定义

这是我的角度js应用程序与HTML代码

<html>
<head>
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/angular.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        angular.module("demo", []).controller('DemoController', function ($scope) {
            $scope.user = {
                dateOfBirth: new Date(1970, 0, 1)
            }
        });
    </script>
</head>
<body>
    <div ng-app="demo" ng-controller="DemoController">
        Date Of Birth:
        <my-datepicker type="text" ng-model="user.dateOfBirth" />
        <br />
        Current user's date of birth: <span id="dateOfBirthDisplay">{{user.dateOfBirth}}</span>
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

它工作正常.但是当我向它添加一个指令时,它显示错误

Error: Argument 'DemoController' is not a function, got undefined
Run Code Online (Sandbox Code Playgroud)

这是带有指令的完整代码

<html>
<head>
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/angular.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        angular.module("demo", []).controller('DemoController', function ($scope) …
Run Code Online (Sandbox Code Playgroud)

javascript directive angularjs angularjs-directive

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

动态创建ng模式的指令

我正在尝试为input元素创建一个指令,该指令将动态创建一个ng-pattern以检查输入字段中的有效IP地址.我所有这样做的尝试都是完全不成功的.虽然我可以动态修改其他属性,但我无法创建ng-pattern会影响$valid状态的属性.

这是我一直在努力的代码,它看起来应该可以工作,但它对它没有任何作用ng-pattern.

app.directive('ipAddress', function($parse) {
    return {
        link: function(scope, element, attrs) {
            var model = $parse(attrs.ngPattern);
            model.assign(scope, "/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/");
            scope.$apply();
        };
});
Run Code Online (Sandbox Code Playgroud)

指示:

<input ng-model="ip" ip-address required type="text" id="inputIP" placeholder="xxx.xxx.xxx.xxx">
Run Code Online (Sandbox Code Playgroud)

是的,我知道我可以只使用标签指定ng-pattern内联,<input>但重点是我希望能够在代码中动态地执行此操作,并且我希望<input>通过不在那里嵌入一堆正则表达式来保持标签更清晰.

谁能帮帮我吗?谢谢!

directive dynamic angularjs

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

滑板数据不可见

我编写了一个slickgrid指令,但它似乎没有显示数据.

如果我检查chrome中的元素,那么我可以看到我的数据呈现的位置slick-viewportgrid-canvasdiv.

我确实试过resizeCanvas没有效果.

基本上网格行被重新连接但不可见.

我的模态看起来像这样

    <div id="TestModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width: 900px; margin-left: -450px">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">Results</h3>
            </div>
            <div class="modal-body">
             <myGrid
                           rows="results"  //results =  tow way bind to controller
                           columns="columns"  //columns =two way bind to controller
                           width="1100px"
                           height="200px"/>
            </div>
            <div class="modal-footer">
                <button ng-class="dialogButtonClass" data-dismiss="modal" aria-hidden="true">Select</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
            </div>
   </div>
Run Code Online (Sandbox Code Playgroud)

并且codel启动它看起来像这样 $('#TestModal').appendTo("body").modal('show');

然后我按照记录的方式渲染数据

var view= this.grid.getData();
           // To set the entire the …
Run Code Online (Sandbox Code Playgroud)

jquery directive slickgrid angularjs

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

AngularJS指令检测传入的模型属性更改

我有一个隔离范围的指令。我想检测作为父作用域上的变量的属性的更改。

到目前为止,我有以下内容:

var app = angular.module("app", []);


app.controller("ctrl", function($scope, $timeout) {

  $timeout(function() {
    console.log("called");

    $scope.isReady = true;
    $scope.$apply();
  }, 2000);


});

app.directive("car", function($log) {
  return {
    scope: {
      make: "=carMake"
    },
    restrict: 'E',
    template: "<strong ng-bind='make'></strong>",
    link: function(scope, elem, attrs) {

      scope.$watch(attrs.shouldDo, function(value) {
        var val = value || null;
        if (val) {
          $log.info(scope.$eval(attrs.shouldDo));
        }
      }, true);

    }
  }
});
Run Code Online (Sandbox Code Playgroud)

http://fiddle.jshell.net/8Qhuk/

如果我将范围设置为false有效,但是我需要它与隔离范围一起使用。

directive angularjs

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