Arc Forumnew | comments | leaders | submitlogin
First Arc pages at pittshuttle.info
3 points by evanrmurphy 5534 days ago | 6 comments
The University of Pittsburgh has their shuttle schedules online [1], but only in the form of PDF files scanned from physical pamphlets. These files are slow and not very accessible, especially on mobile devices where reading PDF isn't well supported.

I'm building my own site (http://pittshuttle.info) to try and address these problems. I want it to be fast and readable on a phone's browser, and to have a UI that minimizes the time it takes you to find exactly the route info you were looking for. The first two are going OK, but I have a lot of work to do on the UI. The site is essentially just up and running with a handful of static HTML pages generated in Arc. You can choose any of the routes and get a dump of its schedule info for the particular days it runs.

I've posted the source [2], but my clumsy knowledge of Arc's I/O led me to do it in HTML, where all indentation was lost and each line sports a terminating nil. [Update: this is no longer the case, thanks to fallintothis.] Honestly I'm embarrassed to be sharing any of this so early on, but I think that's typical when people share their work. If earlier feedback means the project improves and I learn more, then it seems foolish to let ego get in the way.

Look forward to having your comments.

[1] http://www.pc.pitt.edu/transportation/routes.html

[2] http://pittshuttle.info/src



3 points by fallintothis 5534 days ago | link

  (defop src req
    (w/infile inf "../arc/pittshuttle.arc"
      (whiler l (readline inf) nil (prn l (br)))))
The reason you get trailing nils is because you have (prn l (br)). br is defined in html.arc as

  (def br ((o n 1)) 
    (repeat n (pr "<br>")) 
    (prn))
So, (br) will print 1 <br> tag, then a newline. (prn) returns nil. Hence,

  (prn "blah" (br))
first evaluates its arguments: (br) prints "<br>", then returns nil. So, this essentially does

  (prn "<br>")
  (prn "blah" nil)
which prints

  <br>
  blahnil
What you meant was

  (defop src req
    (w/infile inf "../arc/pittshuttle.arc"
      (whiler l (readline inf) nil
        (prn l)
        (br))))
But this still doesn't preserve the whitespace. For source code, you probably want the <pre> and <code> tags.

  (defop src req
    (prn "<pre><code>"
         (eschtml (filechars "../arc/pittshuttle.arc"))
         "</code></pre>"))
Alternatively, you might serve it as a static file.

Or, as a shameless plug, if you use Vim you could get my syntax highlighter (http://www.vim.org/scripts/script.php?script_id=2720) and use :TOhtml. :)

-----

1 point by evanrmurphy 5534 days ago | link

It's fixed now. Thanks, that is so much better.

Checking out your syntax highlighter now. :)

-----

1 point by evanrmurphy 5529 days ago | link

The syntax highlighter has increased my quality of life substantially (insomuch as my life is coding in Vim, which it is for a good part these days :) .

The red highlighting that suddenly appears for mismatched parens is very useful. Saves me a lot of cursoring around to make sure all are matched up. The only nuisance in my own usage is sometimes it's distracting if I deliberately have a temporary mismatch while editing code.

-----

1 point by fallintothis 5528 days ago | link

Good to hear, thanks!

The parenthesis highlighting is a bit of an all-or-nothing proposition, since Vim can't really tell if you intended to leave unmatched parentheses. You can disable it altogether (which won't highlight any paren errors) with

  :hi link arcParenError NONE
and re-enable it with

  :hi link arcParenError Error
Similarly, there's arcBracketError for [] syntax.

If you find any, feel free to let me know of code it doesn't highlight correctly: http://bitbucket.org/fallintothis/arc-vim/issues/

-----

3 points by thaddeus 5534 days ago | link

Looks good. I am sure the students will appreciate not having pdfs.

I would try something like jqTouch for the client side phone UI, targeting the iPhones/Androids out there - which is probably 90% of the students these days :)

http://www.jqtouch.com/

I have yet to try it, but I look forward to giving it a whirl (with Arc as the back end).

-----

1 point by evanrmurphy 5531 days ago | link

Thank you, thaddeus! I'm glad to know about jQTouch and will let you know if I give it a whirl before you do. :)

-----