« first day (8 days earlier)      last day (626 days later) » 

12:03 AM
can someone make backend for posts?
 
Anonymous
12:26 AM
@Downgoat I can work on it. My wife has been determined to not let me work on this project this weekend, though :P
 
with something like this in SQLAlchemy:
class Customer(Base):
    __tablename__ = 'customer'
    id = Column(Integer, primary_key=True)
    name = Column(String)

    billing_address_id = Column(Integer, ForeignKey("address.id"))
    shipping_address_id = Column(Integer, ForeignKey("address.id"))

    billing_address = relationship("Address", foreign_keys=[billing_address_id])
    shipping_address = relationship("Address", foreign_keys=[shipping_address_id])
in ForeignKey("address.id") what does address refer to? A column? The table?
 
Anonymous
12:41 AM
@Downgoat Column id in table address
 
Anonymous
The use of strings everywhere where class objects would be more sensible bugs me about SQLAlchemy
 
Anonymous
Apparently it is possible to not use strings
 
Anonymous
You can do ForeignKey(table.col) instead
 
Anonymous
I'm happy now
 
12:57 AM
@Mego oh wow ok that's ince
 
 
2 hours later…
2:28 AM
For previews should I have a 'preview' button which sends Markdown to server which renders it and returns it?
 
3:02 AM
I think we might want to write our own markdown parser
 
Anonymous
3:24 AM
@Downgoat That seems like a terrible idea
 
not from like scratch but like fork one
beacuse I can't find one that supports both math and tables
 
3:39 AM
it even supports katex :D
ok I'll work on a markdown compiler system
idk how we'll do spam preventon
FYI: this is in add-posts
what I can do is I can try to keep a node markdown.js process running and feed it posts through STDIN, or I can fork a new markdown process everytime it needs to be rendered
not sure if that will cause problems with multithreading
 
Anonymous
@Downgoat I'm going to talk with the Charcoal guys about using a custom instance of Smokey to automatically detect and block spam
 
Anonymous
@Downgoat Neither of those is ideal
 
true but I really should be using JS for markdown because highlightjs, codemirror, katex, mathjax, etc. is all JS and I don't want to reinvent the wheel by reimplenting all of those.
do we want footnotes in markdown
Is it better to cache rendered posts in DB or in redis
 
4:16 AM
Is there a reason I cannot write to a subprocess made with Popen:
> Cannot send input after starting communication
or actually it looks like python won't let me do a subprocess.stdout.read()
wat the f python
oh crap python has blocking IO
does flask support async things?
 
Anonymous
4:36 AM
@Downgoat You're probably doing it wrong. What's your code?
 
Anonymous
@Downgoat Yes
 
Anonymous
@Downgoat redis
 
ok well I fixed one of the things:
render_proc = Popen(['node', exec_path], stdout=PIPE, stdin=PIPE)

def render_markdown(string, id=None, force=False):
    """
    Renders markdown.

    Parameters:
     - string(str): Markdown string to render.
     - id(number): If provided, this will enable caching by identifying the
        markdown string with the Id.
     - force(bool): If provided with an id, this will force a new rendering and
        reset the cache

    Returns: rendered string
    """
    render_proc.stdin.write(string.encode('utf-8'))
the last line hangs
 
Anonymous
@Downgoat It should
 
not sure why
the subprocess flushes stdout
 
Anonymous
4:41 AM
Lemme get back to you on a better version
 
4:55 AM
?
 
Anonymous
1 message moved to Trash
 
weird if I do stdout.readline() it works
idk if stdout.read() waits until end of STDIN
is EOF only emitted on closing of STDIN?
I could also use a local TCP for transfering rendering info
 
Anonymous
5:18 AM
Yeah stdout.read() with no arguments waits for the stream to close
 
Anonymous
You can specify an integer arg for how many bytes to read
 
