## SP Online generate refresh token for testing REST api calls in Posman

I’m refining SPO api calls intended for a mobile app project using Postman, and all is fine except the access token keeps expiring after maybe a day. How do I get the “refresh token” to work so I don’t have to generate a new token each day? I tried adding enable_auto_refresh_access_token = true in the token POST call, but I’ve no idea if that’s what’s required.

## turing machines – What is a make sense (meaningful) example of language that an unrestricted grammar could generate?

I have learned that:

1. Unrestricted grammar is used to define (or describe) a formal language.
2. Unrestricted grammar is used to define recursively enumerable set (https://en.wikipedia.org/wiki/Recursively_enumerable_set)(1).

I’d like to find a meaningful example or a meaningful application for #1 case which is similar to below context sensitives grammar example to learn the purpose of unrestricted grammar. I could find a meaningful example for context sensitives grammar but I could not find a one for the unrestricted grammar yet. Could you help me?

Language for “Network racing game record” with below record instances:

Mr. Bean Male Player 1

Ms. Emma Female Player 2

Mr. Hải n/a Computer 3

Ms. Tú n/a Computer 4

Production rule:

S ⟶ Title Name TAB Sex UserType TAB Rank

Title WomanName ⟶ “Ms. ” WomanName

Title ManName ⟶ “Mr. ” ManName

WomanName TAB Sex “Player” ⟶ WomanName TAB “Female” “Player”

ManName TAB Sex “Player” ⟶ ManName TAB “Male” “Player”

Name TAB Sex “Computer” ⟶ Name TAB “n/a” “Computer”

Name ⟶ WomanName

Name ⟶ ManName

Sex ⟶ “Male”

Sex ⟶ “Female”

UserType ⟶ “Player”

UserType ⟶ “Computer”

Rank ⟶ “1”

Rank ⟶ “2”

Rank ⟶ “3”

Rank ⟶ “4”

WomanName ⟶ “Emma”

WomanName ⟶ “Tú”

ManName ⟶ “Bean”

ManName ⟶ “Hải”

TAB ⟶ “t”

## Algorithm to generate a token as survey summary

I’m searching for an algorithm but struggle to find anything, as I’m not sure how to formulate it correctly. I created a simple survey app in Angular with 24 questions and each has 2-5 answers. When the user answered all the questions I’d like to give him a token (as short as possible) on the result page that he can note down, so the next time he can enter the token instead of having to answer all the questions again.

My thought process so far:

• I can store the information in an array with 24 entries `(1, 4, 2, ..., 2, 3)`
• As all values have 1 digit I can remove everything but the numbers `142...23`

This still leaves me with a 24 digits long number. Nothing one would like to note down and type out by hand. So next I tried to convert this number (with ().toString(2)) to a binary with the goal to turned that binary into a human readable string with String.fromCharCode. But all I got was the rather not so human readable `æu000fu0000³KHu0000u0000u0000` for my test input.

I could break down the number into digit pairs (e.g. 120422… -> (12, 04, 22, …)) and map each of these to a character (00 -> A, 01 -> B, …), but I think there must be something more elegant and efficient, as it would only half the original size. Although using 3 digits for mapping would result in 125 combinations which is rather hard to map to the alphabet, even with upper/lowercases and special characters. But I’d be very happy to hear your ideas. Many thanks in advance!

## I will generate a FB page for your business for \$5

Thank you for visiting my gig:

My Services:

• Suitable template according to business
• Design a unique eye catching cover photo

Note: If interested then contact me before placing an order.

## nt.number theory – In how many ways to generate a vector with odd/even entries

Let $$bar v=(k_1, ldots k_n)$$ be a vector with entries $$k_i$$ from $${0, ldots, K}$$ with $$K in N$$ and such that $$sum_{i=1}^n k_i=K.$$

Find in how many ways we can generate vector $$bar v$$ so that:

1. it contains even number of odd values of $$k_i$$; odd number of even values of $$k_i$$
2. it contains even number of odd values of $$k_i$$ equal to each other.

## javascript – How to make make the ‘ng generate’ command generate component with pug files?

I have an Angular 9 project and I want to use pug files instead of HTML as by view templates. I have `ng-cli-pug-loader` and it works fine compiling app of components with the pug files. But when I use `ng generate component` it creates a component with a HTML view and the app cannot be longer compiled, I have to manually change the extension to pug.

How can I change it to have fresh components generateg with angular schematics have pug files?

## c++ – How to correctly generate tile map with atlas in cocos2d-x (4.0) without TMX file?

Good afternoon!

Can someone give me advice, what is the proper way to generate TileMap?
I know about TiledMapTileLayer in LibGdx. With that tool i could set tile map cell by cell, something like this:

``````TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
cell.setTile(new StaticTiledMapTile(splitTiles((int)cellCoordinates.x)((int)cellCoordinates.y)));
cell.setFlipVertically(tileInfList.get(i).isFlipVertical());
cell.setFlipHorizontally(tileInfList.get(i).isFlipHorizontal());
``````

So algorithm was like this:

1. I parsed my “custom” xml file with map properties (not TMX), such as position of tile in image atlas and position in game world.
2. I created new TiledMap() and TiledMapTileLayer.
3. Added cells to a layer. Than render layer.

But can Cocos2d work with tiles in such a way? Or i should create individual sprite for this purpose (like cells in LibGdx)?
What is the best way to positioning and create map if you have an atlas and xml file with map properties?

``````<TileMap defaultScale="1.0" image="img/love_island_atlas.png" maxScale="2.0" minScale="0.25" tileBorderSize="2" tileHeight="100" tileMapHeight="2700" tileMapWidth="3400" tileWidth="100" tilesPerAtlasColumn="4" tilesPerAtlasRow="4">
<items>
<list>
<Tile flipHorizontal="false" flipVertical="false" height="100" index="1" width="100" x="480" y="-1136"></Tile>
<Tile flipHorizontal="false" flipVertical="false" height="100" index="10" width="100" x="2080" y="464"></Tile>
<Tile flipHorizontal="false" flipVertical="false" height="100" index="1" width="100" x="3780" y="-1036"></Tile>
....
</list>
</items>
``````

Thank you guys!

## magento 1.9 – How to generate just a single row for each product in a Dataflow Profiles export?

We are exporting a list of products from Magento 1.9 using a Dataflow Profiles export.

The resulting export file includes multiple rows for each product if the product has more than one image (eg if the product has 3 images there will be 3 rows for the product in the resulting CSV file).

We would like to have just a single row per product regardless of the number of images for each product.

I assume this can be done by adding some XML to the “Actions XML” field.

How can we force the export to only generate a single line for each product (always just the first line if there is more than one line per product)?

## mg.metric geometry – Fast way to generate random points in 2D according to a density function

I’m looking for a fast way to generate random points in 2D according to a given 2D density function.
For instance something like this:

Right now I’m using a modified version of “Poisson disc” method I found here:
https://www.jasondavies.com/poisson-disc/

To make this fast, it relies on a grid on fixed interval.
In my case, I don’t know the right size of the grid cells since the density changes over the plane.
(To generate this image I used no grid at all and it’s pretty slow)
Is there a “right way” to generalize this algorithm for this need?
Maybe a different approach altogether?

## ssh – Why do only some applications generate “MobaXterm X11 proxy: Unsupported authorisation protocol” error?

This question is related to How to fix “MobaXterm X11 proxy: Unsupported authorisation protocol”, but the answer there did not work for me.

I use MobaXterm to ssh from a Windows PC to a Linux PC, and I know that MobaXterm has a X11 server which allows GUI applications spawned in the Linux environment to appear in the Windows environment (sorry if my terminology is clunky).

I want to run `baobab` because I want to analyze disk space hogs. I guess I need to run `sudo baobab` because otherwise `baobab` reports permission errors and isn’t useful.

Problem/question: if I run `baobab` the gui appears, but if I run `sudo baobab`, I get this error:

``````\$ sudo baobab
MobaXterm X11 proxy: Unsupported authorisation protocol
Unable to init server: Could not connect: Connection refused

(baobab:219372): Gtk-WARNING **: 13:54:54.003: cannot open display: localhost:10.0
``````

I get the same result with `firefox` vs `sudo firefox`.

What is the problem, and how do I work around it?

I’ve already tried the `xauth add` suggestion at the linked post. Display port 10 was already listed to begin with, but I added a new entry anyway, and it didn’t make any difference:

``````\$ xauth list