@gws@mstdn.social
@gws@mstdn.social avatar

gws

@gws@mstdn.social

Mathematician. Software Engineer. I like making things.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

gws, to random
@gws@mstdn.social avatar

PSA: The latest development build of served at https://webr.r-wasm.org/latest/ is now running 4.4.0 🎉 This change will be included as part of the next release. Thanks @jeroenooms for helping get this up and running.

WebAssembly packages for R 4.4 are now being served by https://repo.r-wasm.org/. As before, you can browse the list of available Wasm packages by visiting that URL in your browser. Feel free to let me know if any major packages have been broken in the rebuild process.

hrbrmstr, to random
@hrbrmstr@mastodon.social avatar

🚨Looks like was not immune to deserialization bugs after all https://hiddenlayer.com/research/r-bitrary-code-execution/

Watch those R Data files (and, we now shld come up with better ways to ensure local R library integrity)!!

CVE-2024-27322

gws,
@gws@mstdn.social avatar

@henrikbengtsson @rmflight @hrbrmstr

Though not returned directly, you can still slip unevaluated promises through readRDS() using an environment.

I think I'd argue (my own opinion, not necessarily shared by anyone) that this is not really a bug and that deserialising arbitrary R objects, including promises, is what readRDS() and friends are designed to do.

gws, to webassembly
@gws@mstdn.social avatar

I recently wrote a deep-dive blog post discussing the patches we make to LLVM Flang to cross-compile objects from Fortran source for . It's at https://gws.phd/posts/fortran_wasm/, do take a look if you're interested. With recent releases of LLVM, the patches are now much easier to handle than they used to be -- though, admittedly, still pretty hacky. There are also some fun little interactive BLAS & LAPACK demos near the end of the post, like this hand-drawn digit classifier.

A video showing a demo app consisting of an empty box on the left and a histogram on the right. The video shows hand-drawn digits being written into the box (e.g. with a mouse or touchscreen). The histogram is updating live as the digits are drawn. It shows a probability distribution over the digits 0-9, attempting to classify which digit has been drawn.

gws, to webassembly
@gws@mstdn.social avatar

This is a wonderful article about WebAssembly, webR, and more at https://www.nature.com/articles/d41586-024-00725-1

In case anyone is wondering, when I was still working at Newcastle we did indeed improve assessing R (and Python) code in @numbas. The Numbas programming extension evaluates learner-submitted code in Pyodide and webR, running under : https://github.com/numbas/numbas-extension-programming

hrbrmstr, to random
@hrbrmstr@mastodon.social avatar

OBSERVABLE FRAMEWORK SQL CELLS ARE LIVE!

https://observablehq.com/framework/sql

gws,
@gws@mstdn.social avatar
gws, to webassembly
@gws@mstdn.social avatar

Note to self: Disassembling a 1.4GB module inside devtools is a bad idea. It can do it - it just can't display the result:

https://github.com/ChromeDevTools/devtools-frontend/blob/ca54fd164e5c1c4d395180594a116ec29a280b39/front_end/core/sdk/Script.ts#L220C43-L220C43

Welp. Time to hack devtools to discard the first gigabyte of text I guess...

gws,
@gws@mstdn.social avatar

@voxpelli Yes, I'm experimenting with something large. Though I did exaggerate a little, it's just the text disassembly that's over a GB, the wasm itself is smaller and compresses fairly well.

$ du -h module.wasm
160M module.wasm

$ wasm-dis module.wasm > module.txt
$ du -h module.txt
1.4G module.txt

$ gzip -k module.wasm
$ du -h module.wasm.gz
18M module.wasm.gz

gws, to webassembly
@gws@mstdn.social avatar

Thanks to some great work by @jeroenooms we now have ImageMagick compiled for in the latest development build of . A full image-editing stack, entirely in the browser, available through the magick R package!

We've uploaded a Shinylive app at https://georgestagg.github.io/shinymagick/ showing some examples of the kind of image transformations that magick can do. Once it's loaded, it's pretty fast and it even works on my phone 🤯

gws,
@gws@mstdn.social avatar

The ImageMagick Wasm library will be included in the next released version of webR. For the moment, you can experiment with the latest development build at https://webr.r-wasm.org/latest/ and load the magick R package there.

hrbrmstr, to random
@hrbrmstr@mastodon.social avatar

@gws This https://docs.r-wasm.org/webr/latest/plotting.html#text-rendering-and-font-support-1 mentions being able to put fonts into /home/webr_user/fonts but that directory doesn't seem to be in there (under Node) and creating it and putting fonts there doesn't do what the last paragraph says on the tin (or I am doing something wrong). I must be missing something?

