16.04 replacing folders instead of merging them

When I try to copy a folder into a directory where an older version of that folder already exists, say when backing up a folder to an external hard drive, this window pops up:

enter image description here

Is there a way to also have a Replace option? Because merging will keep all the files in the older folder that I have deleted in the newer one, which is not always preferable.

I use Ubuntu 16.04 with Cinnamon and Nemo as the default file manager.

Merging teams with different front end framework preferences

My company just went through a merger and as a result my small team has been expanded. From our side we have been using react for several years, and I firmly believe for us it is the superior choice in every way to angular which they use historically. We both have our own templates which have been developed over the last few years for various common projects.

Given that the end product of both can be made to look and function almost identically, is it advisable to let both developers use whichever they are most comfortable for new projects? In my head if everyone sticks to some predefined style and data protocols, end users won’t know the difference, and everyone is happy.

As an additionally complexity, if we do take this approach, should new junior devs be pushed either way to try and push towards a majority framework?

Can long lived feature branches be justified by merging master into the feature branch daily

I’ve always considered long lived feature branches a symptom of some underlying problem, but I’ve recently moved jobs and the company I am working for now encourages long lived feature branches. They say it’s fine as long as you merge master (well, the Dev branch, but whatever branch we all work off of) into the feature branch daily. They say you don’t end up with conflicts that way or if you do they are small conflicts. I don’t personally understand this, is there any truth behind the idea that the difficulties surrounding long lived feature branches can be negated by merging master into the branch frequently?

Use LVM for extending a folder’s size by merging it with a folder on an external drive

I basically have this folder where I need to store 1.5 terabytes. However, I only have 900 gb on my internal drive. How do I configure a folder using LVM so that it tries to fill up internal, then moves files to the external drive once it runs out of internal drive space?

Note: I want it to regular check if the internal drive is free; if it still has free space, I want the computer to keep moving external drive files from a designated folder back to the internal drive until internal storage fills up.

Merging partial objects while avoiding path collisions and ordering array indexes

I have been creating a small library to copy parts of deeply nested objects through path strings that supports wildcards. For that I list all paths and values actually found as ObjectPartials and merge-partials these are merged while avoiding path collisions and ordering array indexes. This review is only about this part.

The whole merge-partials.js seems too contrived and confusing. I wanted to have smaller, clearer functions that don’t rely so much on side-effects, as here the ObjectPartials passed to the functions are being changed. Maybe there is even a way simpler solution that I am not seeing.


const set = require('lodash.set');  const InvalidArgError = require('./errors/invalid-arg-error'); const { isUndefined } = require('./utils');  module.exports = class ObjectPartial {   /**    * Creates a new ObjectPartial with the given path and its value    * @param {Array} path    * @param {any} value    */   constructor(path, value) {     if (!Array.isArray(path) || !path.length || isUndefined(value)) {       throw new InvalidArgError(         'No valid path or missing value for ObjectPartial'       );     }     this.path = path.slice();     this.value = value;   }    getPath() {     return this.path;   }    getValue() {     return this.value;   }    /**    * Merge the partial into a new or an existing object    * @param {*} object Optional object to merge the partial into    * @returns Resulting object    */   mergeToObject(object = {}) {     return set(object, this.path, this.value);   }    static createFromObject(object, path) {     if (!path || !Array.isArray(path) || isUndefined(object)) {       throw new InvalidArgError(         'Missing path or object for ObjectPartial.createFromObject'       );     }     let curValue = object;      for (let i = 0; i < path.length; i++) {       if (isUndefined(curValue[path[i]])) {         return null;       }       curValue = curValue[path[i]];     }      return new ObjectPartial(path, curValue);   } }; 


