« first day (2168 days earlier)      last day (3005 days later) » 

@Neal what reason? I see code (sans indentation) and a problem statement.
fs.appendFile('message.txt', 'data to append', (err) => {
@ssube What would be the right way to write it without => ?
@KarmaDoe fs.appendFile(..., function (err) {
If it isn´t asking for much
Thanks
the only time it's tricky is if you use this inside of the arrow function
then you need var self = this; fs.appendFile(..., function (err) { ... self.doStuff; }
18:04
Ill check it out
	var days = [160901, 160902];

	people = results.map(function(e){
		return {
			emp: parseInt(e[0], 10),
			who: e[1],
			timeline: [

				days.forEach(function(x){

					return {day: x}

				});

			]
		};
	});
The forEach inside my timeline array, clearly can't do it like that, how to?
@Waxi map?
	var days = [160901, 160902];

	people = results.map(function(e){
		return {
			emp: parseInt(e[0], 10),
			who: e[1],
			timeline: [

				...days.map(function(x){

					return {day: x}

				});

			]
		};
	});
or remove the [ ] wrapper and then you do not need the spread
Or am I missing something?
Map produced the same error, it doesn't like the semicolon terminating my map function inside that array, but let me remove the [] and see what happens.
user1596138
@Neal Ew
@Waxi lol sorry remove the semicolon
user1596138
18:07
Dat syntax
did not rwalize that was there
I cannot edit that now @Waxi
remove the semi-colon...
user1596138
@Waxi days is not something you need to be inside the original map to access. Do your forEach before the map
Yeah removing it + map worked, but that just leaves me confused. How come you always have the semicolon at the end of the statements, but here you don't ?
user1596138
Then pass it by reference?
timeline: [...days.map wtf?
timeline: days.map(...)
18:09
@Waxi you dont put a semicolon inside of an array or object definition..
you're making and then immediately breaking an array
@ssube lol yep
map is guaranteed to make a copy already, so just use that
@Neal I'll have to remember that!
@ssube Now I know...gracias.
user1596138
@Waxi why would you do that every iteration tho
18:10
var arr = [1;]; // fail!
@Waxi ^
user1596138
Why don't you just save days outside of the loop
user1596138
Or is this an example and the real problem demands it is done each iteration
@Jhawins Not sure I'm following you, but I think it has to be done each time.
Turning my array of arrays into array of objects, and each object needs an array with all these days inside.
user1596138
@Waxi What I mean is days isn't something derived from any property that is only available on each iteration
user1596138
You could make your days object on Line 2..
user1596138
18:14
Instead of making a new identical one for no reason on every iteration.
user1596138
	var days = [160901, 160902];
	days = days.map(x => ({day: x}))

	people = results.map(function(e){
		return {
			emp: parseInt(e[0], 10),
			who: e[1],
			timeline: [days]
		};
	});
user1596138
@Waxi like that
Ahhh that's slick, didn't even think about that, thanks dude.
user1596138
:P
user1596138
You probably don't want the [] wrapping days down in the map tho..
user1596138
18:19
Just was trying to explain quickly'
I'm still getting used to the map function, but dang it's sexy.
Let me write up the issue at hand and maybe you can tell me if my approach is sound...
If you have access to maps (non-native ones preferably), you should split that into 4 mappings where you add a property each time
Each call to map (and reduce, etc) should do one thing, and that one does 4 things
Create object, add emp, add who, and add timeline
Unfortunately I had to change what this thing is doing, so the previous help I had is no longer applicable.
Consider this, jsfiddle.net/44opeesd , above is what I have to work with and below is what my end goal is.
Now, this is how I was gonna do it.
You're trying to create people?
Yeah, that's what I want ultimately, with every day in the days array in the timeline property, and if they had that day in their name with hours, put the hours there.
18:34
@Meredith well that's easy
I can do it, but my approach seems kinda ghetto, let me write what I'm gonna do.
Reduce allRecords from a list to a map
Where the key is ['123', 'Alpha'], and the value is [['160918', 8.0242'], ...]
@ssuube Are yo familiar with Buffers and binary control characters ?
@KarmaDoe slightly
May we mingle for a bit then ?=
18:39
depends on what you mean by "mingle." I'm already seeing someone. :P
if you have a question about buffers, just post it here
someone else has probably used them more than I
I didn't do this right, but I was gonna take this approach...
days.forEach(function(d){

	people.forEach(function(p){

  	p.timeline.forEach(function(t){

    	if (t.day === d.day) {

      		t.labor = // get hours from that person

      }

    });

  });

});
There is this Proxy connected to a relay
The Proxy serves as both, client and server
Yeah that's an abuse of forEach
18:40
> Waxi has been kicked from JavaScript by ssube and cannot return for 1 minute.
lol
user1596138
Lol wtf
Pretty much only use forEach for IO
I love coming back to kicks
on data events the proxy executes data.readUInt16BE(0) and reads the "message length"
the thing is
the relay fucks it up
and i get a message length of for example 12454
Sep 15 at 20:22, by Shog9
just kick first next time, please
18:42
when it should be 78
@rlemon potentially
so whenever on a data event the message differs by a certain natural from data.length
this message is discarted
the thing is, i discard coupled messages
how could i accurately get message length including binary control characters in it
and not crashing the whole thing "trying to read beyond buffer length"
the buffer should accept control characters, so long as it just assumes they're normal data
you can't guarantee a full message each buffer, though
you need nested loops (of sorts)
the realy is suppoused to send full messages
some of them double or triple
for each buffer of data
the buffer will break up the data however it likes (let's say 40 byte chunks, for the sake of example). The messages can be some other length, like 60 bytes. You need to read the data twice, dump one message, read again, dump the next, etc.
@KarmaDoe but the data callback on the buffer doesn't really guarantee any amount of data
it could be low on memory and read one byte at a time or have plenty and read gigs
18:45
i get what you are sayng
so you need to make sure you've gotten a full message before you dump it
which may span multiple data events
so
how do i check i got a propper message ?
if each message is prefaced with the length, it's easy
thats the point
the length comes fucked up sometimes
user1596138
Why does Waxi get kicked so often
18:47
4 mins ago, by ssube
Sep 15 at 20:22, by Shog9
just kick first next time, please
so i get a 70 long message
user1596138
@ssube Yeah, no shit I just read that.
@KarmaDoe what do you mean?
with a heather that says 61535 length
user1596138
That's why I'm asking why.
18:47
Because I'm offensive and old fashioned and this room is cutting edge.
header*
@Jhawins did you read the conversation where Shog said that?
@KarmaDoe those numbers are awfully similar
are you sure your bytes are in the right order?
@Waxi You read my message though right
@Jhawins Because wet wipes are for girls.
forEach is pretty much just for IO
user1596138
18:48
@ssube Yeah he said he was depressed and having a hard time with programming so you guys made fun and banned him is what I saw. I know that's not what actually happened... That's why I'm asking.
that was fast
i cannot guarantee
the bytes are in the right order
ssube has a hotkey
I think it's spacebar
user1596138
Maybe I haven't scrolled up enough
i have been translating it from hex
18:49
@Waxi behave or don't come back please.
2
and getting it in offset (0) of the new Bufeer
to read it
how do I read a single line of text from STDIN?
I don't want to loop!
user1596138
@rlemon He's not doing anything...?
user1596138
I'm so confused. Can someone just give me the context here real quick
@Jhawins read the convo Shog had to get involved in
18:49
I can only seem to find solutions using readline and on('line', ...)
@Jhawins be here more often, he's openly misogynistic and we've told him to keep it to himself a number of times
user1596138
@ssube Apparently I can't find the messages.
there is 0 tolerance for him and sexist comments now.
user1596138
So far I'm 2 hours back from the Shog message you linked and saw nothing :/
@rlemon Check your privileges.
18:50
he got a solid dozen warnings and now prefaces his messages with "so, I'm about to be sexist..."
@KarmaDoe I have, they allow me to kick people
Oh I guess I'm done helping him
wanna try?
@rlemon TRIGGERED
user1596138
I bet the offending message was binned or deleted?
18:51
don't antagonize
@Jhawins lemon flagged a bunch and Shog deleted them, yeah
that's probably why it looks weird
user1596138
Well then yeah, stop telling me to go back and look for the messages that don't exist yeesh lol
Is javascript actually discussed here?
@DCameronMauch when people aren't causing trouble, yes
of course
18:52
Occassionally
we're usually causing trouble, though
someone is atleast
@KarmaDoe that doesn't seem right
you shouldn't need to translate much
user1596138
So Waxi is fair game for flag baiting legitimate flagging?
@Jhawins see it, flag it. He's out of chances.
user1596138
18:52
Cool
What did he say?
@Meredith he tried to argue mental illness wasn't a real thing and people who pretend to have it should "man up"
@ssube From what we've been talking, how do i check if the length of the message is correct?
does he know that schizophrenia has the same mortality rate as breast cancer
user1596138
@Meredith He discredited a minorities disadvantages
18:54
@KarmaDoe well, you need to make sure the input data and output data are the same, first off.
That was brutally long, even at 5 minutes.
Hello! Can I ask for some help with a Webpack problem here?
@rlemon You have no humor sir.
@Meredith probably not, but that's really not an issue anymore.
user1596138
Except in this case being offended by that isn't SJWing... It's hard to figure out what you're allowed to actually care about these days lol
18:54
What isn't?
Shog, mod of the mods, told us to kick.
@Meredith who knows what
Oh ok
@ssube I am limited to work with just the 'data' buffer
And making a pure function
There's a point where you're offensive enough that it doesn't matter whether you're an angry bigot or just an idiot, you can't stay here.
Blah blah blah, we can talk about other things besides me being kicked all the time, it happens and I'm used to it
18:55
@KarmaDoe right, so start by making 100% sure the bytes match
Can anyone help with this single line from STDIN?
I have read that
@ssube That's it, how could i correctly do that ?
@Waxi You're not supposed to get used to breaking the rules.
18:56
@Meredith Yes I read your comment. Still pondering my approach.
I want to read a single line, not repeat over and over
@DCameronMauch what's your code look like and what problem are you running into?
I need to read 1 line, then a completely different 2nd line, then process some stuff, output and exit
not loop over all stdin
I've been doing (readUInt16BE(0) = length + header)
@DCameronMauch then use readline, but change the on('line', ...) callback
user1596138
18:57
@Waxi We'll talk about it as long as we feel like... And it doesn't work that way. Eventually you're going to lose your account, not just get kicked ;). Keep going tho by all means I love to watch
you can always change the callback after the first line
@ssube ? change it to what?
@KendallFrey Point me to the rule where I can't have an opinion on what I believe to be gender specific activities.
that will call the callback for ever line forever
I don't want to do that
18:58
But, coupled messages are like this (/header1/message1/headerN/messageN)
user1596138
inb4 "Waxi has been kicked and cannot rejoin for 10 minutes"
and reading its first offset it gives me just the first message length
user1596138
Sorry I started something, I just wanted to know why this was happening lol
@DCameronMauch so, reader.on('line', cb) attaches a callback for the next line, right? within that callback, you can detach it and use a different one
user1596138
I'll move forward now.
18:58
@Jhawins *30
user1596138
LOL
@KendallFrey + mods, again
@Jhawins what?
user1596138
@KendallFrey That it was 30
I understand, just disappointed that is the only solution. Shouldn't be that hard to read just one freakin line from STDIN
18:59
tl;dr, guys don't like being called girls
@Jhawins I don't get it
@KarmaDoe the first word of the stream might not be right, though
What did you do
user1596138
@KendallFrey It's funny that it was 30min instead of 10...? But I guess it wasn't real
Make fun of men for eating salads?

« first day (2168 days earlier)      last day (3005 days later) »