(Quiz/Algorithm) How many boxes are needed?

I have X pieces to store in Y boxes.

The boxes vary in size and contain N, M, L, Q pieces.

How do I find which boxes and how many boxes to use, in order to use as few of them as possible and without advancing pieces?

Nb: The number of boxes is integer. Not necessarily the boxes are dismantled.


Pieces: 98

Boxes: A (Containing 20 pieces), B (Containing 5 pieces), C (Containing 4 pieces), D (containing 3 pieces)

Answer: (4 box A) + (3 box B) + (1 box D)

What’s the algorithm?

Disable Fields in Custom Meta Boxes inside Custom Post Type

I want to create an Options page for my plugin.

I have two custom post types. Both habe metaboxes with fields inside. They are perfectly saving now (thanks to you guys on stackexchange).

Now, I want to create an Options Page (already done) and want to allow the admin to disable or enable every single field of every metabox

For example

Post Type: np-food Metabox: nutrition-info fields: energy_kcal, energy_kilojoule, etc


Enable energy_kcal yes/no dropdown Enable energy_kilojoule yes/no dropdown

Saving removes them if disabled and let them appear if enabled.

Glad for any help 🙂

Have a great Day


Is this a valid heuristic for Dots and Boxes to reduce the branching factor of the search tree?

I am implementing an AI based on the MiniMax algorithm that plays the game Dots and Boxes. I would like to reduce the branching factor of the search tree, by introducing a heuristic rule that limits the number of successor states. However, I am not sure whether there exist any situations, where this rule would exclude the optimal move and make the AI play worse.

In the game 2 players take turns, until one of them captures a box, after which they have to make another move, possibly capturing another box etc. For this purpose, I define successor states of $ S$ to be all states, where the opponent gets the move, or the terminal state. If a player made a capture and still has to make another move, then the current state is not yet a successor state of $ S$ – the player has to continue making moves until they’re unable to.

My rule is as follows:
Assume a player makes a series of captures from a starting state $ S$ and ends it with a move $ m$ , after which the turn goes to the opponent. Then it’s always better or at least not worse for the player to have made as many captures as possible before finishing the sequence with $ m$ .

This means that any state $ S$ always has less successors, then there are legal moves. All successors where the player captures $ n$ boxes and finishes with move $ m$ are discarded, unless $ n$ is the maximum number of boxes that can be captured such that $ m$ can still be a finishing move. For example, in the following state:
example state
immediately capturing the 4 boxes leads to a loss, while dividing them into 2 small chains, 2 boxes each, with the move (2,2)-(2,3) leads to a victory. The optimal strategy is consistent with the rule, as it would not be possible to finish with the move (2,2)-(2,3), if any of the boxes were captured. The rule excludes all successors, where the player captures 1 or 2 boxes, from being considered.

How can i write script for search two different List columns of search boxes related data show on grid view in SPFX?

Am able to search the PR_Number column data, the same i want to search for Description as input in another search box and show the gridview in SPFx.

