text:
Q: How to automatically create and assign ticket in trac to responsible developer if build failes I'm searching for a possibility to automatically create a new ticket in trac in case of a build failure. The problem is, that the ticket has to be assigned to the person who broke the build.
I tried the TicketToTracScript to create a ticket, but I don't know how to get the responsible person for the ticket.

A: What do you mean by "the responsible person for the ticket"?
If you mean the account responsible for filing the ticket, then I recommend creating a separate Trac user account for your auto-build system.  This account would only be used by scripts that auto-file tickets.  This is typically a much easier route to take than trying to re-use someone's developer account.
If you mean the person to whom the ticket should be assigned, then I'm afraid that there's no easy answer.  Determining who is responsible for breaking a build is usually very difficult to automate based solely on the build results.
If your build output gives you a line number for the offense that caused the failure, you can use a feature like svn blame (if your version control system has something similar) to see who was the last person to change that line.  That may not actually be the person who broke the build, however, but it does give you a start.  I have seen some systems that list everyone who modified the offending file since the last build on the ticket in the "CC" field, and list the last person to change that line as the owner.  That will at least cause the issue to be investigated, and the ticket can be re-assigned if needed.
The only true way to know who broke the build is to attempt to build intermediate revisions until you discover the commit that caused the problem.  Tools like git bisect are useful for this, if your revision control system provides something analagous.  This is of course completely dependent on the length of time it takes to do a full build.  If you have a large code base that takes 45 minutes to build, then this would probably take far too much time to be practical.  If your project is, say, broken up into individual components that can be built separately, then you can test-build only the component that failed and quickly identify the offending commit.


text:
Q: Why would this cause a StringIndexOutOfBoundsException? Android I am working on a small file manager to help me learn the basics of android, but I keep running into an error. WHenever I have a lot of items in the folder, it crashes and I get a message similar to this one,

java.lang.StringIndexOutOfBoundsException: length=26; regionStart=23; regionLength=-2

What could be causing this? The line it points to is line 2:
1.)String mimeType = "";
2.)mimeType = URLConnection.guessContentTypeFromName(f.getName());

A: You are missing some key lines we need to see, such as where f (a File? a URI?) is defined. However when I have seen this problem before it was caused by a URI with no Protocol set.
Making sure you have an extension and using MimeTypeMap#getMimeTypeFromExtension() is probably a good bet too

