How can I identify a Google Sheets drawing in Google Apps Script?

I use Google Sheets to produce simple quizzes for students. Instead of just having a cell display <Good!> when a kid enters a correct answer, I’d like to make a drawing pop up. A sports fan cheering, with a speech bubble, say. Google’s documentation shows I can use GAS to change the size and position of a drawing, and thereby presumably make it go from effectively hidden to conspicuous. I don’t foresee a problem when there’s only one drawing, but if I have several, I don’t see an easy way of selecting one.

I can get an array of the drawings in a sheet using getDrawings(), and use getContainerInfo() to find where the drawing is, and identify it that way, but that’s pretty clunky: my code won’t give any indication of what drawing is at a particular position, and if I accidentally move the drawing, my script won’t select it.

Right now I’m thinking of using setOnAction() with a name that isn’t actually the name of a macro, and looping through the drawings array until getOnAction() returns the name I want, but I don’t know if the compiler will be happy assigning arbitrary strings via setOnAction(). I wonder if there isn’t a cleaner way to do this.

Thanks to all who can offer suggestions!

evaluation strategies – Environment model diagram drawing for letrec

A friend which studies about the environment model evaluation asked me to to draw the environment model diagram for the following scheme code and I got stack:

(define a 2)
(define func1
     (lambda (x) 
        (lambda (y) (/ x y))))
(define func2
   (letrec 
        ((f (func1 a))
         (g (lambda(x) (f x))))
      (lambda (x) 
         (if (= x 0)
           x
          (g x)))))
(func2 (func2 0))

I will draw you with comic or anime style for $10

I will draw you with comic or anime style

Hello there!

I am very fascinated to finish your concept, color your artwork, lineart your sketch, or anything about illustration. I will do my best so that you are satisfied with the results of my work. When you order from me, you also have the right to resell my service.

If you have anything to ask about price or anything else feel free to DM me, I will glad to answer all of your questions. Let’s discuss your project together and achieve the goals that we made.

Thanks for coming

.

Freeze slide while drawing on a Keynote slide in iPad

I use the iPad as the controller for presenting Keynotes (streaming from MacBook). When I use the pencil to draw on a slide, many times I put my hand on the iPad screen, which is interpreted as “next slide” closing the drawing mode and advancing me to the next slide.

Is there any way to freeze the current slide while drawing on it?

Probability of drawing numbers without any number being in its sequential position

Based on a joke going around in Video Game randomizers, where items that are appearing to be “not randomized” are thought to be broken, I was interested in the probabilities related to this.

To simplify, we have n items, which are randomized to appear in n positions.

This can be considered to be similar to be having a bag of n tokens, numbered 1 to n, and we draw them sequentially, so that in a bag of 3, a draw of 3-2-1 is counted as a draw in sequential order, as 2 is drawn in position 2.

Now, the probability of drawing them all in order is simple, $frac{1}{n!}$.
But what is the probability of none of them being in order? (Because, obviously, none of them being in their original order is “truly” random…..) Based on a question and comment here it seems that Rencontres numbers fit my empirical test at low numbers, where

n No sequential draw occurrences Probability
3 2 2/6 = 1/3
4 9 9/24 = 3/8
5 44 44/120 = 11/30

So am I correct in saying that we can use the formula for Rencontres numbers here, which is

$$D_{n,0} = leftlceilfrac{n!}{e}rightrfloor$$

?

Which interestingly enough, without looking too hard on expanding that formula, seems to tend to around 0.3678 as n gets bigger.

Minter launches a drawing for the amount of 15 000$

The chances of winning are higher than ever: 100 winners will be randomly selected

All you need to do is run @MinterStartBot

And confirm participation in the drawing.

Invite your friends and complete tasks inside the bot to get guaranteed prizes and maximize your chances of winning!

{
“lightbox_close”: “Close”,
“lightbox_next”: “Next”,
“lightbox_previous”: “Previous”,
“lightbox_error”: “The requested content cannot be loaded. Please try again later.”,
“lightbox_start_slideshow”: “Start slideshow”,
“lightbox_stop_slideshow”: “Stop slideshow”,
“lightbox_full_screen”: “Full screen”,
“lightbox_thumbnails”: “Thumbnails”,
“lightbox_download”: “Download”,
“lightbox_share”: “Share”,
“lightbox_zoom”: “Zoom”,
“lightbox_new_window”: “New window”,
“lightbox_toggle_sidebar”: “Toggle sidebar”
}

Minter.jpeg

Read more

drawing – Command the draw a graph

Let $G$ be a simple undirected graph. Let the set of vertices be $V=lbrace 1, 2, 3, 4, 5, 6, 7, 8, 9, 10rbrace $, and let the edges set be $E=lbrace (a, b): atext{ divides }btext{ or }btext{ divides }a;text{ and }aneq b~forall a, bin Vrbrace $.

