I tried: https://github.com/dosaygo-coder-0/urizip/commit/cb2bfd2e04e8b814943e42a5bf87eeff31a77126 Got kl9oo67XTkQCETxduLJSW5iUfSNh5pW6iDuhqKmzprOoJCaUYmMo5M7kiMaYxrBRjTQsWzqDks9BlBQWEQKsrKImrQU Which is longer. Also "OK" isn't a great commit message for almost every commit: https://github.com/dosaygo-coder-0/urizip/commits/master
Show HN: Shortern URIs using Huffman Coding, not a database
41–50 of 87 posts
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#42Often urls can be most effectively shortened manually. I wish everybody who sends me something like this: https://www.booking.com/hotel/fr/hotelwestminster.html?label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaDuIAQGYATHCAQN4MTHIAQzYAQHoAQH4AQKSAgF5qAID;sid=9b4fe19e9de68a3cb71714046bf9d64a;checkin=2017-05-12;checkout=2017-05-13;ucfs=1;highlighted_blocks=5190001_91458119_0_2_0;all_sr_blocks=5190001_91458119_0_2_0;room1=A;hpo…
Amazon is another great example. https://www.amazon.com/Cat-Facts-Marcus-Schneck/dp/0880295589/ref=sr_1_1?ie=UTF8&qid=1493754913&sr=8-1&keywords=cat+facts can become https://amazon.com/dp/0880295589/
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#43Earlier quoted context omitted.
I think you missed the part about it being serverless. I think the idea is to integrate the logic into the client.
But what's the benefit to turning a readable url into an unreadable one that's only about 3/4 the size?
Twitter has created some problems for the internet.
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#44Earlier quoted context omitted.
This might be a Poe's Law situation, but how am I supposed to reverse an arbitrary SHA256 hash without having that information stored somewhere? e.g. how do you expect a client to turn "r0WGHoHvVmv4I51qW9FxCAIxX8NSfYlds1Pi-Of92ZI" into something useful?
Sorry should't post jokes like this on the internet - I've moved 'more seriously' to the end to make it clearer.
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#45Earlier quoted context omitted.
Sorry should't post jokes like this on the internet - I've moved 'more seriously' to the end to make it clearer.
I wanted to be sure you weren't describing a DHT for url shorteners ... a distributed content-addressable hashtable of shortened urls
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#46Done naively, it will have the same problems others mentioned here: it barely shortens the URL. However, in the case of my specific app - a browser for data sets for single cell RNA sequencing - the state is largely dependent on the data set being viewed, and the data set is unchanging. What that means is that we can "externalise" the data being referred to, to pre-transform my JS object (which is an object tree) to nested arrays with integers (so a kind of "array tree") that use the data set as a look-up to reverse the operation. The latter is already a lot shorter when stringified, but also more compressible: the character set is limited to ten digits, commas and square brackets, and different values may be transformed into the same numbers, being distinguished by their position in the array tree.
To make this operation easier, I created a few helper functions to declare a "schema" that creates a recursive function for transforming the original JS object to said array of arrays, and vice-versa:
https://gist.github.com/JobLeonard/a47692a1f77bebc06c2518f32...
As you can see in the gist, that transformation shrunk a URL of 2466 characters down to a (admittedly still crazy) 638 characters.
I was thinking on putting it on NPM but it looked so specific in its applicability that I haven't bothered turning it into a proper package yet.
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#47I tried: https://github.com/dosaygo-coder-0/urizip/commit/cb2bfd2e04e8b814943e42a5bf87eeff31a77126 Got kl9oo67XTkQCETxduLJSW5iUfSNh5pW6iDuhqKmzprOoJCaUYmMo5M7kiMaYxrBRjTQsWzqDks9BlBQWEQKsrKImrQU Which is longer. Also "OK" isn't a great commit message for almost every commit: https://github.com/dosaygo-coder-0/urizip/commits/master
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#48Earlier quoted context omitted.
The idea is still interesting. I imagine using some dictionary based compression and crawled data to build a dictionary could get us somewhere.
That's basically what a Huffman code is. Once you have a big list of examples, it's just a way to encode it to take advantage of frequency of occurrence.
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#49Neat but SMAZ has better performance :-) https://github.com/antirez/smaz/tree/master
Performance in terms of compression ratio or in terms of speed or in terms of both or in terms of something else like for example memory usage? Is SMAZ encoded data URL safe?
Re: Show HN: Shortern URIs using Huffman Coding, not a database
#50Often urls can be most effectively shortened manually. I wish everybody who sends me something like this: https://www.booking.com/hotel/fr/hotelwestminster.html?label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaDuIAQGYATHCAQN4MTHIAQzYAQHoAQH4AQKSAgF5qAID;sid=9b4fe19e9de68a3cb71714046bf9d64a;checkin=2017-05-12;checkout=2017-05-13;ucfs=1;highlighted_blocks=5190001_91458119_0_2_0;all_sr_blocks=5190001_91458119_0_2_0;room1=A;hpo…
Which is actually just https://www.reddit.com/68sgew
https://redd.it/68sgew