Awesome, this is exactly what I was looking for. I've been slowly working my way through the blog.arc and news.arc examples while also reading through srv.arc and app.arc to fully understand everything that is happening in each and these writeups should be just what the doctor ordered. I've been using/reading your site extensively since you first starting posting to it and its been an absolutely invaluable resource to me in my studies.
I'm curious though, you seem to have a definite interest in Arc, but are you also a fan of YC News, and if so are you attending the startup school on the 19th? The reason for my query is that I'll be attending and I'm looking forward to meeting quite a few of the contributors to both communities. Hope to meet you there, if not, and if you reside in the bay area, maybe we should work on getting some type of Arc enthusiasts meetup sometime soon? Ping me if you're interested in either--you can, of course, find my email address with my profile.
Either way, congratulations on an excellent site and keep up the good work.
Thanks for your comments on my documentation. Since your email address is hidden, I'll respond here. (One of the mysteries of news.arc is that the email address you enter in the profile form is not displayed to the public, even though it looks like it would be. You need to put it in the "about" field, as in my profile.) Yes, I've been following YC News since it started, but only as a reader. No, I'm not attending startup school. Yes, I reside in the Bay Area.
Crap, never realized that news.arc hides the email. Anyway, I just added a little blurb about myself and my email address to my Arc forum profile. Thanks for posting back and pointing out my obviously poor assumption.
Also, thanks for reading over my little gotchas that I found in the srv.arc documentation and updating them so quickly on your site. I hope the comments helped out. I'm just about to sit down with the app.arc docs for a bit of enjoyable reading before bed :-)
Since you live in the Bay Area, how would you feel about getting some type of an Arc enthusiasts meeting together? If it sounds interesting maybe we can set something up in meetup.com.
I just noticed, as I was reading over the srv.arc documentation, that you have a bad link in the section where you create a very simple form and form handler. Your link for the html.arc documentation is http://arcfn.com/html.html when it should be http://arcfn.com/doc/html.html--you're just missing the doc directory in your URL.
In the table describing the different defop macros, you have two identical column titles (Headers + Redirect). Shouldn't the defopr column title be something like "HTML + Redirect" or just "Redirect"?
First, thanks for catching my errors. I appreciate your comments.
As far as identical titles "Headers + Redirect" for defopr and defopr-raw, I'll take your suggestion and change defopr's title to "Redirect", even though the truth is more complex. The way they work:
defop: takes req as argument, body prints HTML
defop-raw: takes (stream req) as arguments, body prints headers, blank line, HTML
defopr: takes req as argument, body prints headers, returns (not prints) redirect path
defopr-raw: takes (stream req) as arguments, body prints headers, returns redirect path
Everything seemed straightforward between the plain and the -raw macros, until I realized that defopr and defopr-raw both let you modify the headers. So the only difference is defopr-raw uses an extra stream argument, which hardly seems worth a separate macro.
So if I were in charge of Arc, I'd get rid of defopr-raw and arformh, and I'd drop the stream argument from defop-raw.
This may be a longer answer than you were looking for :-)
Nope, not too long, the more information the better. Thanks for the reply, I definitely appreciate the extra info. Keep up the good work, the arcfn site is a godsend for anyone learning Arc.
Am I correct in thinking that asv only supports one-way asynchronous communication from the client to the server? If so, does anyone have any ideas for supporting two-way async?
Actually asv doesn't even support that. It has jfnurl* which is called an asynchronous request, but really it's just a normal request with the result thrown away. The client still blocks for the duration of the request, so nothing is really asynchronous. I suspect asynchronous communication is a not-yet-implemented feature.
But to answer your question, it depends what you mean by two-way async. HTTP only supports requests from the client to the server, so you need to use something like polling, Ajax, HTTP server push, or Comet (see http://en.wikipedia.org/wiki/Comet_%28programming%29). I don't think there's anything in srv.arc that would prevent a persistent server connection, if threadlife* is increased from 30 seconds. (A thread per persistent connection would eventually have scaling issued, though, I think.)
I took a closer look at using Ajax with Arc. It turns out to be pretty easy, thanks to script.aculo.us. I've written details at http://arcfn.com/2008/04/ajax-and-arc.html - please let me know if it works for you or not.
I've substantially changed my example, so it now fetches country data using Ajax.
The biggest problem with using Ajax is that the Arc web server doesn't support .js files, which is a big oversight for a web-targeted language. Consider this a bug report suggesting support for .js static files. (Really the design should allow arbitrary static files with arbitrary mime-types, rather than hard-coding the list.)
If anyone has Arc running on a public web server and wants to run the Ajax example, let me know and I'll add a link to your site from my page. (My hosting isn't suitable for running Arc.)
Actually, the Anarki supports exactly what you want with static files: a root directory for static files, and a table mapping extensions to mime types for them.
And there's a typo on your page: you don't close the code tag around "/getcontents?field=population&name=value", so the rest of the page is in monospaced font.
That said, your site is consistently fantastic, and I find it amazingly useful. Please keep it up!