chris613
2020-2-12 08:41:25

has anyone had an attempt at registering URI handlers with OSX for an application? siminar to how mailto: links open the mail app.


chris613
2020-2-12 09:02:51

just to post research in case anyone else is interested… https://github.com/Grayson/defaultapp/blob/master/defaultapp.m



spdegabrielle
2020-2-12 10:14:25

@soegaard2 i’m getting No key in either environment or home. Using default. decrypt: contract violation expected: bytes? given: #<void> in: the 2nd argument of (->* ((or/c cipher-spec? cipher-impl?) bytes? (or/c bytes? #f) input/c) (#:aad input/c #:auth-size (or/c natural? #f) #:pad boolean?) bytes?) contract from: <pkgs>/crypto-lib/main.rkt blaming: /app/app-racket-stories/secret.rkt the default looks fine?



spdegabrielle
2020-2-12 10:17:53

Thank you all for your help with this I got disk usage for racket-stories on glitch down to 134gb @mflatt @samth @samdphillips @notjack @soegaard2 (in no particular order) I appreciate and thank you for the time you take out of your busy day to help me.:heart:


soegaard2
2020-2-12 10:38:11

@spdegabrielle I am surprised by the error though - it says that the second argument (the key) is void, but the default key is #"A secret key!!!!"


spdegabrielle
2020-2-12 10:38:35

@soegaard2 I read that and assumed #"A secret key!!!!"] woudl be my key (assuming that is valid)


soegaard2
2020-2-12 10:40:24

However use (new-key) to generate a new key, and then store it either in the environment or in ~/.racket-stories/rskey


soegaard2
2020-2-12 10:42:33

I wonder whether it helps to move the definition of aes-decrypt and aes-decrypt-bytes below the definition of key?


spdegabrielle
2020-2-12 11:19:16

thanks for the (new-key) tip. I moved the aes- functions - but I didn’t stop to check the impact.


spdegabrielle
2020-2-12 11:50:51

@soegaard2 I’ve got it running ! https://spdegabrielle-racket-stories.glitch.me/ thanks for your help. The only other thing I needed to do was comment out #;(list 'key-size 64) in authentication.rkt because I was getting the error; pwhash: unsupported option for PBKDF2 option: 'key-size value: 64 Thanks again!


spdegabrielle
2020-2-12 12:41:11

racket-minimal-linux-cs, <https://download.racket-lang.org/releases/7.5/installers/racket-minimal-7.5-x86_64-linux-cs.sh> is reporting as requiring 134mb <https://download.racket-lang.org/releases/7.5/installers/racket-minimal-7.5-x86_64-linux.sh> only requires 41mb. Is that right/expected?


spdegabrielle
2020-2-12 12:45:11

I’m building the rantstack app on https://glitch.com/~rantstack-pol (original is v7.2 at https://glitch.com/~rantstack )


popa.bogdanp
2020-2-12 12:45:21

I think that’s because machine code (cs) takes up more space than bytecode @spdegabrielle


spdegabrielle
2020-2-12 12:46:34

thansk @popa.bogdanp I didnt expect that :astonished:


popa.bogdanp
2020-2-12 12:50:28

Is there a monotonic time source in the standard lib? I imagine current-seconds and current-inexact-milliseconds report system time so they can (and do!) go backwards every now and then, but this isn’t explicitly called out in the documentation. Is current-process-milliseconds what I’m looking for?


soegaard2
2020-2-12 12:58:44

@spdegabrielle Great to hear it worked.


popa.bogdanp
2020-2-12 12:59:30

Seems like current-process-milliseconds isn’t guaranteed to be monotonic either:

https://github.com/racket/racket/blob/5bb837661c12a9752c6a99f952c0e1b267645b33/racket/src/rktio/rktio_time.c#L110-L146


notjack
2020-2-12 13:09:16

I want this too



badkins
2020-2-12 15:03:23

Getting started with emacs can certainly be daunting, but in my case, I viewed it as a long term investment, and I feel it’s paid off extremely well. While some of my friends/colleagues have switched editors a few times over the last number of years, I’ve been able to continue to capitalize on what I’ve learned about emacs and have developed a large number of macros that make life so much easier :slightly_smiling_face:


badkins
2020-2-12 15:04:16

I use both emacs and DrRacket - emacs for most of my day to day editing of Racket code, but I’ll pop into DrRacket sometimes to use it as a REPL and some other features such as the macro expander, debugger, etc.


greg
2020-2-12 15:10:33

I don’t know much about this subject but my first reaction is probably there are multiple, orthogonal use cases people imagine for “monotonic time”. And it might be better/safer to provide (in some package or in Racket) a distinct solution for each?


greg
2020-2-12 15:12:00

Like, measuring performance, the system clock not being monotonic seems like the least of your problems.


greg
2020-2-12 15:13:11

