brett


23 points by brett over 2 years ago | link
cached 7 days ago

12 points by brett over 2 years ago | link | top
cached 8 days ago
start the server in a new thread

  (thread asv)

9 points by brett over 2 years ago | link | parent | top
cached 11 days ago
you don't really need callcc as much as just storing proc closures

here's a ruby version a bit closer to the original. there's a bunch of support and then process roughly corresponds to said above

  #!/usr/bin/env ruby
  require 'rubygems'
  require 'mongrel'

  class FooHandler < Mongrel::HttpHandler
  
    def initialize
      @fnids = {}
      @c = 0
    end
  
    def new_fnid(proc)
      @c += 1
      @fnids[@c] = proc
      @c
    end
  
    def query_params(request)
      request.class.query_parse(request.params['QUERY_STRING'])
    end
  
    def pr(response, html)    
      response.start do |head,out|
        head["Content-Type"] = "text/html"
        out << html
      end
    end
  
    def w_link(response, link_text, &block)
      c = new_fnid(block)
      pr(response, "#{link_text}")
    end
  
    def aform(response, form_html, &block)
      c = new_fnid(block)
      pr(response, "
#{form_html}
") end def process(request, response) if (fnid = query_params(request)['fnid']) @fnids[fnid.to_i].call(request, response) else aform(response, "") do |req1, resp1| w_link(resp1, "click here") do |req2, resp2| pr(resp2, "you said: " + query_params(req1)['foo']) end end end end end Mongrel::Configurator.new :port => 8080 do listener {uri "/", :handler => FooHandler.new} trap("INT") {stop} run end.join

8 points by brett over 2 years ago | link | top
cached 10 days ago
It's not really a bug as much as an artifact of the REPL. You are seeing what the call to (link ...) prints and then the return value of the same call printed right after it by the REPL.

Changing the return value illustrates the point:

  arc> (no (link "A Link" "somepage.html"))
  A Linknil
It might not be optimal that link (or really tag) always returns "

7 points by brett over 2 years ago | link | top
cached 7 days ago
It's sort of an alternate ending to http://dontbreakthechain.com which I made last year.

The source is at: http://goods.tracksruns.com/runs.arc.txt

I'm new to lisp, I welcome (encourage even) tips/pointers/recommendations.


7 points by brett over 2 years ago | link
cached 5 days ago

6 points by brett over 2 years ago | link
cached 12 days ago

5 points by brett over 2 years ago | link | top
cached 22 days ago
Some sort of http://en.wikipedia.org/wiki/Reverse_proxy

I got it to work behind apache with mod_proxy. One gotcha I never got around to fixing was getting the arc app to pay attention to the X-Forwarded-For header instead of just using 127.0.0.1 as the remote ip address.


5 points by brett over 2 years ago | link | top
cached 12 days ago
It's definitely getting the the point where Ken's page deserves a permanent link somewhere on this forum or the arc home page.

5 points by brett over 2 years ago | link | top
cached 10 days ago
I've been running http://tracksruns.com (source http://goods.tracksruns.com/runs.arc.txt) behind apache on ubuntu with mzscheme 360. It gets virtually no traffic but has been up without problems since I started it a month or so ago. I launched it using screen so I can get back to the REPL whenever I want. The server uses some globals that are interesting to look at like optimes*.

It's still on arc0. The main gotcha is that it thinks all requests are from 127.0.0.1 because it does not pay attention to apaches's X-Forwarded-For header.