Re: [racket] Why is this slow?

2013-04-24 Thread Jordan Schatz
Jens Axel Søgaard writes: > I better take the blame for the number-theory collection :-) Ah, sorry for the miss attribution. > In the number-theory module I used remainders modulo 60=2*2*3*5. > The trick is that there are exactly 16 numbers modulo 60, that > stems from non-primes. One can therefo

Re: [racket] Why is this slow?

2013-04-24 Thread Jordan Schatz
Gary Baumgartner writes: > The `range` function produces a list, which is a big overhead for each time > the inner loop executes. There's a big improvement changing the inner loop > sequence clause to just [p n]. There's a bit more improvement making that > [p (in-range n)], which is recognize

[racket] Why is this slow?

2013-04-23 Thread Jordan Schatz
I'm working through some programing puzzles, and one of them was to find the sum of all primes less the 2 million, the new math/number-theory collection (thanks Neil) makes it easy: #lang racket (require math/number-theory) ;;takes about 4 seconds (apply + (filter prime? (range 1 200))) Bu

[racket] TOPSL language?

2012-11-10 Thread Jordan Schatz
I came across this: "Topsl: a domain-specific language for on-line surveys" http://topsl.sourceforge.net/ it appears to have been a library / planet package for Racket, its older though. Does anyone know if there has been further work done on it, or a related project? Thanks, Jordan

Re: [racket] html -> pdf?

2012-09-26 Thread Jordan Schatz
te "hard copy" PDF from content marked up in html and CSS, since html+css is nicer to work with then PS / PDF, and since I already have the content in HTML form... Thanks, Jordan On Tue, 25 Sep 2012 14:16:34 -0500, Carson Chittom wrote: > Jordan Schatz writes: > > > Is any

[racket] html -> pdf?

2012-09-25 Thread Jordan Schatz
Is anyone aware of a way to take arbitrary html pages and turn them into pdfs? At the moment it looks like I would need to write Racket bindings for a html rendering engine (WebKit or Gecko), render the page, capture the output as a bitmap and embed it in a PDF... but that sounds like the long wa

[racket] Web server warnings?

2012-09-23 Thread Jordan Schatz
For awhile now the webserver spits out abunch of these messages: peek-byte: input port is closed context...: /home/jordan/bin/lib/racket/collects/web-server/private/dispatch-server-unit.rkt:74:2: connection-loop I think it only happens when the server is using SSL, is it an indication t

Re: [racket] Webserver, SSL, and intermediate certificates

2012-09-23 Thread Jordan Schatz
d come first, and then any intermediate certs. Thanks! Jordan On Fri, 21 Sep 2012 15:32:22 -0600, Jordan Schatz wrote: > > I tried, the web server doesn't give an error, but all the browsers I've tried > still complain about the missing intermediate CA. > > On Fri, 21 Sep

Re: [racket] Webserver, SSL, and intermediate certificates

2012-09-21 Thread Jordan Schatz
I tried, the web server doesn't give an error, but all the browsers I've tried still complain about the missing intermediate CA. On Fri, 21 Sep 2012 22:11:32 +0200, Stefan Schmiedl wrote: > On Fri, 21 Sep 2012 11:24:39 -0600 > Jordan Schatz wrote: > > > > >

Re: [racket] Webserver, SSL, and intermediate certificates

2012-09-21 Thread Jordan Schatz
are, so I presume that it doesn't support them. > If you can give me some docs or test cases to work with, I could see > how difficult it is to implement. > > Jay > > On Fri, Sep 21, 2012 at 11:24 AM, Jordan Schatz wrote: > > > > I have an SSL certificate that d

[racket] Webserver, SSL, and intermediate certificates

2012-09-21 Thread Jordan Schatz
I have an SSL certificate that depends on an intermediate certificate, but I cant find anything in the documentation on how to tell the web server that my cert needs the intermediate certificate... Are intermediate certificates supported? anyone know of a work around? Thanks, Jordan _

[racket] unwrapping a list

2012-06-11 Thread Jordan Schatz
Is there a way to unwrap or explode a list? I don't see it in the docs, but it seems like it would be a common thing. This is what I want to do: (define-values (year month day) (regexp-split #rx"/" "2012/06/06")) But regexp-split returns a list, not values, so I'd like to "unwrap" the list an

Re: [racket] Web server templates

