« first day (2587 days earlier)      last day (2378 days later) » 

2:00 AM
yea, for anything functional I'm printing (mostly) a decent print is all I need
but for fun stuff, I want perfection
 
indeed
i want to experiement with fast functional and fine detailed
 
I need to buy some new fans (mine are loud) and some new nozzles
experiment with larger nozzles
.8 sounds interesting
 
can ours handle that?
 
I think?
 
i want to print a whole bed of tiny parts. like for a wire chain, or something else that assembles
 
2:04 AM
funny
const fd = process.stdout.fd;

function write() {
  fs.write(fd, buf, write);
}

write();
is slower than piping to stdout :|
 
could be
node vs shell
who knows
 
No no
I mean this code is slower than
const out = stream.Readable({
    read(howMany) {
      this.push(buffer);
    }
});

out.pipe(process.stdout);
Shell is in Gbps
node is stuck at 400megs max with the stream code
 
same thing, depends on what it does
maybe it's justified
 
have you done any profiling?
 
it doesn't surprise me that different implementations of writing to stdout perform differently
 
2:10 AM
just at the airport
 
also that seems like a fairly silly thing to do
 
@ssube I am just curious how fast I can get with streams
 
why?
 
@ssube well I ran yes (cat /dev/urandom | base64 | head -c 1500) | pv --rate > /dev/null
It went into gigs / second
so wondering what gives in node because its stuck at ~400 megs / seconds max
 
2:13 AM
I have this "client" object that I initially get from the server, and update/edit
and until now I lazily sent the entire client object back to update it
resulting in around 250 db transactions to change a single value from 2 to 3
at the level of complexity we're at now
what to do?
I'm thinking keep a separate reference to the "last client from server" and diff that with that I'm trying to update to and send that instead
 
getter on each property with a changed state
er, setter
 
no, just keep the snapshot
 
I was half joking. just a thought that popped up
 
but the server should also know if it's stale..
 
what do you mean by stale
 
2:15 AM
the property way isn't invalid, i just like snapshots better
 
unchanged?
 
yeah, why is the server running a bunch of queries when it very easily knows nothing has changed?
 
I dunno
it's django
I mean, I wrote the backend
 
yea. your diff you send back is a diff from when you got the data, but not always a diff from current.
 
but I don't think I did anything suspicious
 
2:16 AM
but if you are just rejecting it if it's from a stale version, then fine
 
I use the update_or_create method everywhere
and the db gets updated even if nothing has changed
 
lol
 
i don't know what that means. this is what library?
 
django
 
> omg, my ORM is doing foolish things again
it's like, the story of ORMs
 
2:17 AM
well
we do use a base model called TimeStampedModel
that django provides
so maybe the behavior is update the timestamp even if other fields haven't changed
 
what type of concurrency model do you use, now?
 
what are my.. options.. :P
 
like "optimistic concurrency"
 
@Mosho I expected it to use fs.write internally, but I was wrong its using native tty-wrap module
 
where you just check a timestamp or version during tyhe update to make sure the update is being performed against the right version
 
2:20 AM
I don't do any of that, it's django
 
i think 'pessemistic' is where you hold a lock..
ok, then... sending a diff back is fine.. no worse than now.
 
I mean
you have locks
 
better, maybe. you change less stale fields.
 
and I use them
but the result is the same
 
in the pessemistic case, you'll be locking the entire time the user is editing, so probably not
unless you manage your own locks above what the db does
but anywho..
 
2:22 AM
I use something called transaction.atomic()
 
those are your transactions
 
sure. why not a diff.. or just sending changed props.. just make sue all consumers of the api know the difference between setting to null and not setting at all
 
it's a wrapper for your django model updates
 
if you call create_or_update everywhere, there are probably no locks
 
the usage is
 
2:23 AM
I would diff on the backend, but meh
 
as would I, but a 'patch' isn't wrong to support.
 
with transaction.atomic():
    model.update_or_create(**kwargs)
 
it sounds like a randomly slapped together django backend
 
or letting screens use the same api but only set some props
 
hey hey
 
2:23 AM
lol
 
if by randomly slapped together you mean I never worked on a backend before
you would be correct
 
that would certainly count
why not let the DBA decide how to handle it?
 
well, you see
I have no idea how to do it
 
You're talking to him
 
