[racket-users] RabbitMQ

2015-09-10 Thread Jack Firth
Has anyone implemented a RabbitMQ client in racket? Is anyone working on it and 
partway there? I'm trying to set up a distributed task system like Celery in 
Python which needs the workers to be in Racket.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Automatic dependency fixer

2015-09-10 Thread 'John Clements' via Racket Users

> On Sep 9, 2015, at 12:52 PM, Jack Firth  wrote:
> 
> I've written a web service that wraps a useful script Sam wrote for 
> automatically creating a Github pull request to fix a package's dependencies. 
> The web service is linked to a Github account named Racket Package Dependency 
> Fixer, and is scheduled to fix all package dependencies in the catalog once a 
> day. So if your package has some dependency issues, you should see a PR show 
> up from that account eventually.
> 
> There's still a few things to work on with it and I wouldn't call it stable, 
> but I hope you all find it useful.

Very cool! Can’t wait for it to start working.

John Clements



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] RabbitMQ

2015-09-10 Thread Tony Garnock-Jones
On 09/10/2015 01:21 PM, Jack Firth wrote:
> Has anyone implemented a RabbitMQ client in racket? Is anyone working
> on it and partway there? I'm trying to set up a distributed task
> system like Celery in Python which needs the workers to be in
> Racket.

I recommend implementing STOMP rather than AMQP. I have a Racket STOMP
client: https://github.com/tonyg/racket-stomp

Hmm, apparently I haven't turned it into a package yet. I'll get onto that.

Tony

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unexpected output from get-pure-port.

2015-09-10 Thread Greg Hendershott
It might be that the server is giving a 30x Redirect response? Which
wget automatically follows, but get-pure-port by default does not.

Does it help if you supply a non-zero value like say 10 for the
optional #:redirections argument to get-pure-port?


If it still isn't working, you could try using get-impure-port,
calling purify-port to get the headers, and seeing what they say.



