Arc Forumnew | comments | leaders | submitlogin
Help me customize news.arc
2 points by pier0 4298 days ago | 12 comments
I'm not a coder, but using the instructions here (http://nicholasblee.com/blog/hacker-news-clone-on-a-free-aws-ec2-instance-wapache-reverse-proxy-server-20-min-install/) and here (http://plpatterns.blogspot.co.uk/2008/05/arc-news-forum.html) I was somehow able to install Arc/Anarki on an AWS micro instance running Ubuntu 13.04, while using the instructions in this thread: http://arclanguage.org/item?id=17211 I later added nginx to run as a reverse proxy server (or at least I think that's what it does).

However when I edited news.arc to change the name of "My Forum" nothing happened.

My site is http://matchfixingnews.com/ and as the name suggest is dedicated to expose all the match fixing scandals in football and sport in general.

How do I change the name from My Forum to Match Fixing News and replace the Arc logo with something else (not linked to yourdomain.com and hence 1and1) ?

Thanks



4 points by fallintothis 4298 days ago | link

Editing news.arc won't "reload" your changes. If you write the code to the file, it won't actually execute that code. Does that make sense?

You want to go back to the arc> prompt (where you started (nsv)) and do something to get that code to run. You could do this in a few ways. You could do:

  arc> (load "news.arc")
which will reload the changes you saved to the news.arc file. It might look crazy, because it prints out a bunch of messages that look like

  *** redefining logins-page
It'll do that because it's reloading the entirety (!) of news.arc, which includes a bunch of other code. Thus, there are warnings about "redefining" certain code. But as long as you didn't actually change the code in question, it should be fine.

At the end of the day, this is probably the best way to go, despite all the intimidating warning messages. Because if you edit the news.arc file, then the changes you make will be saved in case you ever need to restart the forum in the future.

But, for the sake of completeness, I'll explain how you can also just edit the variables by hand at the prompt. So, instead of changing news.arc to say

  (= this-site*    "Match Fixing Scandals"
     site-url*     "http://news.yourdomain.com/"
     parent-url*   "http://www.yourdomain.com"
     favicon-url*  ""
     site-desc*    "What this site is about."               ; for rss feed
     site-color*   (color 180 180 180)
     border-color* (color 180 180 180)
     prefer-url*   t)
and reloading news.arc, you could actually just put the entire thing above (called an expression) into the arc> prompt:

  arc> (= this-site*    "Match Fixing Scandals"
          site-url*     "http://news.yourdomain.com/"
          parent-url*   "http://www.yourdomain.com"
          favicon-url*  ""
          site-desc*    "What this site is about."               ; for rss feed
          site-color*   (color 180 180 180)
          border-color* (color 180 180 180)
          prefer-url*   t)
This will execute the code, thus modifying your settings.

You could also use simpler expressions---or, really, any Arc code you want. If you weren't a coder before, you are one now! :)

The expression above of the form (= a b c d ...) can be used to change the values of any number of variables (setting a to b, c to d, etc.), which will control how the site displays. So, you could do something like

  arc> (= this-site* "Whatever")
  "Whatever"
  arc> (= site-url* "google.com" parent-url* "wikipedia.org")
  "wikipedia.org"
whenever you want.

One of these settings you'll want to change is buried deep inside of news.arc (about 400 lines down), so it's hard to spot. But, you can change these variables, too:

  (= up-url* "grayarrow.gif" down-url* "graydown.gif" logo-url* "arc.png")
For your purposes, you can do something like

  arc> (= logo-url* "some-other-logo.png")
and make sure that some-other-logo.png is in your static/ directory.

Hope that helps!

-----

2 points by pier0 4297 days ago | link

fallintothis,

thanks for your clear explanation.

I tried to put the entire expression into the arc> prompt and also tried to use simpler expressions, but I still can't get "My Forum" to change.

I've also reloaded news.arc several times and I'm not sure if it means anything, but when I go back to the arc> prompt and enter arc> (load "news.arc") I get nil