How to draw the graph of this type?

zoom cloud meetings – Use an Android tablet as a Wacom drawing tablet for a Mac?

You can do so using the Android remote control software scrcpy:

If you enable Development option on your Android device and afterwards enable the “Android Debug Bridge” option you can connect your Android device to your computer via USB and then remote control the Android device and see it’s screen on your computer using a software like scrcpy (install it on MacOS via brew install scrcpy).

Then in a Zoom call you can share your computer screen which shows the Android screen via scrcpy.

plotting – Drawing a straight line in complex plane

I have these point

p = {1.4048301787418027` + 0.13589831076513692` I, 1.2937864859657142` + 0.09826442126033227` I, 1.2439169436341522` + 0.08152085090585755` I, 1.2112251127756706` + 0.07057066521001881` I, 1.1867797359572914` + 0.06239213624408477` I, 1.1671819237029237` + 0.05584007186977612` I, 1.1507678762649645` + 0.050355104251339586` I, 1.1365972662436867` + 0.04562153217223474` I, 1.124085953294084` + 0.041443428931470704` I, 1.1128457075115394` + 0.037690672840169796` I, 1.1026049923874517` + 0.034272306091684974` I, 1.0931660902037226` + 0.031122129476503592` I, 1.0843802257181003` + 0.028190350543236032` I, 1.076132312976041` + 0.025438465710119672` I, 1.0683311706306955` + 0.02283597890972666` I, 1.060903003028386` + 0.020358216403672635` I, 1.053786913489549` + 0.017984823404026413` I, 1.0469317264511402` + 0.015698699656082248` I, 1.0402936772643052` + 0.013485225924340693` I, 1.0338346910665444` + 0.011331687936209292` I, 1.027521069271944` + 0.009226836941693186` I, 1.021322461994918` + 0.007160546106256114` I, 1.0152110424227831` + 0.0051235346034142525` I, 1.0091608233679767` + 0.003107139398530981` I, 1.0031470719276647` + 0.0011031199836812119` I, 0.9971457882879402` - 0.0008965152800982101` I, 0.9911332209734355` - 0.0028996704469104913` I, 0.9850853942726508` - 0.004914318965930066` I, 0.9789776246938359` - 0.006948664028432134` I, 0.9727840022953297` - 0.009011310260944524` I, 0.9664768094358419` - 0.011111455803159562` I, 0.9600258433964858` - 0.013259115782829277` I, 0.9533975994565845` - 0.015465391402985825` I, 0.9465542556662075` - 0.017742803834833825` I, 0.9394523769004093` - 0.02010571977953537` I, 0.9320412189796319` - 0.022570907472936778` I, 0.9242604553685143` - 0.025158280726805794` I, 0.9160370544286163` - 0.027891919050845516` I, 0.9072808772098193` - 0.030801502627903685` I, 0.8978782922954255` - 0.03392438838789599` I, 0.8876826109570178` - 0.037308710478383814` I, 0.8764992119353089` - 0.041018184124120435` I, 0.864061351522674` - 0.045139880920104784` I, 0.8499886226970275` - 0.04979749980583017` I, 0.8337105619927074` - 0.05517557183546196` I, 0.814313066911355` - 0.06156755652317412` I, 0.7901896657264539` - 0.0694831242611486` I, 0.7580949362489926` - 0.07993065003390927` I, 0.7096897586662804` - 0.09538398209765551` I, 0.6071597345880032` - 0.1250060626682752` I}

Now I did

sol = FindFit(p, a x + b, {a, b}, x);
eqnR(x_) := a x + b /. sol;
eqnR(x) 

Which gives me the output

(1.24601 + 0.0818429 I) - (0.00962482 + 0.00319108 I) x

I want to plot the list plot by doing

ListPlot(Transpose({Re(p),Im(p)}))

and also plot the straight line from the find-fit given by eqnR(x) on the same plot.

But I am not sure how to plot a straight line with complex parameters.
Any suggestions?

This is the list plot. What I would like to have is a plot of straight-line fitting all these points.
enter image description here

rendering – Drawing pixels with SDL2 advice, is it fine to draw them one by one on the CPU?

I want to make a raycaster and I figured out how to open a window and draw pixels to it with SDL2, but the way I am doing it now just doesn’t seem very efficient, I figured out how to do it from briefly reading the documentation.

For every pixel in the window, I am going through them one by one, setting the render color with SDL_SetRenderDrawColor(), then drawing the pixel with SDL_RenderDrawPoint() based on an array. It’s surprisingly fast doing this but is there some way I can send like a pixel buffer to the GPU or something? I see there is a SDL_RenderDrawPoint”s” function but it only takes positions, meaning all the pixels drawn with it would be the same color? Thank you I hope the question is not too vague.