c – Transformed and stored reversed order digits of an integer to a complete integer number

The indentation of your post is very bad, mainly because it is very inconsistent. Run your code through a program that indents the code for you, like indent or ClangFormat.

There is a simpler solution that is also more efficient, by avoiding the first pass over all the digits to find the length of the number. The solution could be a single loop that does this:

while (number != 0) {
    // Step 1: pop last digit from number
    ...

    // Step 2: push the digit to the back of complete_integer
    ...
}

Doing this will result in the order of the digits to be reversed. You already implemented popping the last digit from a number, now try to implement the reverse operation of pushing something to the back of a number, without having to know the exact length of that number.

I wonder why you don’t allow the number 0 to be reversed. It seems that this has a clear answer. You should be able to handle that case without having to write any additional code.

For negative numbers, you could indeed disallow them, or instead define how a negative number will be reversed. For example, you could say that the reverse of the number -123 will be -321, and then ensure your code implements this case. If the requirements for this project don’t say anything about negative numbers, it is up to you.

It is good to have descriptive names for functions and variables. One-letter names are usually bad, unless it’s for very commonly used things such as i for a loop iterator, or x and y for coordinates. But too long names can be bad as well; they require more typing, and they are distracting. Not only try to be clear, also be concise. For example:

int find_out_the_reverse_order_and_transform_digits_as_a_complete_integer(int number,int value){
    ...
}

That’s a lot of text! Now compare the following:

int reverse_digits(int number) {
    ...
}

The name of this function, along with the type of the input parameters and return value, are still very descriptive; it tells you that if you give it a number as a parameter, the function will reverse the digits, and returns the result as an interger. The name is much more concise though.

Similarly, even though you shouldn’t need this function, find_out_the_number_of_digit() could be shortened to count_digits().

On the other hand, also be aware of using too similar names. For example:

int number=get_input_validation();
int value=find_out_the_number_of_digit(number);

Now you have two variables, number and value. Now I have to look at what function was called to find out that value is actually the number of digits in number. Here is a suggestion for renaming it:

int input = get_input();
int digits_in_input = count_digits(input);

graphics – PyBullet & OpenGL – Rotations are reversed in OpenGL

Project description: I am writing a basic game engine to help with my PhD topic on multi-agent learning. I am using PyBullet as the backend physics engine and OpenGL for visual display. I have OpenGL buffers set up to hold the object information such as position(vec3) and rotation(matrix4x4) with rotations being done using Quaternions, but are stored using Euler angles for convenience.

My problem is that when I rotate an object in the OpenGL game world (around any axis), the pyBullet rotation (as seen from the pyBullet GUI) is in the opposite direction and sometime completely off. I must be missing something quiet basic and I apologies if this is a simple fix. I have also provided a video to show the issue that I am having – link to video of error (Link to video):

When I extract the rotation from PyBullet using getBasePositionAndOrientation() and convert the quaternion to Euler angles using pybullet.getEulerFromQuaternion(), the result is the correct vec3, but upon conversion to the rotation matrix pybullet.getMatrixFromQuaternion(), it seems to reverse the rotation direction.

Please see my code below:

'obj = Class BaseSceneObject'
'action = Euler rotation angle in degrees to apply vec3(x, y, z) e.g.(1., 0., 0.) apply +1 degree rotation to x-axis'

'Collect current position and rotation of object and update PyBullet'
# get the rotation - euler angles in degrees vec3(x,y,z)
rot = obj.get_rotation()
# add rotation action (e.g. +1 degree to x = vec3(1., 0., 0.)) and convert to radians
rot = math.radians(rot(0) + action(0)), math.radians(rot(1) + action(1)), math.radians(rot(2) + action(2))
# convert rotation from euler to quaternion
quat = pybullet.getQuaternionFromEuler(rot)
# update position and orientation
pybullet.resetBasePositionAndOrientation(bodyUniqueId=obj.get_rigid_body_id(),
                                         posObj=obj.get_position(),
                                         ornObj=quat)

'Collect PyBullet results and update OpenGL'
# get position and rotation from PyBullet
position, rotation = pybullet.getBasePositionAndOrientation(bodyUniqueId=obj.get_rigid_body_id())
# update object position
obj.set_position(position=position)
# convert rotation quaternion to euler angles
rot_r = pybullet.getEulerFromQuaternion(rotation)
# convert radians to degrees
rot_d = math.degrees(rot_r(0)), math.degrees(rot_r(1)), math.degrees(rot_r(2))
# construct OpenGL object rotation matrix
rot_m_final = numpy.identity(4)
rot_mr = numpy.array(pybullet.getMatrixFromQuaternion(rotation)).reshape(3, 3)
rot_m_final(:3, :3) = rot_mr
# update OpenGL rotation matrix
obj.set_rotation(rotation=rot_d,
                 rotation_matrix=rot_m_final)

Thank you for reading this and I hope that you can help me.

ai – The enemy weapon is not aiming properly when the collision line is reversed in Game Maker Studio

When the enemy moves to the right, their weapon points to the right. When you move to the left, the weapon points to the left as it should. If the player collides with the enemy's collision line on the right, the enemy weapon is pointing correctly at the player.

When the player is on the left side of the enemy and hits the collision line, the enemy weapon points towards the player, but not in the right direction.

 Step Event of Enemy gun object:

//image_xscale = 1 is looking to the right, -1 is left
// I use image_angle so the enemy gun will aim at the player on x and y axis

