$50 WordPress Partial Homepage Design Contest

This is a contest for the "content" section of a WordPress homepage. Basically the header and footer have already been designed, and I just need a good layout for the main content area.

The website is [​IMG] . The design you submit should include the header (everything up to, and including the video) and the footer (grey section at the bottom of the page). If you want to change the header or footer go ahead, it's not necessary but will be appreciated…

$ 50 WordPress Partial Homepage Design Contest

How to solve this partial differential equation for $f$?

I want Mathematica to solve for the function $ f$ .

$ f$ satisfies the following constraints.

$ \frac{\partial}{\partial x} f(x,y) = y$

$ \frac{\partial}{\partial y} f(x,y) = x$

$ f(0,0)=0$

It would seem obvious that $ f(x,y) = x y$

Yet I cannot coax Mathematica into returning this result.

Here is my attempt. Mathematica just returns it. What am I missing?

DSolve[     {        x == D[f[x, y] , y]      , y == D[f[x, y] , x]      , f[0, 0] == 0     }  , {f[x, y], f[x, y]} , {x, y} ] 

How train using the absolute partial derivative of the error function?

I have to do this: Two multi-layer perceptron (NN) were calibrated in the context of regression analyses, one to estimate the diameter (d) and another to estimate the accumulated volume (Vac) from the base up to a given height (h). Both contained two hidden layers: 25 neurons in the first and 10 neurons in the second, all containing the logistic as the activation function. The NN training was oriented to minimize the sum of squared errors through resilient backpropagation algorithm with weight backtracking. For each iteration of the cross-validation the NN was initialized 50 times, and the training ended when the absolute partial derivative of the error function, with respect to the weights, was smaller than 0.01

Im triying to do something but is apparently bad

while True: from sklearn.model_selection import train_test_split xvac_train, Xvac_test, yvac_train, yvac_test = train_test_split(xvac, yvac) mlr=MLPRegressor(solver=’lbfgs’, activation=’logistic’,alpha=1e-5,hidden_layer_sizes=(20,10),random_state=1) mlr.fit(xvac_train,yvac_train) print(mlr.score(xvac_train,yvac_train)) if mlr.score(xvac_train,yvac_train) > 0.99: break

please help

How to handle adding new field / partial data update for a gRPC API?

Assuming we have following message that will be used to update data and it just got updated to version 2.

message HelloRequest {   string name = 1; // version 1   bool is_valid = 2; // version 2 } 

Now assuming we updated our apps like so:

  • server : version 2
  • client A : version 2
  • client B : version 1

We don’t have any problems with client A since it can set the proper is_valid value. The issue is that client B will always send a message with is_valid set to false. Is there any techniques such that the server won’t use the is_valid field if it’s from a version 1 client?

In a RESTful API, I could use PATCH to partially update data. That is, the JSON data will not have the is_valid field, so the server can choose not to change the said field.

Our server will be written in C#, not sure if that needs to be considered with this question.

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.

object-partial.js

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);   } }; 

merge-partials.js

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')   ] */ 

Sum over powers of roots of unity gives only partial answer

Mathematica seems to be unable to handle sums over roots of unity. For example, Simplify[Sum[Exp[2 Pi I a b/m], {a, m}], {b, m} \[Element] Integers] yields 0 instead of a piecewise function like:$ $ \begin{cases} 0 & gcd(b,m)=1\ m & \text{otherwise} \end{cases} \ $ $ Has anybody managed to obtain the correct answer?

Partial cell formatting with CONCATENATE in Google Sheets

Is there a way to format partially using CONCATENATE in google sheets?

For example, =CONCATENATE("*", Sheet1!A1, Sheet1!B1), and I want to make the * bolded or blue in color or something else.

I realize that I could either:

  1. Split it across multiple cells and control the color (this does not work for the sheet I am working on because of all else that is going on in the sheet. To begin with, I have merged two cells in order to fit the text. Unmerging would cause the text to be obstructed. Changing the column width would mess with other entries in the same column.)
  2. Manually convert it to plain text and make the necessary formatting changes. But that too manual.