@coolbutuseless@fosstodon.org
@coolbutuseless@fosstodon.org avatar

coolbutuseless

@coolbutuseless@fosstodon.org

Nerd.

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

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

{rmonocypher} is now feature complete! Simple (yet bulletproof) encryption

Core encryption function is

encrypt(mtcars, filename = "secure.rds", key = "my secret key!")

Security/usability feedback welcomed!

Below the surface there's lots going on!

  • Argon2 key derivation
  • RFC8439 "Authenticated Encryption with Additional Data" using ChaCha20 stream cipher + Poly1305 Message Authentication
  • Required random bytes (nonce) sourced from OS CSPRNG

https://github.com/coolbutuseless/rmonocypher

coolbutuseless, to demoscene
@coolbutuseless@fosstodon.org avatar

users, if your method for creating tables isn't letting you create retro demo effects then what even is the point?

This is {emphatic} output to an SVG animation played back in the browser with 'scale_colour_gradient2()' and some sine waves doing the effect.

video/mp4

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Has anyone ever written a "multi-facetted" package for CRAN?

For example, I have a package that uses the connections API.

I would like the full version available from GitHub and r-universe.

Through clever use of defines and 'if' statements etc, the CRAN version would exclude all forbidden code.

Could this exist in one pkg tarball? Or would the tarballs have to be different?

Are there CRAN-specific ENV vars that can be used to control the inclusion/exclusion of code?

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

hive: has anyone resubmitted a package to CRAN and been asked to fix their use of SET_TRUELENGTH?

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@LukeTierney4 thanks for the info. It was unclear whether the NOTE was a blocker to package updates.

I do recall a checkbox when submitting to CRAN along the lines of "I have checked the CRAN checks and fixed all the errors and warnings and notes(?)".

I am mis-remembering the exact text and extents of the assertion - but that was the gist.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

{emphatic} typst support: added!

Good news: It works!

Bad news: I can't work out how to disable text wrapping and/or set overflow in a block to be hidden.

Large tables make 'typst' want to reflow the text which I expressly do NOT want to do.

I've added a 'font_size' option to help deal with this, but being able to control reflow/overflow would be better!

https://github.com/coolbutuseless/emphatic

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

{emphatic} now renders to latex!

Which means that Quart/Rmd rendering to PDF now works!

#WorkInProgress

https://github.com/coolbutuseless/emphatic

#RStats

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Help needed!

I want to email R-devel & get clarification on "Can we create custom connections in packages?"

I find the situation confusing because using the "Connections.h" is mentioned in R-exts manual - and so formally(?) part of the API

But this conflicts with the NOTE generated if you try to use "R_new_custom_connection()" which says it is "non-API"

Am I tilting at windmills? Poking the bear? HELP!

Edits/suggestions welcomed in the gist below.

https://gist.github.com/coolbutuseless/2b261e2f7f54206c1263fbca0e71ac64

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

API

(Last meme for the week - I promise!)

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Eye-watering stats on packages with unit tests on CRAN

60+% of packages had no tests

From data in 2017 by @juliasilge : https://juliasilge.com/blog/mining-cran-description/

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Do any of the standard/extended checks on CRAN use *BSD?

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

How do I write a test to check if a random number generator is
working?

Context: I need something cross-platofrm that access system CSPRNGs (arc4random, bcyprt (on win), etc).

I can test local on a mac that it behaves sanely, but on windows (running as a github action), I want a few quick tests to check that it as least not all the same number repeated :)

But something a bit cleverer :)

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

mood

yutannihilation, to random
@yutannihilation@fosstodon.org avatar

Some days ago, the CRAN check with R-devel started to raise "Found non-API calls to R" NOTE. I'm not sure if they are serious on disallowing these not-so-minor APIs, but what should I do? Do you take some action or just wait?

For example, rlang package now has these NOTE:

File ‘rlang/libs/rlang.so’:
Found non-API calls to R: ‘R_ClosureExpr’, ‘R_PromiseExpr’,
‘SETLENGTH’, ‘SET_ENCLOS’, ‘SET_ENVFLAGS’, ‘SET_TRUELENGTH’

