Ubuntu 18.04 Swap turns itself off

I allocate a swapfile, and turn it on:

sudo swapon /swapfile

I can see it here:

$ free -h
              total        used        free      shared  buff/cache   available
Mem:            62G        6.0G        7.1G        6.2G         49G         50G
Swap:          199G        256K        199G

I can see it here:

$ sudo swapon --show
/swapfile file 200G   0B   -2

I can see it in dmesg:

[373676.694883] Adding 209715196k swap on /swapfile.  Priority:-2 extents:808 across:258359292k SSFS

Yet after some time, it no longer shows…

$ free -g
              total        used        free      shared  buff/cache   available
Mem:             62           7           0          12          54          42
Swap:             0           0           0

And this

$ sudo swapon --show

Returns nothing.

dmesg gives no error.

It’s like it turned itself off.

unity – Trying to set up a simple swapping system to swap two game pieces using a button press

I am trying to set up a system that will move two objects. This is a puzzle game with a cursor to visualize where the player is. I need to get the position of the cursor’s left and right half, send that to a function that will then switch the two blocks when a key is pressed.

I have code that will move the cursor around but cannot figure out how to swap two blocks based on the position of the cursor.

I do not know if the code that is currently attached to the cursor will be of any help, but I can provide if necessary.

I am more or less looking for a general solution that I could apply to swapping two blocks.

I do not know if I need to be sending the positions of the cursor to the swap function in order to swap. How would I connect this to the tiles themselves? The code below is located in the board classv2 class. I am not very good with Unity as of yet. Any additional help would be appreciated.

 void Update()
        if (Input.GetButtonUp("Swap"))
            swapTiles(cursorLeft.transform.position.x, cursorRight.transform.position.x);

void swapTiles(float x1, float x2)


Game pieces are created and have an x and y number associated with a game board I created.

The Game pieces have a move routine. I can’t seem to get the pieces to actually swap.

public void Move(int destX, int destY, float timeToMove)
    if (!m_isMoving)
        StartCoroutine(MoveRoutine(new Vector3(destX, destY, 0), timeToMove));

//Moves the piece.
IEnumerator MoveRoutine(Vector3 destination, float timeToMove)
    Vector3 startPosition = transform.position;

    bool reachedDestination = false;

    float elapsedTime = 0f;

    m_isMoving = true;

    while (!reachedDestination)
        //if we are close enough to destination
        if (Vector3.Distance(transform.position, destination) < 0.01f)
            reachedDestination = true;

            if(m_board != null)
                m_board.PlaceGamePiece(this, (int)destination.x, (int)destination.y);

        //track the total running time
        elapsedTime += Time.deltaTime;

        //calculate the lerp value
        float t = Mathf.Clamp(elapsedTime / timeToMove,0f,1f);

        switch (interpolation)
            case InterpType.Linear:
            case InterpType.EaseOut:
                Mathf.Sin(t * Mathf.PI * 0.5f);
            case InterpType.EaseIn:
                t = 1 - Mathf.Cos(t * Mathf.PI * 0.5f);
            case InterpType.SmoothStep:
                t = t * t * (3 - 2 * t);
            case InterpType.SmootherStep:
                t = t * t * t * (t * (t * 6 - 15) + 10);

        //move the game piece
        transform.position = Vector3.Lerp(startPosition, destination, t);

        //wait until next frame
        yield return null;
    m_isMoving = false;

(!(Cursor is in the Bottom Left.)(1))(1)
(1): https://i.stack.imgur.com/sUvtx.png

software engineering – Building a unified interface for a swap chain in both DirectX 12 and Vulkan

Most objects in DirectX 12 have natural analogues in Vulkan, e.g.

  • VkInstance = IDXGIFactory
  • VkPhysicalDevice = IDXGIAdapter
  • VkDevice = ID3D12Device
  • VkQueue = ID3D12CommandQueue
  • VkCommandBuffer = ID3D12CommandList

However, when it comes to the swap chain, it’s not clear how the entries in VkSwapchainCreateInfoKHR correspond to entries in DXGI_SWAP_CHAIN_DESC1.

Clearly, there is not always a 1-1 correspondence, but I would really like to know how I can implement a unified interface for both.

node.js – Comportamento inesperado em swap desestruturado em javascript

Bom dia,

Vi sobre atribuição via desestruturação e swap em https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Operators/Atribuicao_via_desestruturacao, porém vi que se eu fizer o seguinte código:

