Regenaxer has quit [Remote host closed the connection]
Regenaxer has joined #picolisp
<Regenaxer>
This drives me crazy!!!
<tankf33der>
eh
<tankf33der>
how should i use hash without collisions ?
<Regenaxer>
In a loop
<Regenaxer>
(while (fetch ...) (new hash
<Regenaxer>
So the same random key does not matter
<Regenaxer>
you need to hash the long URL
<Regenaxer>
to a short value
<tankf33der>
but 65k is less than my 4 chars random key
<Regenaxer>
yes, not 'hash'
<Regenaxer>
thats too short
<Regenaxer>
hmm, but then you need also a reverse index
<Regenaxer>
to check
<Regenaxer>
Better idea: just use incrementing values
<Regenaxer>
i.e. the tree size
<Regenaxer>
that's best
<Regenaxer>
See (count 'tree)
<Regenaxer>
The btree maintains a count
<Regenaxer>
use that in base64 as the short URL
<tankf33der>
so i need base64 than
<tankf33der>
so i need base64 then
<Regenaxer>
it is there
<Regenaxer>
or better another way
<Regenaxer>
hex or AO
<tankf33der>
AO ?
<Regenaxer>
sorry, I mean 'hax'
<Regenaxer>
A ... O
<Regenaxer>
as the DB symbols are encoded
<Regenaxer>
: (hax 123456)
<Regenaxer>
-> "ANBD@"
<tankf33der>
ok (hax (count))
<tankf33der>
then i insert `(== 64 64)
<Regenaxer>
yes, is that usable?
<tankf33der>
yea, i will reimplement
<Regenaxer>
I think hax is in pil32 too
<Regenaxer>
lib/misc.l
<tankf33der>
a, ok
<tankf33der>
then i will not insert `(== 64 64) :)
<Regenaxer>
yeah
<Regenaxer>
You could as well use the number directly as the key
<Regenaxer>
Saves space :)
<Regenaxer>
A number in PLIO takes less space than a string
<Regenaxer>
but you must convert when receiveng a requlst
<Regenaxer>
request
<Regenaxer>
with (format ..)
<tankf33der>
(inc (count))
<Regenaxer>
Not needed
<Regenaxer>
The DB does that
<tankf33der>
just (count) ?
<Regenaxer>
yes
<tankf33der>
ok
<tankf33der>
then numbers without hax
<tankf33der>
ok
<tankf33der>
afk.
<Regenaxer>
See you
<Regenaxer>
Yeah, hax is just overhead
<tankf33der>
what else in list of function for non e/r db manipulations?
<tankf33der>
i know store-fetch, scan, count
<Regenaxer>
yes, also iter, init, step
<Regenaxer>
they are all plain b-tree
<Regenaxer>
Basically all what is in @lib/btree.l
<Regenaxer>
@lib/btree.l works stand-alone, @lib/db.l builds on top of it
<Regenaxer>
Just like @lib/xhtml.l builds on @lib/http.l
<Regenaxer>
etc.
<tankf33der>
insane.
<tankf33der>
i openned pandora’s box
<Regenaxer>
:)
<beneroth>
tankf33der, I sometimes used base36 to turn an incrementing key into a human-readable id
<tankf33der>
ok
<beneroth>
for your use case, I would just random generate some value, and check upon creation if it is already in use (db ...) and a +Ref +String or so
<beneroth>
some overhead, but rather small
<tankf33der>
but just use integer from (count) as key is trivial
<beneroth>
yeah, but do you want to make URL iteration so easy?
<beneroth>
in principle you are right, random URL is security through obscurity, just gives you some time to detect it on the server side (if this is even of interest). Only proper way is having a feature to set a password.
<beneroth>
naturally the ID also gives away how often/intense your service is used.
<tankf33der>
url shortener is rosetta task, come on :)
<beneroth>
ah okay :)
<beneroth>
I think I mixed it up with your snipped tool
<beneroth>
sorry ^^'
lodsw_ has quit [Ping timeout: 240 seconds]
lodsw has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
miskatonic has joined #picolisp
miskatonic has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
<beneroth>
Regenaxer, still up?
<beneroth>
not important :)
<Regenaxer>
Kind of ;)
<beneroth>
oh
<beneroth>
yeah saw you were not away
<Regenaxer>
Watching Tel, drinking Vodka Mix
<Regenaxer>
T
<beneroth>
nice :)
<beneroth>
question: how difficult / how much effort to generalize +UB so it can use all kinds of keys?
<Regenaxer>
2-dim?
<beneroth>
or more
<beneroth>
3-dim ?
<Regenaxer>
yeah
<Regenaxer>
all kinds: not numeric?
* beneroth
is not entirely sure how well UB is for multidimensional data
<beneroth>
aye, also supporting +Link +Symbol as key values
<beneroth>
I mean, those still have an absolute order in pil
<Regenaxer>
Checking
<beneroth>
but no range? maybe that is the problem?
<beneroth>
yeah no stress, we can look into it another time, too
<beneroth>
just theorizing
<Regenaxer>
I think even now it is not limited to 2 dim
* beneroth
wants to store time-series data
<beneroth>
aye
<beneroth>
only limited to numeric keys
<Regenaxer>
ok
<Regenaxer>
did you try?
<beneroth>
no
<beneroth>
just believing the reference without fact checking
<Regenaxer>
It takes a Lst
<beneroth>
also didn't read the source yet
<beneroth>
what about that comment in the ref example?
<Regenaxer>
I don't remember atm
<beneroth>
# Range queries work efficiently with 'collect'. Note that though also Pilog
<beneroth>
queries can handle UB-trees, they may do so sub-optimally for certain ranges.
<beneroth>
ok
<beneroth>
I will look into it and we can discuss another time :)
<beneroth>
enjoy your evening!
<Regenaxer>
I think 2 is not implied
<Regenaxer>
Cool, ok?
<beneroth>
no, multidimensional should be fine
<beneroth>
but limited to numeric values
<Regenaxer>
right
<beneroth>
yeah ok :)
<beneroth>
all fine, thank you
<Regenaxer>
Enjoy too!
<beneroth>
I just have to think stuff further when I get flashes of ideas :)