2012-06-06 Thread Jordan Schatz
I'll have to look into what Jay wrote, as I didn't know it was possible and I'll have to read the docs abit before I really understand it. But I've been getting around (mostly) the write code -> kill server / start server -> test -> debug -> kill server / start server work flow by coding/testing

[racket] code metrics

2012-05-29 Thread Jordan Schatz
Anyone know of a good tool to measure racket code? Some measurements I'd like are: - Total source lines of code - Total unique source lines of code - Number of modules - Number of functions - Number of tests - Test coverage - Average number of lines per module - Maximum number of lines pe

Re: [racket] Serving http and https from the same server

2012-05-29 Thread Jordan Schatz
om both HTTP and HTTPS. > > Jay > > On Mon, May 28, 2012 at 10:36 PM, Jordan Schatz wrote: > > > > Is it possible to serve http and https from the same servlet? > > > > I would like to serve most of my application over SSL, but have a way to >

[racket] Serving http and https from the same server

2012-05-28 Thread Jordan Schatz
Is it possible to serve http and https from the same servlet? I would like to serve most of my application over SSL, but have a way to redirect people from http to https. - Jordan Racket Users list: http://lists.racket-lang.org/users

[racket] Method + URL based dispatch

2012-05-26 Thread Jordan Schatz
I would like to dispatch requests based on a combination of URL and HTTP method. For example a GET request to /path-to-resource would be dispatched to one function, and a POST request to /path-to-resource would be dispatched to another function. The built in dispatch http://docs.racket-lang.org/we

Re: [racket] racket and libcURL

2012-03-21 Thread Jordan Schatz
> Wait… don't Racket's built-in libraries already handle all of those > cases? FWIW I use libcurl alot (in other languages), its awesome and I initially looked for a Racket wrapper... I didn't find one, but since get/put/post/head/delete-impure-port have support for TLS now, and full control of he

Re: [racket] Whither ProfessorJ

2012-01-17 Thread Jordan Schatz
> Excising all Java silliness would leave one with the empty set: { }. > But, thank you for your explanation. I believe you've said here > that you plan to resume work on the book "real soon now" ... I look > forward to that product eagerly. I know that Java has its place, I think that place is a

[racket] sirmail

2012-01-15 Thread Jordan Schatz
Does sirmail have any spam filtering abilities? I see the filtering of messages based on a message header regexp but I'm in need of something that learns from spam / ham and can autoclassify. Thanks, Jordan Racket Users list: http://lists.racket-lang.org/users

Re: [racket] a question of style, and one of performance

2012-01-09 Thread Jordan Schatz
ork is in PHP, and in it you can only use simple values (no variables, functions, class methods etc) as default function arguments. -Jordan On Sun, Jan 08, 2012 at 03:42:51PM -0500, Danny Yoo wrote: > On Sun, Jan 8, 2012 at 3:23 PM, Jordan Schatz wrote: > > This code runs, but I'

Re: [racket] mime/multipart parsing