yes
 
2:25 AM
I figured :D
 
my boss (and only other programming coworker) is the experience backend guy
 
then, my professional advice, is don't do it. Walk away, find a new job, with a real DBA.
nothing good will come of this
 
what? nah.
 
that's the kind of backend that uses admin/admin and leaks the whole DB
 
most of us got our experience by destroying companies
it's the industry standard
 
2:26 AM
copy pasting django has never ended will
that is true, it is standard
 
can confirm
but
I don't copy paste
I write with love
and google extensively
 
or at least you have a footer template with that emoji in it
 
I don't know what you're talking about
anyway
 
that obnoxious "Made with <3 in Stupid Place by Look At Us We're Special" banner projects have
I want a chrome plugin that replaces it with a rickroll
it would actually be an improvement
 
lol
I was just kidding, I have no love to give
 
2:28 AM
Also intersting outcome of this
while(true){
  fs.writeSync(fd, buf);
}
crashes :D
 
stop abusing your machine
 
@Mosho eh?
 
I need to go clean something after this coversation
 
wait
we're not done
 
that's what you think
and what she said
 
2:30 AM
:(
I would solve it in the BE
but I'm not finding anything relevant googling
 
you already know your solution. you are going to filter out un-changed props either on the client or the server
 
one side needs logic that avoid calling the django DB helpers at all
(it sounds like)
 
that part was solid. some disagreement on where, but we have only some of the deets, so..
 
sure, it gets called when nothing has changed too as a result of the same flaw
 
you might be able to do it in the model, if there's some kind of hasChanged hook, but I have no idea if that's a thing
 
2:33 AM
193
Q: Django: When saving, how can you check if a field has changed?

Paul TarjanIn my model I have : class Alias(MyBaseModel): remote_image = models.URLField(max_length=500, null=True, help_text="A URL that is downloaded and cached for the image. Only used when the alias is made") image = models.ImageField(upload_to='alias', default='alias-default.png', help_text="...

 
is every field its own query?
 
this essentially says to do what we're talking about
@ssube db query? every row is
 
I don't know what a row contains, though
is a row a single field?
an entire object?
 
an object
btw, I don't see how this can be easily and cheaply done in the server
I would save a copy of every row as an object in memory at all times?
or read from the db before writing to it?
 
reading before writing is commonly required for many reasons
1. the check the version/timestamp for concurrency
2. look up the user to make sure you can edit this record
 
2:39 AM
but by diffing in the client I can avoid it
 
diffing on the client helps you avoid setting properties BACK to what they were if you ARE operating on stale data* with no concurrency control.
so.. it might be better for you.. just send a PATCH request with the changed props.
 
it's going to be tricky either way
 
it's reasonable for the client to say "I want to change just the lastname field" even if having the server diff is good for other reasons, so I put my stamp of "good enough" on your solution.
 
hooray
 
is shrek here?
 
2:55 AM
@ShrekOverflow I think she's high.
 
@littlepootis Quite possible
@ssube btw I did profile my code and figured out I have an annoying notch in ping because of GC pauses and secondly I was maxed out to ~30megs/sec
(on my vpn sending and recieving data to & from the same device)
 
const { input: { onChange } } = this.props wat
 
?
 
^ yes that works but please keep it only 1 level
beyond that it just gets confusing
 
Should it work?
 
3:04 AM
why not
I mean, it's unreadable shit
but why not
 
destructuring has a bunch of features you should never use
like nesting and renaming
 
Here's the whole method:
onChange (e) {
    const { input: { onChange } } = this.props
    onChange(e.target.files[0])
  }
 
@ShrekOverflow hi
 
lol
 
3:05 AM
yeah, it's trash
 
IkR?
 
that's so lazy it got longer
 
ninja'd
 
you would even save characters by just this.props.input.onChange
 
or if you are into that sort of thing
 
3:05 AM
maybe it was like
a week after babel came out and everyone was having an es6 hard on
 
doesn't matter. It's from a junior. I was just like.. Errr... what?
 
> rejected: quit being towc
 
onChange({target: { files: [selected]}}) {
    const { props: { input: { onChange }} } = this; // I think this will work too
    onChange(selected)
}
I think that'll work too
 
add some with
 
when you search for how to do stuff in python
 
3:08 AM
I can't :(
 
you eventually (and quickly) run into something like this
[filename for path in dirs for filename in os.listdir(path)]
 
and it's always some fat 100 upvotes answer
 
That indeed is very common
I even heard great stories on how that is good code at Pycon India
 
it isn't bad code
 
3:09 AM
it's horrible and unreadable
 
I agree
but its kinda unreadable
 
I'll take 7 levels of destructuring
over that
no matter how many times I see that
 
I'm fixing all of the linting issues that --fix couldn't reconcile right now. It's been a journey of discovery
 
I always have to read it slowly 5 times
and at least that example has naming that gives you some context
good luck with [x for y in z for x in fml]
and that's a mild example of the comprehensions people come up with
 
now I know what was going on :)
 
3:19 AM
i said hi....
 
sup
i was referring to shrek tho
he cranky maybe
 
hey :3
 
4:23 AM
@littlepootis imminent domain is a wonderful thing.
they think they can kill it, lol wont happen
 
@Loktar read the article, that's kinda the point. They don't want to stop it, they're hiring the best eminent domain lawyers they can find to try delay it till the next president can stop the whole thing
 
yeah good luck I guess
 
they're dropping hints about giving people something if they send in $15
 
taking on one of the nations/worlds top land developer lol
 
people are saying it could be a plan to split ownership of the land amongst thousands of people to make litigation even harder
 
4:28 AM
it's more likely a box of ssomething
probably more cards
 
I don't know if it will work, but it's more complicated than 'eminent domain gg'
 
@david I really don't think it is
 
anyone want me to test ur JS skills?
 
try to tell the US government what they can do with a border.. see what happens I guess
farmers/ranchers have been punished for so much less
it's funny regardless
 
exArray1 = name: ['play', 'skee', 'play', 'run'], values: [1, 2, 3, 4], how do you turn this list into --> name: ['play', 'skee', 'run'], values: [4, 2, 4]
remove 'name' duplicates and sum their values
 
4:32 AM
are you missing some curly boyes
 
Node is weird
 
TIL the most made up position
vice president of people
 
pretty sure people are real
 
lol that's random
@Mosho it's not real
 
what's not real
 
4:34 AM
her
and her position
 
she's the vice president of people at apple
 
l2google
@Mosho sounds like their dumbass way of saying HR
 
yeah
 
she stole biebers haircut:
 
it is more concise, tbf
 
4:36 AM
I also learned their VP of hardware is a christian israeli arab
 
so I'm not entirely against having the VP of People, VP of Servers, etc
 
VP of 'people' in terms of what
it's too broad
 
"Human Resources" is not more specific
 
customer service? customer marketing?
HR?
apple is fkn stupid
one day their reign will be over when people realize their products are overpriced
 
the VP and MD of china works for apple?
interesting
 
4:39 AM
i like this guy ^
 
this guy looks like he knows about something that is really wrong in iphone X but can't tell anyone
 
he convinces me that i should buy an overpriced phone because it's design is good
 
@Mosho yep, that is totally his look.
they also had Al Gore there IIRC
@Traitor iPhones are in no way overpriced
 
and everyone is white
except...
 
lol
 
4:40 AM
Whatevercompany that builds iPhones in china is consider a separate state in china
 
 
omg lol
 
that's so fucked up
like...
 
HAHAHA
 
4:41 AM
@Mosho except the asian lady you posted earlier
 
i hate apple even more now
 
@ssube she's the VP of china
 
poor lady
she cant be an engineer or head of something other than 'diversity' department
 
that is what it says
 
smartphones sucked before the iPhone so I give Apple some credit
 
4:42 AM
I hear BB was pretty great
 
@Mosho dude looks pissed af
 
i liked steve jobs iphone too
 
@William the commercial market for smartphones didn't exist
 
but steve is dead :/
 
@Loktar He is a british designer, who had to design UX for animated poop.
 
4:43 AM
so he has a job, makes what I would assume is decent money, and has randoms talking about him on the internet
he should be happier
 
i think he is
 
unless he's squeezing out inspiration in that pic maybe
that would explain the face
 
this topic is random though
 
Im not sure if it is still true but Angela in charge of marketing at Apple got paid more then Tim Cook
 
dont you have better things to do? 'Mosho'?
 
4:45 AM
nope
how about you?
 
i do :/
i have to figure out how to remove duplicates from array and sum their values
 
@Traitor _.uniq
 
groupBy
 
.unique.sum()?
 
[...new Set(arr)].reduce((a, b) => a + b, 0)
done
 
4:46 AM
Hey, what are the rules to this chat?
 
@BradleyWilliamElko Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
the rules are better than in c#
 
that's the most relevant Cap has ever been
 
i got banned once for starting a conversation about cars
 
@Traitor you've been kicked and banned many times, for many reasons
 
4:47 AM
yeah I applaud your presistence
 
in the JS room for good reasons i think and im reformed
im likable now lol
 
traitor experienced the reformation lol
 
@Traitor not really, you're still constantly pushing it
 
Does anyone know anything about javascript array generators?
 
Trolls gonna troll
 
4:48 AM
rly?
 
@BradleyWilliamElko generators with a *?
 
@Mosho will take a look, thx
@monners im reformed
 
@ssube No generators with ones and zeros.
 
@BradleyWilliamElko are you referring to stackoverflow.com/questions/47299315/… ?
because "generator" is a real thing in JS: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
 
@ssube yes, lul.
 
4:54 AM
if you know it will always be 5x5, start with an empty array (or 2d array)
const maze = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
then it's just a matter of figuring out which blocks are walls, and maze-generating algos exist
 
@ssube This array that I have isn't going to be the actual maze. It is going to be the code behind the array. If there is a 1, then it is a HIGH output or a path.
 
like the kernel for another generator?
 
yes, I think.
 
given your rules, you might have to write a loop that walks through the grid and sets one more bit each time
 
The output is simple. If it's a 1, the div in that spot will be white. If it's a 0, the div in that spot will be a picture of fire. I have the code to do this but I need the rules.
If I did it from each spot in the array, It would take a LONG time.
 
5:02 AM
Your questions appears to have the rules but no code.
What have you written so far?
 
@Mosho hey
you meant like this?
  var EDL = new EventDataList();
                    EDL.eventDataList.push(new EventData("Sleep", 500, 0, [1, 2, 3]));
                    EDL.eventDataList.push(new EventData("WakeUp", 0, 56, [1, 2, 3, 4]));
                    EDL.eventDataList.push(new EventData("WGU", 0, 84, [1, 2, 3, 4, 5]));
                    EDL.eventDataList.push(new EventData("Sleep", 20, 28, [1, 2, 3, 4, 5, 6]));
                    EDL.eventDataList.reduce((a, b) => a + b, 0);
 
Do you want me to post the code here?
or put it in a bin?
 
 
fiddle, gist, bin, whatever
 
@Traitor uh, no
 
5:08 AM
im looking at this too but it's syntax is different than urs
 
@Traitor w3schools is trash
 
that's the rendering code, do you have any code to generate the data?
 
wtf
w3schools has an article on reduce?!
damn that's super surprising actually lol
 
.innerHTML = numbers.reduce :(
 
5:10 AM
yeah
 
LOL
 
it's like they sort of tried but got bored halfway through
 
w3schools just being w3schools
 
@ssube No, but I know how to do some of it.
 
@BradleyWilliamElko well, I would start by declaring a function to generate the kernels, and declare an empty (zeroed) array within that.
You can work out the rules from there
and/or return random data to test
 
so i shouldnt learn from w3schools?
just trying out Mosho's cool reduce function but i dont get it :/
 
4
Q: How to merge duplicates in an array of objects and sum a specific property?

nunoarrudaI have this array of objects: var arr = [ { name: 'John', contributions: 2 }, { name: 'Mary', contributions: 4 }, { name: 'John', contributions: 1 }, { name: 'Mary', contributions: 1 } ]; ... and I ...

this is basically my issue
 
5:28 AM
Hi, can somebody explain me what this is doing? Array.apply(null,{length:A[len-1]+1}).map(()=>0); where len=7;
It gives me an array of 31 which maps in a progressive order 11 being the last value of the array with 30 as its key
 
@ssube I made the array with the arrays in it.
 
 
2 hours later…
7:36 AM
Morning
 
meurning
 
morning~
@SunilLama The code doesn't seem to do what you claim it is doing. It takes A[len-1]+1, make an array that long, then fill it with zero.
 

« first day (2587 days earlier)      last day (2378 days later) »