windows – Can we keep only X number of files rotated by Y MB with Apache rotatelogs

Can we rotate Apache logs keeping n number of backups rotated by size.

We can rotate apache logs with size by doing following:

ErrorLog “|bin/rotatelogs.exe logs/error_log-%Y-%m-%d.log 20M”

How I can keep only 5 backups always? What I mean is files should be always when it reaches to 20 MB and it should always keep 5 backups.

I am using Apache 2.4.20 on windows.

c++ – Cube doesn’t render as expected when rotated (representing 3D in 2D)

Cube.
enter image description here
When I rotate the object around OZ moves to the left.
enter image description here
Rotation around OX – the cube rises up.
enter image description here
Rotation around the OY-the cube is compressed.
enter image description here
The function I use for rotation:

void rotation(double angleX, double angleY, double angleZ, int x, int y, int z)
{
    angleX = angleX * M_PI / 180;
    angleY = angleY * M_PI / 180;
    angleZ = angleZ * M_PI / 180;

    double cX = cos(angleX);
    double sX = sin(angleX);
    double cY = cos(angleY);
    double sY = sin(angleY);
    double cZ = cos(angleZ);
    double sZ = sin(angleZ);

    double x0 = x;
    double y0 = y * cX + z * sX;
    double z0 = z * cX - y * sX;

    double x1 = x0 * cY - z0 * sY;
    double y1 = y0;
    double z1 = z0 * cY + x0 * sY;

    double x2 = x1 * cZ + y1 * sZ;
    double y2 = y1 * cZ - x1 * sZ;


    SDL_RenderDrawPoint(ren, x2, y2);
}

Full code:

#include <SDL.h>
#include <iostream>
#include    <vector>
struct point
{
    int x, y;
};
using namespace std;

int SCREEN_WIDTH = 640;
int SCREEN_HEIGHT = 480;

SDL_Window* win = NULL;
SDL_Renderer* ren = NULL;

