Outputting an inner array containing objects ReactJS

I am attempting to output a set of a data from a real-time database into html elements, I have no issues in taking the data from the server and using setState to save the data. I have a custom HTML object from a functional Component that will output props, but I am unable to map the object and the inner objects.

Here is the code responsible for pulling the data from the database:

  componentDidMount() {
    axios.get('./tasks.json')
      .then(response => {
        const fetchedTasks = [];
        for (let key in response.data) {
          fetchedTasks.push({
            ...response.data[key],
            key: key
          });
        }
        this.setState((prevState, props) => {
          return {
            taskList: fetchedTasks
          }
        } )
      })
      .catch(error => console.log(error));
  }

And this is the data I am pulling from the database. I want to be able to display each item, this is from the react devtools log, this is the state of my class component ‘Past.js’ taken from the reactJS devtools tab in chrome.

  taskList:
  Array[3]
  0:
  {…}
  -LMgzJGM78f0BHbPf8cc:
  {…}
  hours:
  0
  id:
  "2018-09-18T14:02:25.022Z"
  minutes:
  0
  name:
  "sadflkjdsalkf"
  seconds:
  2
  start:
  "2018-09-18T14:02:22.508Z"
  -LMgzaEYe0tcCjpxOuPU:
  {…}
  key:
  "09182018"
  1:
  {…}
  2:
  {…}

I have attempted to run nested .map() calls on the state with no luck, mapping the nested item throws ‘array.map is not a function’. This is the code I have so far:

render() {
let outPutItems = [];

if (this.state.loading === false) {
  outPutItems = this.state.taskList.map(array => array.map(item => {
    
  })
)}

return (
  

Past Tasks

{outPutItems}
);

}

All topic

Visualforce tag outputting as text in PDF

Here is the beginning of my visualforce page:


body { font-family: ‘Arial Unicode MS’; }

And this is how it is rendering:
enter image description here

Any assistance would be greatly appreciated. Thank you!

All topic

How to detect if a command block is outputting a redstone comparator signal?

I want to make a pretty much redstone-less contraption, so I want to detect a command block’s NBT data, so that when it gives out a comparator signal, another command block detects that and then does something. Any help?

All topic

SASS partial is outputting a different CSS value

Probably an easy fix, but i just cannot workout why this is happening.

I have a partial called _about-me-section.scss

and in my style.scss it is referenced as @import ‘partials/about-me-section’

I made a change to a div by giving it a width of 60%. I then decided to change the width to 80%. However the output to my CSS file is always 60%, no matter what I type. Even when i delete any css from my scss partial and save it. My outputted css file still state width: 60%.

I’m not sure what to include to help with the answers, so let me know if more info is needed.

Thanks!

All topic

Comparing IP info between two files based on criteria and outputting the results to two different files

I have a file called “knownIP”. This file contain known IP addresses for a group of windows servers. These IP addresses are unique to this group of windows servers.

I have another file called “scanip”. This file contain IP addresses from a vulnerability scanner. These IP addresses are: the IP addresses for the group of windows servers plus other operating systems and network devices mixed in.

I would like to do two things:

  1. Compare the file “knownIP” with the file “scanip” and print out the ip’s that are not exist in the file “knownIP”.
  2. Compare the file “knownIP” with the file “scanip” and print out the ip’s that are only exist in the file “knownIP”.

Here is my syntax:

if diff knownIP scanip > Output;then
  echo The two files are the same
else
  echo The two files are different
fi

All topic

My outputs are not outputting any current at only two of my pinmodes but work fine on the others

My pinMode output 5 and 6 don’t works with this code but will work when they are stand alone.

What is causing the Arduino to not output anything from these outputs within my code?

#include                     // use the software serial library
SoftwareSerial mySerial(3,4); // receive data at pin 3; transmit data at pin 2
int setpoint;
float val;
int roomtemp;
int UCL;
int LCL;

float salinity;
void setup()
{
    // put your setup code here, to run once:
    Serial.begin(9600);
    pinMode(5,OUTPUT);
    pinMode(6,OUTPUT);
    pinMode(3,OUTPUT);
    pinMode(2, OUTPUT);
    roomtemp=25;
    setpoint=7.0291*roomtemp+334.73;
    UCL=setpoint+6.12;
    LCL=setpoint-6.12;
    Serial.print("Setpoint =");
    Serial.print(setpoint);
    Serial.print("Degrees Celsius");
    Serial.print("UCL =");
    Serial.print(UCL);
    Serial.print("Degrees Celsius");
    Serial.print("LCL =");
    Serial.print(LCL);
    Serial.print("Degrees Celsius");
    mySerial.begin(9600);
    delay(500);           // set data rate to 9600 baud; wait for bootup
    mySerial.write(254);
    mySerial.write(128);
    mySerial.write(254);
    mySerial.write(1);    // clear screen & move to top left position
    mySerial.write(254);
    mySerial.write(132);
    mySerial.print("LCL");
    mySerial.write(254);
    mySerial.write(139);
    mySerial.print("SP");
    mySerial.write(254);
    mySerial.write(144);
    mySerial.print("UCL");
    mySerial.write(254);
    mySerial.write(192);
    mySerial.print("S:");
    mySerial.write(254);
    mySerial.write(195);
    mySerial.print(0.072,3);
    mySerial.write(254);
    mySerial.write(201);
    mySerial.print(0.100,3);
    mySerial.write(254);
    mySerial.write(207);
    mySerial.print(0.108,3);
    mySerial.write(254);
    mySerial.write(148);
    mySerial.print("T:");
    mySerial.write(254);
    mySerial.write(152);
    mySerial.print("24.1");
    mySerial.write(254);
    mySerial.write(158);
    mySerial.print("25.0");
    mySerial.write(254);
    mySerial.write(164);
    mySerial.print("25.9");
    mySerial.write(254);
    mySerial.write(212);
    mySerial.write(254);
    mySerial.write(212);
    mySerial.print("S=");
    mySerial.write(254);
    mySerial.write(220);
    mySerial.print("T=");
}

