小编Pab*_*ada的帖子

Rechart 响应式容器不呈现

我正在尝试使用 reChart 渲染一个条形图以使其容器 100% 适合:

http://recharts.org/#/en-US/api/ResponsiveContainer

 <div className="question">
    <div className="question-container">
        <ResponsiveContainer width="100%" height="100%">
            <BarChart   layout="vertical" data={rows}
                      margin={{top: 5, right: 30, left: 20, bottom: 5}}>

                <YAxis axisLine={false} tickLine={false} width={400} dataKey="name" type="category">
                </YAxis>
                <Bar dataKey="valuePre" fill="#00a0dc" label={<Text scaleToFit={true} verticalAnchor="middle" />}/>
                <Bar dataKey="valuePost" fill="#c7c7c7"  label={<Text verticalAnchor="middle" />}/>

            </BarChart>
        </ResponsiveContainer>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

当我添加 ResponsiveContainer 组件时,数据停止呈现。而且只要我取出 ResponsiveContainer 并设置 BarChart 组件的宽度和高度,我就可以再次看到条形图。

谁能帮我找出我做错了什么?

这是一个解决问题的方法:

http://jsfiddle.net/eyh80eeo/

javascript css reactjs

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

使用GNU C内联汇编在VGA内存中绘制字符

我正在学习用DOS和内联汇编在DOS下做一些低级VGA编程.现在我正在尝试创建一个在屏幕上打印出一个角色的功能.

这是我的代码:

//This is the characters BITMAPS
uint8_t characters[464] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x50,
  0x50,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0x50,0xf8,0x50,0x00,0x20,0xf8,0xa0,
  0xf8,0x28,0xf8,0x00,0xc8,0xd0,0x20,0x20,0x58,0x98,0x00,0x40,0xa0,0x40,0xa8,0x90,
  0x68,0x00,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x20,0x40,0x40,0x40,0x40,0x20,0x00,
  0x20,0x10,0x10,0x10,0x10,0x20,0x00,0x50,0x20,0xf8,0x20,0x50,0x00,0x00,0x20,0x20,
  0xf8,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x60,0x20,0x40,0x00,0x00,0x00,0xf8,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x08,0x10,0x20,0x40,0x80,
  0x00,0x70,0x88,0x98,0xa8,0xc8,0x70,0x00,0x20,0x60,0x20,0x20,0x20,0x70,0x00,0x70,
  0x88,0x08,0x70,0x80,0xf8,0x00,0xf8,0x10,0x30,0x08,0x88,0x70,0x00,0x20,0x40,0x90,
  0x90,0xf8,0x10,0x00,0xf8,0x80,0xf0,0x08,0x88,0x70,0x00,0x70,0x80,0xf0,0x88,0x88,
  0x70,0x00,0xf8,0x08,0x10,0x20,0x20,0x20,0x00,0x70,0x88,0x70,0x88,0x88,0x70,0x00,
  0x70,0x88,0x88,0x78,0x08,0x70,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x30,0x30,
  0x00,0x30,0x10,0x20,0x00,0x00,0x10,0x20,0x40,0x20,0x10,0x00,0x00,0xf8,0x00,0xf8,
  0x00,0x00,0x00,0x00,0x20,0x10,0x08,0x10,0x20,0x00,0x70,0x88,0x10,0x20,0x00,0x20,
  0x00,0x70,0x90,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x00,0xf0,
  0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x88,0x70,0x00,0xe0,0x90,0x88,
  0x88,0x90,0xe0,0x00,0xf8,0x80,0xf0,0x80,0x80,0xf8,0x00,0xf8,0x80,0xf0,0x80,0x80,
  0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x70,0x00,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,
  0x70,0x20,0x20,0x20,0x20,0x70,0x00,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x90,0xa0,
  0xc0,0xa0,0x90,0x88,0x00,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,
  0x88,0x88,0x00,0x88,0xc8,0xa8,0x98,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x70,
  0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x70,0x88,0x88,0xa8,0x98,0x70,0x00,0xf0,
  0x88,0x88,0xf0,0x90,0x88,0x00,0x70,0x80,0x70,0x08,0x88,0x70,0x00,0xf8,0x20,0x20,
  0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x88,0x88,0x88,0x88,0x50,
  0x20,0x00,0x88,0x88,0x88,0xa8,0xa8,0x50,0x00,0x88,0x50,0x20,0x20,0x50,0x88,0x00,
  0x88,0x50,0x20,0x20,0x20,0x20,0x00,0xf8,0x10,0x20,0x40,0x80,0xf8,0x00,0x60,0x40,
  0x40,0x40,0x40,0x60,0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x30,0x10,0x10,0x10,
  0x10,0x30,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,
  0x00,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8};
/**************************************************************************
 *  put_char                                                              *
 *     Print char                                                         *
 **************************************************************************/