import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import {   BaseClientSideWebPart,   IPropertyPaneConfiguration,   PropertyPaneTextField } from '@microsoft/sp-webpart-base'; //import styles from './PrFilter.module.scss'; import { escape } from '@microsoft/sp-lodash-subset';  import * as strings from 'PrFilterWebPartStrings'; import PrFilter from './components/PrFilter'; import { IPrFilterProps } from './components/IPrFilterProps'; import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http';  export interface IPrFilterWebPartProps {   description: string; } export interface ISPLists {   value: ISPList[]; } export interface ISPList {   PR_Number: string;   Description: string;   Request_Date: string; }      export default class PrFilterWebPart extends BaseClientSideWebPart<IPrFilterWebPartProps> {    private _getListData(): Promise<ISPLists> {       let queryString: string = '';     let queryStringforPR: string = '';     let searchboxVal: string=(this.domElement.querySelector('#searchbox') as  HTMLInputElement).value;     if(searchboxVal!=""){       // alert("searchboxVal" + searchboxVal);             queryString="$  filter=substringof('"+searchboxVal+"',PR_Number)";       queryStringforPR= searchboxVal;       console.log("qurery string value is " + queryString);       console.log("queryStringforPR value is " + queryStringforPR);     }     return this.context.spHttpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/web/lists/GetByTitle('PurchaseRequest')/Items?$  filter=PR_Number eq $  {queryStringforPR}`, SPHttpClient.configurations.v1)         .then((response: SPHttpClientResponse) => {             return response.json();         });   }   private _renderListAsync(): void    {       this._getListData()     .then((response) => {       this._renderList(response.value);     });   }    private _renderList(items: ISPList[]): void    {     //debugger;     let html: string = '<table class="TFtable" border=1 width=100% style="border-collapse: collapse;">';     html += `<th>PR_Number</th><th>Description</th><th>Request_Date</th>`;     items.forEach((item: ISPList) => {       html += `           <tr>           <td>$  {item.PR_Number}</td>           <td>$  {item.Description}</td>           <td>$  {item.Request_Date}</td>           </tr>           `;     });     html += `</table>`;     const listContainer: Element = this.domElement.querySelector('#spListContainer');     listContainer.innerHTML = html;   }   private _setSearchBtnEventHandlers(): void    {     //debugger;     this.domElement.querySelector('#searchBtn').addEventListener('click', () => {         this._renderListAsync();     });   }     public render(): void {      this.domElement.innerHTML = `     <div>     <div>        <div class="ms-Grid-row ms-fontColor-white">         <div class="ms-Grid-col ms-u-lg10 ms-u-xl8 ms-u-xlPush2 ms-u-lgPush1">                  <p class="ms-font-l ms-fontColor-white" style="text-align: center">P2P Tool</p>         </div>       </div>       <div class="ms-Grid-row ms-fontColor-white ">          <input id="searchbox" type="textbox"/><input id="searchBtn" type="button" value="Search"/>         <input id="searchboxDescription" type="textbox"/><input id="searchBtnDescription" type="button" value="Search"/>              <br>         <div id="spListContainer" />       </div>     </div>   </div>`;     this._renderListAsync();     this._setSearchBtnEventHandlers();   }    protected get dataVersion(): Version {     return Version.parse('1.0');   }    protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {     return {       pages: [         {           header: {             description: strings.PropertyPaneDescription           },           groups: [             {               groupName: strings.BasicGroupName,               groupFields: [                 PropertyPaneTextField('description', {                   label: strings.DescriptionFieldLabel                 })               ]             }           ]         }       ]     };   } }  

enter image description here

Alternatives to boxes

I have a box problem. 90% of all my original magic items either are boxes, or are inside boxes. I try to hide it by making them interesting shapes, but ultimately a box is a box.

It has gotten to the point where if I even so much as mention a box, the words “a box, must be important!” can be heard around the table.

How do I break my box habit, and what alternatives do I have to boxes?

nested boxes algorithm

I am given a set of 3D boxes {$ B_1$ , $ B_2$ $ B_n$ } and each box have length, width and height. But these values are interchangeable since I can rotate the box. I need to find out the maximum sequence of nested boxes.

I have tried this problem using sort. But I still get stuck. I used built in sort function to sort all boxes by length in ascending order. I read the reference about this question and learned that people used radix sort. I have know idea how radix sort is applied here because all sorts I am familiar is comparison sort.

Add boxes for generic_fields

Some fields could be added by default, but not required. Its not a perfect solution, it would me much better to create additional .dat file, where we could define custom types (just like in engine.ini) that can be used for generic fields <- all of them could pop – up in project settings as additional but not required. But they should not be overriden by default Engines data fields ? Its a thing to discuss.


Check off the boxes you wish to unsubscribe from

In attempting to unsubscribe from a company’s emailing list, I was directed to a website with the following form.

enter image description here

Note the phrase “Check off the boxes… you wish to unsubscribe from.” Is this some type of standard phrasing? The use of the terms off and unsubscribe seem to make the sentence ambiguous; should I check or uncheck? (The default page has all check boxes unchecked.)

Is there a way this company can improve their phrasing?

Custom Bath Bomb Boxes

The Custom Bath bomb boxes are aiding the top cosmetic brands to endorse their beauty and skin care range effectually. enhances brand awareness and drive business sales and this is a fact the way of packaging may attract potential customers and induce them to take a look at your product while showcasing on the retail shelf. The alluring color schemes, styles and extensive designs in packaging can be varied and designed in an appealing way to attract planned consumers….

Custom Bath Bomb Boxes