A: This error happens to me when the URL has a fragment, which can be identified by a # followed by some value. (For more on URL fragments, see https://www.w3.org/Addressing/URL/4_2_Fragments.html)
The URL fragment is not helpful in guessing content type, and since it is problematic in this case, it should be removed before calling URLConnection.guessContentTypeFromName().
Here is a simple function that returns a URL without the fragment:
private fun getSafeUrlForGuessing(url: String): String {
    return try {
        val uri = Uri.parse(url)
        if (uri.scheme?.startsWith("http") == true) {
            uri.buildUpon()
                    .fragment(null) // URLs with fragments cause URLConnection.guessContentTypeFromName() to throw
                    .build()
                    .toString()
        } else {
            url
        }
    } catch (error: Throwable) {
        url
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Call a javascript function from one frame's page to another frame's page, gives "Permission Denied" error I have an page which contains frameset of 2 frames. I am loading http://testhost/test.aspx in frame1 and http://otherhost/test2.aspx in frame2. Now, i want to call the javascript function of test.aspx from test2.aspx using parent and child elements. But I am getting "Permission Denied" error, as both pages are from different domain.
Please note that test.aspx and test2.aspx are under two different hosts.
Please help me by suggesting a work around for this.
Thanks in advance.

A: You can't directly call them, communication is possible if you have control over both test.aspx and test2.aspx.  You can use postMessage from HTML5 in supoprted browsers.
It would be much easier to use a library that does this with fallbacks for browsers that don't support postMessage, like easyXDM.

A: You're experiencing "same origin policy" issues because pages are on two different domains.
Best "solution" yet.
https://developer.mozilla.org/en/document.domain


text:
Q: How to redirect python print to a file while running it inside a screen session I have a simple python script test.py:
from __future__ import print_function
print("Hello")

I try to redirect the printing to a file, inside a screen session. The following things work:
Without screen:
python test.py > out.txt

With screen, step by step:
screen -S tmp
python test.py > out.txt
exit

However what I really need is not working (out.txt remains empty):
screen -Sdm tmp python test.py > out.txt

After reading a seemingly related question I also tried:
screen -Sdm tmp stdbuf -i0 -o0 -e0 python test.py > out.txt

But it also didn't work.

A:
However what I really need is not working (out.txt remains empty):
screen -Sdm tmp python test.py > out.txt

That command works as follows:

*

*The shell launches the screen program with standard output redirected to out.txt

*In the screen session python is run without any output redirection. One might expect that the output of python should eventually be sent to out.txt anyway, because of the output redirection applied to its parent process. However, that doesn't happen since screen does its own management of output streams.

You can solve the problem by making the output redirection happen inside the screen session as follows:
screen -Sdm tmp bash -c "python test.py > out.txt"

This runs under screen the following command:
bash -c "python test.py > out.txt"

which stands for start bash and execute inside it the command "python test.py > out.txt".

A: I am not sure of how you could redirect the output externally or how that screen command works, but if modifying that Python program is under your control, what about this solution? You could write something like this at the very beginning of your program:
import sys

class Logger(object):
    def __init__(self, logfile):
        self.terminal = sys.stdout
        self.log = open(logfile, "a")

    def write(self, message):
        self.terminal.write(message)  # This might be optional for you
        self.log.write(message)

    def flush(self):
        #this flush method is needed for python 3 compatibility.
        #this handles the flush command by doing nothing.
        #you might want to specify some extra behavior here.
        pass

if len(sys.argv) > 1:  # Just in case no argument was passed to the program
    sys.stdout = Logger(sys.argv[1])

By doing this, you would not need to rewrite every print statement. You would then use your screen command without the > redirection, passing the file as a normal argument:
screen -Sdm tmp python test.py out.txt

Or perhaps you might require quotation marks for this to work:
screen -Sdm tmp python "test.py out.txt"

A: have you considered using the file read/write ?
example:
file = open("path/to/file", "w")
file.write("Hello")
file.close

A: How about just implementing some logging? Use daiquiri the simplify it.


text:
Q: Scroll Snap for div that looks like an iPhone in HTML I made this iPhone in HTML (Please do not pay attention to the spaghetti code, and it's in german, if it is necessary i can translate it with pleasure):

var time = document.getElementById("time");
    var notification = document.getElementById("notification");
    var notificationHeader = document.getElementById("notificationHeader");
    var notificationDescription = document.getElementById("notificationDescription");
    var verificationCode = Math.floor(1000 + Math.random() * 9000);
    var input = document.getElementById("instagramNumberText");
    var correctOrWrongCheck = document.getElementById("correctOrWrongCheck");
    var verificationCodePTag = document.getElementById("verificationCode");
    var instagram = document.getElementById("instagramApp");
    var mail = document.getElementById("mailApp");
    var createAccountButton = document.getElementById("createAccount");
    var createAccountForm = document.getElementById("createAccountForm");
    var verificationCodeInstagramPage = document.getElementById("verificationCodeInstagramPage");
    var controlVerificationCodeButton = document.getElementById("controlVerificationCode");
    var continueToInstagramAccountButton = document.getElementById("continueToInstagramAccount");
    var verificationCodeEmailDescription = document.getElementById("verificationCodeEmailDescription");
    var verificationCodeEmail = document.getElementById("verificationCodeEmail");
    var erfolgreichAngemeldet = document.getElementById("erfolgreichAngemeldet");
    var instagramAccount = document.getElementById("instagramAccount");

    var instagramName = document.getElementById("instagramName");
    var instagramNameInput = document.getElementById("instagramNameInput");

    // Time

    function checkTime(i) {
        if (i < 10) {
            i = "0" + i;
        }
        return i;
    }

    function startTime() {
        var today = new Date();
        var h = today.getHours();
        var m = today.getMinutes();
        // add a zero in front of numbers<10
        m = checkTime(m);
        document.getElementById('time').innerHTML = h + ":" + m;
        t = setTimeout(function() {
            startTime()
        }, 500);
    }
    startTime();

    // Insta

    function controlVerificationCode() {
        if (input.value == verificationCode) {
            correctOrWrongCheck.innerHTML = "Der Code war korrekt!";
            continueToInstagramAccountButton.style.display = "block";
            continueToInstagramAccountButton.style.margin = "5px auto";
            controlVerificationCodeButton.style.display = "none";
        } else if (input.value !== verificationCode) {
            correctOrWrongCheck.innerHTML = "Der Code ist leider Falsch!";
            continueToInstagramAccountButton.style.display = "none";
            controlVerificationCodeButton.style.display = "block";
        }
    }

    verificationCodeEmailDescription.innerHTML = "Ihr Bestätigunscode lautet: " + verificationCode;

    // OPEN AND CLOSE APPS

    function openVerificationCodeInstagramPage() {
        createAccountForm.style.display = "none";
        verificationCodeInstagramPage.style.display = "block"
        verificationCodeEmail.style.display = "block";
        instagramName.value = instagramNameInput.value;
        notification.style.transform = "translate(-50%, -50%) scale(0)";
        notificationDescription.innerHTML = "Ihr Bestätigunscode lautet: ...";
        setTimeout(
            function() {
                notification.style.transform = "translate(-50%, -50%) scale(1)";
            }, 1000);
         setTimeout(
            function() {
                notification.style.transform = "translate(-50%, -50%) scale(0)";
            }, 7000);
    }

    function continueToInstagramAccount() {
        verificationCodeInstagramPage.style.display = "none";
        instagramAccount.style.display = "flex";
        erfolgreichAngemeldet.display = "none";
        notificationDescription.innerHTML = "Erfolgreich bei Instagram angemeldet"
        notification.style.transform = "translate(-50%, -50%) scale(0)";
        erfolgreichAngemeldet.style.display = "block";

        setTimeout(
            function() {
                notification.style.transform = "translate(-50%, -50%) scale(1)";
            }, 1000);
            setTimeout(
            function() {
                notification.style.transform = "translate(-50%, -50%) scale(0)";
            }, 7000);

        var counter = 0;
        var followers = document.getElementById('followers');
        setTimeout(function(){
            var st = setInterval(function(){
                followers.innerHTML = ++counter;
            },100)
        },100);
        }

    function closeNotification() {
        notification.style.transform = "translate(-50%, -50%) scale(0)";
    }

    function openInstagram() {
        instagram.style.transform = "scale(1)";
    }
    function openMail() {
        mail.style.transform = "scale(1)";
    }

    function closeApp() {
        instagram.style.transform = "scale(0)";
        mail.style.transform = "scale(0)";
    }

    window.onload = function() {
        document.getElementById("instagramNumberText").value = '';
    }
* {
            margin: 0;
            padding: 0;
            font-family: 'Roboto',sans-serif;
            user-select: none;
        }

        input:focus, textarea:focus {
            outline: 0;
        }

        #phone {
            height: 600px;
            width: 350px;
            border-radius: 50px;
            position: absolute;
            top: 600px;
            left: 50%;
            -ms-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
            border-top: 90px solid;
            border-right: 15px solid;
            border-left: 15px solid;
            border-bottom: 90px solid;
            background-image: url("https://ioshacker.com/wp-content/uploads/2019/06/iOS-13-wallpaper.jpg");
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
        }

        .app {
            box-shadow: 0 0 9px -4px #000;
        }

        #topbar {
            padding: 0.3em;
            color: #fff;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 20px;
            transform: translate(-4%,0) scale(0.9);
            width: 370px;
        }

        #connection {
            display: flex;
            align-items: center;
            width: 110px;
            justify-content: space-around;
        }

        #battery {
            display: flex;
            align-items: center;
            width: 110px;
            justify-content: end;
        }

        #battery .bi-battery-full {
            font-size: 23px;
            margin-left: 5px;
        }

        #topbar .bi-wifi-2 {
            font-size: 25px;
            margin-top: -3px;
        }

        #time {
            text-align: center;
        }

        #notification {
            margin: 0;
            position: absolute;
            top: 365px;
            left: 50%;
            -ms-transform: translate(-50%, -50%) scale(0);
            transform: translate(-50%, -50%) scale(0);
            height: 85px;
            width: 315px;
            background: #EDEBED;
            border-radius: 10px;
            z-index: 10000;
            transition: all 0.5s;
            box-shadow: 0 0 10px -1px #525252;
            padding: 0.5em 0 0.5em 1em;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        #notification h1 {
            font-size: 23px;
        }

        #appsOne {
            display: flex;
            justify-content: space-around;
            flex-wrap: wrap;
        }

        #instagramIcon, #verificationCode, #mailIcon {
            margin: 20px;
        }

        .app {
            font-size: 40px;
            width: 50px;
            height: 50px;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 10px;
            transition: all 0.2s;
        }

        .app:hover {
            cursor: pointer;
            filter: brightness(90%);
        }

        .bi-instagram, .bi-envelope-fill {
            width: 40px;
            height: 40px;
            color: #fff;
            font-family: sans-serif;
        }

        /* Instagram */

        #instagramIcon {
            background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
        }

        #instagramApp {
            position: absolute;
            top: 0;
            left: 0;
            background: #EAEAEA;
            height: 100%;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            transition: all 0.3s;
            transform: scale(0);
            z-index: 99999;
            text-align: center;
        }
        .instagramHeader {
            font-family: 'Handlee', cursive;
            font-size: 35px;
        }
        .instagramSecondHeader {
            font-size: 15px;
            width: 260px;
            margin: 1em 0;
        }
        #instagramNameInput, #instagramEmail, #instagramNumberText {
            font-size: 15px;
            padding: 0.5em;
            border: 1px solid #D1D1D1;
            margin: 0.5em 0 0.5em 0;
            width: 220px;
        }
        .instagramButton {
            width: 236px;
            font-size: 15px;
            padding: 0.5em;
            background: #3296F0;
            color: #fff;
            border: none;
            margin: 0.5em 0;
            transition: all 0.2s;
        }
        .instagramButton:hover {
            filter: brightness(80%);
            cursor: pointer;
        }
        #verificationCodeInstagramPage {
            display: none;
        }
        #continueToInstagramAccount {
            display: none;
        }

        #instagramAccount {
            display: none;
            justify-content: flex-start;
            height: 100%;
            width: 100%;
            background: #f7f7f7;
            flex-direction: column;
            align-items: center;
        }
        #instagramName {
            font-size: 20px;
            text-align: left;
            width: 85%;
            padding: 20px 20px 15px 10px;
            border-bottom: 1px solid gray;
            height: 20px;
            border-right: none;
            border-top: none;
            border-left: none;
            background: none;
        }
        #profilePicture {
            font-size: 35px;
            width: 80px;
            height: 80px;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #eae9e9;
            border-radius: 100000px;
            margin: 20px;
            border: 1px solid #6f6e6e;
            color: #6f6e6e;
        }
        #instagramPictureAndNumbers {
            display: inherit;
            width: 360px;
        }
        #numbers {
            width: 225px;
            height: 45px;
            margin: 35px 0 0 0;
        }
        #userDescription {
            width: 320px;
            font-size: 13px;
            border: none;
            background: none;
            resize: none;
        }
        .bi-table {
            font-size: 25px;
            border-bottom: 1px solid;
            width: 90%;
            margin-top: 0.5em;
        }
        #emptyImages {
            color: #c7c7c7;
            margin: 100px;
            font-size: 14px;
        }

        /* Mail */
        #mailIcon {
            background: linear-gradient(0deg, #05ffff 0%, #3cabe6 30%, #2763dc 70%);
        }
        #mailApp {
            position: absolute;
            top: 0;
            left: 0;
            background: #f6f6f6;
            height: 100%;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            flex-direction: column;
            transition: all 0.3s;
            transform: scale(0);
            z-index: 99999;
            text-align: center;
        }
        #mailHeader {
            font-size: 25px;
            padding: 20px;
            background: #fff;
            width: 88%;
            z-index: 999;
        }
        #verificationCodeEmail {
            display: none;
        }
        .email {
            background: #fff;
            width: 97%;
            padding: 5px;
            border-top: 1px solid #e6e6e6;
        }
        .emailHeader {
            text-align: left;
            margin: 10px;
            font-size: 25px;
        }
        #verificationCodeEmailDescription, #erfolgreichAngemeldetDescription {
            text-align: left;
            margin: 10px;
        }

        #erfolgreichAngemeldet {
            display: none;
        }

        /* Home Button */
        #homeButton {
            position: absolute;
            height: 60px;
            width: 60px;
            background: transparent;
            z-index: 9999;
            bottom: -107px;
            border-radius: 100000px;
            left: 50%;
            -ms-transform: translate(-50%, -50%) rotate(-10deg);
            transform: translate(-50%, -50%) rotate(-10deg);
            border: 1px outset;
            cursor: pointer;
        }
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css">
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400&display=swap" rel="stylesheet">

Neue Email erhalten!

            LIDL LTE

            98%

                    <form id="createAccountForm" action="#" onsubmit="openVerificationCodeInstagramPage(); return false;">

Instagram

Erstelle einen Account

                        <input type="text" id="instagramNameInput" placeholder="Name" maxlength="12" autocomplete="off" required>
                        <input type="email" id="instagramEmail" placeholder="E-Mail" autocomplete="off" required>
                        <button type="submit" id="createAccount" class="instagramButton">Erstellen</button>
                    </form>

Bestätigen

Wir haben ihn einen Bestätigungscode per Email gesendet!

                        <input type="text" id="instagramNumberText" maxlength="4" onkeypress="return /[0-9]/i.test(event.key)" placeholder="Bestätigungscode">

                        <button onclick="controlVerificationCode();" id="controlVerificationCode" class="instagramButton">Bestätigen</button>
                        <button class="instagramButton" id="continueToInstagramAccount" onclick="continueToInstagramAccount()">Weiter</button>

                        <input type="text" id="instagramName">

                                    0
                                    1
                                    0

                                    Posts
                                    Followers
                                    Following

                        <textarea id="userDescription" placeholder="Beschreibung..." rows="10"></textarea>

No images found

                Second App Page

E-Mails

Instagram

Erfolgreich angemeldet

Instagram

Ihr Bestätigunscode lautet

To see the iPhone better you should click on Full-Page in the snippet.
My problem was that I have 2 divs: #appsOne and #appsTwo which are in the div #slider. On the home page of the iPhone you can see two apps (#appsOne) and a text (#appsTwo) in the middle. The apps (#appsOne) should stay where they are but the text (#appsTwo) should be made on a second page with a horizontal scroll snap. How could I do that?
And here's an image, how it looks like without the slider and the #appsTwo div:

A: CSS Scroll-snapping
We can seperate the two 'screen's by wrapping each in a div with class panel.
To make the slider scrollable, we have to apply white-space: nowrap to force it into a single line. To make scroll-snap work horizontally, set scroll-snap-type to x and make it mandatory (scroll-snap-type: x mandatory;). This means that:

The visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled. That means it snaps on that point when the scroll action finished, if possible. If content is added, moved, deleted or resized the scroll offset will be adjusted to maintain the resting on that snap point.MDN

We also set overscroll-behavior-x to contain which makes sure that no scroll chaining occurs to neighboring scrolling areas, e.g. underlying elements will not scroll.
We then apply scroll-snap-align: center to .panel. To prevent the overflowing contents in the panels, we also apply white-space: initial.
Result:
https://jsfiddle.net/Spectric/j7br8h5a/
JS Scroll-snapping (mouse drag)
We can take it one step further by adding support for user drag to scroll.
For this, we don't actually need scroll-snap at all. We can do it with pure JS.
Add an event listener for mousedown that sets isDown to true. Record the last position of the mouse.
Add an event listener for mousemove that checks whether the user is currently dragging (isDown == true). If the user is, calculate the distance from the current mouse position and the last mouse position, increment the slider's scrollLeft by the difference, and set the last position to the current position.
Add an event listener for mouseup that sets isDown to false and checks whether the slider's current scrollLeft is bigger than half. If it is, we can use scrollIntoView() on one panel to smoothly scroll it into the viewport.

To prevent scrolling when an app is opened, we can store the status in a variable which we set it to true when one of the open app function is called and false when the closeApp function is called. In the mousemove listener we also check whether this variable is true.
Best viewed in full-page mode

var time = document.getElementById("time");
var notification = document.getElementById("notification");
var notificationHeader = document.getElementById("notificationHeader");
var notificationDescription = document.getElementById("notificationDescription");
var verificationCode = Math.floor(1000 + Math.random() * 9000);
var input = document.getElementById("instagramNumberText");
var correctOrWrongCheck = document.getElementById("correctOrWrongCheck");
var verificationCodePTag = document.getElementById("verificationCode");
var instagram = document.getElementById("instagramApp");
var mail = document.getElementById("mailApp");
var createAccountButton = document.getElementById("createAccount");
var createAccountForm = document.getElementById("createAccountForm");
var verificationCodeInstagramPage = document.getElementById("verificationCodeInstagramPage");
var controlVerificationCodeButton = document.getElementById("controlVerificationCode");
var continueToInstagramAccountButton = document.getElementById("continueToInstagramAccount");
var verificationCodeEmailDescription = document.getElementById("verificationCodeEmailDescription");
var verificationCodeEmail = document.getElementById("verificationCodeEmail");
var erfolgreichAngemeldet = document.getElementById("erfolgreichAngemeldet");
var instagramAccount = document.getElementById("instagramAccount");

var instagramName = document.getElementById("instagramName");
var instagramNameInput = document.getElementById("instagramNameInput");

// Time

function checkTime(i) {
  if (i < 10) {
    i = "0" + i;
  }
  return i;
}

function startTime() {
  var today = new Date();
  var h = today.getHours();
  var m = today.getMinutes();
  // add a zero in front of numbers<10
  m = checkTime(m);
  document.getElementById('time').innerHTML = h + ":" + m;
  t = setTimeout(function() {
    startTime()
  }, 500);
}
startTime();

// Insta

function controlVerificationCode() {
  if (input.value == verificationCode) {
    correctOrWrongCheck.innerHTML = "Der Code war korrekt!";
    continueToInstagramAccountButton.style.display = "block";
    continueToInstagramAccountButton.style.margin = "5px auto";
    controlVerificationCodeButton.style.display = "none";
  } else if (input.value !== verificationCode) {
    correctOrWrongCheck.innerHTML = "Der Code ist leider Falsch!";
    continueToInstagramAccountButton.style.display = "none";
    controlVerificationCodeButton.style.display = "block";
  }
}

verificationCodeEmailDescription.innerHTML = "Ihr Bestätigunscode lautet: " + verificationCode;

// OPEN AND CLOSE APPS

function openVerificationCodeInstagramPage() {
  createAccountForm.style.display = "none";
  verificationCodeInstagramPage.style.display = "block"
  verificationCodeEmail.style.display = "block";
  instagramName.value = instagramNameInput.value;
  notification.style.transform = "translate(-50%, -50%) scale(0)";
  notificationDescription.innerHTML = "Ihr Bestätigunscode lautet: ...";
  setTimeout(
    function() {
      notification.style.transform = "translate(-50%, -50%) scale(1)";
    }, 1000);
  setTimeout(
    function() {
      notification.style.transform = "translate(-50%, -50%) scale(0)";
    }, 7000);
}

function continueToInstagramAccount() {
  verificationCodeInstagramPage.style.display = "none";
  instagramAccount.style.display = "flex";
  erfolgreichAngemeldet.display = "none";
  notificationDescription.innerHTML = "Erfolgreich bei Instagram angemeldet"
  notification.style.transform = "translate(-50%, -50%) scale(0)";
  erfolgreichAngemeldet.style.display = "block";

  setTimeout(
    function() {
      notification.style.transform = "translate(-50%, -50%) scale(1)";
    }, 1000);
  setTimeout(
    function() {
      notification.style.transform = "translate(-50%, -50%) scale(0)";
    }, 7000);

  var counter = 0;
  var followers = document.getElementById('followers');
  setTimeout(function() {
    var st = setInterval(function() {
      followers.innerHTML = ++counter;
    }, 100)
  }, 100);
}

function closeNotification() {
  notification.style.transform = "translate(-50%, -50%) scale(0)";
}

var isAppOpened = false;

function openInstagram() {
  isAppOpened = true;
  instagram.style.transform = "scale(1)";
}

function openMail() {
  isAppOpened = true;
  mail.style.transform = "scale(1)";
}

function closeApp() {
  isAppOpened = false;
  instagram.style.transform = "scale(0)";
  mail.style.transform = "scale(0)";
}

window.onload = function() {
  document.getElementById("instagramNumberText").value = '';
}
const slider = document.getElementById("slider");
const panels = document.querySelectorAll('.panel');
var lastX = 0;
var isDown = false;

document.addEventListener("mousedown", function(e) {
  lastX = e.pageX;
  isDown = true;
})
document.addEventListener("mousemove", function(e) {
  if (isDown && !isAppOpened) {
    const curX = e.pageX;
    const diff = lastX - curX;
    slider.scrollLeft += diff;
    lastX = curX;
  }

})
document.addEventListener("mouseup", function() {
  isDown = false;
  slider.style.scrollBehavior = "smooth";
  if (slider.scrollLeft > 175) {
    panels[1].scrollIntoView();
  } else {
    panels[0].scrollIntoView();
  }
  slider.style.scrollBehavior = "unset";
})
* {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  user-select: none;
}

input:focus,
textarea:focus {
  outline: 0;
}

#phone {
  height: 600px;
  width: 350px;
  border-radius: 50px;
  position: absolute;
  top: 600px;
  left: 50%;
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  border-top: 90px solid;
  border-right: 15px solid;
  border-left: 15px solid;
  border-bottom: 90px solid;
  background-image: url("https://ioshacker.com/wp-content/uploads/2019/06/iOS-13-wallpaper.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.app {
  box-shadow: 0 0 9px -4px #000;
}

#topbar {
  padding: 0.3em;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 20px;
  transform: translate(-4%, 0) scale(0.9);
  width: 370px;
}

#connection {
  display: flex;
  align-items: center;
  width: 110px;
  justify-content: space-around;
}

#battery {
  display: flex;
  align-items: center;
  width: 110px;
  justify-content: end;
}

#battery .bi-battery-full {
  font-size: 23px;
  margin-left: 5px;
}

#topbar .bi-wifi-2 {
  font-size: 25px;
  margin-top: -3px;
}

#time {
  text-align: center;
}

#notification {
  margin: 0;
  position: absolute;
  top: 365px;
  left: 50%;
  -ms-transform: translate(-50%, -50%) scale(0);
  transform: translate(-50%, -50%) scale(0);
  height: 85px;
  width: 315px;
  background: #EDEBED;
  border-radius: 10px;
  z-index: 10000;
  transition: all 0.5s;
  box-shadow: 0 0 10px -1px #525252;
  padding: 0.5em 0 0.5em 1em;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#notification h1 {
  font-size: 23px;
}

#appsOne {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

#instagramIcon,
#verificationCode,
#mailIcon {
  margin: 20px;
}

.app {
  font-size: 40px;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  transition: all 0.2s;
}

.app:hover {
  cursor: pointer;
  filter: brightness(90%);
}

.bi-instagram,
.bi-envelope-fill {
  width: 40px;
  height: 40px;
  color: #fff;
  font-family: sans-serif;
}

/* Instagram */

#instagramIcon {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

#instagramApp {
  position: absolute;
  top: 0;
  left: 0;
  background: #EAEAEA;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: all 0.3s;
  transform: scale(0);
  z-index: 99999;
  text-align: center;
}

.instagramHeader {
  font-family: 'Handlee', cursive;
  font-size: 35px;
}

.instagramSecondHeader {
  font-size: 15px;
  width: 260px;
  margin: 1em 0;
}

#instagramNameInput,
#instagramEmail,
#instagramNumberText {
  font-size: 15px;
  padding: 0.5em;
  border: 1px solid #D1D1D1;
  margin: 0.5em 0 0.5em 0;
  width: 220px;
}

.instagramButton {
  width: 236px;
  font-size: 15px;
  padding: 0.5em;
  background: #3296F0;
  color: #fff;
  border: none;
  margin: 0.5em 0;
  transition: all 0.2s;
}

.instagramButton:hover {
  filter: brightness(80%);
  cursor: pointer;
}

#verificationCodeInstagramPage {
  display: none;
}

#continueToInstagramAccount {
  display: none;
}