const { isUndefined, pushAllUnique } = require('./utils'); const InvalidArgError = require('./errors/invalid-arg-error');  /**  * Creates a map of all the keys on current partials level and its subsequent keys  * @param {ObjectPartial[]} partials  * @param {Number} pathIndex  * @returns Map of each key occurance (*key* (key, indices[], nextKeys[])) to the partials and next keys  */ function createPossibleCollisionsKeyMap(partials, pathIndex) {   const result = { possibleColisionKeys: {}, hasNextLevel: false };    for (let i = 0; i < partials.length; i++) {     const partialPath = partials[i].getPath() || [];     const key = partialPath[pathIndex];     const nextKey = partialPath[pathIndex + 1];      if (!isUndefined(key)) {       if (isUndefined(result.possibleColisionKeys[key])) {         result.possibleColisionKeys[key] = { key, indices: [], nextKeys: [] };       }       result.possibleColisionKeys[key].indices.push(i);       result.possibleColisionKeys[key].nextKeys.push(nextKey);     }     if (!isUndefined(nextKey)) {       result.hasNextLevel = true;     }   }    return result; }  function hasPossibleKeyCollision(indices, nextKeys) {   const hasMultiple = indices.length > 1;   const hasNextUndefined = nextKeys.findIndex(isUndefined) > -1;   const hasNextNonZeroIndices =     nextKeys.filter(nextKey => Number.isInteger(nextKey) && nextKey != 0)       .length > 0;    return (hasNextUndefined && hasMultiple) || hasNextNonZeroIndices; }  /**  * Solves possible key collisions and normalizes array indices (order from 0)  * @hasSideEffects  * @param {ObjectPartial[]} partials  * @param {Array} pathIndex  * @param {Object} indices.nextKeys possible colision key map  */ function solveKeyCollision(partials, pathIndex, { indices, nextKeys }) {   if (!hasPossibleKeyCollision(indices, nextKeys)) {     return;   }   const indicesTransform = [];   let curNextIndex = 0;    for (let i = 0; i < indices.length; i++) {     const partialIndex = indices[i];     const partialNextKey = nextKeys[i];     const partialPath = partials[partialIndex].getPath();      if (isUndefined(partialNextKey)) {       partialPath.splice(pathIndex + 1, 0, curNextIndex);       curNextIndex += 1;     } else if (Number.isInteger(partialNextKey)) {       let newIndex = indicesTransform[partialNextKey];        if (isUndefined(newIndex)) {         newIndex = curNextIndex;         curNextIndex += 1;         indicesTransform[partialNextKey] = newIndex;       }       partialPath[pathIndex + 1] = newIndex;     }   } }  /**  * Handles the possible collisions in current section of the object partials  * @param {ObjectPartial[]} partials  * @param {*} scanMaps (curLevel, partialIndices[])  * @returns (hasNextLevel, uniqueKeys)  */ function handlePathColisions(partials, { curLevel, partialIndices = [] }) {   const thesePartials = partials.filter((_partial, index) =>     partialIndices.includes(index)   );   const { possibleColisionKeys, hasNextLevel } = createPossibleCollisionsKeyMap(     thesePartials,     curLevel   );   const uniqueKeys = [];    Object.keys(possibleColisionKeys).forEach(key => {     solveKeyCollision(thesePartials, curLevel, possibleColisionKeys[key]);     uniqueKeys.push(possibleColisionKeys[key].key);   });    return { hasNextLevel, uniqueKeys }; }  function createDummyScanMap(partials, level) {   return {     curLevel: level,     partialIndices: partials.map((partial, index) => {       return {         path: partial.getPath(),         index       };     })   }; }  /**  * Gets a part of the ObjectPartials to be checked for possible path collisions  * @param {ObjectPartial[]} partials  * @param {Number} level  * @param {string} parentKey  * @returns {Object} Object composed of (curLevel,parentKey,partialIndices[] (path,index))  */ function getScanMap(partials, level, parentKey) {   const result = createDummyScanMap(partials, level);    if (isUndefined(parentKey)) {     result.partialIndices = result.partialIndices       .filter(value => !isUndefined(value.path[0]))       .map(value => value.index);   } else {     result.partialIndices = result.partialIndices       .filter(         value =>           value.path[level - 1] === parentKey && !isUndefined(value.path[level])       )       .map(value => value.index);   }    return result; }  /**  * Prepares object partials to merge contents and normalize array indexes  * @hasSideEffects  * @param {ObjectPartial[]} partials  */ /* eslint-disable no-loop-func */ function mergePartials(partials) {   if (!partials || !Array.isArray(partials) || !partials.length) {     throw new InvalidArgError('Missing ObjectPartial list for mergePartials()');   }   let hasNextLevel = true;   let curLevel = 0;   let parentKeys;   let scanMaps;   let tempResult;    while (hasNextLevel) {     if (curLevel === 0) {       scanMaps = [getScanMap(partials, 0)];     } else {       scanMaps = parentKeys.map(pKey => getScanMap(partials, curLevel, pKey));     }     parentKeys = [];      for (let i = 0; i < scanMaps.length; i++) {       tempResult = handlePathColisions(partials, scanMaps[i]);       pushAllUnique(parentKeys, tempResult.uniqueKeys);       hasNextLevel = false || tempResult.hasNextLevel;     }     curLevel += 1;   } }  module.exports = mergePartials; 

