It's a new project. However, Hubski has been using postgres for a few years, but it's currently an amalgam of Arc and Racket. I didn't write the db code, and am trying to start fresh. The Hubski racket connection looks like:
>Can you show what command you're running to check that you "can connect to the db from the Arc command line"?
Here's my test code that works in the command line, and the response. (I named my db "root" atm and will change that and the user once I get it working. I'm running the app as root.):
arc> (tostring (pipe-to (system "psql -U root -d root") (prn "SELECT * FROM items WHERE name = 'marble';")) )
" item_id | name | type | description | created |
location \n---------+--------+------+-------------------------------------+-- ------------
--------------+----------------------------------------------------\n 1 | marble | tool | A small, translucent orange bauble. | 2022-02-23
17:59:45.480545 | 0101000020E610000012C2A38D239A5EC040683D7C99E44240\n(1 row)\n\n"
arc>
But when I have that same code in the app, it times out. I tried to add (prn "\\q") at the end, but same result. Works in command line but hangs up in the app.
I even tried to specify the host and port:
(pipe-to (system "psql -U root -h 159.203.186.97 -p 5432 -d root") (prn "SELECT * FROM items WHERE name = 'marble';"))
With this in my pg_hba.conf
host all root 159.203.186.97:5432 trust
And the same result; returns in command, app times out. Checked the port:
BTW, I am using the domain xyrth.com with a nginx reverse proxy. I just had the thought it may be my nginx configuration. It probably needs to listen explicity on 5432? Here's my current sites-enabled:
If you don't identify as a programmer, if that isn't your core strength, if you just program now and then because it's expedient, then treating libraries as services may make more sense. If a major issue pops up you'll need to find more expert help, but you knew that already.
I did. :)
Even so, I think it's also worth considering that libraries also represent learning opportunities for some (like myself). For whatever reason, perhaps because it isn't my core strength, the only approach to programming that I have found to work for me is to continually try to do something. I seem only to be able to truly absorb the finer points when they are encountered in the context of a whole.
For a long time this kept me from programming altogether.
Hi darjeeling. I run http://hubski.com Glad you like it! Unfortunately, I don't think there are any quick answers to your questions. Most of this requires writing new code. I'll take a shot at them, to get you started, however:
how difficult would it be to add open-id, facebook, twitter, g+ integration?
That depends on how integrated you want to get. It's fairly trivial to be able to add a 'like' or '+1' button, but if you want deeper integration, you'd have to be specific about what you want to do. I haven't tried open-id. I'm sure it's doable.
how does hubski distinguish text submissions vs videos and so on? How do I group/categorize all of them?
For videos, it is a matter of identifying the url as a video url, etc. For example with findsubseq, you can pick out if contains "youtube" "youtu.be", etc. Text submissions are those that lack a url, and don't have an empty text field, etc. No quick fix here. news.arc wasn't made to sort them that way, I had to do that.
how do I add tags to submissions or allow admins to add tags?
There are a number of ways you might go about that. I added the tag as an additional story key/value pair. Depending on your tagging structure, you might want to make each tag it's own template, containing the ids of stories carrying that tag.
how do i decrease the karma required to downvote?
I think there is downvote-threshold* in news.arc, -just change the value. I don't use karma or downvotes with Hubski. So I don't have that code anymore. :)
how do i mimic HN's job page, ie: no name of the poster and no comment field- just link and text. How to group all such posts?
Shouldn't be too difficult. Each story could have a 'job' key with a value of nil or t. If it is t, then opt not to show the comment tree, name, etc.
From the range of your questions, it seems that you haven't messed with the code too much yet. If you really want to use news.arc, just get in there and start tweaking. I was totally green to Arc when I started. Good luck!
Hi Markkat, thank you very much for your detailed reply. If you don't mind, I'd like to ask more questions.
- If I want to start hacking into the news code, is news.arc the only file I start with? I would also like to change the css, make email field compulsory, send email confirmation and so on. If you could show me some direction, it would be very helpful.
- by integration with other services, I mean allowing likes, +1, commenting, log-in etc. I think I will have to look into the code to start understanding this more, so it is related to the above point.
- about identifying video URLs- how would you recommend expanding something like, say a bit.ly link?
- Yes, I haven't done anything with the code yet because it looks a little unfamiliar at this point. But I'd love to.
Getting a HN clone up and running isn't too bad, and the version of news.arc available is very stable as is. Also, the folk in this forum are very friendly and willing to answer questions. I don't think that getting your HN clone up and running would be much more difficult than any other forum.
Tip: if you are looking to customize news.arc, I would start by working it out of the table formatting and into CSS. If not, it's a pretty rigid beast. It's worth the effort, and would also be a good way to get familiar with the code.