[racket] formlet checkbox behaves differently from others

2014-06-14 Thread J G Cho
Here is my code: #lang web-server/insta (require web-server/formlets) (define (start request) (define answer (get-answer "Formlet")) (response/xexpr `(html (head (title "formlet")) (body "Answer: " ,(format "~a" answer) (define date-formlet (formlet (div "Month:" ,{inpu

Re: [racket] my 2 cents on Web application tutorial being too advanced

2014-05-05 Thread J G Cho
ike: > > > http://localhost:50937/servlets/standalone.rkt;((%22k%22%20.%20%22(1%201%205404687)%22)) > > I thought I probably won't write web application like this. Because I > think URL is part of the content, and it should be meaningful. > > > On Sun, May 4, 2014 at 11:

[racket] my 2 cents on Web application tutorial being too advanced

2014-05-04 Thread J G Cho
I think the first tutorial (blog) might be better off using http://docs.racket-lang.org/web-server/dispatch.html, which resembles more of the conventional way of doing web app, ie dealing with request and response. In particular, the resulting k-url is not permanent (at least when I was working th

[racket] Whalesong questions

2014-03-27 Thread J G Cho
First question is about installation. 1) Tried raco pkg install https://github.com/dyoo/whalesong.git Failed, it did not like the source. 2) Tried raco pkg install whalesong-master.zip seems to install as whalesong-master and not as whalesong. 3) Resorted to copying whalesong dir inside .z

[racket] 2htdp/image right and bottom outline disappears

2014-02-18 Thread J G Cho
Tried it in Dr Racket 5.3.6 running on OSX 10.6.8 #lang racket (require 2htdp/image) (place-image/align (frame (text "ABC Inc." 12 "black")) (/ 100 2) (/ 30 2) "center" "center" (rectangle 100 30 "outline" "black")) Why does the right and

Re: [racket] unit test for close enough values

2013-12-21 Thread J G Cho
That looks very useful. On Sat, Dec 21, 2013 at 6:23 PM, Greg Hendershott wrote: > > check-= wants single value but unfortunately my values are wrapped in > set of vectors. > > Oh I didn't notice that. > > In that case you could define your own check -- that looks inside the > sets and vectors

Re: [racket] unit test for close enough values

2013-12-21 Thread J G Cho
check-= wants single value but unfortunately my values are wrapped in set of vectors. On Sat, Dec 21, 2013 at 5:04 PM, Greg Hendershott wrote: > On Sat, Dec 21, 2013 at 3:42 PM, J G Cho wrote: > > FAILURE > > actual: # > #(0.7071067811865476 -0.7071067811865

[racket] unit test for close enough values

