Arc Forumnew | comments | leaders | submitlogin
Using Arc at work
28 points by sacado 5910 days ago | 13 comments
I'm the luckiest guy on earth, because I've been able to use Arc at work.

I needed a web app for people at my work to be able to browse and recover what they saved on a dedicated server when they break their own data. It needed a login/password system and the ability to compress and transfer files (that was the hard part). It had to use Apache at least as a proxy so as to enable SSL encryption. Something rather simple, but with a few tricky points.

Well, I prototyped it with arc (it was a good occasion to play with the language), it took only 10 hours and produced a 60-lines program. And since it really works fine, I think I'll keep this version for real use (if I do so, I'll hide the fact that I've used an alpha-release of a lisp dedicated to hackers).

Thanks pg and all other contributors !

Btw, as announced by pg himself, my code doesn't work anymore with arc1 :)



11 points by pg 5910 days ago | link

I think you may be the first. Well, except me, obviously.

-----

7 points by almkglor 5910 days ago | link

code or it didn't happen ^^

-----

5 points by sacado 5909 days ago | link

Well, the code (with a few explanations) is now available at http://my-arc-stuff.blogspot.com/

-----

2 points by almkglor 5909 days ago | link

Interesting. I suggest you add defsop to the arc-wiki.git

As for the process that does the archiving... if I remember correctly hacking through srv.arc shows that it will summarily kill any operations that take too long.

-----

1 point by sacado 5908 days ago | link

Ok, I'll add defsop to the git.

Well, concerning long threads... That's the reason why I fix threadlimit* at the beginning to 300 s. That's enough for archives 5OO MB long, and anyway, for even bigger archives, I wouldn't propose people to use this method...

-----

2 points by sacado 5909 days ago | link

Well, ok, I'll deliver it, today or tomorrow, but I have to clean it a little. A few things are written in French & must be translated and a few others are security issues, I have to hide them.

-----

2 points by almkglor 5909 days ago | link

Good ^^ I'll be making a toy that I'll smuggle into the office to handle the office gossip, just so I can also say I've used Arc at the office ^^

-----

3 points by almkglor 5909 days ago | link

toy's done, now all I have to do is smuggle it into the office....

  (= *chismakspath* "arc/chismaksball")
  (ensure-dir *chismakspath*)
  (= *chismaksmax*
    (or (most idfn
         (map [coerce _ 'int]
           (keep (let rx (re "[0-9]") [re-match rx _]) (dir *chismakspath*))))
    0))
  (deftem chismistem
    parent nil
    text ""
    replies nil)
  
  (def ch-urlencode (s)
          (let code [coerce _ 'int 16]
            (tostring
              (forlen i s
                (if (some (s i)
  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
                    (pr (s i))
                  (is (s i) #\space)
                    (pr "+")
                    (pr "%" (coerce (code:s i) 'string 16)))))))
  
  (defmemo chisms (i)
    (errsafe:temload 'chismistem (file-join *chismakspath* (string i))))
  
  (def chismsupdate (i)
     (w/outfile p (file-join *chismakspath* (string i))
       (write (tablist:chisms i) p)))
  
  (mac chismispage (title . body)
    `(tag (html)
       (tag (head)
          (tag (title)
            (let title ,title
              (if title
                 (pr title " - "))
              (pr "Chismaksball!"))))
       (tag (body)
         ,@body)))
  
  (defop chismis req
    (chismispage nil
      (withs
         (
           chosen (arg req "p")
           chobj (when chosen (chisms chosen)) )
        (tag (div)
          (w/bars
            (tag (b) (link "random" "chismaksball"))
            (awhen (and chobj chobj!parent)
              (link "parent" (tostring:pr "?p=" (ch-urlencode it))))))
        (tag (div)
          (if chobj
            (pr:eschtml chobj!text)
            (prn "chismaks not found!")))
        (when chobj
          (tag (div style "font-size: 60%")
            (w/bars
              (w/link
                (chismispage "sasabat pa..."
                  (tag (div)
                    (w/bars
                      (tag (b) (link "random" "chismaksball"))
                      (link "yoko na sumabat..."
                        (+ "chismis?p=" (ch-urlencode chosen)))))
                  (tag (div) (pr:eschtml chobj!text))
                  (tag (div style "font-size: 60%; font-style: bold")
                    (pr "Replying: "))
                  (arform chismissubmit
                    (tag (input type 'hidden name 'parent value chosen) nil)
                    (textarea "ch" 8 42) (br)
                    (submit)))
                (prn "reply"))
              (awhen chobj!replies
                (w/rlink (+ "chismis?p=" (ch-urlencode (random-elt it)))
                  (prn "random reply"))))))
        (arform chismissubmit
            (tag (div style "font-size: 60%; font-style: bold")
              (pr "Bagong chismaks:"))
            (textarea "ch" 8 42) (br)
            (submit)))))
  
  (def chismissubmit (req)
    (awhen (arg req "ch")
      (let num (++ *chismaksmax*)
        (awhen (arg req "parent")
          (push (string num) ((chisms it) 'replies))
          (chismsupdate it))
        (w/outfile p (file-join *chismakspath* (string num))
          (write
            (tablist:inst 'chismistem
                  'parent (arg req "parent")
                  'text it)
            p))))
    "chismaksball")
  
  (defopr chismaksball req
    (aif (dir *chismakspath*)
      (tostring:pr "chismis?p=" (ch-urlencode:random-elt it))
      "chismis"))

-----

2 points by jimbokun 5909 days ago | link

"It needed a login/password system and the ability to compress and transfer files (that was the hard part)."

So how did you manage it? Calls to "system"?

-----

1 point by sacado 5909 days ago | link

Yes. "system" was my best friend here. Not for the login part, Arc already has it built in, but when dealing with files.

-----

2 points by vrk 5910 days ago | link

I'm not sure if I should applaud or shudder... what was the name of your company again?

-----

2 points by sacado 5909 days ago | link

Actually this is not critical code, so the relative immaturity of Arc is not really an issue. It's just a frontend for people scared by rsync or scp and it probably won't be used more than once a month anyway.

Spending too much time on it : that would have been the bad option. And using Perl or Python or PHP would have taken me much longer.

-----

2 points by sbraford 5906 days ago | link

Ahhh this brings back memories.

I did something similar when rails was first hitting the scene.

My boss/PM would've crapped his pants if he knew I was building toy RoR apps for the marketing dept. (it was a Windows shop) =)

-----