gws,
@gws@mstdn.social avatar

@hrbrmstr It's supposed to work something like this: https://observablehq.com/d/32e2b7e465c0b994

Revisiting this, it does seem to be a little fragile. Only the Cairo-based bitmap graphics devices (png, bmp, jpeg, ...) will work with this method, and the fonts need to be in place on the VFS before the device is invoked.

I wasn't able to check with Node.js from here, but I'll be back in front of my work machine on Monday and will double check then.

hrbrmstr, to random
@hrbrmstr@mastodon.social avatar

CLIs have full local filesystem access too

gws,
@gws@mstdn.social avatar

@hrbrmstr Emscripten’s NODEFS filesystem module enables that kind of mounting, it’s really cool! I find it useful to mount a directory containing extracted Wasm R packages, then add the mount directory to search path with .libPaths(). Then you can load R packages directly from the host system without copying them to the virtual filesystem.

hrbrmstr, to random
@hrbrmstr@mastodon.social avatar

ZOMGOSH !Mebbe 🎉

ACTUALLY PORTABLE !!!!!!!

The wizard 🧙 that is @gws has an example up of running under Node.JS!

https://github.com/georgestagg/webr-node-example

You can now create CLI and server apps for folks that do not require an existing, local R installation!

This is as yuge as browser WebR. Mebbe yuger!

gws,
@gws@mstdn.social avatar
gws, to webassembly
@gws@mstdn.social avatar

Sneak preview time! The next version of will have improved performance when loading packages, especially once they've been downloaded and cached by the browser. Here's an example showing ggplot2 loading from cache in about 1.5 seconds.

The commands

gws, to random
@gws@mstdn.social avatar

I had such a great time at ! I got to meet and chat with wonderful people, TA and speak at a workshop, attend many brilliant talks, present my recent work on , and be part of the announcement of Shinylive for R. Thanks to everyone involved for a fantastic conference, I’m already looking forward to the next one!

Here are links to some of my slides:
https://gws.quarto.pub/introduction-to-webr-2023/

https://gws.quarto.pub/magic-with-wasm-and-webr/

gws, to random
@gws@mstdn.social avatar

webR 0.2.0 has been released! 🎉 This release gathers many updates from over the last few months, focusing on improvements to HTML canvas graphics, additional Wasm R packages, better accessibility and internationalisation, and a brand new webR REPL app. I've written a blog post with lots more details at https://www.tidyverse.org/blog/2023/08/webr-0-2-0/

gws, to random
@gws@mstdn.social avatar

Pólya’s conjecture is the usual example of a statement that’s true for many cases, but breaks down for some large value of n. In that example, n=906150257. However, I think I have a new favourite: gcd(n^17 + 9, (n+1)^17 + 9) = 1 for all n < 8424432925592889329288197322308900672459420460792433 (More counterexamples at https://oeis.org/A010034)

gws,
@gws@mstdn.social avatar

@robryk a comment thread about the Riemann Hypothesis on Hacker News led me down a rabbit hole to it ¯_(ツ)_/¯ Probably just a coincidence!

gws, to random
@gws@mstdn.social avatar

Currently updating webR's documentation for how plotting works and it's so nice seeing the recent changes to the HTML canvas graphics device paying off. Letting the web browser handle the details of text rendering is so nice. As far as I can tell everything just does what it's supposed to!

gws, to random
@gws@mstdn.social avatar

A little while ago I teased a video of running Shinylive apps entirely in the browser with . We're working on it, but for the moment I've setup a repo with some technical info about how this all works, targeted at brave JavaScript devs https://github.com/georgestagg/shiny-standalone-webr-demo

gws,
@gws@mstdn.social avatar

The repo is minimal and based on an experimental webR build. But it does demonstrate how JS Service Workers are able to run the show, and an experienced developer could use it as a base to create their own client-side Shiny experiments, like this one https://shiny-standalone-webr-demo.netlify.app/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • tester
  • kavyap
  • DreamBathrooms
  • modclub
  • GTA5RPClips
  • InstantRegret
  • magazineikmin
  • Youngstown
  • thenastyranch
  • rosin
  • slotface
  • mdbf
  • khanakhh
  • ngwrru68w68
  • JUstTest
  • anitta
  • normalnudes
  • Leos
  • cisconetworking
  • osvaldo12
  • everett
  • Durango
  • tacticalgear
  • provamag3
  • megavids
  • ethstaker
  • cubers
  • lostlight
  • All magazines