#instagramAccount {
  display: none;
  justify-content: flex-start;
  height: 100%;
  width: 100%;
  background: #f7f7f7;
  flex-direction: column;
  align-items: center;
}

#instagramName {
  font-size: 20px;
  text-align: left;
  width: 85%;
  padding: 20px 20px 15px 10px;
  border-bottom: 1px solid gray;
  height: 20px;
  border-right: none;
  border-top: none;
  border-left: none;
  background: none;
}

#profilePicture {
  font-size: 35px;
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #eae9e9;
  border-radius: 100000px;
  margin: 20px;
  border: 1px solid #6f6e6e;
  color: #6f6e6e;
}

#instagramPictureAndNumbers {
  display: inherit;
  width: 360px;
}

#numbers {
  width: 225px;
  height: 45px;
  margin: 35px 0 0 0;
}

#userDescription {
  width: 320px;
  font-size: 13px;
  border: none;
  background: none;
  resize: none;
}

.bi-table {
  font-size: 25px;
  border-bottom: 1px solid;
  width: 90%;
  margin-top: 0.5em;
}

#emptyImages {
  color: #c7c7c7;
  margin: 100px;
  font-size: 14px;
}

/* Mail */

#mailIcon {
  background: linear-gradient(0deg, #05ffff 0%, #3cabe6 30%, #2763dc 70%);
}

#mailApp {
  position: absolute;
  top: 0;
  left: 0;
  background: #f6f6f6;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  transition: all 0.3s;
  transform: scale(0);
  z-index: 99999;
  text-align: center;
}

#mailHeader {
  font-size: 25px;
  padding: 20px;
  background: #fff;
  width: 88%;
  z-index: 999;
}

#verificationCodeEmail {
  display: none;
}

.email {
  background: #fff;
  width: 97%;
  padding: 5px;
  border-top: 1px solid #e6e6e6;
}

.emailHeader {
  text-align: left;
  margin: 10px;
  font-size: 25px;
}

#verificationCodeEmailDescription,
#erfolgreichAngemeldetDescription {
  text-align: left;
  margin: 10px;
}

#erfolgreichAngemeldet {
  display: none;
}

/* Home Button */

#homeButton {
  position: absolute;
  height: 60px;
  width: 60px;
  background: transparent;
  z-index: 9999;
  bottom: -107px;
  border-radius: 100000px;
  left: 50%;
  -ms-transform: translate(-50%, -50%) rotate(-10deg);
  transform: translate(-50%, -50%) rotate(-10deg);
  border: 1px outset;
  cursor: pointer;
}

#slider {
  white-space: nowrap;
  position: relative;
  overflow-x: scroll;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  height: calc(100% - 30px);
}

.panel {
  display: inline-block;
  width: 350px;
  white-space: initial;
}

#appsTwo {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}
<!DOCTYPE html>

  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css">
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400&display=swap" rel="stylesheet">

Neue Email erhalten!

         LIDL LTE

        98%

            <form id="createAccountForm" action="#" onsubmit="openVerificationCodeInstagramPage(); return false;">

Instagram

Erstelle einen Account

              <input type="text" id="instagramNameInput" placeholder="Name" maxlength="12" autocomplete="off" required>
              <input type="email" id="instagramEmail" placeholder="E-Mail" autocomplete="off" required>
              <button type="submit" id="createAccount" class="instagramButton">Erstellen</button>
            </form>

Bestätigen

Wir haben ihn einen Bestätigungscode per Email gesendet!

              <input type="text" id="instagramNumberText" maxlength="4" onkeypress="return /[0-9]/i.test(event.key)" placeholder="Bestätigungscode">

              <button onclick="controlVerificationCode();" id="controlVerificationCode" class="instagramButton">Bestätigen</button>
              <button class="instagramButton" id="continueToInstagramAccount" onclick="continueToInstagramAccount()">Weiter</button>

              <input type="text" id="instagramName">

                    0
                    1
                    0

                    Posts
                    Followers
                    Following

              <textarea id="userDescription" placeholder="Beschreibung..." rows="10"></textarea>

No images found

E-Mails

Instagram

Erfolgreich angemeldet

Instagram

Ihr Bestätigunscode lautet

            Second App Page

Result:

You can hide the horizontal scrollbar by applying overflow-x:hidden to #slider


text:
Q: Twisted http gzip support I'm looking to help an open source project with Python.
As far as I could tell, Twisted doesn't didn't support  sending and receiving gzip information with HTTP (as of 2011).
http://twistedmatrix.com/trac/ticket/104
Google seems to confirm it, since I couldn't find any mention of it the documentation.
My question is whether I'm right about this, or if this has changed?
Alternatively, is it actually useful to anyone? I guess there's a reason it hasn't been implemented yet.
Sorry if this isn't the right place to ask...

A: This is now possible using Resource Encoders. Quoting from that link:
from twisted.web.server import Site, GzipEncoderFactory
from twisted.web.resource import Resource, EncodingResourceWrapper
from twisted.internet import reactor

class Simple(Resource):
    isLeaf = True
    def render_GET(self, request):
        return "<html>Hello, world!</html>"

resource = Simple()
wrapped = EncodingResourceWrapper(resource, [GzipEncoderFactory()])
site = Site(wrapped)
reactor.listenTCP(8080, site)
reactor.run()

See the link for more information. The ticket in the question is now closed as well.

A: From the documentation for EncodingResourceWrapper:

Note that the returned children resources won't be wrapped, so you
  have to explicitly wrap them if you want the encoding to be applied.

So if a Resource implements getChild, then you need to wrap that resource as well.
For example:
from twisted.web.server import Site, GzipEncoderFactory
from twisted.web.resource import EncodingResourceWrapper
from twisted.web import static
from twisted.internet import reactor
from twisted.python import log
import sys
log.startLogging(sys.stdout)

class WebServer(static.File):
    def getChild(self, path, request):
        child = static.File.getChild(self, path, request)
        return EncodingResourceWrapper(child, [GzipEncoderFactory()])

resource = WebServer('/tmp')

site = Site(resource)
reactor.listenTCP(8080, site)
reactor.run()

you can test it with netcat:
printf 'GET /  HTTP/1.1\r\nHost: localhost\r\nAccept-Encoding: gzip,deflate\r\nConnection: close\r\n\r\n' | nc localhost 8080

A: The ticket is still open, so it is correct that this feature is still not available in Twisted.  However, Nevow includes support for sending gzipped responses: http://bazaar.launchpad.net/~divmod-dev/divmod.org/trunk/view/head:/Nevow/nevow/compression.py.  Since Nevow can Twisted Web can easily be used together, this might be a way to get what you want.
Hopefully the feature will also be ported from Nevow to Twisted Web someday as well.

A: I'd like to expand a bit @danbrough's great answer in case someone else lands here:
Fist of all, if you happen to put children with IResource.putChild, his solution won't work directly, you'll have to overwrite IResource.getChildWithDefault instead of just IResource.getChild.
It also happens, that having some resources protected with HTTP BasicAuthentication and serving them compressed with Gzip is a bit trickier, since the above won't work. In this case you'll need to fiddle with the HTTPAuthSessionWrapper like this:
class GzipAuthSessionWrapper(HTTPAuthSessionWrapper):
  def getChildWithDefault(self, path, request):
    child = HTTPAuthSessionWrapper.getChildWithDefault(self, path, request)
    gzipChild = EncodingResourceWrapper(child, [GzipEncoderFactory()])
    return gzipChild

You'll also have to set up the Realm, Checkers and Portal as usual (documentation).


text:
Q: Method invocation may produce java NullpointerException in Button click listener I want to open just make a toast when user click on button it is very simplest thing but i cant do it :| method innovation may produce java NullpointerException warning occurred and toast didn't show
public class TrackingRecord extends AppCompatActivity {
 GPSTracker  gps;
ArrayList<String> cordsList= new ArrayList<String>();
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tracking_record);

    //decelartions
    TextView tv1=(TextView) findViewById(R.id.tv_set1);
    TextView tv2=(TextView) findViewById(R.id.tv_set2);
    TextView tv3=(TextView) findViewById(R.id.tv_set3);
    Button ST=(Button) findViewById(R.id.btn_ST) ;

    Log.i("Finall", "AndroidGPSTrackingActivity-> ");
    ST.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(getApplicationContext(),"HIIIIIIIIII",Toast.LENGTH_LONG).show();
        }
    });

    }
}

following warning shows

Method invocation 'ST.setOnClickListener(new View.OnClickListener() {                      @Override public void onC...' may produce 'java.lang.NullPointerException


text:
Q: EBS or Instance Storage for MongoDB in EC2? Cassandra recommends using instance local storage for EC2 deployments instead of EBS
I am deploying MongoDB in EC2... should I also be using instance local storage instead of EBS PIOPS?

A: Here is a slide about using Hybrid (Instance store and PIOPS EBS) of MongoDB on EC2.
http://www.slideshare.net/mongodb/world-high-performance-mongo-db-on-ec2-20140620
Related topic:
Instance store is super fast - https://gist.github.com/ktheory/3c3616fca42a3716346b
Conclusions:
Instance-store is over 5x faster than EBS-SSD for uncached reads.
Instance-store and EBS-SSD are equalivent for cached reads.
Instance-store is over 10x faster than EBS-SSD for writes.
Special notes:
Ephemeral storage or instance-store DOES persist across reboots of an instance! It does not persist across a stop/start, nor a termination, nor some instance hardware failures.

A: The MongoDB manual has a section with EC2 storage considerations including the general recommendation to use EBS-optimized EC2 instances with provisioned IOPS (PIOPS) EBS volumes.
There are several good reasons to use EBS over local storage:

*

