小编nvc*_*emp的帖子

如何在make clean上使用通配符时修复Makefile语法错误?

我有一个简单的Makefile只包含这个目标.它看起来像这样:

SHELL:=/bin/bash

clean:
    rm !(*.tex|Makefile|*.pdf)
Run Code Online (Sandbox Code Playgroud)

当我在bash中运行此命令时它工作正常,即它没有给出任何错误,它删除了所需的文件.但是当我运行make clean它时会出现以下错误:

$ make clean
rm !(*.tex|Makefile|*.pdf)
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `rm !(*.tex|Makefile|*.pdf)'
make: *** [clean] Error 1
Run Code Online (Sandbox Code Playgroud)

有谁知道我做错了什么?谢谢.

bash shell makefile wildcard

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

在python中访问父命名空间

def c():
    def a():
        print dir()

    def b():
        pass

    a()

c()
Run Code Online (Sandbox Code Playgroud)

可能是一个非常简单的问题,但我似乎无法通过谷歌搜索找到答案.我有上面的代码,我想要一个方法来打印包含方法a和b的命名空间,即我希望它打印它所调用的点形式的命名空间.这可能吗?最好是在Python 2.x中

python

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

x范围用于Gnuplot中的非数字数据

运行以下脚本时,收到错误消息:

set terminal postscript enhanced color
set output '| ps2pdf - histogram_categorie.pdf'
set auto x
set key off
set yrange [0:20]
set style fill solid border -1
set boxwidth 5
unset border
unset ytic
set xtics nomirror
plot "categorie.dat" using 1:2 ti col with boxes
Run Code Online (Sandbox Code Playgroud)

我得到的错误消息是

smeik:plots nvcleemp$ gnuplot categorie.gnuplot 

plot "categorie.dat" using 1:2 ti col with boxes
                                            ^
"categorie.gnuplot", line 13: x range is invalid
Run Code Online (Sandbox Code Playgroud)

文件的内容categorie.dat

categorie   aantal
poussin  13
pupil  9
miniem  15
cadet  15
junior …
Run Code Online (Sandbox Code Playgroud)

gnuplot

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

使用C中的fscanf跳过行的剩余部分

我正在阅读一个文件,在读完一个数字后,我想跳过剩下的那一行.这是一个文件的例子

2 This part should be skipped
10 and also this should be skipped
other part of the file
Run Code Online (Sandbox Code Playgroud)

目前我通过使用这个循环来解决这个问题:

char c = '\0';
while(c!='\n') fscanf(f, "%c", &c);
Run Code Online (Sandbox Code Playgroud)

然而,我想知道是否有更好的方法来做到这一点.我尝试了这个,但由于某种原因它不起作用:

fscanf(f, "%*[^\n]%*c");
Run Code Online (Sandbox Code Playgroud)

我原以为这会读到新行的所有内容然后再读新行.我不需要内容,所以我使用*运算符.但是,当我使用此命令时没有任何反应.光标未移动.

c scanf

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

在Polymer元素中设置svg的宽度和高度

这可能只是我正在犯的一些愚蠢的错误,但我无法确定问题的原因.我正在创建一个包含SVG元素的Polymer元素.我已经尝试了几种方法来设置svg元素的宽度和高度,但我所有的努力似乎都被从结果页面中剥离了.我在Chrome和Firefox的最新版本中检查了结果,但是在每个版本中都没有留下任何宽度或高度属性,CSS属性似乎已经消失.svg在两种情况下都是300像素宽和150像素高.

这是svg-test.html:

<link rel="import" href="../polymer/polymer.html">

<dom-module id="svg-test">

  <style>
    svg {
      width: {{width}};
      height: {{height}};
    }
  </style>

  <template>
    <svg width="{{width}}" height="{{height}}"></svg>
  </template>

</dom-module>

<script>

  Polymer({

    is: 'svg-test',

    properties: {
      width: {
        type: Number,
        value: 200
      },
      height: {
        type: Number,
        value: 200
      }
    }

  });

</script>
Run Code Online (Sandbox Code Playgroud)

这是一个测试页面:

<!doctype html>
<html>
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <script src="../webcomponentsjs/webcomponents-lite.js"></script>
  <link rel="import" href="svg-test.html">

</head>
<body>

  <svg-test></svg-test>
  <svg-test width="300" height="15"></svg-test>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是bower.json:

{
  "name": "svg-test",
  "main": "svg-test.html",
  "dependencies": …
Run Code Online (Sandbox Code Playgroud)

svg polymer

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

标签 统计

bash ×1

c ×1

gnuplot ×1

makefile ×1

polymer ×1

python ×1

scanf ×1

shell ×1

svg ×1

wildcard ×1