if obj_testEnemy.image_xscale == 1 { //When the enemy is looking to the right
    if (collision_line(x, y, x + 128, obj_testPlayer.y , obj_testPlayer, false, true)) {
        image_angle = point_direction(x,y,obj_testPlayer.x,obj_testPlayer.y); //how it aims at the player
    } else {
        image_angle = obj_testEnemy.image_xscale; // faces the correct direction when not colliding
    }

} else {
    if (collision_line(x, y, x - 128, obj_testPlayer.y , obj_testPlayer, false, true)) {
        image_angle = point_direction(x,y,obj_testPlayer.x,obj_testPlayer.y);
        image_xscale = -1; //gun should be facing left but it's not
    }
}

I don't understand why the gun doesn't point to the left when the collision line points to the left

Exposure – The film counter has reversed in the camera bag

This camera has a very simple film winding mechanism.

MY first guess, It may be that the button you press to release the film to rewind it was pressed while it was in the bag (release spool released), and this enabled the live film in the canister, the film pull off film backwards and the counter with it. * I believe the counter is driven by the take-up spool when the spool turns the counter. *

MY second guess, The basic winding mechanism is that the film is held on the take-up spool by the sprocket holes just instead of having a slot that the leader's tip fits into. This means that the tension of the film wrapped around the spool keeps the sprocket knobs in engagement with the sprocket holes in the film. I suspect that if the camera was pushed around in a pocket, the tension on the spool may have been released and the spool could have rotated there by turning the counter.

There are two ways to proceed: You can simply wrap the film back in the canister and develop it OR Bring the camera to a very dark room Absolutely black would be best but very dark and would cover the lens with a black cloth, then release the shutter and keep moving the film until you get from 12 to 19 or 20 (counting in your head, it's dark). Then go back into the light, make sure the counter has advanced and take a photo, wrap the feed lever to make sure the film advances the counter. If so, you should be able to shoot the rest of the film. If the counter has not advanced, just rewind it and develop the 18 you have.

apache2 – Can Apache proxying to the cloud be reversed without losing the CDN benefits?

context

I have a Cloudfront instance https://abc.cloudfront.net, Its origin is an S3 bucket that provides a static website.

The URL www.cooldomain.com points to an Apache server that I control and I can create SSL certificates for this domain. However, I have no control over the DNS server that indicates this www.cooldomain.com to my Apache server.

My questions

  1. Is it possible to reverse the proxy of my Apache server so that the static assets uploaded to S3 are shown to the user by? https://www.cooldomain.com? †

  2. If the answer to (1) is yes, will I lose the CDN benefits (since I assume that the static files provided by Cloudfront must be forwarded to the end user through my Apache server)?

† Note: I tried the following code

...
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off


    ProxyPass https://abc.cloudfront.net/
    ProxyPassReverse https://abc.cloudfront.net/
    RequestHeader set "Host" "abc.cloudfront.net"
    RequestHeader unset Cookie

my apache server on cloudfront reverse proxy but this gives me the error The proxy server received an invalid response from an upstream server. I'm assuming Cloudfront requires adding a CNAME to my server, but as mentioned earlier, I can't create an SSL certificate on AWS because I can't control the DNS server for that cooldomain.com Domain.

18.04 – Bash on Ubuntu on Windows. Launcher. The icon in the taskbar has reversed the colors

I recently installed Ubuntu 18.04 on Windows 10 (w10) via wsl. However, I have noticed an error in the display of the icon in the w10 taskbar.

1. Title of the edition

The Bash On Ubuntu icon in the system tray has reversed the colors.

2. Windows version / build number

C:UsersWindows>ver
Microsoft Windows (version 10.0.18362.535)

3. Steps to reproduce

  • Windows 10 Home Edition 1903
  • In Settings> Personalization> Taskbar
  • The "Use small button in the taskbar" property is deactivated (/! Otherwise the good symbol is displayed).
  • Install the "Ubuntu" app from the Windows Store (not the "Ubuntu 18.04" app)

4. Copy of the terminal edition

N / A

5. Expected behavior

It may be necessary to display a 24 icon with the orange and round background this could be safely called up in the task bar

Square44x44Logo.altform-unplated_targetsize-24.png

7. Additional information

in the

C:Program FilesWindowsAppsCanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgscAssets

Symbol files are listed, one seems to be missing

Square44x44Logo.altform-unplated_targetsize-24.png

There are two files that are this size:

    Square44x44Logo.targetsize-24.png
    Square44x44Logo.targetsize-24_altform-unplated.png

"altform-unplated_" are the orange and round background symbols &
The orange circles on white round symbols are only "target size". These are therefore reversed in color and therefore do not meet the requirements of the Ubuntu logo guidelines.

I could not find or create the appropriate file because I cannot create Package.appxmanifest.

And it seems Canonical is making such a package.

Thank you for reading these lines and happy new year!

turing machines – Prove that the language of CFGs that are closed when reversed cannot be decided

Note

The wording of the title may be a bit vague, but I'm not asking if CFLs are closed for reversal. See below.

Problem Description

Given a word $ w $, define $ w ^ {r} $ be its inversion.

To let $ L = {G vert G text {is a} CFG text {and for every} w in L (G) w ^ {r} in L (G) } $

Prove that $ L $ is undecidable.

My attempt

I am aware that I should reduce a language known to be undecidable to L, but by looking at the four undecidable languages ​​here (equivalence, disjointness, containment, universality), I still couldn't determine which language i can use. Please give me a direction, thank you.

Reversed Lens – Changing the aperture changes the field of view

I have a reverse lens macro setup, with a 35mm inverted lens attached to an 80-200 zoom lens via an adapter. I have the following problem: Changing the aperture setting on the zoom lens changes the field of view in my system.

I'm not sure why the aperture ring changes the field stop. Can someone help me explain this?

Thank you so much!