*Local storage (or "Instance Store" in EC2 terms) is ephemeral and introduces potential data loss scenarios on instance stop/start/terminate as well as hardware failure (see AWS docs on Instance Store Lifetime).

*While an Instance Store is dedicated to a particular instance, the disk subsystem is shared among instances on the host server hardware. As with regular EBS volumes, contention for a shared resource can lead to unpredictable I/O behaviour. Provisioned IOPS EBS volumes will provide more predictable I/O performance for an active database workload -- no spikes of higher than expected performance, but also no troughs of decreased performance.

*The sizes of Instance Stores are determined by the instance type. EBS volumes can be provisioned independently to meet your storage and performance requirements.

*If you want to change your instance types, EBS volumes can be re-attached to a new instance in the same availability zone.

*EBS volumes can be combined using RAID for additional capacity or redundancy.

*EBS volumes support asynchronous snapshots, which are a common backup strategy.

*EBS volumes can support encryption for data at rest for most instance types.

A: EBS is recommended because it provided by more than one actual drive with 2ms transaction commit between mirror drives. EBS itself is fast enough and can reach 500+MB/sec for read and write.
Linux kernel this is what affect IOPS dramatically, see what Pinterest engineers investigated:

Final choice: kernel 3.18.7 + XFS + 64K RAID block size.
•  Best overall performance for async random read.
•  Very competitive performance everywhere else.
•  Networking-related kernel bugs (Xen-specific) in 3.13 that aren't
  fixed until 3.16.

https://www.percona.com/live/mysql-conference-2015/sites/default/files/slides/all_your_iops_are_belong_to_usPLMCE2015.pdf


text:
Q: M2E: Version is duplicate of parent version - Why is this a warning? I have several Maven projects that each have some common functionality or at least common configuration/dependencies. I extracted this in to a common pom.xml, and then modularlized several facets, for example persistence, Spring related dependencies, and so on - all in their own modules which inherit from this parent POM.
Right now, "Common" is version 1.0.0 and I have "ProjectA" that I wish to inherit from it. I receive the warning:

Version is duplicate of parent version

I don't fully understand why this is a warning. I thought I had the option of omitting the version from my project POM in order to inherit the version. (I do this for common modules - for example, common-spring adds additional common dependencies for Spring apps, and in fact, ProjectA actually inherits from common-spring.)
Isn't it just that - an option? If I change my ProjectA version to 1.0.1 or 2.0.0 all is well.

A: Newer versions of m2e (since 1.1) now allow you to disable this warning.

Preferences > Maven > Warnings > Disable "Version is duplicate of parent version" warning

Original bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=356796

A: It´s just m2e trying to be clever because the version element (like group id) sometimes can be redundant and be can be inherited from the parent POM, so it would be safe to remove this element from your child POM.
But sometimes this is not a redundant information, like when the parent and the child project have different life cycles, and m2e should allow this warning to be disabled. Unfortunately there is no way to do this yet: http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01961.html
UPDATE: As Duncan says bellow, in newer versions you can disable this warning.

A: If it really annoys you, use a property to supress the warning with some cunning sleight of hand:
<version>${api.version}</version>
<properties>
    <api.version>0.0.1-SNAPSHOT</api.version>
</properties>

but all you'll really be doing is moving the warning to the console output:
[WARNING] Some problems were encountered while building the effective model for [project]
[WARNING] 'version' contains an expression but should be a constant.


text:
Q: How to bring the image to the right of react Card I have a react Card.
I want to bring the image on the card to the right-side of card and it should also be parellel to the Name Pankaj Rout, and should be responsive.
This is what I have tried so far,
var userMap = [
  {name: "Pankaj Rout", email: "pankaj.rout@somedomain.com"}
]