and only after loading news.arc a second time I get the "* redefining" messages

I remember that to run news.arc the first time I also used (nsv) so I tried that as well and for what is worth I got the following error:

  rm: cannot remove ‘arc/news/story/*.tmp’: No such file or directory
  load items:
  user break
  context...:
   /home/ubuntu/arc/ac.scm:1031:20
    gs1259
  user break
  context...:
   /home/ubuntu/arc/ac.scm:1031:20
    gs1259
  Error: "tcp-listen: listen failed\n  port number: 8080\n  system error: Address already in use; errno=98"
  arc>

-----

4 points by thaddeus 4297 days ago | link

Hmmm it's been a really long time since I looked at the code, but I would try two things.

1. Enter this-site* at the prompt to confirm the change took place.

2. Abort the session, I.e such that the arc prompt is killed. Then goto the webpage and make sure its no longer running news (just to confirm the abort occurred and/or is not somehow running a past instance), then reload arc again.

-----

2 points by akkartik 4297 days ago | link

Yeah these are good suggestions. The "address already in use" error suggests that you might have multiple copies of arc running, so that you're making changes to the wrong copy. Use the commands 'ps' and 'kill' to look for the other copies and stop them.

http://stackoverflow.com/questions/3510673/find-and-kill-a-p...

-----

2 points by pier0 4297 days ago | link

I used the command ps aux | grep 'news.arc' and it returned only one copy running, but I suspect that's not right.

And your comment about multiple copies also got me thinking that from the main Arc directory to go into the Arc prompt maybe I shouldn't have been using $ mzscheme -f as.scm

Was I supposed to use that just once to run news.arc for the first time?

-----

3 points by akkartik 4297 days ago | link

No, you want to run:

  $ ps aux |grep mzscheme
ps doesn't know about news.arc, that's just one of the files loaded by mzscheme.

I didn't understand the second and third paragraphs. Can you tell me more about what version of arc you downloaded and how you're running it?

-----

2 points by pier0 4296 days ago | link

I did as you suggested and found a second process running, Then I run this

kill $(ps aux | grep '[m]zscheme' | awk '{print $2}')

and it killed one. After it was just a matter of starting-restating Arc with the changes in news.arc.

And next is the logo. Thanks for your precious advice.

PS In the previous post I was starting to doubt that I'm not supposed to use mzscheme -f as.scm as a command to get to the Arc prompt

-----

2 points by akkartik 4296 days ago | link

Great!

Out of curiosity, how do you stop the server once you start it?

-----

2 points by pier0 4293 days ago | link

I eventually connected the problem with the multiple copies of Arc running with having a detached screen, so I stopped that and closed the terminal.

After doing so the news site was down, which I believe is what Thaddeus was recommending to happen.

Then I had to restart it and detach the screen and start the process again.

It is not ideal, but I think it works.

-----

2 points by thaddeus 4292 days ago | link

Assuming you're using 'GNU screen' you also have the option to re-attach to an existing session using the 'screen -r' command. Using 'screen -ls' will list out all the sessions should you not be sure, or have more than one.

That aside, most developers will do development changes on a local machine where they need not attach/reattach and this way you wouldn't need to troubleshoot your code and the host environment at the same time.

Then you create a stable deployment process. eg. Backup the old code, drop in the new code, re-attach to the existing session and either load your changes or restart the program if you're ok with some nominal downtime.

Hope that helps.

-----

2 points by pier0 4296 days ago | link

I couldn't understand what you meant by "make sure its no longer running news" but now I know.

Basically I got a bad gateway error and the web page was no longer accessible until I reloaded news.arc

  arc> (load "news.arc")
  arc> (nsv)
Thanks thaddeus

-----

3 points by thaddeus 4294 days ago | link

No problemo and yeah, in retrospect, I could have chosen better terminology and been much more descriptive, but that's one of the things you will enjoy about the arc forum... You just keep asking and, generally speaking, people are very helpful. After all, I learned how to program by just doing what you are, running the news app, reading the arc code and relying on this forum for help along the way.

-----