hm ok
If I do int(stdout.read()) will it read it as a big-endian or little-endian int
or is that platform-specific
or hm I don't think int will work
    read_len, = unpack('<i', render_proc.stdout.read(4))
struct.error: unpack requires a bytes object of length 4
does stdout.read not return a byets object?
>>> from app.helpers.markdown import render_markdown
>>> render_markdown("# test")
b'<h1>test</h1>\n'
:DDDDDDDDDDDD
python unpack is the most amazing function ever
 
5:50 AM
@Mego so I looked up how to configure MySQL on Fedora, and the response I got was to use MariaDB. Can I use Maria instead of MySQL?
 
Anonymous
@Pavel It doesn't make sense to switch DBs
 
@Mego The command is still called mysql but the package and service are called MariaDB.
 
good news: Posting works :D
also so does markdown rendering
 
@Mego The problem is that whenever I try to start the service it doesn't work
 
Anonymous
5:58 AM
So sudo service mysqld start doesn't work?
 
example post I just made (we can work on styling)
Should I do nullabe=False if I hvae a default?
 
@Mego It does now and didn't 5 minutes ago and I changed nothing
@Mego do you know how to set the root password?
 
:| SQL is not letting me DROP TABLE post;
ok update now
you don't need to it's empty by default
 
6:30 AM
@Mego I can't get mysql working pls halp ;-;
I can start the service but I can't reset the root password. I'm told to start the service with --skip-grant-tables to use it without a login, but idk how to do that
systemctl start mysqld doesn't take options.
 
Anonymous
@Pavel The docs clearly explain how
 
@Mego There are like 4 different sets of docs
They all have different instructions
I haven't seen that page you just linked yet but I'll try it
Yay it worked
bloody hell
 
 
4 hours later…
Anonymous
10:09 AM
3 messages moved from The Nineteenth Byte
 
11:43 AM
you guys want to use mysql for the site?! ugh, sounds like the project is f^Hdead before it's even born :(
 
Anonymous
yesterday, by Mego
@Christopher2EZ4RTZ If you don't have anything constructive to contribute, then don't.
 
well, here's something constructive: get rid of mysql and use a real database system :)
 
Anonymous
Saying "you're using X? ugh" is not constructive
 
Anonymous
Flamebait is also not constructive
 
such as postgresql
 
Anonymous
11:50 AM
Also it's worth noting that we're just using MySQL for development. Since we're using an ORM, we can (mostly) seamlessly transition to whatever RDBMS is available on the hosting platform
 
Anonymous
I chose MySQL because 1) it's one of the RDBMSes that I'm experienced with, and 2) it's not Oracle
 
well, at least 2 is a good point
 
Anonymous
My uni had a contract with Oracle that made half of my DBMS course be about Oracle
 
Anonymous
It sucked
 
Anonymous
1:08 PM
@Downgoat I think we're going to want to use an async task library like Celery for rendering Markdown and other such things. It's Python, it plays well with Flask and Redis, and it supports distributed workers for if/when we add more servers.
 
Anonymous
The flow for rendering Markdown would be Flask -> Celery -> some worker somewhere -> local markdown.js process -> worker -> Celery -> Flask
 
Anonymous
2:09 PM
Celery even supports tasks queues for advanced routing, which will be nice when we have to do load balancing
 
5:17 PM
@Mego does that do something asyncio doesn’t?
 
Anonymous
@Downgoat Celery runs tasks in separate processes, and the workers don't have to even be on the same machine. It's like asyncio + distributed programming.
 
Anonymous
6:01 PM
It also introduces a clean way to dispatch tasks - you either do foo() to call foo in the current process/thread, or do foo.delay() to have a worker call it
 
Anonymous
It will be really helpful for scaling
 
8:45 PM
I figured out what MariaDB is. On Fedora, Mysql redirects to MariaDB in the same way that yum redirects to dnf.
 
 
3 hours later…
11:34 PM
do we want to track question views?
 

« first day (8 days earlier)      last day (626 days later) »