Re: The Future (ASS, ASOC, Cocoa + AS)
Re: The Future (ASS, ASOC, Cocoa + AS)
- Subject: Re: The Future (ASS, ASOC, Cocoa + AS)
- From: Bruce Robertson <email@hidden>
- Date: Mon, 3 May 2010 10:19:06 -0700
Thanks, looks very useful. Unfortunately I am a little clueless and need a bit more detail to make this work.
Here's what I did:
1. Saved lines from #! to forever() as HTTPServer.sh
2. Go to terminal, cd to this directory, chmod 777 HTTPServer.sh
3. LS to confirm chmod; then try to run:
Macintosh:Downloads bruce$ ls -l HTTPS*
-rwxrwxrwx@ 1 bruce staff 662 May 3 09:42 HTTPServer.sh
Macintosh:Downloads bruce$ HTTPServer.sh
-bash: HTTPServer.sh: command not found
On May 3, 2010, at 8:29 AM, has wrote:
> Bruce Robertson wrote:
>
>> Simple (or not) examples?
>>
>>>> Incidentally, I've started putting browser-based UIs on my workflows, rather than GUIs or CLIs, which is very easy to do in Python and Ruby - another option you might consider if your systems are server-based.
>>>
>>> I can vouch for the coolness of using WebKit with ASOC. You can cook up some very good looking UI with CSS3, HTML, JavaScript in a WebFrame. The HIG overlords may cringe at creating iPhone-like UIs on the Mac, but what the heck. Looks great.
>
> Can't speak for WebKit/ASOC, but creating a basic HTTP server in Python is really simple:
>
> #!/usr/bin/python
>
> from BaseHTTPServer import *
> from urlparse import *
>
> class MyRequestHandler(BaseHTTPRequestHandler):
>
> def _encode(self, s):
> return s.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"')
>
> def do_GET(self):
> # process the request
> request = urlparse(self.path)
> path = request.path
> query = parse_qs(request.query, True)
> # build the response
> self.send_response(200)
> self.send_header('Content-Type', 'text/html')
> self.end_headers()
> html = '<p>%s</p>\n<p>%s</p>' % (self._encode(path), self._encode(str(query)))
> self.wfile.write(html)
>
> HTTPServer(('', 8080), MyRequestHandler).serve_forever()
>
> Save it to file, make it executable, and run it. This example just extracts the path and query from a URL and prints them out, e.g.:
>
> http://localhost:8080/foo?bar=baz
>
> gives:
>
> <p>/foo</p>
> <p>{'bar': ['baz']}</p>
>
> which should illustrate the point. POSTs are slightly different, but no harder.
>
> No authentication or anything fancy - I would turn to a proper web framework for that - but for a modest distributed application running on an internal network that needs to pass job tickets between processes and display a basic admin UI, it's quite adequate.
>
> has
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden