Re: [racket-users] Escaping strings for the shell
David Storrs wrote on 12/28/18 11:09 PM: I am using 'system' to offload some work onto wget and other applications in a few one-off scripts. Is there an easy way to escape a string so it's suitable for usage in the shell? Things like backwhacking all the quotes and relevant spaces and such. As you know (just to articulate it for the list), processing command lines through the host shell is a little scary, and an imperfection here can be a huge security hole, or otherwise cause failures. We can try to do escaping/quoting, but there are so many potential special cases on different host systems. Fortunately, there might be an alternative... If you're getting a command line from elsewhere, safer is to parse it yourself into process arguments in Racket, and pass those to something like `system*`, so that you know it's done correctly, and there's no shell-specific special characters or bugs or Unicode tricks or anything else. There are cases in which you have a host shell command line that you can't parse it yourself (e.g., a process takes a command line as an argument, or you have to use a subshell command line). If you really have to do that, you could look at how I did it for a side project several years ago, but it isn't quite my current thinking: https://www.neilvandyke.org/racket/sudo/ (IIRC, I probably wrote that `sudo` module for a module possibly even more scary: https://www.neilvandyke.org/racket/parted/ ) -- 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] Escaping strings for the shell
On Fri, 28 Dec 2018 at 23:09 -0500, David Storrs wrote: > I am using 'system' to offload some work onto wget and other > applications in a few one-off scripts. Is there an easy way to escape > a string so it's suitable for usage in the shell? Things like > backwhacking all the quotes and relevant spaces and such. Is avoiding the shell altogether an option? You could use "system*" -- Jack M. Rosenthal http://jack.rosenth.al /* Return code=1: generic error condition Return code=2: all other error conditions */ -- 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: PGP signature
[racket-users] Escaping strings for the shell
I am using 'system' to offload some work onto wget and other applications in a few one-off scripts. Is there an easy way to escape a string so it's suitable for usage in the shell? Things like backwhacking all the quotes and relevant spaces and such. -- 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] make-output-port events
I'm trying to create an output port that wraps a set of foreign interface functions. The ffi has a bytes_writable function which tells how many bytes can be written as well as a write_bytes function that does the writing. In this case I need to poll with bytes_writable until it returns more than 0 before I can make the event ready. what is a good way to implement the event? Thanks, Curt -- 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] hackernews
On Fri, Dec 28, 2018 at 06:18:30AM +0100, Jesse Alama wrote: > > I've had some moderate success in established, non-Racket companies by > working around -- rather than taking on and trying to replace -- the main > language & toolchain. For the PHP shop where I work, I made a DSL called > Riposte [1] for testing HTTP APIs. It has become, in time, the de facto tool > for such things. Thanks to Riposte, all developers have Racket installed on > their workstations, even though I'm the only one who knows Racket and can > fix problems with the tool. Not for Racket, but for Scheme: Gambit makes a great scripting language for C and C++. At a Lisp-related conference a few years at, there was a paper describing a 200,000-line C/C++ program that got Gambit grafted on. Subsequent development found it often better to add functionality to the Gambit scripts than to rewrite existing C/C++ code. Within a few years the entire system was vastly smaller, and faster as well. An example of gradualism. Perhaps the application was ideally suited to it, perhaps not. I don't know. -- hendrik -- 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] Long live SDRAW.LISP -- in Racket pict!
Greetings Racketeers, In case you are not familiar with the SDRAW program from Touretzky's "Common Lisp: A Gentle Intro to Symbolic Computation", it is a program which draws cons-cell diagrams in an X-window using CLX. The program is pretty dated, and getting it up and running on a modern machine is a little bit of work, so why not remake it in Racket -- better yet, using pict! This is exactly what I've been working on... What I've got so far is here: https://github.com/jackrosenthal/sdraw-racket Go ahead and clone it: there's only one function you need to know: sdraw. It takes either a datum or syntax and produces a pict. There's also optional keyword arguments to control some of the output parameters. You can even do things like this: (sdraw (list (face 'happy) 2 (list* 3 4 (face 'happy (and those faces will be rendered in the picture!) I'm relatively new with working in Racket, and I'm interested in: 1. Hearing any thoughts from others on how I can improve my code: either to make the code more readable, or the interface easier to understand. 2. I am still working on documentation etc., and am wondering if people think I should submit this as a pull request to the pict library, or as a separate library. I think it could be particularly useful in pict, and it is only one function anyway. Thank you, Jack -- Jack M. Rosenthal http://jack.rosenth.al We guarantee that each number is random individually, but we don't guarantee that more than one of them is random. -- early PMMLCG vendor -- 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: PGP signature
Re: [racket-users] hackernews
On December 27, 2018 10:47:24 PM GMT+01:00, Stephen De Gabrielle wrote: >I always wanted to ask if the prototype object model is a good idea or >bad idea? The most fun I ever had making GUIs was in Garnet, a library for CMU CL which combined prototype objects and a system where slots we're computed from formulas (a forerunner to FRP). The combination was just fantastic, productive, and made the code very easy to follow. -- 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] how to implement chez scheme's unread-char on racket?
hi: I want to use unread-char in racket, but I do not know how to implement ? Anyone can help me? Thank you! -- 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.