Message from @DanielKO

Discord ID: 430588487599915008


2018-04-03 00:20:57 UTC  

reporting you to the cyber police for grossly offensive comments about a minority of linux users

2018-04-03 00:21:16 UTC  

expect UK police at your doorstep at 2am 😃

2018-04-03 00:25:07 UTC  

I have butter knives and I know how to use them. There will be casualties!

2018-04-03 00:26:01 UTC  

this will require at least 30 police officers

2018-04-03 00:26:47 UTC  

our police are a joke

2018-04-03 02:16:43 UTC  

@meratrix Confirming that ddd works on the rpi. Qemu is making it crash via SSH though.

https://cdn.discordapp.com/attachments/423219052849397773/430551191769055234/ddd-on-rpi.png

2018-04-03 02:17:09 UTC  

gdb is crashing, that is.

2018-04-03 02:17:14 UTC  

Even on the console.

2018-04-03 02:17:36 UTC  

yeah, I installed it and used it, I’ve used it previously on lab machines.

2018-04-03 02:18:11 UTC  

I’m just glad it works.

2018-04-03 02:18:35 UTC  

Time to study for my calc 3 exam tomorrow, ooooooh wee

2018-04-03 04:31:45 UTC  

JS IS SO FUCKING DUMB

2018-04-03 04:31:49 UTC  

holy shit

2018-04-03 04:32:09 UTC  

```js
async function populateImageInformation(productRecord) {
let imageInfo = [];
for(let uploadId of productRecord.images) {
let imageData = await File.getByUploadId(uploadId);
imageInfo.push(imageData);
}
productRecord.images = imageInfo;

console.log(require('util').inspect(productRecord))

return productRecord;
}
```

2018-04-03 04:32:29 UTC  

why the fuck is the output so dumb

2018-04-03 04:33:17 UTC  

```
[{"_id":"5ac2952b7619a334903bccd7","name":"test product","stockCode":"XD69","price":"30","__v":0,"updatedAt":"2018-04-02T20:40:11.902Z","createdAt":"2018-04-02T20:40:11.898Z",

"images":
["{ _id: 5ac295257619a334903bccd6,\n uploadId: 'b6788f4788d9f131475aa04b61f5e29c',\n name: 'stainless-steel-bg-3.jpg',\n type: 'image/jpeg',\n size: 1021415,\n uploader: 5a84547d95a6728d64dcca41,\n __v: 0,\n updatedAt: 2018-04-02T20:40:05.022Z,\n createdAt: 2018-04-02T20:40:05.013Z,\n staffOnly: false }"]

,"description":"this is a test xd"}]```

2018-04-03 04:35:17 UTC  

the images property is an array of string versions of an object, not JSON, not valid objects, just human readable strings complete with whitespace

2018-04-03 04:44:43 UTC  

lol

2018-04-03 04:44:49 UTC  

>JS IS SO FUCKING DUMB

2018-04-03 04:44:55 UTC  

Free strings, dude.

2018-04-03 04:44:59 UTC  

no need to repeat it twice my dude

2018-04-03 04:50:51 UTC  

In this case, the blame is on whoever created that File class, no?

2018-04-03 04:51:23 UTC  

It's return a stringified JSON.

2018-04-03 05:16:21 UTC  

File is a `mongoose` schematic object, basically it is a class that abstracts a connection to a MongoDB collection

2018-04-03 05:16:48 UTC  

so it usually makes it easy to get records from the database

2018-04-03 05:17:03 UTC  

in this case it finds the one record with a specified ID

2018-04-03 05:17:18 UTC  

the data is returned and, when tested is an object

2018-04-03 05:17:39 UTC  

but for some reason when I push it to an array it goes ape shit and becomes a human readable string

2018-04-03 05:19:02 UTC  

the function takes a product record, then iterates the list of image upload IDs then loads info for each one. then it is supposed to replace that array with the list of file information records

2018-04-03 05:19:22 UTC  

I cannot for the life of me figure out why this fucks with the objects

2018-04-03 05:25:12 UTC  

A class that retrieves data from a database, called `File`?

2018-04-03 05:25:14 UTC  

Holy crap.

2018-04-03 05:25:46 UTC  

```js
getByUploadId: function(uploadId) {
return this.findOne({
uploadId
});
},
```

2018-04-03 05:26:12 UTC  

Now you check `findOne()`.

2018-04-03 05:26:33 UTC  

no it returns an object

2018-04-03 05:26:57 UTC  

and `typeof imageData` was === 'object

2018-04-03 05:29:22 UTC  

literally going bald from the amount of hair I am tearing out over here

2018-04-03 05:29:38 UTC  

What happens if you replace
```js
imageInfo.push(imageData);
```
by
```js
imageInfo = [imageData];
```

2018-04-03 05:29:50 UTC  

wut

2018-04-03 05:30:20 UTC  

in this case there could be multiple files...