var (a, b) = (1, 2) {1}

console.log(a) //1  {3}

console.log(b) //2  {4}

(b, a)=(a, b) {6}

console.log(a) //2 {7}
console.log(b) //1 {8}

sem o “;” ao final do console.log(b) da linha {4} retorna o erro Cannot set property ‘1’ of undefined, mas se eu colocar o “;” o algoritmo funciona normalmente.

Meu questionamento é o seguinte: já que “;” é opcional em javascript por quê preciso colocar nesse caso?

linux – How to swap Alt_R and arrow left with xmodmap?

I bought a new keyboard with a 60% layout, in this keyboard the left arrow is over the alt-right key, and I have to do fn + Left to achieve Alt-right, this is especially annoying for me because I use alt-right + (w,a,s,d) instead of the arrows, and I love that setup.

I’m having a hard time trying to swap the arrow key to the alt-right key, I’ve tried with this line in my xmodmaprc

keycode 113 = Alt_R Alt_R Alt_R Alt_R Alt_R Alt_R 

I also tried this

keycode 113 = Alt_R NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol

I got the keycode with xev and the xmodmap syntax from the arch wiki

Just to clarify, I’m not forgetting to reload the configuration with xmodmap xmodmaprc

dnd 3.5e – Can I use a maneuver to meet the prerequisites for a martial stance, then swap out that maneuver later?

This order is detailed in the Player’s Handbook (58-9), but it’s absent from the SRD so that Wizards of the Coast can sell you books. What you need to know from it is this: class decisions are made before feat decisions.

Thus, this warblade must use his ability to learn a new maneuver in place of an old maneuver before picking as his level 6 feat Martial Stance, and, were the warblade to’ve ditched that lone Diamond Mind maneuver, the warblade can no longer meet the Martial Stance feat’s prerequisite for taking the stance pearl of black doubt.

However, once the warblade knows the stance pearl of black doubt via the feat Martial Stance, because “(s)tances are considered maneuvers for the purpose of fulfilling prerequisites for learning higher-level maneuvers, or qualifying for prestige classes or feats” (Tome of Battle 43), the warblade can safely swap out (perhaps at level 8?) that other Diamond Mind maneuver that he used to meet the Martial Stance feat’s prerequisite and continue to meet the prerequisite for the feat Martial Stance and the stance pearl of black doubt with the stance itself. (Note that this—that is, meeting a feat’s prerequisite with what’s, essentially, the feat’s benefit—does make this DM a little queasy, but it’s not like the warblade’s casting spells or anything, so whatever.)

dnd 3.5e – Can I swap a maneuver known with another one if I have te requisite before the swap but stop having it after?

The Tome of Battle states the following:

Upon reaching 4th level, and at every even-numbered swordsage level
after that (6th, 8th, 10th, and so on), you can choose to learn a new
maneuver in place of one you already know. In effect, you lose the old
maneuver in exchange for the new one. You can choose a new maneuver of
any level you like, as long as you observe your restriction on the
highest- level maneuvers you know; you need not replace the old
maneuver with a maneuver of the same level. For example, upon reaching
10th level, you could trade in a single 1st-, 2nd-, 3rd- or 4th-level
maneuver for a maneuver of 5th level or lower, as long as you meet the
prerequisite of the new maneuver. You can swap only a single maneuver
at any given level.

So, let’s say my PC (Monk 4, Swordsage 4) has Mighty Throw as his only Setting Sun maneuver and wants to swap it at level 4 with Devastating Throw. He accomplishes the requisite of having 1 Setting Sun maneuver before the swap, however, he no longer accomplishes the requisite after the swap (unless you count the Devastating Throw itself). Is this swap possible?

usability – What is the purpose of a swap button in an airline booking app?

It’s to save the user time from having to re-input values.

I’ve heard it called a swap button, but that’s informal.

This is a common pattern in applications where a trip is being planned (or en route). It allows users to quickly reverse the start and end destinations.

enter image description here

The principle behind it is more important to know: don’t make users do more work than they need to.

multivariable calculus – swap integral to polar

Trying to swap to polar and solve the following double integral, but I am not getting the same answer.

int_{-3/4}^{3/4} int_1^2 int_{sqrt(3/4-x^2}^{sqrt(3/4-x^2} 1/2 (3-4sqrt(x^2+y^2)) dy dx

Here is the conversion into polar: int_0^{2pi} int_0^{3/4} rrdrdq = 9pi/32

Not sure what I’m doing wrong.