Whereas if you need some local monotonic counter, and feel it would be convenient not to persist it in storage between program runs, a monotonic system clock seems like a handy way to do that. But you really want a counter not a timer, and that shapes the available solutions.


greg
2020-2-12 15:13:14

idk


deactivateduser60718
2020-2-12 16:07:48

I am using break-thread off the main thread. Related: https://github.com/zyrolasting/kinda-ferpy/blob/master/main.rkt#L68


deactivateduser60718
2020-2-12 16:08:50

This an implementation of the spreadsheet metaphor for async tasks. In this context a cell’s value is a thread, and if a dependency changes it breaks the thread it already has and replaces it with a new thread to restart the task.


deactivateduser60718
2020-2-12 16:09:46

What caused me to post here was that when it does so, checking for exn:break on the main thread did not stop the program from spamming user break


deactivateduser60718
2020-2-12 16:11:20

But I have not yet tried various permutations of with-handlers* inside and outside of a created thread. I’ll be getting to that sometime today or tomorrow.


greg
2020-2-12 16:41:07

Oh cool idea.


greg
2020-2-12 16:43:03

https://github.com/zyrolasting/kinda-ferpy/blob/master/main.rkt#L332-L333 the endless loop can use a lot of resources I think? Better might be simply (sync never-evt). That will cause the thread to block forever.


greg
2020-2-12 16:49:44

Speaking of sync, you might consider using thread messages — thread-send and thread-receive? These workers could thread-receive a value that is either some work to do, or, a value like say 'quit that means they should do nothing more, just return, which causes the thread to end. Instead of using break-thread or kill-thread, you could (thread-send some-thread 'quit). I’m not saying that would be better, I don’t fully understand your problem domain. Just pointing out it’s maybe an option. Racket’s synchronizable events including channels — or simply using thread messages — make concurrency really nice to deal with. But maybe it would be a distraction from what you’re trying to focus on right now. If so — sorry!


greg
2020-2-12 16:53:05

Hmm I guess break-thread does let you interrupt a thread that is stuck running something. And unlike kill-thread, it does allow the thread to do some cleanup if necessary. Probably that’s what you were thinking. If so, never mind I guess. :smile:


deactivateduser60718
2020-2-12 17:07:35

Yes, that’s the thinking. And I did forget about never-evt at the time, so thanks for the reminder there. The test resolves quickly enough for it not to be a big problem at least.

Re: use of async channels, I did think about that since I wasn’t sure how I wanted to handle a large proliferation of threads. One use case I’m working on now is crawling an HTML document and building the resources it references using href, src, and srcset attributes. It doesn’t always make sense for one build to wait on the others since they all entail disk or network activity, and async cells help with that. But many such attributes means many threads, and I figured I could either coordinate a global thread pool of ~8 threads, or figure out a way of managing thread groups such that the resources with the fewest dependents get a larger share of CPU time. In any case I don’t really like that the threads are all in the same thread group anyway.


deactivateduser60718
2020-2-12 17:09:23

How would you do it?


popa.bogdanp
2020-2-12 19:58:11

notjack
2020-2-12 19:59:51

@popa.bogdanp ooooo shiny


popa.bogdanp
2020-2-12 20:00:58

@greg my particular use case has to do with tracking the duration of certain bits of code, but it isn’t quite what people normally think of as measuring performance. I just need to be sure the measurement is never negative. When you say measuring performance this way is the least of one’s problems, do you mean because whatever you’re measuring could be de-scheduled and b/c of the JIT and GC interference or something else?


leif
2020-2-12 20:04:02

@jeapostrophe You might be able to answer this: https://stackoverflow.com/questions/60094572/form-validation-in-racket


greg
2020-2-12 20:12:41

Racket threads are “green threads” not OS threads. The bad news is you won’t get any parallelism. The good news is that they still help when things might block for I/O (disk or network); other threads can progress. (They also help when it’s just easier to think about a problem concurrently.) The other good news is that they are cheap. You could have dozens or hundreds and it should be fine.


greg
2020-2-12 20:13:48

So I’d say create as many threads as you want. Don’t worry about how many. And definitely don’t worry about things like thread pools, at least for the reasons you would for OS threads.


greg
2020-2-12 20:16:05

As one small example, the “More: systems” introduction — https://docs.racket-lang.org/more/index.html — creates a thread to handle each request. And for each of those, it creates another thread, whose only job is to maybe kill the first thread if it takes too long.



greg
2020-2-12 20:16:29

Threads are cheap, it’s fine to use them for little jobs like this.


greg
2020-2-12 20:17:59

In fact instead of using break-thread, you could use a similar pattern. Two threads per cell. One thread does the work. Another thread does a thread-receive waiting for a 'kill message, and if it gets it, kills the worker thread.


greg
2020-2-12 20:18:15

I’m not sure if that’s better than using break-thread, but it might be? idk


