Arc Forumnew | comments | leaders | submit | CatDancer's commentslogin

"inputs" is actually a macro, so changing "inputs" will only affect code that you load after the change. (A macro works by transforming the code it is applied to, so after the code has been transformed the macro isn't used anymore).

For your first question, can you post your definition that isn't working for you?

-----

2 points by thaddeus 6314 days ago | link

I see - I didn't know macs transformed code like that.... I just reversed the order of loading my mac's and tada - everything worked!

Thanks! T.

the hack i did turned out to work, but as requested, here it is:

    (mac x-inputs args
      `(tag (table border 0)
         ,@(map (fn ((name label len text))
                  (w/uniq (gl gt)
                    `(let ,gl ,len
                           (pr ',label ":")
                           (if (isa ,gl 'cons)
                               (do (textarea ',name (car ,gl) (cadr ,gl)
                                     (let ,gt ,text (if ,gt (pr ,gt)))(br)))
                               (do (br)(gentag input type  ',(if (is label 'password) 
                                                            'password 
                                                    'text)
                                         name ',name 
                                         size ,len 
                                         value ,text)    (br))))))
   (tuples args 4)))
)

-----

4 points by CatDancer 6320 days ago | link | parent | on: Ssl support for arc

The easiest? To serve HTTPS web pages run a web server which supports SSL such as nginx, lighttpd, or Apache in front of Arc; and to make HTTPS requests from Arc run a web client program which supports SSL such as wget or curl.

-----


If you want to make an AJAX call from your browser to fetch some HTML from your server and put that data inside a div, you don't need to use JSON for that. Just have your Arc op return the HTML.

Untested, so I apologize for any mistakes:

  (defop grabdata req
    (pr "This is my <i>HTML</i> content!"))
and, in the browser, using for example JQuery (http://jquery.com/) as a convenient way to make the AJAX call:

  $.get("http://yourserver.com/grabdata", function (data) {
    $('#your_div').html(data);
  });
replaces the contents of the div that has the id "your_div" with the HTML content returned by grabdata.

-----

1 point by thaddeus 6320 days ago | link

I don't think I learned anything about JSON, but holy crow jquery is awesome.... The chaining methods alone just made my day! :)

-----


Presumably forward slashes in URL's would need to be changed to backslashes to store the library file in the lib directory with the corresponding path. (MzScheme has some platform-independent path manipulation procedures that could be used if they turn out to be convenient).

Also, is there a version of wget for Windows? What are the instructions for installing it that should be added to the lib documentation? Would the lib code need to invoke wget differently?

There may be some other things too, those are the ones that occur to me off the top of my head.

-----

1 point by eds 6311 days ago | link

There is a version of wget for Windows; you can get it from either Cygwin (http://www.cygwin.com/) or GnuWin32 (http://gnuwin32.sourceforge.net/). You can download the wget binary by itself at http://gnuwin32.sourceforge.net/packages/wget.htm .

I don't normally have any problems with forward/backward slashes on Windows (but I use Cygwin a lot, so my perspective may be biased).

-----

1 point by CatDancer 6310 days ago | link

So does the current version of lib work as it is with Cygwin and wget installed on Windows? Or is Cygwin even needed?

(I said that "Windows is not supported" but it would be more accurate to say that I haven't tried it with Windows).

-----

1 point by CatDancer 6324 days ago | link | parent | on: Extend Arc functions

Having the tests for two extensions return true for an input can be useful, for example if you have a specific case and a general case. By loading the specific extension after the general extension, the specific one will override the general one.

-----


Browser-side Javascript is like this in a way, for example to include the JQuery library all you need to say is

  <script
    type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"
    />
and the browser doesn't need to download it again if it is already in the browser's cache. This was one of my inspirations as I've been doing a lot of browser Javascript lately. The addition I made was to avoid getting the latest version automatically, as I imagined people might be nervous about that. (I know I would be. After all, Javascript in the browser runs in a sandbox, but Arc on your server can call (system "rm -rf /") etc...)

-----

2 points by CatDancer 6328 days ago | link | parent | on: Call graph for news.arc [pdf]

Very cool!

-----

2 points by conanite 6327 days ago | link

I second that.

If you're planning to add dynamic information and looking for ideas, encoding profiling data in the graph could be über cool.

Anarki has a basic profiler - see http://arclanguage.org/item?id=5318

-----

1 point by chris_l 6326 days ago | link

Thanks for the hint, I've now got a simple version where it takes the who-called-who from recording invocations. I'm currently working on sample call data, but profiling would also be interesting.

-----

3 points by CatDancer 6328 days ago | link | parent | on: Call graph for news.arc [pdf]

The correct URL appears to be http://electronreactor.wordpress.com/2009/02/04/call-graph-n...

-----

8 points by CatDancer 6328 days ago | link | parent | on: Arc presentation

The first thing that comes to my mind is more of a philosophy rather than a feature. One of the Agile principles is don't implement things until you need them... no speculative development: the tenth principle down in http://agilemanifesto.org/principles.html reads "Simplicity--the art of maximizing the amount of work not done--is essential." The XP process implements this with its rule that you only write code to implement the current iteration, no writing code to implement features that you "know" will be coming in future iterations.

When I first read the Arc web server code (srv.arc) I was astonished at how simple the code was.

srv.arc doesn't do everything I want, but other web frameworks don't do everything I want either. And I've found it much easier to hack srv.arc to do what I want, precisely because it isn't massively bloated with "framework" stuff, stuff that we imagine we'd need to write a web application, but we don't actually need or it turns out we need in some other way when we actually write an application.

Showing off how easy srv.arc is to hack is a great example of the Agile simplicity principle. Need to get a servlet to output a custom header? Plow through the documentation to find the right addHeader() invocation and what object to call it on. Need to get Arc to output a custom header? (prn "My-header: foo")

-----

1 point by conanite 6327 days ago | link

This is interesting, I had been thinking only of how the core language might appeal to an agile mindset but it's true that the libraries have a lot to offer as well.

-----

1 point by CatDancer 6329 days ago | link | parent | on: Arc Web Server Security Protocols?

Hmm, because you mentioned verisign I jumped to the conclusion that you were talking about HTTPS, but by "data security" were instead talking about keeping people from breaking into your server? You wouldn't need HTTPS for that... with Slicehost or Linode you'll be using ssh to login to your server, and ssh is encrypted and secure.

-----

1 point by thaddeus 6328 days ago | link

You were correct. I was looking to log into my web-app using https. And in retrospect (you're right again) I could just log into the secure server and show the work that way too. All that being said I still would like to learn setting up https, even for the sake of learning (and I'm sure someday I will need to).

Thanks again. T.

-----

More