void put_char(int x ,int y,int ascii_char ,byte color){

    __asm__(
        "push %si\n\t"
        "push %di\n\t"
        "push %cx\n\t"
        "mov color,%dl\n\t"   //test color
        "mov ascii_char,%al\n\t"  //test char
        "sub $32,%al\n\t"
        "mov $7,%ah\n\t"
        "mul %ah\n\t"
        "lea $characters,%si\n\t" …
Run Code Online (Sandbox Code Playgroud)

c x86 gcc dos djgpp

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

在Pycharm上配置现有的Django项目

我开始在Pycharm IDE中使用Django并成功配置了我的第一个项目.

但是,我尝试向Pycharm添加一个新的现有项目,当我尝试更改Run Configuration以使用我的secondProject(GuatepediaLocal)的manage.py时,我没有选择在下拉菜单中选择它.当我尝试运行该项目时,它会继续运行PollSite manage.py runserver而不是GuatepediaLocal的manage.py runserver

任何人都可以帮我解决这个问题并在pycharm上配置已经存在的Django项目吗?

在此输入图像描述

python django pycharm

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

无法通过docker容器执行ansible playbook

我在docker容器内的jenkins上执行管道.此管道调用另一个执行ansible playbook的docker-compose文件.执行playbook的服务称为agent,定义如下:

agent:
  image: pjestrada/ansible
  links:
    - db
  environment:
    PROBE_HOST: "db"
    PROBE_PORT: "3306"
  command: ["probe.yml"]
Run Code Online (Sandbox Code Playgroud)

这是它使用的图像:

FROM ubuntu:trusty
MAINTAINER Pablo Estrada <pjestradac@gmail.com>

# Prevent dpkg errors
ENV TERM=x-term-256color


RUN sed -i "s/http:\/\/archive./http:\/\/nz.archive./g" /etc/apt/sources.list


#Install ansible

RUN apt-get update -qy && \
    apt-get install -qy software-properties-common && \
    apt-add-repository -y ppa:ansible/ansible && \
    apt-get update -qy && \
    apt-get install -qy ansible

# Copy baked in playbooks

COPY ansible /ansible

# Add voulme for Ansible Playbooks
Volume /ansible
WORKDIR /ansible
RUN …
Run Code Online (Sandbox Code Playgroud)

jenkins docker

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

pyAudioAnalysis 库错误:无法将大小为 4400 的数组重塑为形状 (220,10)

我正在尝试提取 wav 文件的一些特征,我有这个:

https://s3-us-west-2.amazonaws.com/music-emotions/ambient/13+Clock+in+the+Morning+-+Waiters+the++Free+Music+Archive+(无+版权+音乐) .wav

我正在使用 pyAudioAnalysis 库的特征提取工具:

https://github.com/tyiannak/pyAudioAnalysis/wiki/3.-特征提取

问题是我遇到了reshape()numpy 函数的错误。我遵循 wiki 中如何使用特征提取器的指南,如下所示:

[Fs, x] = audioBasicIO.readAudioFile('13 Clock in the Morning - Waiters the  Free Music Archive (No Copyright Music).wav')
F = audioFeatureExtraction.stFeatureExtraction(x, Fs, 0.050 * Fs, 0.025 * Fs)
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

      1 [Fs, x] = audioBasicIO.readAudioFile("song-wavs/"+song.name)
----> 2 F = audioFeatureExtraction.stFeatureExtraction(x, Fs, 0.050 * Fs, 0.025 * Fs)

pyAudioAnalysis/audioFeatureExtraction.pyc in stFeatureExtraction(signal, Fs, Win, Step)
    575         curFV[0] = stZCR(x)                              # zero crossing rate
    576         curFV[1] = stEnergy(x)                           # short-term …
Run Code Online (Sandbox Code Playgroud)

python audio numpy pyaudioanalysis

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

如何通过LoopBack JS中包含的模型属性进行排序

我有一个人模型,它与会议模型有一个belongsTo关系.我在做查询

Person.find({include:['meetings']})
Run Code Online (Sandbox Code Playgroud)

这给了我一个像这样的结果:

    person:{
        name:"person 1",
        age: 15
        meeting:{
            name: "The meeting",
            date:"June 26, 2019 11:13:00"
        }
    }
Run Code Online (Sandbox Code Playgroud)

我想要做的是在会议日期之前订购查找功能的结果.有什么方法可以在单个查询中实现这一点吗?

我试过这个:

Person.find({include:['meeting'],order:"meeting.date DESC"})
Run Code Online (Sandbox Code Playgroud)

但是在尝试这个时服务器崩溃了.谁能帮我实现这个目标?

javascript node.js loopbackjs

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

Angular-Chart 无法读取未定义的属性“跳过”

我在 angular-chart 上有以下图表:

<canvas id="line" class="chart chart-line" chart-data="data"  chart-colors="colors"
        chart-series="series" chart-options="options">
</canvas>
Run Code Online (Sandbox Code Playgroud)

使用此选项:

$scope.options = {
  type:'line',
  tooltips: {
    enabled: false
  },
  showTooltips: false,
  hover: {mode: null},
  scales: {
    xAxes: [{
      type:"time"
    }]
  }
};
Run Code Online (Sandbox Code Playgroud)

我通过这样的 websocket 更新数据:

channel.on("create:entry", function (msg) {
  // Before updating the data, set the new time to the current time
  $log.log("received entry");
  $log.log(msg);
  // Refetch the data points
  $scope.data[0].push(
    {
      x: new Date(),
      y: msg.sonnar
    });
  vm.current = msg.sonnar;
  vm.logEntries.splice(0, 0, {time: moment(new Date()).format("MMMM Do …
Run Code Online (Sandbox Code Playgroud)

javascript charts angularjs

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

更改单选按钮的值时出现 ReduxForm 错误

我使用 reduxform 生成一个调查,其中包括一些单选按钮问题。问题是,每当我更改单选按钮的值时,都会收到此错误:

Uncaught Error: Must access array elements with a number, not "undefined".
    at deleteInWithPath (deleteIn.js:21)
    at deleteInWithPath (deleteIn.js:35)
    at deleteIn (deleteIn.js:61)
    at createReducer.js:233
    at reducer (createReducer.js:548)
    at createReducer.js:566
    at combination (combineReducers.js:120)
    at autoRehydrate.js:30
    at computeNextEntry (<anonymous>:2:27469)
    at recomputeStates (<anonymous>:2:27769)
Run Code Online (Sandbox Code Playgroud)

我不知道是什么导致了错误,所以任何帮助发现它的人都将不胜感激。

这是呈现单选按钮的组件。

export const QuestionYesNo=({question,valueQuestion,metaData})=>{
  let error=null;

  if(metaData!==undefined){
    if(metaData[question.id]!==undefined){
      if((valueQuestion(question.id)===undefined ||valueQuestion(question.id)==='') && metaData[question.id].touched===true){
        error=<h4 style={{color:'red'}}>¡Required!</h4>
      }
    }
  }
  return(
    <div>
      <div className="question">
        <div><h3>{question.ordinal+"- "+question.name}</h3></div>
        <div>
          <label>
            <Field
              name={""+question.id}
              component="input"
              type="radio"
              value="YES"
            />{' '}
            Si
          </label>
          <label>
            <Field
              name={""+question.id}
              component="input" …
Run Code Online (Sandbox Code Playgroud)

redux-form

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

Mapbox GL Js:添加和删除GeoJSON源和图层

我在添加和删除mapbox gl中的图层时遇到问题。

我有这层:

   map.addLayer({
        "id": "route",
        "type": "line",
        "source": {
            "type": "geojson",
            "data": {
                "type": "Feature",
                "properties": {},
                "geometry": {
                    "type": "LineString",
                    "coordinates": [
                        [-122.48369693756104, 37.83381888486939],
                        [-122.48348236083984, 37.83317489144141],
                        [-122.48339653015138, 37.83270036637107],
                        [-122.48356819152832, 37.832056363179625],
                        [-122.48404026031496, 37.83114119107971],
                        [-122.48404026031496, 37.83049717427869],
                        [-122.48348236083984, 37.829920943955045],
                        [-122.48356819152832, 37.82954808664175],
                        [-122.48507022857666, 37.82944639795659],
                        [-122.48610019683838, 37.82880236636284],
                        [-122.48695850372314, 37.82931081282506],
                        [-122.48700141906738, 37.83080223556934],
                        [-122.48751640319824, 37.83168351665737],
                        [-122.48803138732912, 37.832158048267786],
                        [-122.48888969421387, 37.83297152392784],
                        [-122.48987674713133, 37.83263257682617],
                        [-122.49043464660643, 37.832937629287755],
                        [-122.49125003814696, 37.832429207817725],
                        [-122.49163627624512, 37.832564787218985],
                        [-122.49223709106445, 37.83337825839438],
                        [-122.49378204345702, 37.83368330777276]
                    ]
                }
            }
        },
        "layout": {
            "line-join": "round",
            "line-cap": "round"
        },
        "paint": {
            "line-color": …
Run Code Online (Sandbox Code Playgroud)

mapbox-gl-js

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

PostgreSQL删除触发器

我在PGAdminIII上创建了一个触发器,我想删除在另一个表上有外键的行.但是我收到一个语法错误,我找不到问题所在:

CREATE TRIGGER clienteDelete
BEFORE DELETE ON cliente
FOR EACH ROW
BEGIN
    DELETE FROM contacto WHERE contacto.id = OLD.contacto_idcontacto;
END;

ERROR:  syntax error at or near "BEGIN"
LINE 4: BEGIN
        ^

********** Error **********

ERROR: syntax error at or near "BEGIN"
SQL state: 42601
Character: 68
Run Code Online (Sandbox Code Playgroud)

我不习惯Postgres上的触发器语法,但这是我根据SQL标准所知道的.任何帮助都会得到很高的评价

postgresql triggers

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