5 ms·
> Unlike many URL shorteners, this one does not need a database and can be entirely hosted on GitHub pages. it does need a database though. it just uses someo
by VWWHFSfQ 6y ago
> Unlike many URL shorteners, this one does not need a database and can be entirely hosted on GitHub pages.
it does need a database though. it just uses someone else's database
- nelsontky 6y agoHAHA yes it does opps slightly clickbait
- nvr219 6y agoHAHA roasted
- veesahni 6y agoJust like serverless still has servers, this can be reasonably called dbless :)
- xwdv 6y agoEssentially this is the promise of the blockchain. Imagine one massive global database where anyone can store anything in encrypted form. Free, forever.
- logram 6y agoI was under the impression that you paid for a transaction. That wouldn't be free, would it?
- sp332 6y agoPaying puts your transaction near the head of the queue. This matters more when there's a backlog. If you're willing to wait for things to clear up, you don't need to pay. https://bitcoinfees.net/ https://bitcoinfees.net/
- eloff 6y agoThere is no free lunch. That goes double for proof of work algorithms.
- LASR 6y agoWhen something called "proof of work" is so central to an idea, it can't be at the same time, "free".
- sp332 6y agoExactly, so let's not repeat that mistake!
- fishtoaster 6y agoA URL shortener can be done with no database - I did it using only Lambda functions once, but I wouldn't recommend it. :) https://kevinkuchta.com/2018/03/lambda-only-url-shortener/ https://kevinkuchta.com/2018/03/lambda-only-url-shortener/
- keanebean86 6y agoI've seen people suggest using pi as a "database." In this instance you could map ranges of pi to characters. Then you search pi until you find the right range. The URL would contain the range(s) needed. This is terrible and so computationally wasteful. But it's interesting to think about.
- earthboundkid 6y ago"X in pi" is an interesting thought experiment, but practically speaking, the least efficient way to do anything, since finding a string of N digits in pi will require a search space exponentially much larger than N on average, so it ends up just being an extremely inefficient encoding. A huffman coding + base32/base64 is a better "databaseless" short URL system.
- skulk 6y agoIn a similar vein, almost every algorithm can be converted into a O(1) space version simply by converting it into the dumbest possible search algorithm over the solution space: just sample from the solution space randomly (with a seeded PRNG or something) until you get the right answer. A well-known example of this is bogosort: https://en.wikipedia.org/wiki/Bogosort https://en.wikipedia.org/wiki/Bogosort
- teraflop 6y agoInterestingly, bogosort cannot actually be implemented in constant space -- at least, not if you're talking about a deterministic algorithm. In order for your PRNG to have a large enough state space to cover all possible permutations, it needs O(n log n) bits. In the Turing machine model of computation, algorithms that use O(1) space are theoretically equivalent to finite state machines (potentially with a very large number of states). Logarithmic space is where things start to get interesting, because it's enough to store a constant number of pointers into an arbitrarily large input.