void init() {
    win = SDL_CreateWindow("Cube", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
    ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
}

void quit() {
    SDL_DestroyWindow(win);
    win = NULL;
    SDL_DestroyRenderer(ren);
    ren = NULL;
    SDL_Quit;
}

std::vector<point> lines(int centerX, int centerY)
{
    std::vector<point> v;
    //line 1
    int x1 = centerX;
    int y1 = centerY;
    for (int i = 0; i < 100; i++)
    {
        x1 += 1;
        v.push_back(point{ x1, y1 });
        //SDL_RenderDrawPoint(ren, x1, y1);
    }
    //line 2
    int x2 = x1;
    int y2 = y1;
    for (int i = 0; i < 100; i++)
    {
        y2 -= 1;
        v.push_back(point{ x2, y2 });
        //SDL_RenderDrawPoint(ren, x2, y2);
    }
    //line 3
    int x3 = x2;
    int y3 = y2;
    for (int i = 0; i < 100; i++)
    {
        x3 -= 1;
        v.push_back(point{ x3, y3 });
        //SDL_RenderDrawPoint(ren, x3, y3);
    }
    //line 4
    int x4 = x3;
    int y4 = y3;
    for (int i = 0; i < 100; i++)
    {
        y4 += 1;
        v.push_back(point{ x4, y4 });
        //SDL_RenderDrawPoint(ren, x4, y4);
    }
    //line 5
    int x5 = x1;
    int y5 = y1;
    for (int i = 0; i < 50; i++)
    {
        y5 -= 1;
        x5 += 1;
        v.push_back(point{ x5, y5 });
        //SDL_RenderDrawPoint(ren, x5, y5);
    }
    //line 6
    int x6 = x5;
    int y6 = y5;
    for (int i = 0; i < 100; i++)
    {
        y6 -= 1;
        v.push_back(point{ x6, y6 });
        //SDL_RenderDrawPoint(ren, x6, y6);
    }
    //line 7
    int x7 = x2;
    int y7 = y2;
    for (int i = 0; i < 50; i++)
    {
        y7 -= 1;
        x7 += 1;
        v.push_back(point{ x7, y7 });
        //SDL_RenderDrawPoint(ren, x7, y7);
    }
    //line 8
    int x8 = x7;
    int y8 = y7;
    for (int i = 0; i < 100; i++)
    {
        x8 -= 1;
        v.push_back(point{ x8, y8 });
       //SDL_RenderDrawPoint(ren, x8, y8);
    }
    //line 9
    int x9 = x3;
    int y9 = y3;
    for (int i = 0; i < 50; i++)
    {
        y9 -= 1;
        x9 += 1;
        v.push_back(point{ x9, y9 });
        //SDL_RenderDrawPoint(ren, x9, y9);
    }
    //line 10 
    int x10 = centerX;
    int y10 = centerY;
    for (int i = 0; i < 50; i++)
    {
        y10 -= 1;
        x10 += 1;
        v.push_back(point{ x10, y10 });
       // SDL_RenderDrawPoint(ren, x10, y10);
    }
    //line 11 
    int x11 = x10;
    int y11 = y10;
    for (int i = 0; i < 100; i++)
    {
        x11 += 1;
        v.push_back(point{ x11, y11 });
        //SDL_RenderDrawPoint(ren, x11, y11);
    }
    //line 12
    int x12 = x10;
    int y12 = y10;
    for (int i = 0; i < 100; i++)
    {
        y12 -= 1;
        v.push_back(point{ x12, y12 });
        //SDL_RenderDrawPoint(ren, x12, y12);
    }
    return v;
}

void rotation(double angleX, double angleY, double angleZ, int x, int y, int z)
{
    angleX = angleX * M_PI / 180;
    angleY = angleY * M_PI / 180;
    angleZ = angleZ * M_PI / 180;

    double cX = cos(angleX);
    double sX = sin(angleX);
    double cY = cos(angleY);
    double sY = sin(angleY);
    double cZ = cos(angleZ);
    double sZ = sin(angleZ);

    double x0 = x;
    double y0 = y * cX + z * sX;
    double z0 = z * cX - y * sX;

    double x1 = x0 * cY - z0 * sY;
    double y1 = y0;
    double z1 = z0 * cY + x0 * sY;

    double x2 = x1 * cZ + y1 * sZ;
    double y2 = y1 * cZ - x1 * sZ;

    SDL_RenderDrawPoint(ren, x2, y2);
}

int main(int arhc, char** argv) {
    init();
    SDL_SetRenderDrawColor(ren, 0xFF, 0xFF, 0xFF, 0xFF);
    int centerX = SCREEN_WIDTH / 3;
    int centerY = SCREEN_HEIGHT / 2 + 100;
    int angleX = 0;
    int angleY = 0;
    int angleZ = 50;
    auto v = lines(centerX, centerY);
    for (int i = 0; i < 1000; i++)
        rotation(angleX, angleY, angleZ, v(i).x, v(i).y, 100);
    SDL_RenderPresent(ren);
    SDL_Delay(500000);
    quit();
    return 0;
}

Used matrices. However, the result was the same.

lens design – Why are flatbed-scanned images warped when compared to itself scanned & rotated 90 degrees?

This has been absolutely baffling me. I scanned an image both vertically and horizontally on the flatbed of my HP Color LaserJet Pro MFP M277dw using Windows Fax and Scan. I then used Gimp to rotate one of the images 90 degrees, to overlay it above the other image.
But then, the image appears to have been stretched by the flatbed!

Not giving up, I tried on another scanner, the Epson Stylus C88+, and got the same results! Is there an inherent flaw with most flatbed scanners? Why does it seem to skew out the image when compared to its horizontal counterpart?

In the 3rd image below, if I lined up the “A“, the “D” gets misaligned. The graphing paper also shows the effects of a horizontal scan.

Why does this happen? Are there any scanners that don’t do this? Is it dependent on the angle that light is reaching the photo-sensors?

Finally, can this multi-angle scanner invention have anything at all to do with this effect?

Vertically scanned image

Horizontally scanned image

Merged scanned image from vertical & horizontal images

Mod Security: ModSecurity doesn't write to new rotated log files?

I have the following record rotation configured in the operating system for nginx and modsec records, and it works for nginx records but not for modsec. The result for modsec is that you made a copy for the log file but keep writing to the previous file as follows:

-rw-r--r-- 1 root root 26996998524 Apr 30 12:00 modsec_debug.log.1
drwxr-xr-x 3 root root        4096 Apr 29 10:31 .
-rw-r--r-- 1 root root           0 Apr 29 10:31 modsec_debug.log

Can someone tell me what I have missed? Apart from & # 39; kill -USR1 cat /var/run/nginx.pid& # 39 ;, should I run something else?
Note that the nginx runs inside a container and I have this volume allocation: /var/log/nginx:/usr/local/openresty/nginx/logs

Other information:
openresty: 1.13.6.2
Modsec: 3.0.3
Operating system version: Ubuntu 18.04.3 LTS

/var/log/nginx/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        create 0640 root root
        maxsize 500M
        minsize 500M
        sharedscripts
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then 
                        run-parts /etc/logrotate.d/httpd-prerotate; 
                fi 
        endscript
        postrotate
                docker exec www-proxy /bin/sh -c 'kill -USR1 `cat /var/run/nginx.pid`'
        endscript
}

/var/log/nginx/modsec/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        create 0640 root root
        maxsize 500M
        minsize 500M
        sharedscripts
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then 
                        run-parts /etc/logrotate.d/httpd-prerotate; 
                fi 
        endscript
        postrotate
                docker exec www-proxy /bin/sh -c 'kill -USR1 `cat /var/run/nginx.pid`'
        endscript
}

Thank you.

polygons – region function of rotated polyhedron

