00:00:34  <SinisterRectus>i believe it does that to set up a copy of the luvit enviorment
00:00:43  <SinisterRectus>environment*
00:01:13  <SinisterRectus>or
00:01:18  <SinisterRectus>you can pass a loadstring
00:01:22  <SinisterRectus>just checked the code
00:01:29  <SinisterRectus>well, not the loadstring
00:01:32  <SinisterRectus>the string to load
00:01:36  <cat5e>so basically I start a new thread for every SQL query?
00:01:44  <SinisterRectus>hmmm
00:01:49  <SinisterRectus>not necessarily
00:02:03  <SinisterRectus>would every query contain only strings or numbers?
00:02:14  <cat5e>yes
00:02:22  <SinisterRectus>actually, let me think
00:03:16  <SinisterRectus>https://github.com/luvit/luv/blob/master/examples/uvbook/queue-work.lua
00:03:17  <cat5e>creationix, how would I go about making a simple pastebin with luvit and sqlite?
00:03:27  <SinisterRectus>there's an example of a uv work
00:03:46  <SinisterRectus>where you can continuously pass arguments to the threaded function
00:04:25  <SinisterRectus>i don't have enough experience to give you a "here's how you do it". best way is to just try things and figure out what you need.
00:05:37  <SinisterRectus>thread.work might be helpful
00:07:31  <cat5e>wait should I use sqlite or should I use postgresql?
00:07:45  <SinisterRectus>whichever you are more comfortable with
00:07:57  <SinisterRectus>you can even use a non-sql db
00:08:10  <SinisterRectus>like redis
00:08:11  <cat5e>what's the difference between sqlite and postgresql? (other than that postgres is turing-complete)
00:08:16  <SinisterRectus>which wouldn't require threads
00:08:28  <SinisterRectus>that i don't know
00:08:38  <SinisterRectus>i've only briefly used sqlite
00:09:00  <SinisterRectus>https://www.digitalocean.com/community/tutorials/sqlite-vs-mysql-vs-postgresql-a-comparison-of-relational-database-management-systems
00:16:42  <cat5e>hmm meh
00:16:52  <cat5e>how bad is sqlite anyway
00:20:24  <SinisterRectus>i think that page explains in-depth how "good" or "bad" it is
00:20:31  <cat5e>no I mean like
00:20:42  <cat5e>how can I know if I haven't tried it
00:20:59  <SinisterRectus>you can't
00:21:17  <SinisterRectus>unless you try it or read literature about it
00:21:33  <SinisterRectus>i don't have an opinion on sqlite
00:21:37  <cat5e>hmm
00:21:51  <cat5e>I could just have one DB per user
00:22:11  <SinisterRectus>uhh
00:22:40  <SinisterRectus>you usually have one db made up of many tables which is made up of many entries
00:22:51  <cat5e>actually I shouldn't worry about it until I run into issues
00:23:08  <cat5e>so...
00:23:16  <cat5e>how do I get sqlite on this thing?
00:24:04  <SinisterRectus>you can download a library manually and require it where you need it, or search lit for sql
00:24:13  <SinisterRectus>there seem to be 2 wrappers in lit
00:24:22  <cat5e>yeah, which one should I use?
00:24:35  <SinisterRectus>you need to decide that for yourself
00:25:03  <SinisterRectus>sorry, but i've never used any of them
01:03:42  * Haragethquit (Read error: Connection reset by peer)
01:38:12  * Haragethjoined
02:33:58  * Haragethquit (Read error: Connection reset by peer)
03:39:39  * SkyRocknRolljoined
03:45:56  * SkyRocknRollquit (Remote host closed the connection)
04:30:29  * rgrinbergquit (Ping timeout: 258 seconds)
04:40:15  * rgrinbergjoined
05:03:24  * creationixtopic: http://luvit.io | https://gitter.im/luvit/luvit | IRC Logs at http://logs.nodejs.org/luvit/latest
05:04:10  * creationixtopic: http://luvit.io | https://gitter.im/luvit/luvit | IRC Logs at http://logs.nodejs.org/luvit/latest
05:04:49  * creationixtopic: http://luvit.io | https://gitter.im/luvit/luvit | IRC Logs at http://logs.nodejs.org/luvit/latest
05:05:48  * creationixtopic: http://luvit.io | https://gitter.im/luvit/luvit | IRC Logs at http://logs.nodejs.org/luvit/latest
05:06:25  * creationixtopic: http://luvit.io | https://gitter.im/luvit/luvit | IRC Logs at http://logs.nodejs.org/luvit/latest
05:07:38  * creationixtopic: http://luvit.io | https://gitter.im/luvit/luvit | IRC Logs at http://logs.nodejs.org/luvit/latest
05:14:34  * rgrinbergquit (Ping timeout: 240 seconds)
05:31:34  * SkyRocknRolljoined
06:08:25  <inex>nvm i couldnt get it to work
07:09:08  * rendarjoined
09:11:47  * SkyRocknRollquit (Ping timeout: 260 seconds)
09:23:29  * DarkGodjoined
09:25:12  * SkyRocknRolljoined
10:41:22  * SkyRocknRollquit (Ping timeout: 252 seconds)
10:45:51  * cptG_joined
10:49:04  * cptGquit (Ping timeout: 240 seconds)
10:58:26  * SkyRocknRolljoined
11:14:09  * cptG_quit (Ping timeout: 276 seconds)
11:41:59  * cptGjoined
12:51:57  * rgrinbergjoined
13:06:58  * rgrinbergquit (Quit: WeeChat 1.5)
13:07:18  * rgrinbergjoined
13:31:42  * SkyRocknRollquit (Ping timeout: 272 seconds)
14:08:23  * rendarquit (Ping timeout: 250 seconds)
14:17:11  * cat5equit (Ping timeout: 240 seconds)
14:18:36  * cat5ejoined
14:47:46  * rgrinbergquit (Ping timeout: 252 seconds)
15:05:46  * rgrinbergjoined
15:25:26  <creationix>cat5e redis would be a lot easier than sqlite
15:25:45  <creationix>(from luvit's point of view, redis is a simple protocol over TCP, sqlite is a custom blocking C interface)
15:26:24  <creationix>https://github.com/creationix/redis-luvit
15:34:10  <cat5e>is it fast?
15:39:18  <cat5e>what's the difference between SQL and NoSQL?
15:40:05  <creationix>for a pastebin, redis will be way easier and faster than sqlite
15:40:34  <creationix>now it's not super persistent (meaning don't store mission critical data that's meant to be 100% safe and last for years)
15:40:44  <creationix>but I would think it's plenty for a pastebin
15:50:27  <creationix>cat5e, the main difference is with SQL you create tables with fixed columns and use SQL language to join tables in queries
15:50:35  <creationix>with noSQL, there is no sql language
15:50:53  <creationix>also they typically are document stores where some key points to some structured value (JSON-like usually)
15:52:06  <creationix>will you bother with authentication and allowing people to edit pastes?
15:52:21  <cat5e>yes
15:52:29  <cat5e>and oauth
15:52:33  <cat5e>and some other stuff
15:52:49  <creationix>so you need a place to store oauth tokens and user accounts and who owns the pastes
15:53:16  <creationix>I don't think redis allows joins in the engine (unless you do some lua scripting inside), but the queries are so fast you can manually join in the client
15:53:36  <creationix>so get paste by ID, in the paste metadata, look up owner and get that value by key as well
15:53:48  <cat5e>why shouldn't I use SQL?
15:54:01  <creationix>the main problem with SQL is it's harder to write luvit drivers for it
15:54:14  <creationix>I did write a driver that implements the postgres wire protocol
15:54:35  <creationix>but things like sqlite that live inside the process can only be accessed via their C interface
15:54:41  <cat5e>postgres is probably overkill for this
15:54:57  <creationix>which often uses blocking I/O that destroys the entire purpose of using luvit with it's non-blocking I/O system
15:55:13  <creationix>you can use sqlite with luvit if you put the luvit calls on libuv's thread pools
15:55:38  <creationix>I don't know what those two wrappers use. Last time I did it I just wrapped the sqlite command-line tool using luvit's child process
15:55:44  <creationix>it's super slow, but effective
15:56:00  <creationix>and type information is lost with sqlite, it's all strings
15:56:06  <cat5e>ಠ_ಠ
15:56:20  <creationix>mysql is even worse to support
15:56:33  <creationix>it took node.js years to get a good mysql driver and I'm not sure it's even that good
15:56:47  <creationix>whereas adding a redis driver took me an afternoon
15:56:54  <cat5e>ok
15:57:08  <creationix>leveldb would be ideal. It's the nosql version of sqlite
15:57:16  <creationix>and has non-blocking I/O, but it's C++ and is a pain to use from luvit
15:57:32  <cat5e>;_;
15:57:45  <creationix>If you don't mind setting up a redis server, it's by far the easiest
15:57:54  <creationix>redis is pretty easy to setup and you can configure it to be persistent
15:57:56  <cat5e>can I setup redis on localhost?
15:58:14  <creationix>just don't use it for important data. It's not designed for persistence
15:58:27  <creationix>yep, what's your local machine? Arch?
15:58:37  <cat5e>yeah
15:58:51  <creationix>I would assume just `pacman -Syu redis`
15:58:57  * creationixlooks up just in case
15:59:18  <cat5e>no -Syu is to update the system, it's just -S
15:59:33  <cat5e>but I mean like can I configure it to listen on 127.0.0.1?
15:59:47  <creationix>sure
15:59:55  <creationix>https://www.ideaplexus.com/2014/10/08/install-redis-on-arch-linux/
16:00:11  <creationix>there should be an option in /etc/redis.conf to bind to 127.0.0.1
16:00:17  <creationix>or even a local unix socket
16:00:25  <creationix>my client supports either
16:01:41  <cat5e>uh you know I don't trust network interfaces...
16:02:05  <cat5e>and sqlite is something I've used before
16:02:41  <creationix>well, you can try one of the wrappers on lit
16:03:23  <creationix>but why don't you trust loopback? Do you have untrusted users running arbitrary code on your machine?
16:03:41  <creationix>I think you can add authentication to redis if that's the case
16:03:41  <cat5e>not exactly
16:03:54  <creationix>or maybe permission the unix socket so that only certain users can access it
16:03:56  <cat5e>but sometimes
16:04:46  <creationix>sqlite isn't exactly that safe either if they can read the database files
16:04:53  <creationix>it depends on where the risk is
16:08:29  <cat5e>ok so first I need an http server right?
16:08:40  <creationix>luvit can provide that easily
16:08:43  <creationix>I would recommend using weblit
16:08:58  <creationix>https://github.com/creationix/weblit
16:09:01  <cat5e>I just wish these things had proper docs :/
16:09:27  <creationix>weblit is documented fairly well I think
16:10:43  <creationix>will your pastebin generate HTML server-side or download the data over websocket/xhr and render in the client?
16:11:20  <cat5e>server-side
16:11:52  <creationix>so you want a template language then? Or just manually concat html in lua?
16:12:10  * Haragethjoined
16:12:15  <creationix>luvit.io uses weblit and has a super basic template engine https://github.com/luvit/luvit.io
16:12:35  <cat5e>a template language would be nice I guess but I still have to manually escape HTML entities no?
16:12:56  <creationix>depends on the template engine
16:14:46  <creationix>and if your pastebin wants syntax highlighting, it's going to be easier client-side
16:14:54  <creationix>(which can still be done with server-generated HTML)
16:15:22  <creationix>but easier simply because libraries like code-mirror are trivial to use and support tons of languages. I'm not sure what there is for lua
16:16:39  <cat5e>so how do I do config files?
16:16:56  <cat5e>(configure host/port etc)
16:17:04  <creationix>cat5e, if it doesn't take all the fun out of it, I can write a blog post showing a way to use luvit (or lua + luv + lit most likely) to make a simple pastebin
16:17:13  <creationix>lua often makes a good config file
16:17:18  <creationix>also there is the JSON module
16:17:23  <creationix>or you can read environment variables
16:17:29  <cat5e>hmm
16:17:45  <cat5e>how can I parse this? https://github.com/SoniEx2/MDXML
16:17:49  <creationix>I once made something called LON that's the lua version of JSON
16:18:09  <cat5e>uh isn't that LTON? Lua Table Object Notation?
16:18:24  <creationix>probably
16:18:42  <cat5e>does luvit come with lpeg?
16:19:11  <creationix>I think I include it in the default luvi build
16:19:27  <creationix>yep
16:19:33  <cat5e>can it fallback to the system lpeg?
16:20:27  <cat5e>(e.g. if it's compiled without lpeg)
16:27:30  <creationix>yes, the luvit require should fallback to luv's require
16:27:37  <creationix>but you can also use native require and not luvit's require
16:27:54  <creationix>lit-loader or luvi-loader just insert a custom loader into lua's native require
16:28:03  <creationix>(lit uses them, for example)
16:28:27  <cat5e>so like you're good at parsers right?
16:28:35  <creationix>I've done a few
16:28:40  <creationix>never used lpeg though
16:28:56  <cat5e>that's fine, how can I parse MDXML?
16:29:07  <creationix>didn't you design it?
16:29:12  <cat5e>yeah
16:29:36  <cat5e>well kinda
16:29:42  <cat5e>it's markdown
16:29:54  <cat5e>but I put different meanings to different markdown things
16:31:39  <creationix>I'm not sure I see the appeal of the language
16:31:50  <creationix>but it looks fairly easy to parse. I would just use lua patterns
16:32:07  <creationix>line by line keeping state in a local variable
16:46:57  * rgrinbergquit (Ping timeout: 276 seconds)
16:51:22  * SkyRocknRolljoined
16:53:38  <creationix>cat5e, I just tested, https://github.com/bungle/lua-resty-template/blob/master/lib/resty/template.lua works out of the box with luvit
16:54:17  <creationix>well for compiling single files from lua. It does use blocking I/O to load template files, but as long as they are cached, that shouldn't be a problem
17:36:09  * rgrinbergjoined
18:55:00  * SkyRocknRollquit (Remote host closed the connection)
19:25:27  * DarkGodquit (Remote host closed the connection)
19:27:32  * DarkGodjoined
19:28:16  * Haragethquit (Remote host closed the connection)
20:48:04  * Haragethjoined
23:31:54  * rgrinbergquit (Ping timeout: 276 seconds)
23:38:30  * rgrinbergjoined
23:55:14  <cat5e>I have no idea what I'm doing
23:55:30  <cat5e>:/