userData.map((data) => {
      return (

          <Card style={cardStyle}>
            <Card.Body>

              <Card.Title> {data.name} </Card.Title>
              <Card.Subtitle className="mb-2 text-muted">
                General Manager
              </Card.Subtitle>
              <Card.Text> {data.email} </Card.Text>
                <Button> Delete </Button>
                <Button> Email </Button>
                <Button> Chat </Button>
            </Card.Body>
          </Card>

      );

classes is used from withStyles hook
const useStyles = (theme) => ({
  img: {
    justifyContent: 'right',
  }
});

following style is referring to cardImgStyle
const cardImgStyle = {
  width: "30%",
  height: "30%",
  borderRadius: "50%",
  display: "flex",
  flexWrap: "wrap",
};

Could anyone please point out what is wrong here?
Thanks!!

A: justifyContent : 'space-beetwin' ;
or
for img  :
float :' right';


text:
Q: Notation for the mapping from a parent variable to a child variable. Denote the causal parent of the vertice set $\mathbf{X}$ as $\mathrm{Pa}(\mathbf{X})$, I have a function $f$ that maps the value of $\mathrm{Pa}(\mathbf{X})$ to the value of $\mathbf{X}$.
My question is: What's the standard notation to describe the mapping? Can I use $f:\mathcal{Pa(X) \to \mathcal{X}}$?
Please attach the reference paper if you have any.


text:
Q: Advise clustering file system for storage for the array through the Fibre Channel I deploy Openstack for private cloud. Faced a problem of a choice of file system for storage. That live migration between physical servers worked.
Configuration:
HP P2000 FC disk massif and four computing notes which are connected on through HBA FiberChanel to one general lun on storage.
Advise clustering file system without use of iscsi, fcoe... etc... Only FC. As VMFS from Vmware...
Thx!

A: I can tell you about OpenStack Object Storage aka Swift, you can use fibre channel across zones/regions/geo-cluster for data transfer.
Hope it helps.

A: There are no good cluster filesystem alternatives to VMware VMFS on Linux. You may look at Oracle OCFS2, Red Hat GFS2, SGI CXFS and Symantec VxFS. All of them are dated. Newer generation of filesystems moved to distributed architecture over local drives (as compared to shared SAN) for scalability.

A: *

*I think you need object file system Ceph, Lustre, NetApp object storage etc.

*But you can create san cluster. I dont know MSA maybe not supported but 3Par have HP peer persistence.


text:
Q: Decode with alias name in cursor I want to use decode function in cursor with alias names to avoid column ambiguity so i used below approach.
I have code such as:
 declare
     cl number;
     cursor c is
        select c1.rowid,c1.col1,
               DECODE(c1.col2, 'XYZ', c1.col3, 10) cl
          from table1 d,table2 c1 where c1.process_id=13525 and d.col3(+)=cl;
begin
  for rec in c
  loop
    dbms_output.put_line(NVL(rec.cl,'-1'));
  end loop;
end;

In this, when i will fire query by removing condition 'and d.col3(+)=cl' it will retrieve me data with the value of 'cl' . But when i assign this condtion it will not retrive data and not go in for loop of cursor.I have a matching data in d.col3.
Suppose if i will get cl as 5 then it is also present in d.col3 then it should give me data i did this because i need to remove duplicate records.Because with that single condition i will get duplicate records.Here col3 in d table is as primary key.
So i am not getting why it will not go in for loop as it gets value from query.

A: You can't use alias in WHERE clause: Using an Alias in a WHERE clause
In such cases, a sub-query or a CTE might help. Something like that (untested!):
with V as (
  select c1.rowid rid, ,c1.col1, c1.process_id,
         DECODE(c1.col2, 'XYZ', c1.col3, 10) cl
    from table2 c1)

select V.rid, V.col1, V.cl from table1 d,V
  where V.process_id=13525 and d.col3(+)=V.cl;

A: After getting suggestion that using WITH clause, My approach to retrieve data through DECODE() using alternative table name is:
  declare
     cl number;
     cursor c is
        with V as (
           select c1.process_id,
                  DECODE(c1.col2, 'BANDM', c1.col3, 10) cl
             from table2 c1)
           select c1.rowid rid,c1.col1, V.cl from table1 d,V,table2 c1
            where V.process_id=1
              and d.col3(+)=V.cl
              and c1.col3=V.cl;

  begin
    for rec in c
    loop
     dbms_output.put_line(NVL(rec.rid,'-1'));
     dbms_output.put_line(NVL(rec.cl,'-1'));
    end loop;
  end;

Another solution without WITH clause is :
  declare
     c2 number;
     cursor c is
          select c1.process_id
                 c1.rowid,
                 c1.col1,
                 DECODE(c1.col2, 'BANDM', c1.col3, 10) as c2
            from table1 d,
                 table2 c1
           where c1.process_id=1
             and d.col3(+) = DECODE(c1.col2, 'BANDM', c1.col3, 10);

  begin
    for rec in c
    loop
     dbms_output.put_line(NVL(rec.rid,'-1'));
     dbms_output.put_line(NVL(rec.c2,'-1'));
    end loop;
  end;


text:
Q: I have an error to add a root view handler in AppDelegate I am developing an application in which the launch screen is similar to Twitter and I wanted to implement a navigation drawer with MMDrawer, but I have an error that says
"UIViewControllerHierarchyInconsistency ', reason:' adding a root view controller  as a child of view controller:  '"
I attached the AppDelegate code
I hope you can help me, thank you very much for reading me! regards.
//
//  AppDelegate.swift
//  Rodrigo
//
//  Created by expo on 02/03/17.
//  Copyright © 2017 Rodrigo. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var drawerContainer:MMDrawerController?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        //Personaliza la vista
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window! .backgroundColor = UIColor(red: 35/255, green: 34/255, blue: 34/255, alpha:1)
        self.window!.makeKeyAndVisible()

        let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

        //Recuerda al usuario
        let userId = UserDefaults.standard.string(forKey: "userId")
        if (userId != nil )
        {

            buildNavigationDrawer()

        }
            //Fin de recordar al usuario

        else{

            //rootViewController from storyboard

            let navigationController = mainStoryboard.instantiateViewController(withIdentifier: "navigationController")
            self.window!.rootViewController = navigationController

            //logomask
            navigationController.view.layer.mask = CALayer()
            navigationController.view.layer.mask?.contents = UIImage(named: "logoGrande500pts")!.cgImage
            navigationController.view.layer.mask?.bounds = CGRect(x:0, y:0, width: 60, height: 60)
            navigationController.view.layer.mask?.anchorPoint = CGPoint (x: 0.5, y: 0.5)
            navigationController.view.layer.mask?.position = CGPoint (x: navigationController.view.frame.width / 2, y: navigationController.view.frame.height / 2)

            //logo mask background view
            let maskBigView = UIView(frame: navigationController.view.frame)
            maskBigView.backgroundColor = UIColor.white
            navigationController.view.addSubview(maskBigView)
            navigationController.view.bringSubview(toFront: maskBigView)

            //logo mask animation
            let transformAnimation = CAKeyframeAnimation (keyPath: "bounds")
            transformAnimation.duration = 0.5
            transformAnimation.beginTime = CACurrentMediaTime() + 1

            let initalBounds = NSValue(cgRect: (navigationController.view.layer.mask?.bounds)!)
            let secondBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 50, height: 50))
            let finalBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 2000, height: 2000))

            transformAnimation.values = [initalBounds, secondBounds, finalBounds]
            transformAnimation.keyTimes = [0, 0.5, 1]
            transformAnimation.timingFunctions = [CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut), CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)]
            transformAnimation.isRemovedOnCompletion = false
            transformAnimation.fillMode = kCAFillModeForwards
            navigationController.view.layer.mask?.add(transformAnimation, forKey: "maskAnimation")

            UIView.animate(withDuration: 0.1, delay: 1.35, options: UIViewAnimationOptions.curveEaseIn,
                           animations: {
                            maskBigView.alpha = 0.0
            },
                           completion: {finished in
                            maskBigView.removeFromSuperview()
            })

            UIView.animate(withDuration: 0.25,
                           delay: 1.3,
                           options: UIViewAnimationOptions(),
                           animations: {
                            self.window!.rootViewController!.view.transform = CGAffineTransform(scaleX: 1.05, y: 1.05)

            },
                           completion: {finished in
                            UIView.animate(withDuration: 0.3,
                                           delay: 0.0,
                                           options : UIViewAnimationOptions.curveEaseInOut,
                                           animations: {
                                            self.window!.rootViewController!.view.transform = CGAffineTransform.identity
                            },
                                           completion: nil
                            )
            })

        }

        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

    func CAAnimationDelegate (anim: CAAnimation!, finished flag: Bool){
        self.window!.rootViewController!.view.layer.mask=nil
    }

    func buildNavigationDrawer(){

        //Personaliza la vista
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window! .backgroundColor = UIColor(red: 35/255, green: 34/255, blue: 34/255, alpha:1)
        self.window!.makeKeyAndVisible()

        let mainStoryBoard:UIStoryboard = UIStoryboard(name:"Main", bundle:nil)
        let navigationController:PrincipalViewController = mainStoryBoard.instantiateViewController(withIdentifier: "PrincipalViewController") as! PrincipalViewController
        let leftSideMenu:LeftSideViewController = mainStoryBoard.instantiateViewController(withIdentifier: "LeftSideViewController") as! LeftSideViewController
        let rightSideMenu:RightSideViewController = mainStoryBoard.instantiateViewController(withIdentifier: "RightSideViewController") as! RightSideViewController

        let mainPageNav = UINavigationController(rootViewController: navigationController)

     window?.rootViewController = drawerContainer
     self.window?.rootViewController = mainPageNav

        let leftSideMenuNav = UINavigationController(rootViewController:leftSideMenu)
        let rightSideMenuNav = UINavigationController(rootViewController:rightSideMenu)

        drawerContainer = MMDrawerController(center: mainPageNav, leftDrawerViewController: leftSideMenuNav, rightDrawerViewController: rightSideMenuNav)

        drawerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.panningCenterView
        drawerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.panningCenterView

        /*
         let navigationController = mainStoryboard.instantiateViewController(withIdentifier: "PrincipalViewController") as! PrincipalViewController
         let mainPageNav = UINavigationController(rootViewController: navigationController)
         self.window?.rootViewController = mainPageNav
        */

        //logomask
        navigationController.view.layer.mask = CALayer()
        navigationController.view.layer.mask?.contents = UIImage(named: "logoGrande500pts")!.cgImage
        navigationController.view.layer.mask?.bounds = CGRect(x:0, y:0, width: 60, height: 60)
        navigationController.view.layer.mask?.anchorPoint = CGPoint (x: 0.5, y: 0.5)
        navigationController.view.layer.mask?.position = CGPoint (x: navigationController.view.frame.width / 2, y: navigationController.view.frame.height / 2)
        //logo mask background view
        let maskBigView = UIView(frame: navigationController.view.frame)
        maskBigView.backgroundColor = UIColor.white
        navigationController.view.addSubview(maskBigView)
        navigationController.view.bringSubview(toFront: maskBigView)
        //logo mask animation
        let transformAnimation = CAKeyframeAnimation (keyPath: "bounds")
        transformAnimation.duration = 0.5
        transformAnimation.beginTime = CACurrentMediaTime() + 1
        let initalBounds = NSValue(cgRect: (navigationController.view.layer.mask?.bounds)!)
        let secondBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 50, height: 50))
        let finalBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 2000, height: 2000))
        transformAnimation.values = [initalBounds, secondBounds, finalBounds]
        transformAnimation.keyTimes = [0, 0.5, 1]
        transformAnimation.timingFunctions = [CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut), CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)]
        transformAnimation.isRemovedOnCompletion = false
        transformAnimation.fillMode = kCAFillModeForwards
        navigationController.view.layer.mask?.add(transformAnimation, forKey: "maskAnimation")
        UIView.animate(withDuration: 0.1, delay: 1.35, options: UIViewAnimationOptions.curveEaseIn,
                       animations: {
                        maskBigView.alpha = 0.0
        },
                       completion: {finished in
                        maskBigView.removeFromSuperview()
        })
        UIView.animate(withDuration: 0.25,
                       delay: 1.3,
                       options: UIViewAnimationOptions(),
                       animations: {
                        self.window!.rootViewController!.view.transform = CGAffineTransform(scaleX: 1.05, y: 1.05)
        },
                       completion: {finished in
                        UIView.animate(withDuration: 0.3,
                                       delay: 0.0,
                                       options : UIViewAnimationOptions.curveEaseInOut,
                                       animations: {
                                        self.window!.rootViewController!.view.transform = CGAffineTransform.identity
                        },
                                       completion: nil
                        )
        })

    }

}

A: The error you are getting is pretty clear.
The problem is here:
window?.rootViewController = drawerContainer
self.window?.rootViewController = mainPageNav

You are setting the rootViewController and then on the very next line, setting it again with something different.
Then, a few lines later, you do this:
drawerContainer = MMDrawerController(center: mainPageNav, leftDrawerViewController: leftSideMenuNav, rightDrawerViewController: rightSideMenuNav)

You are taking the rootViewController of your window, and trying to add it as a child to another container view controller.
Obvious fixes:

*

*Remove this line:
self.window?.rootViewController = mainPageNav

*Change the order of the rootViewController assignment and drawerContainer instantiation. Right now, you are throwing away whatever the original drawerContainer was (if it had a value at all).
drawerContainer = MMDrawerController(center: mainPageNav, leftDrawerViewController: leftSideMenuNav, rightDrawerViewController: rightSideMenuNav)

needs to come before
window?.rootViewController = drawerContainer

There are probably more problems with your code, but these 2 are issues for sure.