On Thu, Sep 10, 2015 at 4:46 PM, R. Clayton  wrote:
> I'm trying to download a page using get-pure-port and I'm not getting the
> result I expected:
>
>   $ cat d.rkt
>   #lang racket
>
>   (require net/url)
>
>   (define library-url (string->url
> "http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;))
>
>   (call/input-url
> library-url
> get-pure-port
> port->string)
>
>   $ mzscheme --eval '(require "d.rkt")' > r.html
>
>   $ wget -O w.html --quiet 
> "http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;
>
>   $ wc -lc [wr].html
>1   5618 r.html
> 3353 116900 w.html
> 3354 122518 total
>
>   $ mzscheme --version
>   Welcome to Racket v6.2.
>
>   $
>
> And no, example.com is not the hostname I used.  The fields in library-url 
> seem
> reasonable when compared to the url string.  Why is there a difference
> between the results of get-pure-port and wget?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Unexpected output from get-pure-port.

2015-09-10 Thread R. Clayton
I'm trying to download a page using get-pure-port and I'm not getting the
result I expected:

  $ cat d.rkt
  #lang racket

  (require net/url)

  (define library-url (string->url
"http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;))

  (call/input-url
library-url
get-pure-port
port->string)

  $ mzscheme --eval '(require "d.rkt")' > r.html

  $ wget -O w.html --quiet 
"http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;

  $ wc -lc [wr].html
   1   5618 r.html
3353 116900 w.html
3354 122518 total

  $ mzscheme --version
  Welcome to Racket v6.2.

  $
  
And no, example.com is not the hostname I used.  The fields in library-url seem
reasonable when compared to the url string.  Why is there a difference
between the results of get-pure-port and wget?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Make, in place build, was Re: [racket-users] Racket v6.2

2015-09-10 Thread Anthony Carrico
On 09/10/2015 04:27 PM, Matthew Flatt wrote:
> At Thu, 10 Sep 2015 15:10:27 -0400, Anthony Carrico wrote:
>> This failed to
>> build, I guess because of package mismatches, so I pulled and tried
>> again, which failed.
> 
> I'm a little curious about that failure, but many things can go wrong
> at this level.

I'll forward you a transcript of a failed build.

-- 
Anthony Carrico

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Make, in place build, was Re: [racket-users] Racket v6.2

2015-09-10 Thread Anthony Carrico
On 09/10/2015 08:40 PM, Anthony Carrico wrote:
> I'll forward you a transcript of a failed build.

FYI: Off list Matthew suggested that it ran out of memory, and indeed
the build succeeds with more free memory.

-- 
Anthony Carrico


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


[racket-users] Re: Unexpected output from get-pure-port.

2015-09-10 Thread R. Clayton
  Thanks for your reply to my message.
  
It might be that the server is giving a 30x Redirect response? Which wget
automatically follows, but get-pure-port by default does not.

Does it help if you supply a non-zero value like say 10 for the optional
#:redirections argument to get-pure-port?

  Yes, I saw that mentioned during my Web search.  It turns out not to matter:

$ cat d.rkt
#lang racket

(require net/url)

(define library-url (string->url
  "http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;))

(call/input-url
  library-url
  (lambda (u) (get-pure-port u #:redirections 10))
  port->string)

$ mzscheme --eval '(require "d.rkt")' > rr.html

$ diff r.html rr.html

  But maybe I don't have the right number of redirects.  Approaching the
  question from the other direction:

$ wget --max-redirect=0 -O ww.html --quiet 
"http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;

$ diff w.html ww.html

$

If it still isn't working, you could try using get-impure-port, calling
purify-port to get the headers, and seeing what they say.

  Ah, ok:

$ cat d.rkt
#lang racket

(require net/url)

(define library-url (string->url
  "http://example.com/search?/ftlist^bib18%2C1%2C0%2C2703/mode=2;))

(define port (get-impure-port library-url))

(purify-port port)

$ mzscheme --eval '(require "d.rkt")' | sed -e 's/\\r\\n/~/g' | tr '~' 
'\012'
"HTTP/1.1 200 OK
Date: Fri, 11 Sep 2015 01:10:39 GMT
Server: III 100
Pragma: no-cache
Content-Type: text/html; ISO-8859-1
Expires: Fri, 11 Sep 2015 01:10:39 GMT
Cache-control: no-cache
Set-Cookie: SESSION_LANGUAGE=eng; path=/; domain=.example.com; path=/
Set-Cookie: III_EXPT_FILE=aa20885; path=/; domain=.example.com; path=/
Set-Cookie: III_SESSION_ID=3ba8ef1c57601a925bc732a44b4bb791; 
domain=.example.com; path=/
Set-Cookie: SESSION_SCOPE=0; path=/
Vary: User-Agent,Accept-Encoding
Transfer-Encoding: chunked

"

$

  To the extent I understand these things (just barely), the header looks ok.

  I futzed around with other urls (google, reddit/programming) and was able to
  get roughly the same pages back from racket and wget.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Unexpected output from get-pure-port.

2015-09-10 Thread Greg Hendershott
On Thu, Sep 10, 2015 at 9:26 PM, R. Clayton  wrote:
> "HTTP/1.1 200 OK
> Date: Fri, 11 Sep 2015 01:10:39 GMT
> Server: III 100
> Pragma: no-cache
> Content-Type: text/html; ISO-8859-1
> Expires: Fri, 11 Sep 2015 01:10:39 GMT
> Cache-control: no-cache
> Set-Cookie: SESSION_LANGUAGE=eng; path=/; domain=.example.com; path=/
> Set-Cookie: III_EXPT_FILE=aa20885; path=/; domain=.example.com; path=/
> Set-Cookie: III_SESSION_ID=3ba8ef1c57601a925bc732a44b4bb791; 
> domain=.example.com; path=/
> Set-Cookie: SESSION_SCOPE=0; path=/
> Vary: User-Agent,Accept-Encoding
> Transfer-Encoding: chunked

Aha. The last, "Transfer-Encoding: chunked" header is the issue:

  https://en.wikipedia.org/wiki/Chunked_transfer_encoding

Also notice there is no Content-Length header -- therefore the client
can't read some specific number of bytes.

Plus, the response says HTTP 1.1, which means that multiple requests
and responses may be made over one connection -- therefore the client
can't just read until "end of file".

Instead, the client must do chunked transfer decoding. But
get-pure-port doesn't know how to. And it shouldn't need to: When a
client makes an HTTP 1.1 request, the server is allowed to assume the
client knows how to do chunked transfer encoding. But IIRC,
get-pure-port supplies HTTP 1.0 in the request header. So technically,
this web server must not respond like this. But it is. In other words,
welcome to the real world wide web. :)


TL;DR: Instead you probably want to use Racket's http-client library,
which knows how to handle HTTP 1.1 including chunked
transfer-encoding:

  http://docs.racket-lang.org/net/http-client.html

That should do all you need.


p.s. I also have an http package that does a bit more:

  https://github.com/greghendershott/http

You can install with:

  raco pkg install http

But again, http-client should be fine for what you're doing.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Make, in place build, was Re: [racket-users] Racket v6.2

2015-09-10 Thread Anthony Carrico
I did a 2 character change to Racket (see
https://github.com/plt/racket/pull/1045), and hit make. This failed to
build, I guess because of package mismatches, so I pulled and tried
again, which failed.
Also, my laptop is very slow for this kind of thing, so I did a fresh
clone and in place build on a faster desktop, which went fine.

Next I reapplied my 2 character change and hit make again. It started
off and I got bored an went to lunch. Later it was done and everything
is nice.

1. This is a slow way to work. I'm wondering what cycle the primary devs
use? Avoid make somehow?

2. Is it possible to extract the in place build from the fast desktop to
use on my laptop (same architecture)?

On 06/23/2015 08:39 PM, Jay McCarthy wrote:
> Here's what I do for building from git, and I think it's the simplest thing:
> 
> $ git clone https://github.com/plt/racket
> $ cd racket
> $ make
> 
> This clones a single (small) repository and then builds everything. It
> will automatically install the latest version of whatever other
> packages you need without actually cloning any of the other
> repositories. This means that you have a pretty minimal connection to
> git.
> 
> When you need to update again, you can just update racket and then do
> another "make" and it will download the updates for the packages too.
> 
> Now, sometimes you will actually want to have the git repos of other
> packages. That's easy too. Since I work on the Web server, here's what
> I did:
> 
> # Create a helpful directory. There's nothing special about this name,
> but I like it
> $ mkdir extra-pkgs
> $ cd extra-pkgs
> # Tell racket to switch the web-server package from being a tar-ball
> install to being a git clone
> $ raco pkg update --clone web-server
> 
> Now I'm good to go to
> 
> $ cd web-server
> $ ed web-server-lib/web-server/main.rkt
> 
> and so forth.
> 
> Something that is neat about the new world is that it is easy to have
> a released version of Racket downloaded from the site, but have a git
> clone of some small set of other package repos that you are doing
> development on. The only difference will be the first three steps.
> 
> I hope this helps,
> 
> <3
> 
> Jay
> 

-- 
Anthony Carrico

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Class constracts and equality

2015-09-10 Thread Asumu Takikawa
On 2015-09-02 08:41:21 +0200, Konrad Hinsen wrote:
> That would be great, but if that's not possible, the next-best option would
> be to document the restriction.

I now have a pull request that should address this:

  https://github.com/plt/racket/pull/1044

I've only found one issue with this so far, which is that `object->vector` can
expose the difference between an object produced from a contracted class and a
regular object. This seems minor though.

Cheers,
Asumu

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Make, in place build, was Re: [racket-users] Racket v6.2

2015-09-10 Thread Matthew Flatt
At Thu, 10 Sep 2015 15:10:27 -0400, Anthony Carrico wrote:
> I did a 2 character change to Racket (see
> https://github.com/plt/racket/pull/1045), and hit make.

For that case, I would use `raco setup` instead of `make` (since it's
not a change to the runtime). Or I might use `make as-is`, which
refrains from updating packages and is otherwise mostly `raco setup`.

> This failed to
> build, I guess because of package mismatches, so I pulled and tried
> again, which failed.

I'm a little curious about that failure, but many things can go wrong
at this level.

> 1. This is a slow way to work. I'm wondering what cycle the primary devs
> use? Avoid make somehow?

Changing something as primitive is "kw.rkt" is slow for me, too. I
would use something like `raco setup racket` to first try out the
change on limited set of modules, but a full `raco setup` is usually
not far behind.

> 2. Is it possible to extract the in place build from the fast desktop to
> use on my laptop (same architecture)?

Yes, you should be able to copy over an in-place build, and using `tar`
to preserve timestamps will work best. The contents of the
"racket/src/build" directory tend to be sensitive to the path, though,
so you'd have to discard that part.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.