greg
2020-2-12 20:19:14

Yeah I just mean the “real time” portion of the output is subject to all sorts of noise and interference, IIUC, including other things running on your computer.


greg
2020-2-12 20:20:03

I agree it’s sad if once or twice a year, a “leap” or “smear” system clock adjustment makes one timing wrong. But they’re all a little bit wrong. And outliers should be looked at skeptically, regardless.


greg
2020-2-12 20:20:48

The “cpu time” part is more interesting. And for Racket, often the main thing that will matter is the “gc time” portion.


greg
2020-2-12 20:21:27

So for some purposes I feel like the best improvement to time would be not to show the “real time” stats at all. I’m kind of exaggerating, but not totally.


greg
2020-2-12 20:24:08

@popa.bogdanp Having said all that, I probably don’t really know what I’m talking about, and, racket-monotonic looks great!


popa.bogdanp
2020-2-12 20:35:13

Thanks! What you said makes sense, though my experience has been that, when taken in aggregate, wall time measurements can be extremely helpful.

For example, at $dayjob we use http://honeycomb.io\|honeycomb.io to observe all sorts of operations our code makes. Some things take on the order of seconds and most, milliseconds. At the millisecond level, we don’t tend to see much disruption from other processes (because, generally, there aren’t any others apart from the kernel on these servers) or from scheduling or GC because we tend to allocate things up-front so something like a leap second would actually disrupt a whole lot of observations, albeit for a very short time. Then there’s also that whole thing about governments changing timezones on a whim, though I’m not 100% sure how that affects system time (if at all).

(I am building something like honeycomb in Racket, for funsies, hence this whole thread :P)


notjack
2020-2-12 20:44:38

Huge +1 to the point that monotonic time is designed for measuring latency, not performance. It’s great for timing code that does I/O


deactivateduser60718
2020-2-12 20:53:29

I knew about the green threads bit and I’m glad to know that they are cheap.

The reason I’m still thinking about the CPU is because I don’t want to tell Racket’s scheduler that all of these threads are created equal. Case in point, I have a server that starts an async cell’s task as a side-effect of a request. I noticed that creating a bunch of threads causes a noticeable lag, even though there is nothing technically blocking the server from creating a response to send to the user. Isn’t that a matter of the thread preparing a response being in the same thread group?


deactivateduser60718
2020-2-12 20:55:37

I’d expect the response to be more or less instant if nothing is blocking.


greg
2020-2-12 22:10:16

Actual comment I just wrote in a test: ;; This test succeeds on all Racket versions before and after 6.10. ;; I spent an hour installing 6.10 locally and exploring the problem ;; but so far have no clue. As neither 6.10 nor I are getting any ;; younger, I am choosing to ignore this, for now. (It’s about fetch-blueboxes-strs from scribble/blueboxes returning #f even for basic things like list.)


greg
2020-2-12 22:13:27

I try hard to keep Racket Mode supporting older versions of Racket, but I don’t try this hard. :smile:


soegaard2
2020-2-12 22:13:54

greg
2020-2-12 22:16:36

@soegaard2 Aha that sounds like it; thanks! I was looking at the commit history for scribble/blueboxes.rkt and it’s like, “nope, nothing changed since 2015” and 6.10 is c. 2017. I never would have tracked it down to a bug in cons/dc. :eyes:


greg
2020-2-12 22:17:07

My curiosity is satisfied but there’s nothing I can do about this so the test will remain excluded.


greg
2020-2-12 22:18:38

Mainly I’m just happy that a benefit of getting older is I can use “I’m not getting any younger” as a more-convincing rationalization in comments. :smile:


soegaard2
2020-2-12 22:19:27

Interesting to hear from a man, who uses “omg” :wink:


greg
2020-2-12 22:20:00

My main pleasure in life is a bowl of soup with saltine crackers. I am that old.


soegaard2
2020-2-12 22:20:24

I suddenly got a craving.


greg
2020-2-12 22:20:34

:smile:


greg
2020-2-12 22:21:43

@soegaard2 You’re up late for .dk ?!


massung
2020-2-12 22:21:44

> a bowl of soup with saltine crackers. I am that old. If that’s a sign of old age, I’m f’d.


massung
2020-2-12 22:23:25

My general test for old age is this… how many times in the shower do you find yourself asking “did I shampoo?” and end up probably doing it multiple times.


greg
2020-2-12 22:24:49

I do that sometimes but it’s more a function of how distracted my brain is by some programming problem I’ve been working on. For me it’s a “step away from the computer” signal.


sorawee
2020-2-13 01:52:52

> My general test for old age is this… how many times in the shower do you find yourself asking “did I shampoo?” and end up probably doing it multiple times. If that’s a sign of old age, I’m f’d.


notjack
2020-2-13 01:57:03

I’m pretty sure I’m at least 140 years old by that metric