Is it possible to find the equation of the inner region of a rotated polyhedron? For example, the analytical region for a dodecahedron is found by:

PolyhedronData["Dodecahedron", "RegionFunction"][x, y, z]

How do you find the equation of the rotated dodecahedron itself some angle about $ x $, $ and $ or $ z $ axis?

unit: the small health bar above the entity is drawn differently when the entity is rotated differently

Here is a simple positioning code for my health bar:

transform.position = Camera.main.WorldToScreenPoint(target.position - 0.2f * target.up);

Here is the precast:

enter the image description here

  • HealthBar is anchored in the center and has 0.5, 0.5 pivoted,
  • The bottom and fill stretch and 0.5, 0.5 rotate, but the bottom is in the Left, Right, Top, Bottom -1 position.

This is how it should look: (all images are enlarged)

enter the image description here

And here is a video about the rotating entity: https://i.imgur.com/EOzFEvt.mp4

2 example rotations, in which the health bar is drawn incorrectly: (see the border of the bar)

enter the image description here

enter the image description here

Why?

Edit: Origin of the entity:

enter the image description here

graphics: the box disappears when rotated in the presence of a density graph

Note that the rotated "Hello" does not appear (MacOS, Mathematica 12.0). If you remove the DisplayPlotthen it does.

Show(DensityPlot(x^2 + y^2, {x, -1, 1}, {y, -1, 1}, ColorFunction -> (GrayLevel(.6 + .4 #) &)),
 Graphics({
   Inset(Style("Hi", FontSize -> 140), {0, 0}),
   Rotate(Inset(Style("Hi", FontSize -> 140), {0, 0}), .5)
   })
 )

Is this a bug or a feature? And is there an alternative solution?

enter the image description here

tracing – How can I intersect a line with its rotated counterpart?

So, I am trying to intersect an infinite line with a line, this is my code for now, I have been using Region Intersection, but it seems that it does not work with this case, I have:

s1 = {-41, 14}
s2 = {-40.5, 14.5}

v1 = {-24.3, 0.4}
v2 = {-16.86, 1.34}
v3 = {-21.46, 7.43}

md = Midpoint[{v3, v1}]

prism = {v1, v2, v3, v1}

a = Rotate[InfiniteLine[{s1, md}], -Pi/35, s1]

Show[ListLinePlot[{prism, {s1, md}}, PlotRange -> All], 
 Graphics[Rotate[InfiniteLine[{s1, md}], Pi/35, s1], Frame -> True], 
 Graphics[Rotate[InfiniteLine[{s1, md}], -Pi/35, s1], Frame -> True]]
RegionIntersection[a, InfiniteLine[{v1, v3}]]

blender: the root bone was not rotated, but after being imported into Unity, the animations were rotated and do not match the loop

I made 9 animations in Blender and passed the humanoid type configuration (I used rigify).

All animations do not move the root bone (the position / rotation / scale of the root bone is blocked), however, when I imported my model to Unity and played the animation, some of them rotate at a certain angle, it does not look forward.

enter the description of the image here

And one of my animations has a really serious problem, when I play a preview animation, every time the animation ends, it turns permanently like a clock bar tick.

There are also some problems that the loop matching of some options has a red signal.

enter the description of the image here

I read this document: https://docs.unity3d.com/2018.3/Documentation/Manual/LoopingAnimationClips.html, so I tried to fix this manually by adjusting the timeline, but changing the timeline cut my animations. How do I solve this without cutting the animation?

He used Blender 2.78b and Unity 2018.3.

rotation – Spacing of rotated elements (labels) in the grid

How can I change the size of a specific subset of cells in a Grid? I'm using the ItemSize parameter for which I want to change, but it affects others, and I cannot control the sizes separately.

More details: I want to present a large matrix (48×48) with labels for each column and row. The way I am doing it now is with Grid, adding an additional row and column with the desired labels. However, since the entries are of different lengths, I want to adjust the size of these Grid cells so they are all the same, but I want to leave the label cells unchanged.

Here is (one MWE of) my code to start:

labels = {"Long property name A", "Extremely long Property name B"};
Grid(Partition(Riffle(Join(
    {Null},
    Item(Rotate(#, -90 Degree), Alignment -> Bottom) & /@ labels,
    {1, 3000, 5, 7000}),
   Item(#, Alignment -> Right) & /@ labels, {4, -1, 3}), 3), 
 Frame -> All)

This is the result:

enter the description of the image here

Now, I would like to change the size of the cells in the lower right 4×4 submatrix, so that they all have the same size. I fix this by changing the table entry {1,3000,5,7000} to:

Item(#, ItemSize -> 4) & /@ {1, 3000, 5, 7000}

But then this is the result:

enter the description of the image here

I tried to add the ItemSize parameter to the Items that contains the tags, but the tag text appears on a single line only if the cell is extremely wide, such as ItemSize->20, which I don't want So, how can I change the size of some of the cells without affecting the size of other cells?