[racket-users] ann: forms

2019-01-21 Thread Bogdan Popa
Hey all, I needed a web form validation library last week and web-server-lib's formlets don't, afaict, provide any facilities for collecting and displaying validation errors to the end user so I made "forms" to scratch that particular itch. I hope it proves useful to some of you!

Re: [racket-users] Re: Signal handling (or alternative)

2018-11-30 Thread Bogdan Popa
Brian Adkins writes: > I just did a quick test, and "kill " will stop the Racket web server, > but not gracefully. In other words, it doesn't allow the current request to > finish. Maybe another signal will gracefully stop it? I personally run the server with serve[1] which runs it in a

Re: [racket-users] Re: Multiple places listening to a TCP port [was: Racket application servers]

2018-11-25 Thread Bogdan Popa
One way you might also solve this on UNIX systems is you could fork after listening on the socket. The file descriptor for the socket from the parent would then be shared with the children and so their accept calls would be "load balanced" by way of them all accepting connections from the same

Re: [racket-users] i18n / translations

2019-02-09 Thread Bogdan Popa
> How are people currently translating their programs? I was searching for a way to do l10n yesterday[1] and the best I could find was SRFI 29[2] from srfi-lib. [1]:

[racket-users] [ann] marionette: control Firefox from Racket

2019-06-08 Thread Bogdan Popa
Hey everybody! I just wrote `marionette`, a library that lets you control the Firefox web browser from Racket and I figured I'd share it! * the source code is here: https://github.com/bogdanp/marionette, * you can install the package by running `raco pkg install marionette` and * the docs will

Re: [racket-users] Trying out a Racket-powered Webpack alternative

2019-08-25 Thread Bogdan Popa
Sage Gerard writes: > - unlike-assets: A build tool for interdependent assets. Similar to Webpack, > if you are familiar with the JS ecosystem. Cool stuff! I was very close to building an asset pipeline for koyo[1] a couple months ago, but I settled on just using broccoli.js instead. I'm glad

Re: [racket-users] Persistent job queue

2019-08-31 Thread Bogdan Popa
> I haven't been able to find a persistent job queue for Racket, so I thought > I'd ask if one exists before writing a simple one. I did see Jay's job > queue package, but it doesn't appear to persist to disk, and that is a > requirement. FWIW, I am working on a new Redis client package[1] that

Re: [racket-users] What is a (the?) way to track requirements for a web or app with Racket?

2019-09-16 Thread Bogdan Popa
Marc Kaufmann writes: > this is surely answered somewhere, but I have not made much progress. If > you know python, what I want to do is essentially > > $ pip install requirements.txt > Although it's not exactly the same thing, I use `info.rkt'[1][2] (similar to `setup.py') for this purpose

Re: [racket-users] What is a (the?) way to track requirements for a web or app with Racket?

2019-09-16 Thread Bogdan Popa
Alex Harsanyi writes: >> Although it's not exactly the same thing, I use `info.rkt'[1][2] >> (similar to `setup.py') for this purpose and each one of >> my web apps is its own package. >> > > Does this mean that the application itself is available as a package and > you can require files from

Re: [racket-users] What is a (the?) way to track requirements for a web or app with Racket?

2019-09-16 Thread Bogdan Popa
Marc Kaufmann writes: > So the easiest to do is to create such an info.rkt file and call `raco pkg > install app-name/` -- and that should work even if I don't do the `raco > exe` and `raco distribute`? Yes, that's right. `raco exe' and `raco distribute' are not required. I realize now that

Re: [racket-users] dogfood a simple structured discussion forum in racket