A: I enclose my code with the solution
//
//  AppDelegate.swift
//  Expodiseño
//
//  Created by expo on 02/03/17.
//  Copyright © 2017 Creategia360. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var drawerContainer:MMDrawerController?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        //Personaliza la vista
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window! .backgroundColor = UIColor(red: 35/255, green: 34/255, blue: 34/255, alpha:1)
        self.window!.makeKeyAndVisible()

        let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

        //Recuerda al usuario
        let userId = UserDefaults.standard.string(forKey: "userId")
        if (userId != nil )
        {

            //let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
            let navigationController = mainStoryboard.instantiateViewController(withIdentifier: "PrincipalViewController") as! PrincipalViewController
            let mainPageNav = UINavigationController(rootViewController: navigationController)
            self.window?.rootViewController = mainPageNav

            //logomask
            navigationController.view.layer.mask = CALayer()
            navigationController.view.layer.mask?.contents = UIImage(named: "logoGrande500pts")!.cgImage
            navigationController.view.layer.mask?.bounds = CGRect(x:0, y:0, width: 60, height: 60)
            navigationController.view.layer.mask?.anchorPoint = CGPoint (x: 0.5, y: 0.5)
            navigationController.view.layer.mask?.position = CGPoint (x: navigationController.view.frame.width / 2, y: navigationController.view.frame.height / 2)

            //logo mask background view
            let maskBigView = UIView(frame: navigationController.view.frame)
            maskBigView.backgroundColor = UIColor.white
            navigationController.view.addSubview(maskBigView)
            navigationController.view.bringSubview(toFront: maskBigView)

            //logo mask animation
            let transformAnimation = CAKeyframeAnimation (keyPath: "bounds")
            transformAnimation.duration = 0.5
            transformAnimation.beginTime = CACurrentMediaTime() + 1

            let initalBounds = NSValue(cgRect: (navigationController.view.layer.mask?.bounds)!)
            let secondBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 50, height: 50))
            let finalBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 2000, height: 2000))

            transformAnimation.values = [initalBounds, secondBounds, finalBounds]
            transformAnimation.keyTimes = [0, 0.5, 1]
            transformAnimation.timingFunctions = [CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut), CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)]
            transformAnimation.isRemovedOnCompletion = false
            transformAnimation.fillMode = kCAFillModeForwards
            navigationController.view.layer.mask?.add(transformAnimation, forKey: "maskAnimation")

            UIView.animate(withDuration: 0.1, delay: 1.35, options: UIViewAnimationOptions.curveEaseIn,
                           animations: {
                            maskBigView.alpha = 0.0
            },
                           completion: {finished in
                            maskBigView.removeFromSuperview()
            })

            UIView.animate(withDuration: 0.25,
                           delay: 1.3,
                           options: UIViewAnimationOptions(),
                           animations: {
                            self.window!.rootViewController!.view.transform = CGAffineTransform(scaleX: 1.05, y: 1.05)

            },
                           completion: {finished in
                            UIView.animate(withDuration: 0.3,
                                           delay: 0.0,
                                           options : UIViewAnimationOptions.curveEaseInOut,
                                           animations: {
                                            self.window!.rootViewController!.view.transform = CGAffineTransform.identity
                            },
                                           completion: nil
                            )
            })

       buildNavigationDrawer()

        }
            //Fin de recordar al usuario

        else{

            //rootViewController from storyboard

            let navigationController = mainStoryboard.instantiateViewController(withIdentifier: "navigationController")
            self.window!.rootViewController = navigationController

            //logomask
            navigationController.view.layer.mask = CALayer()
            navigationController.view.layer.mask?.contents = UIImage(named: "logoGrande500pts")!.cgImage
            navigationController.view.layer.mask?.bounds = CGRect(x:0, y:0, width: 60, height: 60)
            navigationController.view.layer.mask?.anchorPoint = CGPoint (x: 0.5, y: 0.5)
            navigationController.view.layer.mask?.position = CGPoint (x: navigationController.view.frame.width / 2, y: navigationController.view.frame.height / 2)

            //logo mask background view
            let maskBigView = UIView(frame: navigationController.view.frame)
            maskBigView.backgroundColor = UIColor.white
            navigationController.view.addSubview(maskBigView)
            navigationController.view.bringSubview(toFront: maskBigView)

            //logo mask animation
            let transformAnimation = CAKeyframeAnimation (keyPath: "bounds")
            transformAnimation.duration = 0.5
            transformAnimation.beginTime = CACurrentMediaTime() + 1

            let initalBounds = NSValue(cgRect: (navigationController.view.layer.mask?.bounds)!)
            let secondBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 50, height: 50))
            let finalBounds = NSValue(cgRect: CGRect(x: 0, y: 0, width: 2000, height: 2000))

            transformAnimation.values = [initalBounds, secondBounds, finalBounds]
            transformAnimation.keyTimes = [0, 0.5, 1]
            transformAnimation.timingFunctions = [CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut), CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)]
            transformAnimation.isRemovedOnCompletion = false
            transformAnimation.fillMode = kCAFillModeForwards
            navigationController.view.layer.mask?.add(transformAnimation, forKey: "maskAnimation")

            UIView.animate(withDuration: 0.1, delay: 1.35, options: UIViewAnimationOptions.curveEaseIn,
                           animations: {
                            maskBigView.alpha = 0.0
            },
                           completion: {finished in
                            maskBigView.removeFromSuperview()
            })

            UIView.animate(withDuration: 0.25,
                           delay: 1.3,
                           options: UIViewAnimationOptions(),
                           animations: {
                            self.window!.rootViewController!.view.transform = CGAffineTransform(scaleX: 1.05, y: 1.05)

            },
                           completion: {finished in
                            UIView.animate(withDuration: 0.3,
                                           delay: 0.0,
                                           options : UIViewAnimationOptions.curveEaseInOut,
                                           animations: {
                                            self.window!.rootViewController!.view.transform = CGAffineTransform.identity
                            },
                                           completion: nil
                            )
            })

        }

        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

    func CAAnimationDelegate (anim: CAAnimation!, finished flag: Bool){
        self.window!.rootViewController!.view.layer.mask=nil
    }

    func buildNavigationDrawer(){

        let mainStoryBoard:UIStoryboard = UIStoryboard(name:"Main", bundle:nil)
        let navigationController:PrincipalViewController = mainStoryBoard.instantiateViewController(withIdentifier: "PrincipalViewController") as! PrincipalViewController
        let leftSideMenu:LeftSideViewController = mainStoryBoard.instantiateViewController(withIdentifier: "LeftSideViewController") as! LeftSideViewController
        let rightSideMenu:RightSideViewController = mainStoryBoard.instantiateViewController(withIdentifier: "RightSideViewController") as! RightSideViewController

        let mainPageNav = UINavigationController(rootViewController: navigationController)
        let leftSideMenuNav = UINavigationController(rootViewController:leftSideMenu)
        let rightSideMenuNav = UINavigationController(rootViewController:rightSideMenu)

        //  self.window!.rootViewController = navigationController
        drawerContainer = MMDrawerController(center: mainPageNav, leftDrawerViewController: leftSideMenuNav, rightDrawerViewController: rightSideMenuNav)

        drawerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.panningCenterView
        drawerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.panningCenterView

        window?.rootViewController = drawerContainer
        //self.window?.rootViewController = mainPageNav

    }

}


text:
Q: How can I get a semi-opaque css background overlay to display in landscape? My overlay, a semi-transparent background on top of my background, doesn't display properly when you rotate a screen from portrait to landscape.
Not sure how to fix this.
$primary-color: #313030;
$secondary-color: #d4fe01;
$show-home-image: true;
$home-image: url(../img/background.jpg);
$background-opacity: 0.8;

@mixin easeOut {
  transition: all 0.5s ease-out;
}

// hmm

@mixin background {
  @if $show-home-image {
    &#bg-img {
      background: $home-image;
      background-attachment: fixed;
      background-size: cover;

      &:after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        background: rgba($primary-color, $background-opacity);
      }
    }
  }
}

https://github.com/shimanopower/newPortfolio/blob/master/dist/img/projects/LearnTerminalAssets/Screen%20Shot%202019-07-06%20at%206.56.30%20PM.png
https://github.com/shimanopower/newPortfolio/blob/master/dist/img/projects/LearnTerminalAssets/audreysmonsters.com_(iPhone%20X)%20(1).png
the site w the overlay: https://audreysmonsters.com

A: You can apply a different style when the screen orientation is in landscape with the CSS. suggest that you increase the height of you after pseudo element when you are in the landscape orientation and in mobile with a media querie.
@media only screen and (max-width: 812px) and (orientation: landscape){
    #bg-img:after{
        height: 120%;
    }
}


text:
Q: Suppose you are in a closed box which is in motion
Suppose you are inside a closed box which is moving with a constant speed with no acceleration whatsoever. You cannot see outside the box. If you are given all the instruments you need, what experiment could you perform to ascertain that you are, in fact, in motion?

This was a question asked in an interview for admission to a pure sciences research university.
The only thing I was able to think of was maybe if we somehow converted the mass of some object into energy it would be slightly more than what we would expect from $E=mc^2$ since it also has kinetic energy.
Is this even remotely correct? Does it even have an answer or was it simply a trick question?

A: First of all the question is a little ambiguous , but I assume that it meant "constant speed" relative to  an inertial frame(Newtonian definition) if so , then there is  no experiment you can do (done entirely in the box) to figure out whether your moving with constant speed (for example relative to earth) or other things are moving and your fixed or it's a combination of both .
Note:I assumed the non-relativistic case , but even considering SR my answer wouldn't change .

A: You can't.  This is a literal textbook question about Galileo's ship.  I cannot understand why this seems not to be taught in schools, the idea is nearly 400 years old, and the description of it is only a couple of hundred words.

A: This question is basically asking about the principle of relativity, which states:

Physical laws should be the same in every inertial frame of reference.

Since you're moving at constant speed, you are in an inertial frame of reference, and there is no detectable difference. That's why you are equally justified to say you are at rest and the rest of the universe is moving backwards at constant speed. This principle is also why we say there's no preferred frame of reference.

A: The interview question is inherently flawed because the box must permit its contents one path of interaction with the exterior: gravity. The reason is that other masses within the box's light cone, however remote, will accelerate the box and must accelerate its contents as well. The contents is supposed to move with the box along the same geodesic. The box can not, even not within the realm of our thought experiment, shield its contents from gravity in the way we can assume it shields from radiation.
Now the gravitational field will be ever-so-slightly inhomogeneous; there will be tidal forces within the box which can be measured. The universe is supposedly isotropic when perceived from the cosmic rest frame. If you start moving relative to it, you'll have anisotropic inhomogeneities in the gravitational fields you measure. For example, if the box is large enough to build a Ligo in it you'll measure a red/blue shift of the gravitational wave frequencies from large mass collisions. Even if, to make it harder, we suspend such events for the duration of our thought experiment you still have "inhomogeneity events", just ones which are harder to measure (passing a far star etc.). These events will be anisotropic while you move relative to the cosmic rest frame.1
The only way to prevent gravity from betraying your movement is to imagine the box in an empty light cone. Then there are two questions left to ask the interviewer:

*

*What exactly was the box supposed to shield me from again?

*Which motion?

1 Of course, the gravity from far objects will be weak, their inhomogeneities minuscule, and unless the box is moving at cosmological speed their anisotropy will be so small that only the keenest and most patient experimenter will be able to obtain statistically significant data through the eons. But hey, it's a thought experiment. We are not putting people in boxes.

A: As other's have said, there's no experiment you can do to determine your velocity.

maybe if we somehow converted the mass of some object into energy it would be slightly more than what we would expect from $E=mc^2$ since it also has kinetic energy.

No, that won't work. The object is (presumably) at rest in the frame of the box, so it has zero kinetic energy relative to that frame. There's no such thing as absolute kinetic energy or velocity, it's always measured relative to some frame.
But if you have, for example, an electron and a positron, which both have (rest) mass of $511\, keV/c^2$, and those particles have a total kinetic energy of $E$ relative to the box, when you annihilate the electron  with the positron the gamma rays produced will have total energy of $E + 1022\,keV$.

A: There always exists an inertial reference frame in which your velocity is not identically zero, so in some sense, you could say you are "in motion" in any situation. However, since the box is moving inertially, it would often be conventional to set its velocity to zero.

A: More heat would be generated on different sides of the box from friction. So assuming they tell you the only thing that can be going on outside is movement or not, that would give an answer. Unless you are in a vacuum.

A: It can be done depending on the circumstances
We need to know (1) where you are relative to the nearest massive object (2) what the constant 'speed' is and its direction (3) how long you have to carry out the experiment (4) if the box is allowed to rotate.
For example
Suppose the box starts on the surface of the Earth, and moves in a straight line, tangent to the surface. You will leave Earth. As you do so, the apparent direction and force of gravity will change. A simple static pendulum will detect one and a spring balance will detect the other.

A: There are a few ways you could attempt to answer the trick question and thereby give the interviewer an idea of how you approach problems (after you've first said "under our current understanding of physics, there is no privileged inertial reference frame" and thereby answered the object-level question).
One of the instruments you need might be a drill or an X-ray-sensitive plate, for example, so that in a couple of different ways you can start to see outside the box. Maybe one of the instruments is an odometer of some sort (and discuss how you might be able to make an odometer for e.g. a car that is on a freely-moving conveyor belt).


text:
Q: How can I use python code file as you type in ipython console? If you are familiar to Matlab you know that you are able to use any defined function from its definition file, if it is in the workspace path, you do not need to call or import.
Is there any mechanism in ipython mimics that behaviour of matlab. My current work flow is to write the code in the Sublime text and paste it to ipython (seems stupid). Would you suggest any other way to achieve efficient
I am too lazy to do so but writing a periodic auto import code in the startup file of Ipython in some way might work. Maybe ipython curators would consider this.

A: I guess you'll have to reimport your module on every code change.
And you could use from my_module import * to avoid module name before every function call, though this construction works slowly.

A: If you're running the Python interpreter in your workspace, you can import the file:
/path/to/workspace$ ls
some_files    youtube.py     other_files

/path/to/workspace$ python
Python 2.7.3 (default, Dec 18 2012, 13:50:09)
Type "help", "copyright", "credits" or "license" for more information.
>>> import youtube
# I know there's a method get_video_thumbnail in my file
>>> youtube.get_video_thumbnail('http://youtu.be/IAooXLAPoBQ')
'http://img.youtube.com/vi/IAooXLAPoBQ/hqdefault.jpg'
>>> youtube.NO_PREVIEW
'/static/img/no_preview.png'
>>> # etc.

If you edit the Python file, you can re-import it, it will overwrite the module namespace and its content in the interpreter.

A: I'm surprised no one has suggested using the %edit magic function.
From another answer I gave on the same topic, if you setup Sublime to be your editor, you can simply run:
In [72]: %ed somefile.py

After you save & close, IPython will automatically execute the code contained in the file - so instead of copy/paste, you just let IPython do its magic.
I've never used Sublime, so I don't know exactly how that would work. As an alternative, you could look at how LightTable communicates with IPython, and write a Sublime extension for that.


text:
Q: "%" and "/" simbols difference in Ruby I'm trying to solve the FizzBuzz game.
I need to check if a number is divisible by 3. So, when we take a number and divide it by 3, we need that operation to have NO REST, or 0 REST.
The solution given to me is this:
def fizzbuzz(number)

  if number % 3 == 0
    return "Fizz"
  end

Why does they propose to use the "%"symbol? Why not the "/"symbol? Or both work as the same?
How should I check if the division has NO REST?

A: division operator / - gives the quotient of the division whatever the remainder of the division is. So you cannot determine if a number is perfectly divisible (remainder = 0) or not perfectly divisible (with non-zero remainder) using a division operator (/).
10 / 3
#=> 3

modulo operator % - gives the remainder of the division. If perfectly divisible, the output is 0, if not-perfectly divisible the output is non-zero value.
10 % 3
#=> 1

In your case number % 3 == 0 is true only if number is divisible by 3 with 0 remainder (i.e if number passed into the method frizzbuzz is a multiple of 3 like -12, -3, 3, 6, 9, etc )

A: Ruby has 4 division operators.
divmod returns the division and the remainder
  number = 15
  number.divmod(7) # => 2, 1

modulo alias % returns the remainder only
  number = 15
  number % 7 # => 1
  number.modulo(7) # => 1

div alias / returns the integer division if both operands are integers, and floating-point division if either operand is a float.
  number = 15
  number / 7 # => 2
  number.div(7) # => 2
  1.0 * number / 7 # => 2.142857142857143

fdiv always returns a full precision floating-point division
  number = 15
  number.fdiv(7) # => 2.142857142857143

A: % is the Modulus - Divides left hand operand by right hand operand and returns remainder. \ is just the Divider. No Rest means that x % y == 0.

A: lets take an example to understand better:
number1 = 12
number2 = 13

lets see if number1 and number2 is devisible by 4 ok?
number1 / 4 = 3 and the rest = 0
number2 / 4 = 3 and the rest = 1

so the "/" operation let us know the result of devision operation
and the "%" operation let us know the rest of devision operation
so if we take our examples the number1 is devisible by 3 because
number1 % 3 = 0 ( the rest )


text:
Q: java.lang.ClassNotFoundException: javax.persistence.PersistenceException I am new to Hibernate,servlets. I am trying to store data in mysql database  using hibernate from html registration form.. But I am keep getting this error as root cause.
here is the two root causes pop up.
HTTP status 500 Internal server error.

Exception

javax.servlet.ServletException: Servlet execution threw an exception
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

java.lang.NoClassDefFoundError: javax/persistence/PersistenceException
    java.base/java.lang.ClassLoader.defineClass1(Native Method)
    java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007)
    java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2339)
    org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:829)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
    kish.hibernate.servletController.registerData.doGet(registerData.java:30)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

java.lang.ClassNotFoundException: javax.persistence.PersistenceException
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
    java.base/java.lang.ClassLoader.defineClass1(Native Method)
    java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007)
    java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2339)
    org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:829)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
    kish.hibernate.servletController.registerData.doGet(registerData.java:30)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

here is my hibernate.cfg.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configurationn>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
        <property name="hibernate.connection.password">Kish</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/demo</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
        <property name="hbm2ddl.auto">create</property>
        <property name="show_sql">true</property>
        <mapping class="kish.hibernate.Pojo.Student"></mapping>

    </session-factory>

</hibernate-configurationn>

here is my html file

<title> RegistrationForm</title>
<link rel = "stylesheet" type = "text/css" href = "style1.css">

 enter your details below form

<form action = "registerData" method ="get">

Firstname

    <input type="text" name="first_name" placeholder="Enter your firstname">

Lastname

   <input type = "text" name= "last_name" placeholder="Your lastname ">

Branch

   <input type = "text" name="branch" placeholder="your branch">

Id

   <input type = "text" name = "Id" placeholder="your id">

password

   <input type="password" name="password" placeholder="create your password">
   <input type="submit" name="submit" value = "confirm">
 </form>

servlet file registerData.java
[package kish.hibernate.servletController;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import kish.hibernate.DAO.MainController;

@WebServlet("/registerData")
public class registerData extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public registerData() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String first_name = request.getParameter("first_name");
        String last_name = request.getParameter("last_name");
        String branch = request.getParameter("branch");
        int Id = Integer.parseInt(request.getParameter("Id"));
        String password = request.getParameter("password");

        MainController mc = new MainController();
        mc.addUserDeatails(first_name, last_name, branch, Id, password);
        response.sendRedirect("success");

    }

}

I will post any further data if needed.
Any suggestions appreciated.
  Thanks.
Edit:
"javax.persistence.jar"
It clearly contains "javax.persistence.PersistenceException.class"
added this jar and still showing the same error.
updated jar file in classpath

A: Put your jar under WEB-INF/lib folder. Build your project.It will work.

A: ClassNotFoundException comes when JVM tries to the load a class at runtime dynamically
NoClassDefFoundError the problematic class was present during Compile time and that's why the program successfully compiled but not available during runtime for any reason
Please check your class path. Since its maven please check the lib folder path in your setting.xml and check if the jar is available in m2.repository.

A: The solution is, add below shown jar files
to WEB-INF/lib folder.
jar files


text:
Q: Installing python package through AUR gives distutils error on ArchLinux Hello I am running ArchLinux with latest version of Python(3.10+) and I am installing python packages. I require a dependency that I can't get through pacman so I am using AUR to get python-onnx package
When I run makepkg I get this error
distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpjgzqj6vs', '--quiet', 'pytest-runner']' returned non-zero exit status 1.
==> ERROR: A failure occurred in build().
    Aborting...

I am not really sure what is cause of this as I am not using pip but I do have it installed. Could someone please advise what this error message is referring to and potential fix?

A: Ok so it was just missing the pytest-runner package which you can get
pacman -S python-pytest-runner

Usually it would tell you are missing a module/dependency. I am not sure why it caused the error to be thrown this way.