« first day (957 days earlier)      last day (2546 days later) » 

3:23 AM
> Thank you!! That was very thorough and is exactly what I was looking for.
Zero upvotes; not accepted
@MatthieuM. I just got back from Denver, Colorado, USA which has legal marijuana. I don't mind the concept, but greatly dislike the smell. Riding the bus with people smoking was unpleasant.
 
 
2 hours later…
5:25 AM
I found a solution to a problem I had on Code Golf (of all places)
I was looking for an algorithm for the heaviest increasing subsequence problem, found this: codegolf.stackexchange.com/questions/54159/…
 
 
6 hours later…
11:13 AM
@Shepmaster :<
 
 
3 hours later…
1:47 PM
@FrancisGagné What real-world problem do you have that can be solved by that?
@LukasKalbertodt dropping the hammer on these silly tab-based indenters
 
2:43 PM
@Shepmaster Uh, my comment got 5 upduhts ^_^
 
 
1 hour later…
4:04 PM
@Shep Didn't you have an answer here?
 
4:15 PM
This one is actually interesting, but not that much in the molds of SO.
 
4:37 PM
@E_net4 I did, but it was factually incorrect so I deleted it
 
5:00 PM
@Shepmaster why not just fix it? Sure we now know that there's a way to create an xml error from outside, but should we?
 
@E_net4 That's why I added a comment to OPs answer - suggesting that it isnt a good idea.
 
 
2 hours later…
6:41 PM
@Shepmaster it's part of my diff library
the first step is finding matches: it finds substrings that appear exactly once on both sides, no matter where (I use suffix trees for that)
the second step is finding a subsequence of matches that appear in order on both sides; this is essentially finding the heaviest increasing subsequence
where "heaviest" is measured by the length of a match and "increasing" means that the match's positions are increasing on both sides
the text from matches in the HIS are reported as unchanged, while the text from matches not in the HIS are reported as moved
 
 
3 hours later…
9:34 PM
@FrancisGagné That's very cool
How generic is your library? Could I give it a slice of things?
 
10:02 PM
it only works on byte slices
though I guess it could be made to work on anything that is Eq + Ord
 
@FrancisGagné I always thought it would be cool to have a reusable generic diff
But never got aorund to experimenting
 
just to be clear, my diff library doesn't just handle insertions and removals, it also finds moves and "copies"
"copies" are created when matches overlap
my initial goal with this library was to build a merge tool that can resolve merges in more situations than the tools I've used before (i.e. in situations where the resolution is arguably unambiguous)
 
@FrancisGagné Sounds even better. In the back of my head, I'm thinking about conceptually diffing two token streams of Rust code
 
ha
while my library works on the byte level, I've also built a mechanism for rejecting matches that don't fall on "useful" boundaries
and it's extensible
the library currently offers a strategy for UTF-8 character boundaries, Unicode grapheme cluster boundaries and Unicode word boundaries
I want to make another one tailored for source code, because Unicode word boundaries doesn't work as I would like
plus I'll have to do something with indentation, right now indenting/unindenting a block of code will give messed up results
 
10:19 PM
and I happen to have code that parses rust into tokens ;-)
I've also thought about a "tiered" diff
where you diff larger (smaller?) chunks, then step down (up?) to get more refined diffs
like, line-wise first, then word-wise, then char wise
I forget exactly why I thought that would be valuable
 
my diff will recurse on the differences it finds
because "substrings that appear exactly once on both sides" is a bit too strict :P
though sometimes the recursive part gives strange results
like when you indent a piece of code, on one line it'll report the first few spaces as inserted, then on the next line it may report the last few spaces as inserted, then it keeps alternating
whereas what it's "supposed" to report is that spaces were inserted somewhere but it's ambiguous where exactly
which is why I thought about adding a layer that "normalizes" whitespace (i.e. turn all sequences of whitespace chars into a single space) before feeding it into the diff function, and then remapping the diff onto the original string
and then diffing the whitespace if necessary
 
11:01 PM
> turn all sequences of whitespace chars into a single space
I think that's what git diff -b (or is it -w?) does
 
well the thing is, I don't want to ignore whitespace differences, I just want to make them less important/significant when finding matches
in fact, my library can't even represent "ignored differences", since it assumes that unchanged parts have the same length on both sides
 
@FrancisGagné is your library online in some form yet?
 
no, not yet
 

« first day (957 days earlier)      last day (2546 days later) »