2019-07-21 Thread Bogdan Popa
In case someone sets out to do this, here are some things I have open sourced (from my closed source projects) in the web space that may help: * koyo[1]: a general toolking built on top of web-server-lib that adds many of the things you need in a real web application (CSRF, CORS,

Re: [racket-users] Re: i18n / srfi-29

2019-07-23 Thread Bogdan Popa
> Is it OK to wrap declare-bundle! + store-bundle inside (begin-for-syntax > ...) to make side effect during raco setup? If not, what is preferred way > to do it? Is there any reason not to do it at runtime? This[1] is what I do in forms-lib. Other modules depend on that module so the bundles

Re: [racket-users] define/contract for private functions

2019-07-23 Thread Bogdan Popa
> When I want to enable these private contracts (e.g. when running tests or > debugging a problem) I simply change the source code of `def/c` so that it > is wired up to `define/contract` and the contract is checked. Here is an > example: http://pasterack.org/pastes/4224 You can run arbitrary

Re: [racket-users] Re: i18n / translations

2019-10-01 Thread Bogdan Popa
This is great! Thank you. Roman Klochkov writes: > Now we have gettext: https://docs.racket-lang.org/gettext/index.html > > суббота, 9 февраля 2019 г., 18:56:59 UTC+5 пользователь cwebber написал: >> >> How are people currently translating their programs? >> I expected to see a gettext library

Re: [racket-users] [ANN] RacketScript working for 7.x

2019-10-02 Thread Bogdan Popa
This is fantastic news! Thank you! Stephen Chang writes: > The RacketScript compiler [1] has been updated to work with Racket 7.x > programs, ie all tests pass (though we are still working to support > more primitives). > > Try it out here: http://rapture.twistedplane.com:8080/ > > The next

Re: [racket-users] Re: raco distribute and runtime paths, conditioned on whether a package was installed at compile time

2019-11-16 Thread Bogdan Popa
James Platt writes: > Would this now be the preferred method to include a copy of the SQLite > library. required by the DB module, to your distribution? The > software I am working on requires a newer version of SQLite than is > included in at least some of the operating systems we want to

Re: [racket-users] Re: Package server broken, at least five hundred intro cs students affected!

2019-10-06 Thread Bogdan Popa
> (The issue was that some of the packages had started to take advantage of a > feature of the dependencies list in info.rkt that allowed regular > expressions in the platform restriction clause. When it came time for the > indexer to convert the dependencies list to JSON, it failed because it >

Re: [racket-users] How to stream file uploads with the Racket web server?

2020-02-13 Thread Bogdan Popa
The version of the web-server that will be included with Racket 7.6 changes the way file uploads are handled so that they get offloaded to disk after a certain threshold (similar to how that nginx module you linked to works). You can check out the pre-release docs for details: *

Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2020-02-20 Thread Bogdan Popa
Jon Zeppieri writes: > When you stream the response, it doesn't use a chunked transfer encoding? -Jon The web server chunks all responses on HTTP/1.1 connections[1]. I can confirm that the web server works great[2] for streaming uses cases like long polling! [1]:

Re: [racket-users] Web server + authentication

2020-01-22 Thread Bogdan Popa
Jens Axel Søgaard writes: > But I haven't implemented "reset password" functionality yet. I need > to figure out how best to handle sending mails from a server. My > concern is being flagged for spamming - so I don't dare use my normal > mail. I like using Postmark[0] for this. Their free

Re: [racket-users] rename-in issue

2020-04-09 Thread Bogdan Popa
I'd recommend using `prefix-in' with the dispatcher modules, as that avoids these types of issues altogether: (require (prefix-in files: web-server/dispatchers/dispatch-files) (prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)) (sequencer:make (files:make

Re: [racket-users] Question about generating urls with dispatch-rules from imported modules

2020-04-25 Thread Bogdan Popa
I solved this in koyo by defining an alternate version[1] of `dispatch-rules' whose generated `reverse-uri' functions take route names rather than functions as arguments: https://koyoweb.org/dispatch/index.html#%28form._%28%28lib._koyo%2Fdispatch..rkt%29._dispatch-rules%2Broles%29%29 The

Re: [racket-users] Re: Should I stop sending packages to the catalog?

2020-05-01 Thread Bogdan Popa
Sam Tobin-Hochstadt writes: > This is very cool! One question -- for "main-distribution" packages, > are you snapshotting the most-recent release catalog? Or > pkgs.racket-lang.org? The latter is simpler, but the former is > probably needed to make the examples in the README work. Otherwise, >

Re: [racket-users] Re: Should I stop sending packages to the catalog?

2020-05-02 Thread Bogdan Popa
Sage Gerard writes: > As long as I don't have to keep reorganizing my code to accommodate > the tooling, then it's a night and day improvement. Would you mind > terribly if I worked with you? I was mulling over this myself in the > dev list, but I am happy to aid any existing effort. I'd

Re: [racket-users] Re: Should I stop sending packages to the catalog?

2020-05-01 Thread Bogdan Popa
Alex Harsanyi writes: > As an application writer, I am on the other side of this problem, by > depending on other packages. Having limited time to work on my project I > want to upgrade package dependencies at my own pace. I'm in a similar position since I operate a few Racket applications.

Re: [racket-users] Exception throwing in web-server

2020-05-25 Thread Bogdan Popa
Norman Gray writes: > But what happens in this case (the my-app/error case in my example) is > that the (server) program keeps going but the client stalls. The > unexpected error in the response-output procedure is caught, and (as > far as I can see) handled by killing the producer thread

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-01 Thread Bogdan Popa
George Neuner writes: > But Python's DB pool is threaded, and Python's threads are core > limited by the GIL in all the major implementations (excepting > Jython). Python's Postgres pooling does not[1] use POSIX threads under the hood to manage the connections if that's what you mean, nor is

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-01 Thread Bogdan Popa
I replied earlier today off of my Phone, but, for whatever reason (caught in the moderation queue?), it's not showing up in this thread. Here's what it said: The reason for poor performance relative to the other langs/frameworks is that there is currently no easy way to take advantage

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-02 Thread Bogdan Popa
George Neuner writes: > What I did say is that Python's threads are core limited - and *that* > is true. As a technical matter, Python *may* in fact start threads > on different cores, but the continual need to take the GIL quickly > forces every running thread in the process onto the same

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-02 Thread Bogdan Popa
Bogdan Popa writes: > Only dispatchers get direct access to the output port for the socket. > If you use `dispatch/servlet', then it takes care of taking your > `response' value and calling `output-response' on it. Unless the server > knows the connection should be close

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-02 Thread Bogdan Popa
The reason for the poor performance relative to the other langs/frameworks is that there is currently no easy way to take advantage of multiple cores using the web framework so what’s being benchmarked is single core perf. This is mainly a problem for benchmarks such as this, but not really an

Re: [racket-users] Utah snapshots will switch to CS by default

2020-08-12 Thread Bogdan Popa
Thanks for the heads-up! Will CS continue to be built on Xenial and BC on Precise? Matthew Flatt writes: > As you may know, the Racket Git repo recently switched to Racket CS as > the default build. That is, if you check out the repo and `make`, then > you get an in-place Racket CS build

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-07 Thread Bogdan Popa
Small update on this: I've updated the benchmarks to run multiple Racket processes with an Nginx load balancer in front. After some tuning[1], here is what the results look like on my 12 core AMD Ryzen 9 3900 server:

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-08 Thread Bogdan Popa
Yury Bulka writes: > Wow, from 695 requests per second to 49,516 is a huge improvement! > > Since we were comparing to django previously, it's now much closer with > django (which does 78,132 rps.) I expect the Racket benchmark will do even better on TechEmpower's hw than it did on mine

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-09 Thread Bogdan Popa
George Neuner writes: > Multiple Racket applications *should* all be able to listen on the > same port without having been spawned from the same ancestor process. > If that isn't working now, something has gotten hosed. I don't know whether this used to work in the past or not, but currently

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-09 Thread Bogdan Popa
Alex Harsanyi writes: > Question 1: Based on this benchmark, is there any reason to chose anything > else but "drogon"? Even if one chooses the second best on that list, which > is "actix", they already loose about 6% performance and things degrade > quickly afterwards. The framework at

Re: [racket-users] Utah snapshots will switch to CS by default

2020-08-14 Thread Bogdan Popa
cise. > > But CS will also be built on Xenial --- mostly because that build is > set up, but maybe it's a step toward migrating the build. > > At Wed, 12 Aug 2020 10:17:15 +0300, Bogdan Popa wrote: >> Thanks for the heads-up! Will CS continue to be built on Xenial and BC >> o

[racket-users] recent sqlite3 versions (was Re: preview of a cross-compilation tool)

2021-05-18 Thread Bogdan Popa
kamist...@gmail.com writes: > (So I guess the only question that comes up is: is it possible to update > the sqlite version?) > [vaguely remember seeing a mailing list thread about this but, currently I > only find other ones] My libsqlite3[1] package provides recent versions (currently

Re: [racket-users] Speeding up the conversion of flvectors to string

2021-06-27 Thread Bogdan Popa
>/dev/null Bogdan Popa writes: > Hi Alessandro, > > Here is a version of your program that is about 30 times faster on my > machine (9s -> 300ms): > > #lang racket/base > > (require racket/flonum > racket/format > racket/port) &

Re: [racket-users] Speeding up the conversion of flvectors to string

2021-06-27 Thread Bogdan Popa
Hi Alessandro, Here is a version of your program that is about 30 times faster on my machine (9s -> 300ms): #lang racket/base (require racket/flonum racket/format racket/port) (define (xy-vectors->string x-vec y-vec) (call-with-output-string

Re: [racket-users] Speeding up the conversion of flvectors to string

2021-06-27 Thread Bogdan Popa
While I think the complexity piece is important, I feel like it's worth pointing out just how much more expensive the allocation -- and its ramifications, like the resulting GC pressure and CPU cache misses -- is than one might think. Here's a quadratic version of the code that avoids

Re: [racket-users] Speeding up the conversion of flvectors to string

2021-06-27 Thread Bogdan Popa
Matthew Flatt writes: > At Sun, 27 Jun 2021 21:36:09 +0300, Bogdan Popa wrote: > Your program does run fast on my machine, but I think it's because this > line doesn't have the intended bad effect: > >> (string-copy! dst 0 dst 0 len) ;; intentionally pe

Re: [racket-users] Speeding up the conversion of flvectors to string

2021-06-28 Thread Bogdan Popa
Bogdan Popa writes: > Ah! You're right. When I make the change you suggest, the program > takes 5s to run. Filed under "Accidentally Not Quadratic" . The program actually takes 2.5s to run. I missed the fact that I had made two separate calls to `string-append!`

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2021-02-10 Thread Bogdan Popa
Round 20 was recently published and Racket's score improved, as expected: https://www.techempower.com/benchmarks/#section=data-r20=ph=composite We're now beating many of the popular frameworks in the composite scores and I think there are still plenty of improvements that could be made.

Re: [racket-users] Word Count program/benchmark performance

2021-03-18 Thread Bogdan Popa
I managed to get it about as fast as Python by making it really imperative and rolling my own hash: https://gist.github.com/Bogdanp/fb39d202037cdaadd55dae3d45737571 Sam Tobin-Hochstadt writes: > Here are several variants of the code: > https://gist.github.com/d6fbe3757c462d5b4d1d9393b72f9ab9 >

Re: [racket-users] Word Count program/benchmark performance

2021-03-19 Thread Bogdan Popa
I updated the gist with some cleanups and additional improvements that get the runtime down to a little over 1s (vs ~350ms for the optimized C and Rust code) on my maxed-out 2019 MBP and ~600ms on my M1 Mac Mini. Pawel Mosakowski writes: > Hi Bogdan, > > This is a brilliant solution and also

Re: [racket-users] Word Count program/benchmark performance

2021-03-20 Thread Bogdan Popa
2e7bdc327fb59c8858a42258c26a >> >> >> >> Sam >> >> >> >> On Fri, Mar 19, 2021 at 7:21 AM Sam Tobin-Hochstadt >> >> wrote: >> >> > >> >> > One minor additional suggestion: if you use #:au

Re: [racket-users] Word Count program/benchmark performance

2021-03-19 Thread Bogdan Popa
es the vectors and all those refs are inlined anyway). > > > Cheers, > Dominik > > [1] https://xkcd.com/386/ > [2] http://phdcomics.com/comics/archive.php?comicid=1735 > [3] https://gist.github.com/dzoep/0e081d0544afac539a4829179c601e0e > > On 19. 03. 21 11:18, Bogdan P