I did do some tests for this that are passing and here is an example of input and output ObjectPartials. Hope the purpose of the whole thing is clear, let me know if I missed something.

  mergePartials([     new ObjectPartial(['A', 3, 'BA'], 'example'),     new ObjectPartial(['A', 3, 'B'], 123),     new ObjectPartial(['A', 4, 'B'], 456),     new ObjectPartial(['D'], 'yay'),     new ObjectPartial(['D', 0], 'nay')   ]);   /* --> [     new ObjectPartial(['A', 0, 'BA'], 'example'),     new ObjectPartial(['A', 0, 'B'], 123),     new ObjectPartial(['A', 1, 'B'], 456),     new ObjectPartial(['D', 0], 'yay'),     new ObjectPartial(['D', 1], 'nay')   ] */ 

Merging profile and fan page pages on Facebook

I am wondering to know what is the best way to merge my personal profile (~2k friends) with my fan page (~1k likes).

Is it possible to merge them? Should I delete the fan page and convert my personal profile into page?

What will happen with my 2k friends after this migration? Will I be able to follow them like I do know (e.g. see their photos, posts etc)?

When providing programming documentation to users of an office suite software, does intelligent cell merging in tables, make the info more accessible?

Examples of such merged-cell use, alongside versions of same info without merged-cell use

Info using merged cells

Table 1

VBA non-intrinsic data types table with merged cells

Table 2

VBA intrinsic data types table with merged cells

Same info without using merged cells

Table 1

VBA non-intrinsic data types table without merged cells

Table 2

VBA intrinsic data types table without merged cells


I was advised that such merging might make it more difficult for such users to access the information (rather than help them). The adviser also implied that I should ask other programmers of the programming language, what they would prefer in regards to the merging. Because of this, I am posting this question here & at other places.

Merging data sets

In a google sheet I have multiple tables containing a list of dates. I want to create a single (sorted) list containing all the dates and the table they came from.

Table foo: 1.1.19 3.1.19  Table bar: 2.1.19 4.1.19  Result: 1.1.19 foo 2.1.19 bar 3.1.19 foo 4.1.19 bar 

Is this somehow possible with regular formulas or do I need to switch to custom functions here?

Unexpected output from the merging of a quadtree, when that data is converted to Box2D fixtures

I’ve been staring at this code trying to troubleshoot this for the past 3 days, but I seem to have gone Code Blind. I KNOW the issue is stupidly simple, but I just can’t crack the problem.

I’m using a bastardized quadtree to store the terrain for a map. Each node is either full of children, or stores an instance of a tile (position data is saved in the tile). tile stores its AABB (x,y,w,h), and block type (1 = ground, 0 = air/nothing). Later it will store objects and entities as well. Inserting (right now) does NOT cause merging – that is a separate function call.

The darn thing renders properly if drawn to a Pixmap. Which drives me absolutely crazy.

Expected Output (image generated to PixMap from data) :

Expected output from a properly merged quadtree

Output WITHOUT merging (tile width/heigh is 8 pixels), totally as expected :

Perfectly normal representation of the above quadtree, without merging of same blocks (all data 8x8 pixel squares)

Output WITH merging (bizzare.) : The same exact quadtree in all other images, except the squares are not aligned at all.

Code which I am fairly sure is the problem (from the tile class) PPM is a constant defined elsewhere (Pixels Per Meter), set to 8. This is all rendered through LibGDX :

    public void setPhys(World w) {     if(this.block != 0) {         this.bdef = new BodyDef();         NovaLog.debug("bdef.position.set(" + (this.aabb.x / PPM) + ", " + (this.aabb.y / PPM) + ");");         bdef.position.set(this.aabb.x / PPM,this.aabb.y / PPM);         bdef.type = BodyType.StaticBody;         this.body = w.createBody(bdef);          PolygonShape shape = new PolygonShape();         NovaLog.debug("shape.setAsBox("+((this.aabb.width / PPM)/2) + ", " +  ((this.aabb.height / PPM)/2) +");");         shape.setAsBox((this.aabb.width / PPM)/2, (this.aabb.height / PPM)/2);         this.fdef = new FixtureDef();         this.fdef.shape = shape;         this.fixture = this.body.createFixture(fdef);         this.fixture.setUserData(this);     } } 

At this point, I’m a Westworld Host looking at something that could do harm to his psyche – “It doesn’t look like anything to me.” Please help – the bruise on my forehead from banging my head against the wall is growing larger.