https://cran.r-project.org/web/checks/check_results_rlang.html

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@yutannihilation what's the process for handling these checks?

Do I not need to do anything unless I get an email?

I guess next time I submit a package, I have to say that I've dealt with all these NOTEs

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

I am paying close attention to the R-devel discussion on R API definition.

A package I'm working on (rmonocypher) uses connections to enable encryption in lots of useful places in R for seamless/easy data encryption.

But connection registration in R code is "non API", meaning that you can't write a new connection in a package!

The connection API has been stable for 10 years. Not sure why its use is verboten.

https://github.com/coolbutuseless/rmonocypher

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@LukeTierney4 :/

I would've thought I could just use/check the R_CONNECTIONS_API version and update the package when it gets updated ?

Just like we do with R_GE_version for the graphics system.

It feels limiting to have a stable API for enhancing R marked as "don't use"

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Programming tip: When writing extensions for R using C:

  • Allocate memory before trying to copy data into it.
  • Copying into a NULL pointer is bad.

Like and subscribe for more "great" programming tips!!!

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

I ❤️ {rhub} !

Just checked new package on 9 R setups - including valgrind and address sanitizer.

Such a confidence builder that the package won't barf too much on CRAN :)

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

The wildest R error I've seen this week!

I've managed to trigger a condition that requires "R 22538.0.0 or newer"

o_O

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

A handy thing about having a local CRAN mirror is that I can zgrep across the repository looking for code examples :)

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Is there a blessed way to create a RAWSXP from an existing chunk of memory within C?

Specifics:

  • The memory is already allocated elsewhere
  • I don't want to use memcpy, just wrap the memory where it is such that the RAWSXP points to it.
  • I don't want the garbage collector to know about it - I will free the memory myself later.
  • It still has to be valid RAWSXP that I can use in R

This is a bit of a callback to this post: https://fosstodon.org/@coolbutuseless/111956983679205597

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

The reason I want to wrap existing memory in a raw vector:

  • R does not expose handling of "connections" within C
  • In C, I have existing memory to write to an R connection
  • I have to alloc a RAWSXP of the appropriate size & copy the memory into it
  • Then call out to R (from C) to the function writeBin()
  • And writeBin() is just going to unbox this & use the raw memory

So a 'fake' SEXP header would save a bit of unnecessary overhead & copying

And there is lots of data to write!

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

Obviously, I'm going to try and write it, but I was hoping it was a known thing that was already exposed in the R API.

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

R 4.4.0 is coming in less than one month!

With rig you can try the first alpha easily while keeping your current R version. Run

rig add next

to install, and then

R-next

to start R 4.4.0 alpha.

On Windows, macOS or one of the many supported Linux distributions.

See https://github.com/r-lib/rig#readme

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

{rig} is brilliant! In half-an-hour I:

  • Installed rig for the first time on macOS
  • Installed R 4.2 and 4.4
  • Used the handy shortcuts to start my project in Rstudio with these alternate R versions
  • Tested my new package locally to see some version-specific options worked

@gaborcsardi

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Now that this pkg is actually in a state where it can do something useful, I can quickly realize some ideas for rendering. From idea to proof-of-concept render was ~15 minutes.

This is a ggplot object rendered into isometric layers.

It's just a shear + foreshortening transformation applied to the geometry, with points further offset in the y axis.

Isometric transformed ggplot with layer separation.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Leos
  • tsrsr
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • hgfsjryuu7
  • Youngstown
  • InstantRegret
  • slotface
  • khanakhh
  • rosin
  • ngwrru68w68
  • kavyap
  • PowerRangers
  • normalnudes
  • tacticalgear
  • cisconetworking
  • everett
  • vwfavf
  • GTA5RPClips
  • osvaldo12
  • Durango
  • mdbf
  • modclub
  • tester
  • cubers
  • ethstaker
  • anitta
  • All magazines