void loop()
{
    Serial.println();
    int val=analogRead(5);
    Serial.print("Analog Value =");
    Serial.print(val);
    Serial.print("Temperature =");
    Serial.println((0.14227*val)-47.621);

    if(valUCL) { digitalWrite(3,LOW); }

    mySerial.write(254);
    mySerial.write(227);

    if(valUCL) { mySerial.write("H=OFF"); }

    digitalWrite(2, HIGH);
    delay(100);
    int analogS=analogRead(4);
    digitalWrite(2, LOW);
    Serial.println(analogS);
    delay(1000);
    salinity = 2.0955*pow(10,-19)*pow(analogS,5.8106)*100.000;
    Serial.print("Salinity =");
    Serial.println(salinity);
    mySerial.write(254);
    mySerial.write(214);
    mySerial.print(salinity);
    mySerial.write(254);
    mySerial.write(222);
    mySerial.print((0.14227*val)-47.621,1);
    Serial.println("analog value");
    Serial.print(analogRead(4));
    float target= (salinity-(salinity-.1)*.60);
    float numer=((((target)*.08585-(salinity)*.08585)/(.1-(.1*.15+salinity*.85)))*60.0);
    float denom= ((.1));
    float valve= ((numer/denom)/10.00);

    if(.096.104) {
        delay(5000);
    }

    if(salinity>.104) {
        Serial.print("Entering DIon Function");
        digitalWrite(6,HIGH);
        delay(valve);
        digitalWrite(6,LOW);
        delay(5000);
    }

    if(salinity<.096) {
        Serial.print("Entering Saltyon Function");
        digitalWrite(5,HIGH);
        delay(valve);
        digitalWrite(5,LOW);
        delay(5000);
    }

    Serial.print("time");
    Serial.println(valve);
}

All topic

Outputting an STL file that contains multiple objects for import into Blender

I want to print a object that looks like a flat board with a set of matchbox-like lumps on top of it.

I have written a script that outputs an STL file. To keep the script simple, it creates an object that includes non-manifold edges. To be precise, the board and the boxes are a single model, but each has 6 faces made from 2 triangles. The underside of each matchbox rests on the top of the larger flat board.

If I understand correctly, the top face of the board should be broken up into many smaller triangles to take into account the position of the matchboxes, but coding this by hand (although it might be an interesting Exercise For The Reader) would not be a good use of time. Well-written code that already does this is built into FOSS applications like Blender.

However, Blender cannot merge or fuse shapes that are part of the same object. My current understanding is that I will need to:

  1. Provide Blender with multiple objects
  2. Select all the objects
  3. Use Ctrl-J to merge them
  4. Export the world in STL format

Is this a valid approach?

If so, my key question is: how do I format the STL file so that Blender will recognize that it contains multiple separate objects?

(I have found references to STL files containing multiple objects, but I have seen nothing in any of the STL files that I have examined that tells me: here is the end of one object and the beginning of another.)

Or should I just be clunky and export two STL files — one for the board and one for all the matchboxes — and then import both into Blender?


NOTE: I know that there are free services like Netfabb that will correct my simple files for me, but I would prefer not to include that in my workflow if possible.

All topic

Outputting a link as a button in node.tpl.php

I am trying to rewrite the output of node.tpl.php.

I am using field link. I cannot figure out how to get the field to render as a button. I did find that the field is output as an array

I tried this but it just makes the link just a link to the page I am on:

">Buy Now

The devel module gives me this info. Keep in mind php is my week area. This is my first time rewriting a node file as I used to have a helper and he has moved on.

field_amazon_link (Array, 1 element)

0 (Array, 5 elements)
    url (String, 142 characters ) https://www.amazon.com/gp/product/B00ZGUBN3C/re...
    title (String, 83 characters ) https://www.amazon.com/gp/product/B00ZGUBN3C/re...
    attributes (Array, 1 element)
    html (Boolean) FALSE
    display_url (String, 83 characters ) https://www.amazon.com/gp/product/B00ZGUBN3C/re... 

And this is from the object devel tool
field_amazon_link (Array, 1 element)

und (Array, 1 element)
    0 (Array, 5 elements)
        url (String, 142 characters ) https://www.amazon.com/gp/product/B00ZGUBN3C/re...
        title (String, 83 characters ) https://www.amazon.com/gp/product/B00ZGUBN3C/re...
        attributes (Array, 1 element)
        html (Boolean) FALSE
        display_url (String, 83 characters ) https://www.amazon.com/gp/product/B00ZGUBN3C/re..

All topic