ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp
xkapastel has quit [Quit: Connection closed for inactivity]
aw- has joined #picolisp
orivej has joined #picolisp
aw- has quit [Quit: Leaving.]
_whitelogger has joined #picolisp
mtsd has joined #picolisp
<Nistur> mornin'
<Regenaxer> Cheers Nistur!
<Nistur> \o/
<Nistur> Just a reminder (not that you lot need it) https://pbs.twimg.com/media/ETOoWk3XkAES2DF.jpg
<Regenaxer> Haha, exactly
mtsd has quit [Quit: Leaving]
mtsd has joined #picolisp
<beneroth> Nistur, hehe XD
mtsd has quit [Quit: Leaving]
mtsd has joined #picolisp
mtsd_ has joined #picolisp
mtsd has quit [Read error: Connection reset by peer]
DerGuteMoritz has quit [Ping timeout: 258 seconds]
DerGuteMoritz has joined #picolisp
mtsd_ has quit [Client Quit]
mtsd has joined #picolisp
<mtsd> Regenaxer, do you have a minute?
<Regenaxer> yess :)
<mtsd> Thanks! I am changing index types and, of course, ended up with things dangling
<mtsd> I assume I need to re-build the new index?
<Regenaxer> yes
<Regenaxer> with 'rebuild'
<Regenaxer> The e/r model is ok?
<mtsd> I think so, at least
<Regenaxer> Then just (rebuild (db: +Cls) 'var '+Cls)
<Regenaxer> (in single-user mode ;)
<mtsd> I'll have a go, just a second :)
<Regenaxer> sure
<Regenaxer> ... and you must have loaded @lib/too.l
<Regenaxer> (I have that almost always on my command line)
<mtsd> Seems to have worked, Thank you!
<Regenaxer> np :)
<mtsd> :)
mtsd has quit [Ping timeout: 256 seconds]
mtsd has joined #picolisp
rob_w has joined #picolisp
mtsd has quit [Quit: Leaving]
<tankf33der> i implement those rosetta task about URL shortener
<tankf33der> in post i do store and commit
<Regenaxer> yes
<Regenaxer> and (dbSync) first
<tankf33der> and in get i cant output stored info in db
<tankf33der> http://ix.io/2i8P
<tankf33der> where to insert dbSync ?
<tankf33der> for storing or fetching ?
<Regenaxer> Only store
<Regenaxer> (dbSync) (store ..) (commit 'upd)
<Regenaxer> And when GET, just 'redirect'?
<tankf33der> yea :)
<Regenaxer> May be tricky
<tankf33der> works.
<Regenaxer> Needs to pass all original arguments to the destination address
<Regenaxer> OK, maybe 'redirect' does that. I don't remember
<tankf33der> but for rosetta task its ok anyway.
<Regenaxer> yeah
<tankf33der> on every post i got the same random key, but i do seed
<tankf33der> maybe wrong place or something else.
<Regenaxer> you are in a child
<Regenaxer> It inherits the same seed from the parent
<Regenaxer> (push '*Fork '(seed (time)))
<Regenaxer> or (seed (usec))
<Regenaxer> (seed (list (usec) *Pid)) :)
<tankf33der> damn, forget restart pil.
<Regenaxer> restart?
<tankf33der> because i do via (server 8080 "!short)
<tankf33der> with allowed
<Regenaxer> This does not matter
<Regenaxer> On every HTTP request the parent forks
<tankf33der> but dont reread url-short.l file
<Regenaxer> yes, this is not the point
<Regenaxer> Each requests forks from the same server process
<Regenaxer> So it inherits the same seed
<Regenaxer> -> same random sequence
<tankf33der> this is i understand.
<Regenaxer> ok
<Regenaxer> Grrr, my stupiy FritzBox disconnects me every few minutes
<Regenaxer> I can't find the reason
<Regenaxer> Wifi
<Regenaxer> Disconnects when I move around in the house
<Regenaxer> despide good signal strength
<Regenaxer> I googled for that, but found no solution
<tankf33der> task done:
<tankf33der> http://ix.io/2i8Z
<Regenaxer> other people seem to have that too
<Regenaxer> OK, the store looks good
<Regenaxer> But 'ukey' should be called in the child, right?
<tankf33der> right
<Regenaxer> (push '*Fork (setq *UKey (pack ...
<Regenaxer> (push '*Fork '(setq *UKey (pack ...
<tankf33der> i dont know this mechanism
<Regenaxer> Very simple
<Regenaxer> like *Bye
<tankf33der> and where I should insert this ?
<Regenaxer> Expressions in *Fork are executed in the child after a fork
<Regenaxer> Insted of (de ukey
<Regenaxer> no
<Regenaxer> ukey is fine
<Regenaxer> You must init the seed in the child
<Regenaxer> the function ukey can stay
<Regenaxer> or just (in "/dev/urandom" ...
<tankf33der> but i do this:
<tankf33der> (de short (R)
<tankf33der> (seed (list (usec) *Pid))
<Regenaxer> I think a random key is not good
<tankf33der> ...
<Regenaxer> may collide
<Regenaxer> Why is it needed?
rob_w has quit [Read error: Connection reset by peer]
<tankf33der> $ curl -F 'u=https://picolisp.com/wiki/?home' 127.0.0.1:8080
<tankf33der> shorter version of url for redirects
<Regenaxer> ok
<tankf33der> on every curl call i get random key
<Regenaxer> You just need hash
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
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 :)
<beneroth> thanks, I am :D
<Regenaxer> good :)
<beneroth> zum Wohl!
<Regenaxer> Danke :)
<Regenaxer> Masako's idea. Vodka + Lemonade + Zitrone
<beneroth> Sounds good! which sort of lemonade?
<Regenaxer> "flumi" :)
<beneroth> ah
<beneroth> we don't have this, I think. But google helps :)
<Regenaxer> No idea. Local dealer
<beneroth> kind regards to Masako :)
<Regenaxer> thanks!
<Regenaxer> I told her :)
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp