« first day (2552 days earlier)      last day (2379 days later) » 

1:00 PM
o/
 
@jAndy there are backup tools, iirc
 
@KamilSolecki when she gets the "too many messages" she tries again later
 
I guess you can just copy the dbname.couch and dbname_design files
 
so long as they aren't being written to at the time
 
yes that's what the replication is probably good for
 
1:07 PM
I'm not sure how it works with couchbase, but for SQL, keeping a replica for backups does work well.
Pause it, run the backup, then let it resume and catch up while the backup uploads.
 
Yep thats what Apache recommends for couch too. First replicate and backup the replicated db
 
helps keep the alerts from going off on the masters
 
1:23 PM
!!deadlifts or no
 
@Mosho no
 
mmm
 
gosh my tummy hurts
 
Your tummy?
 
intestines, stomach
 
1:32 PM
Better
 
I didn't take biology in highschool
nor am I clever
 
that happens after you eat a pizza
you get used to it
 
pizza hangovers?
urgh, that salted poop taste is still everwhere :/
 
Surprisingly, pizza hangover is cured by alcohol
 
surely that's not backwards
 
1:34 PM
pizza before liquor
optionally after, but before more liquor
 
okay, I'm either too tired or too stupid to figure out how to do this. I have a list of numbers and a limit, I need to figure out start/count between the numbers in this list.
const list = [0, 1, 4, 5, 8, 9, 12, 13, 15, 17, 18, 20, 22, 23, 24, 25, 132];
const limit = 21;

// output: [0, 21], [22, 4], [132, 1]
like, I'm still a bit confused how to go about it ..
I need a coffee I think
 
@rlemon I don't get it
 
I don't either
 
not sure what you're doing :/
but you do need a coffee
 
I get the [0, 21] output, but not the other 2
 
1:35 PM
what's the limit have to do with the latter segments?
 
I'm also confused
 
0 with a count of 21 will cover [0, 1, 4, 5, 8, 9, 12, 13, 15, 17, 18, 20], 22 with a count of 4 will cover [22, 23, 24,25] etc
 
"cover"?
 
oh I get it! Take a function that takes some inputs, disgards them, and outputs those pairs
 
what's the limit then?
 
1:36 PM
where does 4 come in?
 
Why [22, 4] and not [22, 5]?
 
the limit is how many I am allowed to count per block
 
You want to split a list into ranges, where the limit is the max length of the range?
 
@Zirak because I don't need the 26th value
@KendallFrey yes.
 
oh, I think I get what you mean, sort of
 
1:37 PM
So .filter(x=>x<limit) is not good enough for you?
 
oh, should be easy with a reduce
 
famous last words
 
@OliverSalzburg no
 
So what makes [0, 6], [8, 18] not a valid output?
 
Then I still don't get it. I'll wait for the ending
 
1:39 PM
@KendallFrey I always want to try to get as many in a single '21 block' as I can
 
so you want to find each bin, where (last - first) < limit, and return [first, length]?
 
yes
and have as minimal bins as possible in the end
 
gotcha
 
So you want to consume until you hit the limit, then round the length down and start again at the next value?
 
uhh, maybe?
lemmy go make a coffee, I'll think better
 
1:41 PM
I think a true "minimal" set would mean grouping and finding the best way to pack each group, but you can get a good answer with a simpler algo
 
you can do it with an ugly loop and like two variables
 
Seems like looping over the list is the way to go
Seems like proving that's the optimal approach would be fun to prove
 
assuming the input is sorted, you just need the value and index of the current bin's first/left value
 
@rlemon Also, make sure you don't make any off-by-one errors. Those are super easy here, since [0, 1, 2, 3] is actually [0, 4]
 
I think you could get a much more optimal solution by looking for gaps larger than the limit and finding the best way to pack each isolated group
the time probably isn't worth it here
 
1:43 PM
Guys they did it they solved perpetual motion
 
/me paints a large "150" on his stomach
 
@SterlingArcher flawless logic
 
@SterlingArcher nice xD
 
so, this returns the elements themselves:
const split = (list, limit) => list.reduce((acc, x, i) => {
 const last = acc[acc.length - 1];
 if(i === 0 || x - last[0] >= limit) {
  acc.push([x])
 } else
  last.push(x);
 return acc;
}, [])
and you can just pass that through a .map to get what you need
!!> var split = (list, limit) => list.reduce((acc, x, i) => { const last = acc[acc.length - 1]; if(i === 0 || x - last[0] >= limit) { acc.push([x]) } else last.push(x); return acc; }, []); split([0, 1, 4, 5, 8, 9, 12, 13, 15, 17, 18, 20, 22, 23, 24, 25, 132], 21)
 
@towc "SyntaxError: expected expression, got end of script"
@towc [[0,1,4,5,8,9,12,13,15,17,18,20],[22,23,24,25],[132]]
 
1:50 PM
@CapricaSix That's not [0, 21], [22, 4], [132, 1]
 
@KendallFrey SNC just announced plans to work with the Canadian Space Agency 😱😱😱
 
partaaaay
 
@rlemon The 21 in the first array still doesn't click for me
 
I think something's inconsistent with what rlemon said. He wanted [first, count], but the 21 just doesn't make sense
also
 
It's not the amount of items, it's the end of the sequence
But for the rest it's the amount of items
So wassup
 
1:51 PM
!!> [[0,1,4,5,8,9,12,13,15,17,18,20],[22,23,24,25],[132]].map(x => [x[0], x.length])
 
@towc [[0,12],[22,4],[132,1]]
 
probably a typo I guess
 
@Zirak if I understand right
12 mins ago, by ssube
so you want to find each bin, where (last - first) < limit, and return [first, length]?
 
@towc Good catch
 
@ssube There aren't 21 items in the first bin though
 
1:52 PM
> probably a typo
 
It could be history being made and towc's right that it's a typo
 
hm, that's true
 
either way, that reduce's ugly af
don't really know how make reduces not ugly tbf
 
VSCode's integrated terminal is now 5x - 45x faster
 
@corvid hmmm try a real terminal
but that's cool
 
1:54 PM
@corvid Yeah, and the text is less readable as well!
 
@towc you've never used a real terminal
 
isn't it great?
 
I've never used a real terminal
 
@ssube I can't contest that
 
Now I can not read the text 5-45x faster
 
1:54 PM
@Zirak because those numbers correspond to an index, so I want from 0-20, so I start at 0 and count 21 up (including 0). the next one I start at 22 and count up 4 (including 22) to get 22, 23, 24, 25. for the last one I need 132, count 1
make sense?
 
@rlemon did you still mean 12?
 
user7480455
hi all
 
oooooh
 
wait
 
1:55 PM
here's what I got
 
you don't want the length, you want the actual difference
 
@rlemon I'm so confused
 
ugly
 
!!> [[0,1,4,5,8,9,12,13,15,17,18,20],[22,23,24,25],[132]].map(x => [x[0], x[x.length - 1] - x[0] + 1])
 
@towc [[0,20],[22,3],[132,0]]
@towc [[0,21],[22,4],[132,1]]
 
1:56 PM
there ya go
 
you skipped the chunking of the array?
 
@Zirak [index, length]
 
😛
 
@rlemon read up
 
It's not the length
 
1:56 PM
Oh no that doesn't make sense
 
8 mins ago, by towc
const split = (list, limit) => list.reduce((acc, x, i) => {
 const last = acc[acc.length - 1];
 if(i === 0 || x - last[0] >= limit) {
  acc.push([x])
 } else
  last.push(x);
 return acc;
}, [])
 
It's the length for every argument except the first one?
 
@Cereal it's the difference between last and first
he lied to ssube
and didn't make a typo
 
okay
allright
meh
 
1:58 PM
oh
 
those are all addresses on a table I need to lookup. I can request ranges by start,numberToRead
 
so yeah, I can probably definitely make the reduce much more efficient
 
looking up is very expensive.
and I can only look up X many before it throws errors
 
btw @rlemon, wanting to make this use the least amount of blocks is a whole other monster
 
so now I need to make this function
 

« first day (2552 days earlier)      last day (2379 days later) »