2012-01-09 Thread Jordan Schatz
Jan 08, 2012 at 12:17:34PM -0700, Matthew Flatt wrote: > At Sun, 8 Jan 2012 06:59:47 -0700, Jordan Schatz wrote: > > > Was this input perhaps extracted as a part of an enclosing multi-part > > > message? (Maybe not using `net/mime' for that outer message?) > > The

[racket] a question of style, and one of performance

2012-01-08 Thread Jordan Schatz
This code runs, but I'm guessing that its not the "right way" to do it. (define (js-date [i (current-date)]) (let ([original-format (date-display-format)] [return ((λ () (date-display-format 'rfc2822) (date->string i #t)))]) (date-display-for

Re: [racket] mime/multipart parsing

2012-01-08 Thread Jordan Schatz
/mime' for that outer message?) > > SirMail, which has been my mail client, uses `net/mime', so I'm fairly > confident that the library works on real messages --- no problems in > the last decade or so. > > At Sat

Re: [racket] mime/multipart parsing

2012-01-07 Thread Jordan Schatz
e)' instead of > `(entity-fields inner-entity)' will get you the headers that include > "X-Riak-Vclock: ...". The result of `(entity-fields inner-entity)' > would correspond to a further m

[racket] mime/multipart parsing

2012-01-06 Thread Jordan Schatz
I'm having difficulties parsing mime multipart messages (probably I missed something in the docs again). I have this code: -- #lang racket (require net/mime) (define ip (open-input-string "--9nbsYRvJBLRyuL4VOuuejw9LcAy Cont

Re: [racket] question about client side http post

2012-01-02 Thread Jordan Schatz
It looks correct to me, except for port-string should be port->string (note the ->). The string that the server returns will depend on what the server responds, so your server code would need to echo the value or give some other confirmation, if that is how you are verifying that the data was sent

Re: [racket] Racket documentation for web development is just awful!

2011-12-19 Thread Jordan Schatz
On Sun, Dec 18, 2011 at 05:19:11PM -0500, Danny Yoo wrote: > I think you're really complaining about the following: you're not > finding easy "next steps" to continue after the Continue tutorial. Is > that your understanding as well? > > That would mean, not that the reference documentation is no

Re: [racket] Racket documentation for web development is just awful!

2011-12-19 Thread Jordan Schatz
> web world!). Let's face it: Jay McCarthy is perhaps an excellent > programmer and all his honor. But, as a documentation writer, this man > has no idea. This is my well-intentioned advice to this community: let > someone with more literary talent to write documentation for web > development in t

Re: [racket] Racket documentation for web development is just awful!

2011-12-19 Thread Jordan Schatz
> write it with the help of list members here. I've got the barest of a start here: http://github.com/shofetim/Racket-the-Missing-Manual On Sat, Dec 17, 2011 at 11:18:03AM -0500, Matthias Felleisen wrote: > > Dear Racket Noon, thank you for outspoken criticism. There is no > question that all o

Re: [racket] web server log format

2011-12-12 Thread Jordan Schatz
On Mon, Dec 12, 2011 at 04:38:06PM -0500, Eli Barzilay wrote: > The common reason to not include it is when the response comes from > code, and you can't include the size before you've run the code which > means that you have to hold the complete response somewhere before you > send it. Thanks Eli

Re: [racket] web server log format

2011-12-12 Thread Jordan Schatz
On Mon, Dec 12, 2011 at 11:30:59AM -0700, Jay McCarthy wrote: > But the Racket Web server only has request logging by default, not response > logging, so it makes something up in these positions. I will update the > docs to mention this. I think that a single dash is typically used if a value is m

Re: [racket] Racket Web Server

2011-12-12 Thread Jordan Schatz
https://github.com/shofetim/Racket-Riak Its very much still a work-in-progress. You can store, update, retrieve, get server status, get/set bucket properties, and map reduce. I need to update it for some changes in riak 1.0, add support for Luwak, and handle multipart responses. I also want to loo

Re: [racket] Racket Web Server

2011-12-11 Thread Jordan Schatz
On Sun, Dec 11, 2011 at 04:25:46PM -0600, Gerry Weaver wrote: > I am new to Racket and Lisp/Scheme in general. I am trying to write a > simple rest web service in Racket, but I'm not making much > progress. Unfortunately, I don't find the Racket docs to be very > helpful. I guess my brain just isn'

[racket] # in xexpr

2011-12-09 Thread Jordan Schatz
I think thats there must be a "lisp" way of doing this, but I'm still too new to see how. Anyone care to enlighten me? I'm trying to create a function that produces an xexpr: (define (custom-input name #:class [class "xlarge"] #:id [id #f]

Re: [racket] Running a webserver on port 80

2011-12-09 Thread Jordan Schatz
http://docs.racket-lang.org/web-server/faq.html ? -Jordan On Fri, Dec 09, 2011 at 09:09:11PM -0500, Neil Van Dyke wrote: > Jay McCarthy wrote at 12/09/2011 08:38 PM: > >On Fri, Dec 9, 2011 at 5:36 PM, Jordan Schatz > >mailto:jor...@noionlabs.com>> wrote: > > > >Wh

Re: [racket] web server log format

2011-12-09 Thread Jordan Schatz
sometime > tomorrow. > > Jay > > On Fri, Dec 9, 2011 at 5:07 PM, Jordan Schatz wrote: > > > I have a web server with logging setup like so: > > (serve/servlet start > > #:log-file "../logs/server" > > #:log-format '

[racket] Running a webserver on port 80

2011-12-09 Thread Jordan Schatz
What is considered the best way to run a web server as non-root and accept connections on port 80? I believe Apache handles it by being started as root, binding to the port, and then dropping privileges. I don't think that the racket web server knows to drop any privileges? I'm guessing that comm

[racket] web server log format

2011-12-09 Thread Jordan Schatz
I have a web server with logging setup like so: (serve/servlet start #:log-file "../logs/server" #:log-format 'apache-default) Here are the headers from a client request HTTP/1.1 200 OK Date: Fri, 09 Dec 2011 21:23:16 GMT Last-Modified: Thu, 08 Dec 2011 05:04:56 GMT S

[racket] dispatch-rules

2011-12-08 Thread Jordan Schatz
The docs don't seem to specify, and I can't get it to work, so am I correct that dispatch-rules cant handle url patterns that contain slashes? ;;Doesn't work (define-values (static-dispatch static-url) (dispatch-rules ;;None of these functions take any arguments [("invoice/dashboard") dashb

Re: [racket] Web server and URL dispatch

2011-12-05 Thread Jordan Schatz
> <<< > > Where do you think a different example should go? Somewhere on > > http://docs.racket-lang.org/web-server/dispatch.html > > ? > > On Fri, Dec 2, 2011 at 8:15 PM, Jordan Schatz wrote: > > > On Fri, Dec 02, 2011 at 06:23:38PM -0700, Jay

Re: [racket] Web server and URL dispatch

2011-12-02 Thread Jordan Schatz
On Fri, Dec 02, 2011 at 06:23:38PM -0700, Jay McCarthy wrote: > The blog-dispatch function returned by dispatch-rules has the contract > "request? -> response?" so you pass it in in place of "start" to > serve/servlet: > > (serve/servlet blog-dispatch ...) > > It is not a "dispatcher" in the Web

[racket] Web server and URL dispatch

2011-12-02 Thread Jordan Schatz
Its unclear to me how to get url dispatch working... -- #lang web-server (require web-server/templates web-server/dispatch web-server/web-server) (define-values (blog-dispatch blog-url) ;;blog-dispatch is our

Re: [racket] doctype in an xexpr?

2011-11-28 Thread Jordan Schatz
e/xexpr > #:preamble #"" > `(html (head (title "Hello world!")) > (body (p "Hey out there!") > > On Sat, Nov 26, 2011 at 9:44 PM, Jordan Schatz wrote: > > > I don't see any way to include a DOCTYPE declaration in an x

[racket] doctype in an xexpr?

2011-11-26 Thread Jordan Schatz
I don't see any way to include a DOCTYPE declaration in an xexpr? (define (start req) (response/xexpr "" `(html (head (title "Hello world!")) (body (p "Hey out there!") (except of course that doesn't work : ) Shalom, Jordan _

Re: [racket] Google Challenge

2011-11-22 Thread Jordan Schatz
On Tue, Nov 22, 2011 at 01:30:27PM -0500, Neil Van Dyke wrote: > Some clever students should show that the old ways of our people are > not lost... and spend their (US) Thanksgiving weekend hacking Racket on > "http://aichallenge.org/";. It would probably help if there was a racket starter package

Re: [racket] formlet-fill

2011-11-21 Thread Jordan Schatz
On Mon, Nov 21, 2011 at 06:32:18AM -0700, Jay McCarthy wrote: > I can imagine implementing something like... > > (define record-formlet > (formlet > ;; Define the input format > ([name (hash-ref this 'name)] > [company (hash-ref this 'company)] >

Re: [racket] formlet-fill

2011-11-19 Thread Jordan Schatz
; be a formlet. If you can clarify your use case, it may be worth > investigating. > > Jay > > On Fri, Nov 18, 2011 at 1:13 PM, Jordan Schatz wrote: > > > > > I have a pattern of user interaction that is common in my web app: > > > > I have a db record, I present

[racket] formlet-fill

2011-11-18 Thread Jordan Schatz
I have a pattern of user interaction that is common in my web app: I have a db record, I present it to the user in a form, the user edits the form, submits it, server side logic validates it, and then returns the same form with the updated record. I want to port the app to Racket, and I thought

[racket] formlets and . => .

2011-11-17 Thread Jordan Schatz
What does => mean? I see it used in formlets: >From http://docs.racket-lang.org/web-server/formlets.html?q=formlets like: (define date-formlet (formlet (div "Month:" ,{input-int . => . month} "Day:" ,{input-int . => . day}) (list month day))) Which I think should be and appears t

Re: [racket] Why internal definitions?

2011-11-16 Thread Jordan Schatz
> (define (foo x) > (define i 10) > (define j 12) > (+ i j x)) > > It's preferable to local defines for aesthetic reasons because it > consumes less horizontal space (a smaller indentation). So it is really only a matter of style, not semantics/meaning, and the preference is for: (define

[racket] Why internal definitions?

2011-11-15 Thread Jordan Schatz
>From Racket v5.2 release notes: > Internal-definition expansion has changed to use let* semantics for > sequences that contain no back references. This change removes a > performance penalty for using internal definitions instead of let in > common cases, and it only changes the meaning of progra

[racket] I'd use an object for this in PHP, how do I handle it in racket?

2011-11-04 Thread Jordan Schatz
I'm making an API wrapper for the WebDriver wire protocol: http://code.google.com/p/selenium/wiki/JsonWireProtocol#Command_Detail In general all of the API calls require me to pass back to the server a token (:sessionId in the spec) that is unique to the current instance. In PHP or some "other" la

Re: [racket] Call racket with long code from racket

2011-09-08 Thread Jordan Schatz
Niitsuma, > I am trying to call racket with long code from racket You might have the wrong idea... calling another racket process to evaluate some code is probably doing things the hard way. Have a look at the eval function: http://doc.racket-lang.org/reference/eval.html?q=eval#(def._((quote._~2

Re: [racket] Planet Packages

2011-08-24 Thread Jordan Schatz
> I think the thing to do is to contact the author and ask if you can > help, or, if s/he is not planning on updating the package, whether > s/he would mind if you released a modified version of the package. Thanks guys, I'll contact the original dev and take things from there. Shalom, Jordan

[racket] Planet Packages

2011-08-24 Thread Jordan Schatz
There is a planet package that looks like it's author is too busy to maintain (it has open bugs, and some with unmerged patches, and they are many months old) that I plan on fixing for my own needs... What is the proper etiquette for getting a version with my updates into planet? On github I would

Re: [racket] bug?

2011-07-07 Thread Jordan Schatz
a (ip) (copy-port ip (current-output-port)) (newline)) (list "User-Agent: racket")) Works like a charm... Shalom, Jordan On Mon, Jun 27, 2011 at 03:19:36AM -0400, Eli Barzilay wrote: > 8 hours ago, Jordan Schatz wrote: > > I'm not sure if this is considered a bu

Re: [racket] bug?

2011-06-29 Thread Jordan Schatz
have no idea. Shalom, Jordan On Mon, Jun 27, 2011 at 03:19:36AM -0400, Eli Barzilay wrote: > 8 hours ago, Jordan Schatz wrote: > > I'm not sure if this is considered a bug in racket or in the SSL > > implementation at mtgox.com. The mtgox url does work fine for me > > v

[racket] bug?

2011-06-26 Thread Jordan Schatz
#lang racket (require net/url) ;; Works (call/input-url (string->url "https://encrypted.google.com";) get-pure-port (lambda (ip) (copy-port ip (current-output-port)) (newline))) ;; Doesn't work (call/input-url (string->url "https://mtgox.com/code/data/ticker.php";) get-pure-port (lam

Re: [racket] retrieving an https url

2011-06-18 Thread Jordan Schatz
> HTTPS support should *really*, *really* be in Racket out of the box, > so that "get-pure-port" and friends do the right thing whether it's > HTTP or HTTPS. I'd second that... I haven't gotten to it yet but I think serving HTTPS also requires jumping through some hoops? Anyway HTTPS is something

[racket] retrieving an https url

2011-06-17 Thread Jordan Schatz
I am still pretty new to Racket, I've built a few trivial projects and am now jumping into a more serious app. One of the first things I need to be able to do though is work with (as a client, not server) https urls. GET PUT POST HEAD DELETE, and most of the time send special headers. I have seen

[racket] #lang scheme vrs #lang racket in libraries

2011-05-09 Thread Jordan Schatz
I'm working on updating a racket library that someone else wrote and hope to make it into a planet package. I've noticed that several of the planet packages (and the code that I am working on) start out with #lang scheme and then (require racket), which to me looks like the same thing as just doing

Re: [racket] stop IE8 on Win7 blocking Help Desk search

2011-05-06 Thread Jordan Schatz
This is the only way I am aware of to get IE to automatically run JS in local files: http://technet.microsoft.com/en-us/library/cc749149(WS.10).aspx (keep reading, it starts there but the important bit is a couple paragraphs down) It makes no sense to me why IE does that... Shalom, Jordan On F

Re: [racket] sqlite: how to open a database via the web ?

2010-10-15 Thread Jordan Schatz
You may be confusing web (URL) paths with file system paths. If you move the SQLite database file to a different location on the file system you will need to change the path, but otherwise it stays the same. You might also want to put the DB file outside of the webroot, so that it couldn't be dow