Arc Forumnew | comments | leaders | submitlogin
2 points by bOR_ 5971 days ago | link | parent

Although just from the website it is a bit hard to see how arc is being used. Perhaps if something interesting during building the site was encountered, this could be shared?


11 points by antiismist 5971 days ago | link

Sure, I can share some things I've learned. The caveat of course is that I am no elite hacker, so some of this is going to be obvious or not really correct...

- macros: In news.arc, they are all over the place. So I tried to code in a similar style, but it turns out that if something can be done via a macro vs being done with a function, then it is more natural for me to use a function. I work a lot with the REPL, and it turns out to be really annoying to change a macro, and then I have to track down all the places that use that macro, and "refresh" them to use the new macro. Especially with macros that call macros that call macros, and I change the macro at the end of the chain. Whereas with a function, I just have to paste in the new function and it takes effect right away.

- news.arc stores posts in a hash table. I started off modeling ballerinc that way. But as time goes on, I am starting to move things over to plain old lists. Basically, working with a hash table pushes me into code that uses side effects to get things done, like using each. Whereas with lists, the code is usually cleaner and shorter.

- repl: using the repl on the running web server is pretty amazing. Already I have pushed changes directly to the live site. For ballerinc restarting the server takes about 10 minutes, so this has been a life saver. I don't worry about "releases" at all anymore - just make the feature, test it, and deploy it.

- the codebase is about 386 LOC. For the past week I've been adding features and doing code cleanup, and the LOC keeps going down.

-----

1 point by skenney26 5971 days ago | link

Any advice related to setting up and running your web server would be highly appreciated. I recently got a hosting account and was stuck trying to figure out how to keep the server running after logging out of ssh. Also, have you had any security concerns while developing your applications?

-----

3 points by antiismist 5971 days ago | link

I use the screen utility. Basically, I always have screen running, and the repl / vim running. With the repl running in screen you can detach via control-a d, and then log off, and the repl keeps on running. Then you ssh back in, and can reattach via screen -dr.

I haven't had any security concerns - I have a couple admin pages but of course one has to be an admin to see them.

-----

2 points by zitterbewegung 5971 days ago | link

How do you parse the rss feeds?

-----

2 points by antiismist 5971 days ago | link

That part is a big hack...I have a ruby script that generates an s-expr of the feed, and work from that:

       (each i (read (tostring (system (string "ruby bench.rb " r!url))))
           (add-post (alref i 'title) (alref i 'link) r!league))

-----

2 points by zitterbewegung 5970 days ago | link

There is a function (xml->xexpr) in PLT scheme which could also generate an s-expr of the rss feed.

-----

1 point by antiismist 5970 days ago | link

I had trouble figuring it out ...

If you had a URL for an RSS feed, how would you get an s-expr containing all the links and titles in the items?

-----