Page 1 of 1

started planning on commentboxb

Posted: Tue Jul 05, 2011 7:10 pm
by Isaac
The plan is easier to view on this page....
http://testing.isaacg.net/commentboxb/
...because it allows dragging the image around in case the image is too big for your monitor.

I figured it could be posted now, since the rest of the planning is admin and database related.


The idea is the admin that installs the comment box simply pastes in an iframe with a src="cb.cgi" source, which pulls in javascript that replaces the iframe, if javascript works. If javascript does not work, the comment box depends on the iframe, via <form method="post">.

The admin side authorizes the comment box and moderates all authorized comment boxes.

Re: started planning on commentboxb

Posted: Tue Jul 05, 2011 11:54 pm
by Jeff250
Hmmm, looks like a nice plan. Some thoughts:

1. What about if you want different comment lists for different pages? (Hint: Relational databases are good at this sort of thing.)
2. IP address/OS is generally insufficient for authentication. If you want to let people edit/delete stuff, the most common way is to have people sign up for accounts.
3. Anything to deal with spambots?

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 7:31 am
by Isaac
Jeff250 wrote:1. What about if you want different comment lists for different pages? (Hint: Relational databases are good at this sort of thing.)
Oh yes! I was thinking of that. the comment management system should be able to link or segregate comment boxes. So you could have the same comment box on different pages, for whatever reason, or have different comment boxes for the same, or different, pages.

For Pickle, I could use embedded dictionaries for keeping track of all comments in one file. However, I think this is a short term solution. MySQL might be more long-term and better for people who might want to write their own comment management system, in a language other than python.
Jeff250 wrote:2. IP address/OS is generally insufficient for authentication. If you want to let people edit/delete stuff, the most common way is to have people sign up for accounts.
I completely agree. I think this should be an option. I can also imagine the "ip" address method working if, and only if, there's a time limit for a comment to be edited. The comment's time would expire and would become permanent, unless removed by an admin.

I'm not completely sure how long a time limit should be, for editing. A day, is my guess.
Jeff250 wrote:3. Anything to deal with spambots?
I hate that capachya stuff, but I might have to allow that as an option. I don't want it to be set by default.

The comment management tools might be good enough for the admin to keep control across all boxes. there also could be a "delete by ip", "delete by phrase", or "delete by country" admin tool.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 10:36 am
by fliptw
you can do this without an iframe.

you could also set a cookie that expires to use for short term authentication.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 1:33 pm
by Jeff250
fliptw wrote:you could also set a cookie that expires to use for short term authentication.
Yeah, this is probably the best of both worlds. Isaac, also keep in mind that more than one person can have the same IP address simultaneously.
Isaac wrote:For Pickle, I could use embedded dictionaries for keeping track of all comments in one file. However, I think this is a short term solution.
I think even calling it a solution is a stretch. There are huge faults in using pickling here. Performance-wise, every time you want to read any comment, you have to read every comment. Any time you want to insert/edit/delete a comment, you have to both read and write every comment. Correctness-wise, simultaneous modifications can get lost. Imagine if person A and person B both click "Add Comment" at the same time. Then this could happen:

Code: Select all

Person A's script Person B's script  Time
----------------- -----------------
comments = read()
                  comments = read()   ||
comments.add(c_a)                     ||
                  comments.add(c_b)   ||
write(comments)                       vv
                  write(comments)
Here, person A's comment will be lost. You can get around these issues by making your pickling solution more complicated, but ultimately you'll just be rewriting MySQL.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 2:09 pm
by Isaac
Hmm... Though it's unlikely to happen with 2 or 3 people (I've tested this),with 50000 users at once these errors would be common.

So cookies and MySQL database... two things I should know how to do, but don't.

I guess I know what I'm working on next.

Thanks!

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 2:35 pm
by fliptw
You want to start with SQL, then move onto parametrized queries.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 4:45 pm
by Isaac
Oh ok. ever heard of sqlite3 or redis or couchdb?

The sqlite page says:
SQLite Is Serverless

Most SQL database engines are implemented as a separate server process. Programs that want to access the database communicate with the server using some kind of interprocess communication (typically TCP/IP) to send requests to the server and to receive back results. SQLite does not work this way. With SQLite, the process that wants to access the database reads and writes directly from the database files on disk. There is no intermediary server process.

There are advantages and disadvantages to being serverless. The main advantage is that there is no separate server process to install, setup, configure, initialize, manage, and troubleshoot. This is one reason why SQLite is a "zero-configuration" database engine. Programs that use SQLite require no administrative support for setting up the database engine before they are run. Any program that is able to access the disk is able to use an SQLite database.
edit edit:
Right now I'm open to anything, but my admin won't let me install new software, except for some scripts that I can make executable. Actually, I bet I could get python to install something, since it appears to have more rights than I do, but I'm not sure if that's allowed.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 6:17 pm
by Krom
Your host may already have a full blown MySQL service available (most web hosts have it as a standard feature), check for that first.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 6:21 pm
by Isaac
It does. Should I just use that? It sounds like sqlite3 installs like a javascript or python file, meaning it might be an alternative.

Re: started planning on commentboxb

Posted: Wed Jul 06, 2011 9:59 pm
by Jeff250
Most of the point of SQLite is to get around having to have an out-of-process database server running. If you already have one running like MySQL, you might as well just use that. And chances are your host already has the MySQL python bindings installed too.

Re: started planning on commentboxb

Posted: Thu Jul 07, 2011 12:59 am
by fliptw
sqlite would be good for a website that doesn't exceed 100K hits, but if you have mysql, then use it. with the right abstraction layer switching between engines would be just changing one line.

firefox uses sqlite to handle it storage needs.

Re: started planning on commentboxb

Posted: Sun Feb 05, 2012 8:42 pm
by Isaac
update:
Got a cool little bar going.
This one bar first asks you your name, unless you have a user ID, then it becomes your message box!
Later I'll be connecting it to my mysql database.
Link to the box:
http://testing.isaacg.net/commentboxb/commentboxb.html

Basic concept (special thanks to jeff for the ajax sleep/delay idea):
http://testing.isaacg.net/commentboxb/commentboxb.png

Re: started planning on commentboxb

Posted: Sun Feb 05, 2012 9:30 pm
by Jeff250
So is this supposed to do something yet?

Re: started planning on commentboxb

Posted: Mon Feb 06, 2012 6:28 am
by Isaac
There's no posting yet. That will come later. Right now I just have been trying to make the one text area behave differently when asking you your name then accepting regular comments. Once in comment mode the box becomes longer, with that optional login button gone. It also tells you to press enter after you've typed something, within the textbox itself, which vanishes to get out of the way. The box also clears after hitting enter.

Basic stuff, but it took me a while to get it that far.

update: added posting, but no saving.