2013-12-21 Thread J G Cho
I have a test that fails. (module+ test (check-equal? (list->set (vector-2d-orthogonals (vector 1 1))) (list->set (list (vector-unit (vector -1 1))

Re: [racket] (check-equal? hash1 hash2) fails

2013-08-17 Thread J G Cho
e and the other isn't (this, unfortunately, doesn't show up in the > print outs). It is quite confusing, I agree. > > > (equal? #hash((6 . 1) (4 . 1) (3 . 2) (2 . 2)) #hash((2 . 2) (3 . 2) (4 > . 1) (6 . 1))) > #t > > Robby > > > > On Sat, Aug 17,

[racket] (check-equal? hash1 hash2) fails

2013-08-17 Thread J G Cho
FAILURE actual: #hash((6 . 1) (4 . 1) (3 . 2) (2 . 2)) expected: #hash((2 . 2) (3 . 2) (4 . 1) (6 . 1)) name: check-equal? I tried alternative like (check-true (hash-equal? hash1 hash2)) but it turns out hash-equal? is not what I expected it to be. Other than writing a custom compar

Re: [racket] use plot as render in universe

2013-08-11 Thread J G Cho
(define (sim init) (big-bang init (on-tick random-walk 1/2) (on-key shock) (to-draw plot-render) )) (sim initial-world) On Sun, Aug 11, 2013 at 3:58 PM, Matthias Felleisen wrote: > > Tests your functions. Use Rackunit Luke. > > On A

Re: [racket] use plot as render in universe

2013-08-11 Thread J G Cho
Thanks for the assurance. It helped me to focus on my world->list-of-vectors It turns out it did not return enough vectors (at least 2, I think) for initial-world. On Sun, Aug 11, 2013 at 12:34 PM, Matthias Felleisen wrote: > > On Aug 10, 2013, at 7:04 PM, J G Cho wrote: > >

[racket] use plot as render in universe

2013-08-10 Thread J G Cho
I get an error (somewhat expectedly) when I try (big-bang init (on-tick random-walk 1) ;(on-key door-actions) (to-draw plot-render) )) where plot-render is defined as (define (plot-render world) (p:plot (p:lines (world->list-of-vectors

[racket] for/fold accum val at each step

2013-08-10 Thread J G Cho
I think I understand the following example from the documentation: (define (example) (for/fold ([sum 0] [averages null]) ;; 2 accums named sum and rev-roots are initialized ([i '(1 2 3 4)]) ;; i will iterate over 1..4 (values (+ sum i) ;; adding

Re: [racket] normalize-response (in the context of web server)

2013-04-30 Thread J G Cho
It printed out the surrounding "". I changed to write-string, and the chrome seems to handle it as correct html. Thanks. On Tue, Apr 30, 2013 at 2:03 PM, Jay McCarthy wrote: > What's wrong with that output? Is that you want display and not write? > > On Tue, Apr 30, 2

Re: [racket] normalize-response (in the context of web server)

2013-04-30 Thread J G Cho
functions of the Web > server. You'll have to look into what it was doing and update it to > the modern documented server. > > Jay > > On Tue, Apr 30, 2013 at 11:12 AM, J G Cho wrote: > > While trying out dherman's site generator (from > > > planet.rack

[racket] normalize-response (in the context of web server)

2013-04-30 Thread J G Cho
While trying out dherman's site generator (from planet.racket-lang.oracketg/package-source/dherman/static-page.plt/1/0/main.ss), the following error is thrown: normalize-response: unbound identifier This procedure does not turn up in Search Manuals. Is there way to fix/work around this? jGc

[racket] lambda as default value to dict-ref

2013-02-15 Thread J G Cho
So, I have a dict A that looks like (list ("string as key" . (lambda (arg) ...) ...) I do ((dict-ref A key (lambda (_) "wrong key")) some-params). When keys are valid the above work as expected. When the key does not find any, I was expecting ((lambda (_) "wrong key") some-params) but it fails w

[racket] Check out this small webapp if you have time.

2013-01-17 Thread J G Cho
It's for - Anyone who is interested in something that's smaller than the blog example. - Anyone who is interested in a quick/dirty/flexible way to present data (stored in SQL DB) to the users. It's at https://github.com/racketeer/rdb/tree/master/web Cheers, jGc Racket U

Re: [racket] How can I speed up this code?

2013-01-15 Thread J G Cho
Make a huge difference. On Mon, Jan 14, 2013 at 5:52 PM, J G Cho wrote: > Will give it a try. > > Thanks. > > On Mon, Jan 14, 2013 at 5:12 PM, Eli Barzilay wrote: >> A few minutes ago, J G Cho wrote: >>> >>> I did a onetime read of json and then wrote

Re: [racket] How can I speed up this code?

2013-01-14 Thread J G Cho
I am sorry if my email points the finger at json library. That was not intentional. I think there could be other issues: I did a onetime read of json and then wrote out as SEXP. I noticed the slowness persisted despite that. So then I wrote out only 1000 rows for the time being. Here is the conv

[racket] How can I speed up this code?

2013-01-14 Thread J G Cho
Dear performance experts, With the news of math library in Racket and the goal of improving my data analysis skill, I have started going over the examples in book "Python for Data Anyalysis" by McKinney using both Python and Racket. Too early to tell which is preferable for me. But I do have one "

[racket] More on K-URL question

2013-01-07 Thread J G Cho
I think the previously asked behavior has nothing to do with stateful vs stateless. I've been trying to compose different 'apps' together under one web-server. /xapps/A, /xapps/B, etc. I am just realizing that if I happened to use /xapps/B;(( ...k-url...)) first then later K-URLs start with /xapp

[racket] web-server weird K-URL generation when stuffer is used

2013-01-07 Thread J G Cho
Here is the background. I have been running a stateless web-server fine for a while. (Call this A) It gets started from http://...com/xapps/A and then it generates various K-URLs as /xapps/A;(( ...)) I just finished developing another 'servlet' and added to the above server. (Call this B) It get

Re: [racket] How to insert array into Postgresql using DB module

2013-01-04 Thread J G Cho
Thank you. If I may ask another question, what is the best way to handle inserting a new record and fetching that ID? Is there a better way than what I am about to do below? ;; [String] -> ID (define (create! ... ) (define batch! (lambda () (define prev-id (query-value conn

[racket] How to insert array into Postgresql using DB module

2013-01-03 Thread J G Cho
Postgresql allows INSERT INTO sal_emp VALUES ('Bill', '{1, 1, 1, 1}', '{{"meeting", "lunch"}, {"training", "presentation"}}'); I have inherited this table that is not quite normalized and has columns that are expecting arrays. Can I do something like following? (quer

Re: [racket] WebServer not finding param in POST but does so in GET???

2012-12-07 Thread J G Cho
Tried again with v5.3.1 without success. On Mon, Dec 3, 2012 at 3:22 PM, J G Cho wrote: > Thanks. Will upgrade. > > On Mon, Dec 3, 2012 at 3:14 PM, Jay McCarthy wrote: >> Yes, this was fixed very recently. >> >> Jay >> >> On Mon, Dec 3, 2012 at 1:14 PM

Re: [racket] WebServer not finding param in POST but does so in GET???

2012-12-03 Thread J G Cho
Thanks. Will upgrade. On Mon, Dec 3, 2012 at 3:14 PM, Jay McCarthy wrote: > Yes, this was fixed very recently. > > Jay > > On Mon, Dec 3, 2012 at 1:14 PM, J G Cho wrote: >> 5.3 Is it too old? >> >> On Mon, Dec 3, 2012 at 2:34 PM, Jay McCarthy wrote: >>

Re: [racket] WebServer not finding param in POST but does so in GET???

2012-12-03 Thread J G Cho
t; > If you are on 5.3.1, then it is an error with that change and you > should let me know (perhaps with a PR) so I can fix it. > > Jay > > On Mon, Dec 3, 2012 at 9:50 AM, J G Cho wrote: >> (define bs (request-bindings req)) >> ... >> [(exists-binding? '

[racket] WebServer not finding param in POST but does so in GET???

2012-12-03 Thread J G Cho
(define bs (request-bindings req)) ... [(exists-binding? 'stat bs) (handle-post-stat (extract-binding/single 'stat bs))] The above cond clause evaluates when Browser invokes $.ajax({ type: "GET", url: "/abc/xyz", data: {stat: JSON.stringify( data )}, But not when P

[racket] a few questions while reading about racket/draw libray (http://docs.racket-lang.org/draw/overview.html)

2012-09-14 Thread J G Cho
Q1. Possible syntax error? Code that generates Racketeers, ho! (with reflections) near the bottom of the tutorial, goes like this: (define-values (tw th) (let-values ([(tw th 1 2) (send dc get-text-extent str the-font)]) (values (inexact->exact (ceiling tw)) (ine

Re: [racket] usage of plt-web-server command

2012-09-05 Thread J G Cho
Thanks. Got curious because it (plt-web-server) seems to be the only (?) way to use with SSL. On Fri, Aug 31, 2012 at 10:29 PM, Jay McCarthy wrote: > On Fri, Aug 31, 2012 at 11:49 AM, J G Cho wrote: >> Near the end of 3.9 Soft State section found on >> http://docs.racket-lang

[racket] usage of plt-web-server command

2012-08-31 Thread J G Cho
Near the end of 3.9 Soft State section found on http://docs.racket-lang.org/web-server/stateless.html?q=%23%3Aquit&q=rackunit&q=commandline&q=substring&q=dispatch-rules&q=response/full#(part._stateless-example) #lang web-server (provide interface-version start) (define interface-version 'stateles

[racket] rackunit not in textual?

2012-08-30 Thread J G Cho
I am greeted by ... collection not found collection: "rackuint" in my v5.3 (textual). Is it because rackunit relies/depends on some graphics/window? Is there an alternative? jGc Racket Users list: http://lists.racket-lang.org/users

Re: [racket] loop in stateless webserver acts different/weird

2012-08-27 Thread J G Cho
let/web (which you are getting from web-server/servlet) > > The problem is that your send/suspend/dispatch is the STATEFUL one, > not the STATELESS one and so there is no state instance available. > > Jay > > On Fri, Aug 24, 2012 at 8:38 AM, J G Cho wrote: >> So I have

[racket] Stateless Webserver

2012-08-16 Thread J G Cho
Hello, I am going over the Blog Tutorial ( http://docs.racket-lang.org/continue/index.html ) and trying to run it "Stateless". I made it to the version where the model is put into a separate module model.rkt with small changes: (require racket/serialize) (serializable-struct blog (posts) #:mut

Re: [racket] WebServer memory and custom expiration page

2012-04-26 Thread J G Cho
asonable range. On Thu, Apr 26, 2012 at 12:04 AM, Jay McCarthy wrote: > On Wed, Apr 25, 2012 at 3:58 PM, J G Cho wrote: >> A couple of minor question about page expiring too fast. >> >> How does one assign more memory to WebServer (with State)? (I am >> guessing

[racket] WebServer memory and custom expiration page

2012-04-25 Thread J G Cho
A couple of minor question about page expiring too fast. How does one assign more memory to WebServer (with State)? (I am guessing this delays expiration. Please correct me if I am wrong.) I read something about Continuation Managers but not clear how to create one and how to use it with serve/ser

Re: [racket] PLT-Web-Server unter Apache

2012-04-23 Thread J G Cho
Thank you. It seems to work. To recap: On Ubuntu edit /etc/apache2/sites-enabled/default ProxyPass /apps/ http://localhost:8080/apps/ ProxyPassReverse /apps/ http://localhost:8080/apps/ #:servlet-path "/apps/" I did not have the trailing / in my tests and Apache did not forward apps;k-url to

[racket] Apache does not get along with RKT WebServer?

2012-04-20 Thread J G Cho
My search on previous discussions on this topic did not bring up a definitive answer so allow me to ask this question one more time. First, what does work: ProxyRequests Off ProxyPreserveHost On ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8000/ However, t

Re: [racket] Pulling BLOB from SQL DB

2012-04-16 Thread J G Cho
longer > than max_allowed_packet with NULL in query results. > > Could you try your program again with a version of Racket that includes my > changes? (In about four hours there should be a new nightly build at > http://pre.racket-lang.org/ that includes these changes.) > > Ryan

[racket] 2 minor suggestion to the Tutorial "Continue: Web Applications in Racket"

2012-04-14 Thread J G Cho
1. Currently the following Formlet is used: (define new-post-formlet (formlet (#%# ,{input-string . => . title} ,{input-string . => . body}) (values title body))) Although it is pretty and elegant, some people might benefit seeing the more verbose version: (define new-post-formle

[racket] Any one familiar with Racket + Apache setup?

2012-04-14 Thread J G Cho
Q1. Doc suggests using rewrite rule with Apache: RewriteEngine on RewriteRule ^(.*)$ http://localhost:8080/$1 [P,NE] What would that mean for URLs currently handled by Apache such as index.html /lib/foo.js /css/milli-helen.css /bar/xyz.php ,etc? The above seems like Apache acts as a go-between a

[racket] Racket with Apache

2012-04-14 Thread J G Cho
Doc suggests: RewriteEngine on RewriteRule ^(.*)$ http://localhost:8080/$1 [P,NE] What happens to URLs currently handled by Apache such as /index.html /foo/bar.php /css/milihelen.css ...? Has anybody tried Reverse Proxy? ProxyRequests Off Racket Users list: http://list

Re: [racket] Can't get PLaneT neil/json package today? Or is it just me?

2012-04-12 Thread J G Cho
Sounds like it's time for me to try out this Wireshark... Thanks for the great tips. On Thu, Apr 12, 2012 at 8:49 PM, Neil Van Dyke wrote: > J G Cho wrote at 04/12/2012 08:30 PM: > >> Does anyone know if it's possible to copy packages from my Laptop >> (seems to

Re: [racket] Can't get PLaneT neil/json package today? Or is it just me?

2012-04-12 Thread J G Cho
I just downloaded Racket 5.2.1 (SnowLeo). It seems to get the package from the PLanet fine. This is a bad news for me in terms of using Racket at its full strength at work. Does anyone know if it's possible to copy packages from my Laptop (seems to be under Library/Racket) to Linux (where would b

Re: [racket] Can't get PLaneT neil/json package today? Or is it just me?

2012-04-12 Thread J G Cho
(require (planet neil/json-parsing:1:=2)) which worked fine from my laptop (not behind the firewall). Would you know how I can 'undo' package installation such that I can try to re-install it (on the laptop at home) to rule out machine/location scenario? Thanks. On Thu, Apr 12, 2012 at 7:16 PM,

[racket] Can't get PLaneT neil/json package today? Or is it just me?

2012-04-12 Thread J G Cho
Just want to make sure this is not due to me trapped behind a Corp/Firewall. Here is what DrRacket tells me: PLaneT: downloading neil/json-parsing:1 from planet.racket-lang.org via HTTP PLaneT: PLaneT could not download the package "neil/json-parsing:1": Server did not include valid major and min

[racket] Pulling BLOB from SQL DB

2012-04-12 Thread J G Cho
While reading a BLOB from MySQL, DrRacket (5.2.1 on Win7) crashes every time. (SQL was like 'select blobcol from table LIMIT 1') Ran the same code via command line on Ubuntu. Racket seems to run out of memory due to the size of BLOB. Questions: How can I give more memory to /usr/local/bin/racket

[racket] db not in collects

2012-04-09 Thread J G Cho
Hello, I just compiled racket-textual-5.2.1-src-unix.tgz on Ubuntu and discovered that db module is not in collects directory. Not clear why so. I used db in Servlet without DrRacket before. Anyhow, how can I get it after the installation. (require db) throws an error instead its usual behavior

Re: [racket] Error installing whalesong

2012-01-18 Thread J G Cho
> Whalesong appears to be tickling a bug in Typed Racket under Racket > 5.2.  I apologize for this; I should have caught this when Racket 5.2 > came out.  I'll try to be better at tracking with Racket's subsequent > releases and make sure this doesn't happen again. > > I just released Whalesong 1.1

Re: [racket] Error installing whalesong

2012-01-17 Thread J G Cho
On Tue, Jan 17, 2012 at 5:24 PM, Danny Yoo wrote: > On Tue, Jan 17, 2012 at 5:09 PM, J G Cho wrote: >> Following instruction per http://hashcollision.org/whalesong/, I tried to run >> >> #lang racket/base >> (require (planet dyoo/whalesong:1:12/make-launcher))

[racket] Error installing whalesong

2012-01-17 Thread J G Cho
Following instruction per http://hashcollision.org/whalesong/, I tried to run #lang racket/base (require (planet dyoo/whalesong:1:12/make-launcher)) in DrRacket. (v 5.2 with unlimited memory flag, OSX Snow Leop with 1GB memorty) Dr complains during installation: Type Checker: Internal Typed Rack

Re: [racket] What is a comparable rkt code for curl command with HTTP Auth?

2012-01-08 Thread J G Cho
Thanks for all your help. Parse.com is now accepting POST from rkt! FYI, I had to modify regexp-replace #rx#"[\r\n]+$" to regexp-replace* #rx#"[\r\n]+" There were '\r\n' in the middle as well as at the end. On Sun, Jan 8, 2012 at 10:18 PM, Eli Barzilay wrote

Re: [racket] What is a comparable rkt code for curl command with HTTP Auth?

2012-01-08 Thread J G Cho
Thanks for the tip on base64-encode newline 'feature'. Kinda stuff that takes long to figure out on one's own. As for inspecting what curl is sending out, I modified the code from More: Systems Programming with Racket tutorial a bit: (define (handle in out) (copy-port in out) (display "bye" o

[racket] What is a comparable rkt code for curl command with HTTP Auth?

2012-01-07 Thread J G Cho
I am trying to see if I can do the following curl cmd (from Parse.com REST API) in rkt using (require net/*). (To eventually use it from WebServlet and not from my desktop where curl would suffice.) export APPLICATION_ID="your application id" export MASTER_KEY="your master key" curl --user $APPLI

[racket] Compile seems to stall or hang.

2012-01-05 Thread J G Cho
Compiling racket-textual-5.2 (unix) on EC2 (CentOS), seems to stall around: a - ../foreign/foreign.o a - ../foreign/libffi/src/closures.o a - ../foreign/libffi/src/debug.o a - ../foreign/libffi/src/java_raw_api.o a - ../foreign/libffi/src/prep_cif.o a - ../foreign/libffi/src/raw_api.o a - ../forei

Re: [racket] question about client side http post

2012-01-02 Thread J G Cho
Thank you very much. Excellent debugging! Your code/confirmation gave me the courage to look for other possibilities and resolved my issue. The real culprit turned out to be a very silly mistake on my part, which I am too ashamed to write here but it was not due to -> (which would've thrown an er

[racket] question about client side http post

2012-01-02 Thread J G Cho
I am trying to do client side HTTP POST using (require net/url) (post-pure-port URL post [header]) → input-port? URL : url? post : bytes? header : (listof string?) = null The following throws no exception but does not seem to do the intended job (I used Chrome to test the remote URL's get

Re: [racket] Formlets, Templates

2011-12-30 Thread J G Cho
On Tue, Dec 27, 2011 at 10:01 AM, Grant Rettke wrote: > On Mon, Dec 26, 2011 at 11:53 AM, J G Cho wrote: >> FYI, >> >> I've just started to tinker with formlets, templates, and forms from Wufoo. >> >> I forget things easily now, so I am writing down my study not

Re: [racket] Some more questions about using/composing Formlets

2011-12-29 Thread J G Cho
te: > On Thu, Dec 29, 2011 at 2:42 PM, J G Cho wrote: >> After tinkering with Formlets a bit, I have some questions for the experts. >> >> 1. I am trying to use Formlet with Template to piggy back >> on some given CSS/JSs (from Wufoo in this instance), >> which means I

[racket] Some more questions about using/composing Formlets

2011-12-29 Thread J G Cho
After tinkering with Formlets a bit, I have some questions for the experts. 1. I am trying to use Formlet with Template to piggy back on some given CSS/JSs (from Wufoo in this instance), which means I have to provide lots of #attributes and ((class "left right large small")) So, I am forced to do

[racket] Formlets, Templates

2011-12-26 Thread J G Cho
FYI, I've just started to tinker with formlets, templates, and forms from Wufoo. I forget things easily now, so I am writing down my study notes here (https://github.com/racketeer/racketeering/tree/master/wufooing). Looks like it could be of use to other newcomers to rkt. I would also welcome cr

Re: [racket] In rkt or scheme, is there way to refer to the value of last expression?

2011-12-12 Thread J G Cho
Thanks for all the good answers as usual. BTW, rkt is very "practical" in the sense it makes me think about programming in a way that I normally do not in my more mundane chores. On Tue, Dec 13, 2011 at 9:29 AM, Richard Cleis wrote: > I was thinking that a person mailing from 'fundingmatters' is

[racket] In rkt or scheme, is there way to refer to the value of last expression?

2011-12-12 Thread J G Cho
Just for the readability, is it possible to write some-list (proc-1 some-list) (proc-2 (val-of-last-expression)) ... (proc-n (val-of-last-expression)) ;where n is 'largeish' instead of (proc-n ... (proc-2 (proc-1 some-list Just curious, jGc _

[racket] HTML element to string (and vice versa)

2011-12-08 Thread J G Cho
To HTML parser experts: I am trying to transform a div tag in the following HTML document: (define an-html (h:read-html (open-input-string (string-append "My title" "Hello worldreplace meTesting!" "" I want replace me to read something like I am replaced. I am trying (wit

Re: [racket] V5.2 (sequence? 2)

2011-11-10 Thread J G Cho
> > iterates `i' from 0 to 9. > > At Wed, 9 Nov 2011 23:20:37 -0700, Jay McCarthy wrote: >> It is intentional. It broke mongodb too, but I forget what the >> justification was. I think Matthew made the chance... but I forget >> when. >> >> On Wed,

[racket] V5.2 (sequence? 2)

2011-11-09 Thread J G Cho
Congrats to the new release. Some of my tests were failing under 5.2 Upon some poking around, I find (sequence? 2) now return #t is the culprit. Is this change intentional? If so, why? Regards, jgc _ For list-related administrative tasks: http

Re: [racket] A function (in web-servlet) is expected to be invoked just once but seems to have more lives ...

2011-08-05 Thread J G Cho
ml (body (h1 "ok") > > (serve/servlet start >               #:port 8080 >               #:servlet-regexp #rx"") > > On Fri, Aug 5, 2011 at 9:30 AM, J G Cho wrote: >> There was a discussion about TOPSL paper not too long ago. I've been >> readi

[racket] A function (in web-servlet) is expected to be invoked just once but seems to have more lives ...

2011-08-04 Thread J G Cho
There was a discussion about TOPSL paper not too long ago. I've been reading it with much interest and studying the code from SourceForge as well. In the course of my study, I wrote this code. (I think it's the kind that TOPSL was designed to replace/obviate.) Anyway there is one obvious bug in the

Re: [racket] Unexpected error extracting value from request bindings.

2011-07-31 Thread J G Cho
; other way. The bindings library produces symbols from strings, so they aren't > eq to the gensym'd one. > > Jay > > Sent from my iPhone > > On 2011/07/31, at 15:13, J G Cho wrote: > >> I am a bit puzzled by this error: >> >> >> Exception &

[racket] Unexpected error extracting value from request bindings.

2011-07-31 Thread J G Cho
I am a bit puzzled by this error: Exception The application raised an exception with the message: extract-binding/single: 'q10493 not found in '((q10493 . "no")) Context: Symbol q10493 was generated by (gensym 'q) and used in (list (radio-input (symbol->string nom) "yes") (ra

Re: [racket] Print Cookie Path issue

2011-07-01 Thread J G Cho
> Looks like "cookie-path", for one, can add the quotes (indirectly; > ultimately in "convert-to-quoted"). I read that part after sending this email inquiry. It does seem to have some rules RFC rules about quoting string. ;; value: token | quoted-string (define (rfc2109:value? s) (or (rfc2068:

[racket] Print Cookie Path issue

2011-07-01 Thread J G Cho
(map (λ (item) (display (header-field item)) (display " ") (display (header-value item)) (newline) item) (list (cookie->header (make-cookie "id" "joseph" #:max-age 500 #:path "/" outputs: Set-Cookie id=joseph; Max-Age=500; Path="/"; Version=1 I thin

[racket] Setting cookie with (make-cookie name val #:path "/") is causing subsequent reading to fail.

2011-06-30 Thread J G Cho
Without #:path optional arg, when I write cookie while at URL /abc/efg, the cookie path is set to /abc. I can read the cookie while at URL such as /abc/xyz. This seems to work as expected. So I tried setting cookie with #:path "/" such that I can read the cookie 'site-wide'. It did not seem to w

Re: [racket] Help needed in writing Macro to transform (lambda (req) ....) to be used in web-server/servlet using auth cookies

2011-06-26 Thread J G Cho
> > What did you think it would do? I had in mind that it would start a loop listening on 8080... > > The documentation above that example says: > > "Constructs an appropriate dispatch-server-config^, invokes the > dispatch-server@, and calls its serve function." > > And serve (found from clickin

Re: [racket] Help needed in writing Macro to transform (lambda (req) ....) to be used in web-server/servlet using auth cookies

2011-06-25 Thread J G Cho
expected. Not that this helps me at all. ((start-file-server (current-directory))) just returns. Is there something else I can/should try? On Sat, Jun 25, 2011 at 10:56 PM, Jay McCarthy wrote: > 2011/6/25 J G Cho : >> Yikes. I did read those documents before sometime ago when I started

Re: [racket] Help needed in writing Macro to transform (lambda (req) ....) to be used in web-server/servlet using auth cookies

2011-06-25 Thread J G Cho
ize the server to do exactly what > you want. > > Launching a server with your custom dispatcher is as easy as using > serve/servlet or web-server/insta: > > http://docs.racket-lang.org/web-server-internal/web-server.html > > Jay > > 2011/6/25 J G Cho : >> Seems

Re: [racket] Help needed in writing Macro to transform (lambda (req) ....) to be used in web-server/servlet using auth cookies

2011-06-25 Thread J G Cho
req) > (authenticated? req)) (next-dispatcher) (display-error/login-page >  (dispatch/servlet ...))) > > Then the servlet code can basically ignore the authenticator. > > Jay > > 2011/6/24 J G Cho : >> Hello again, >> >> I am guessing my problem calls for

[racket] Help needed in writing Macro to transform (lambda (req) ....) to be used in web-server/servlet using auth cookies

2011-06-24 Thread J G Cho
Hello again, I am guessing my problem calls for macro (which is "beyond my pay scale") and I am hoping this is the right place. Anyway, after reading this http://docs.racket-lang.org/web-server/faq.html#(part._.What_special_considerations_are_there_for_security_with_the_.Web_.Server_) I am led t

Re: [racket] Cookie Indigestion

2011-05-18 Thread J G Cho
t > > Notice at the top I just get the substring of the BASE64. > > Jay > > 2011/5/18 Neil Van Dyke : >> J G Cho wrote at 05/18/2011 04:23 AM: >>> >>> (define (make-digest s1 s2) >>>  (bytes->string/utf-8 >>>  (base64-encode >>>   (

[racket] Cookie Indigestion

2011-05-18 Thread J G Cho
Hello, back with more questions about Web-Server doc. I am going over HTTP Cookie section. Per recommendation, read MIT Cookie Eaters paper. I am left with impression that I am to use exp=t&data=s&digest=MAC(exp=t&data=s) as an authenticator Cookie after a valid login. So I am trying out with s

[racket] xexpr to mark a radio button 'checked'

2011-04-27 Thread J G Cho
I am trying to print: the egg The closest I can come up is: checkedthe egg Valid XML but not quite what a browser wants. Is this (the first line) possible with xexpr? jGc _ For list-related administrative tasks: http://lists.racket-lang.org/li

Re: [racket] I did not expect this code to work but it did. So now I am a bit puzzled by how dispatch-rule work with K-URL.

2011-04-23 Thread J G Cho
ordinate > different parts of the app. If you wanted to do that, you'd have to > write a dispatcher to sit outside the servlet dispatcher. > > Jay > > 2011/4/23 J G Cho : >> At the bottom of this email is a code that I did not think would work but it >> did.  (The c

[racket] I did not expect this code to work but it did. So now I am a bit puzzled by how dispatch-rule work with K-URL.

2011-04-23 Thread J G Cho
At the bottom of this email is a code that I did not think would work but it did. (The code is a combination of get-number and count-dot-com tutorial. I first ask the user to type in a number. If it's 42, then count-dot-com is evaluated. If not 42, it keeps asking for a number. (To run it, you mig

Re: [racket] Some newbie trouble on running Web Server on EC 2

2011-04-22 Thread J G Cho
ote: > On Wed, Apr 20, 2011 at 6:03 PM, J G Cho wrote: >> 1. Following along the system (aka '/more') tutorial: When evaluating >> (require readline), REPL sometimes hangs but not all the time. > > Dunno. > >> 2. Following along the blog webapp: When runn

[racket] Some newbie trouble on running Web Server on EC 2

2011-04-20 Thread J G Cho
FYI I've been going thru 2 Racket tutorials (http://docs.racket-lang.org/continue/index.html and http://docs.racket-lang.org/more/index.html). Very informative, and they run fine on my laptop. (OSX Intel 10.6.7 Racket 5.1) In addition, I am trying to run them on Amazon EC2 with some challenges (d

Re: [racket] webserver mapping servlets to path

2011-04-18 Thread J G Cho
as a static file.) Going back to the tutorials. jGc On Mon, Apr 18, 2011 at 9:11 AM, Jay McCarthy wrote: > Hi jGc, > > It is actually simpler than Noel suggests. Scroll down... > > 2011/4/16 J G Cho : >> To those familiar with Web Server, >> >> I am a bit lost

[racket] webserver mapping servlets to path

2011-04-16 Thread J G Cho
To those familiar with Web Server, I am a bit lost trying to map servlets to paths. e.g.: servlet1.rkt should requests to http://localhost:8080/app1 servlet2.rkt should requests to http://localhost:8080/app2 etc. First, I tried the following: (require "servlet1.rkt" "servlet2.rkt") ; they expo