Is it theoretically possible to dynamically grow array size in stack memory?

I was wondering, given the usual stack memory functioning, whether it is possible for an array like primitive type allowed to grow in size to exist.
The functioning of such primitive type is as follows.

  • Any one function is allowed to have only one such primitive variable.
  • Appending to such primitive variable is allowed only within the function that it was initialized in.
  • If the function that such primitive variable was initialize in is not the last in the stack, such primitive variable is not allowed to grow in size.

enter image description here

I was wondering whether:

  • Such primitive type is theoretically possible.
  • Whether it is something that is already in use.

Need suggestions for creating field level permissions which can be changed dynamically in an app

This is currently my User-Role-Permission model in the Db schema (excluded other tables to avoid confusion). My implementation goes like this: I have a Customer table and each Role has a different set of permissions to enable the User to interact with it. The User with Salesman role can only read from it while Admin has all the CRUD permissions. To do this I’ll save 4 entries in the Permission table with perm_type = “create customer”, “read customer” etc. I have a clear mapping of which role has which permissions and those can be changed dynamically as well; simply insert or delete entries in the Role_Permission table. So before performing any action I’ll just check the user role and whether the role has the required permission with a simple if statement in my code. enter image description here

All good so far but there’s a catch now. The Salesman is supposed to have permission to update Customer as well but only the balance field. Salesman cannot update anything else say Customer name, contact etc. There are 2 ways I can implement this:

  1. Grant update permission to Salesman but in the client side only display the form for updating balance. But then again someone can exploit this, right?
  2. Create 2 methods and their corresponding permissions in the Permission table: updateCustomer(Customer updatedCustomer) and updateCustomerBalance(int id, float balance). But what if in future I want salesman to be able to update contact or address of Customer? I’ll have to add more methods for that, compile and deploy my code again. I can do that for every field before deploying my app but it looks very cumbersome especially when I have at least 15 more tables.

So is there any other way I can do this?

Change page layout dynamically depending on url parameter

The standard layout of my categories are 2-columns-left, so that the layered navigation is visible in my shop. What I want is, to use the same categories to display a content.

This is an example for my shop link: products/chemicals.html IfI click this link my products are shown in my list.phtml

This is an example for my “cms” link: products/chemicals.html?cms_id=123 If I click this link my “cms” content is displayed in my list.phtml

What I want now, is to display my content without the left sidebar. By css I can set the sidebar display:none, that works, but the page loads my products.

I would prefer to change the page layout when i call my “cms” category page.

Any idea?

Christian

Dynamically update 2D configuration – Data from file

I’m trying to simulate the evolution of a classical fluid in 2D. I have a file that contains the evolution of a configuration of points in a 2D, with a white line between each “snapshot”. For 3 particles, something like :

x y

1 4

2 2 <- snapshot at t

4 7

(white line)

2 2

4 5 <- snapshot at t+dt

1 9

(…)

Is it possible to get a dynamic plot in Mathematica showing this evolution? (Each point should be a circle of radius 0.5)

How to remove a dynamically created list item that has a specific class when clicking on a button?

A user adds list items dynamically and clicks them to mark them as complete once selected as complete a user should then be able to click the button and remove them from the page. I am unsure as to why the remove functionality does not work any help appreciated!

const addText = function () { $  addBtn.on("click", function () {     addLI(); }); };  const addLI = function () { if($  inputBox.val()!=="") {     $  newItemList.append("<li>" +"<p onclick = 'markComplete(this)'>"+  $  inputBox.val() +"</p>" + "</li>"); } $  removeBtn.on('click', function() {     if($  ('li').hasClass('finishedItem'))     {         $  ('li').remove();     } }); }; function markComplete(p){ $  (p).toggleClass("finishedItem") } 

Fabric UI DetailsList component – Dynamically load group items

I’m using grouped DetailsList Fabric UI component in custom SPFx webpart for displaying list data.

https://developer.microsoft.com/en-us/fabric/#/controls/web/detailslist/grouped

I need to load items of the group dynamically from the server by the API call, but can’t find any available group expand callbacks in DetailsList component with available exposed group props (name of the group, etc.) as a method parameter for building a request string. It should look like that:

https://contoso.sharepoint.com/site/_api/web/Lists/getbytitle('ListTitle')/RenderListDataAsStream?@listUrl=&View=&IsGroupRender=TRUE&DrillDown=1&GroupString=%3B%23Exel%20Format%20Files%3B%23%3B%23& 

Basically, I want to achieve behavior of the standard modern Document Library webpart existing in Sharepoint 2019. Any other ways to achieve this with DetailsList component?

Code sample of the component (from documentation):

import * as React from 'react'; import {   BaseComponent,   DefaultButton,   DetailsHeader,   DetailsList,   IColumn,   IDetailsHeaderProps,   IDetailsList,   IGroup,   IRenderFunction,   IToggleStyles,   mergeStyles,   Toggle } from 'office-ui-fabric-react';  const margin = '0 20px 20px 0'; const controlWrapperClass = mergeStyles({   display: 'flex',   flexWrap: 'wrap' }); const toggleStyles: Partial<IToggleStyles> = {   root: { margin: margin },   label: { marginLeft: 10 } };  export interface IDetailsListGroupedExampleItem {   key: string;   name: string;   color: string; }  export interface IDetailsListGroupedExampleState {   items: IDetailsListGroupedExampleItem[];   groups: IGroup[];   showItemIndexInView: boolean;   isCompactMode: boolean; } const _blueGroupIndex = 2;  export class DetailsListGroupedExample extends BaseComponent<{}, IDetailsListGroupedExampleState> {   private _root = React.createRef<IDetailsList>();   private _columns: IColumn[];    constructor(props: {}) {     super(props);      this.state = {       items: [         { key: 'a', name: 'a', color: 'red' },         { key: 'b', name: 'b', color: 'red' },         { key: 'c', name: 'c', color: 'blue' },         { key: 'd', name: 'd', color: 'blue' },         { key: 'e', name: 'e', color: 'blue' }       ],       // This is based on the definition of items       groups: [         { key: 'groupred0', name: 'Color: "red"', startIndex: 0, count: 2 },         { key: 'groupgreen2', name: 'Color: "green"', startIndex: 2, count: 0 },         { key: 'groupblue2', name: 'Color: "blue"', startIndex: 2, count: 3 }       ],       showItemIndexInView: false,       isCompactMode: false     };      this._columns = [       { key: 'name', name: 'Name', fieldName: 'name', minWidth: 100, maxWidth: 200, isResizable: true },       { key: 'color', name: 'Color', fieldName: 'color', minWidth: 100, maxWidth: 200 }     ];   }    public componentWillUnmount() {     if (this.state.showItemIndexInView) {       const itemIndexInView = this._root.current!.getStartItemIndexInView();       alert('first item index that was in view: ' + itemIndexInView);     }   }    public render() {     const { items, groups, isCompactMode } = this.state;      return (       <div>         <div className={controlWrapperClass}>           <DefaultButton onClick={this._addItem} text="Add an item" styles={{ root: { margin: margin } }} />           <Toggle label="Compact mode" inlineLabel checked={isCompactMode} onChange={this._onChangeCompactMode} styles={toggleStyles} />           <Toggle             label="Show index of first item in view when unmounting"             inlineLabel             checked={this.state.showItemIndexInView}             onChange={this._onShowItemIndexInViewChanged}             styles={toggleStyles}           />         </div>         <DetailsList           componentRef={this._root}           items={items}           groups={groups}           columns={this._columns}           ariaLabelForSelectAllCheckbox="Toggle selection for all items"           ariaLabelForSelectionColumn="Toggle selection"           onRenderDetailsHeader={this._onRenderDetailsHeader}           groupProps={{             showEmptyGroups: true           }}           onRenderItemColumn={this._onRenderColumn}           compact={isCompactMode}         />       </div>     );   }    private _addItem = (): void => {     const items = this.state.items;     const groups = [...this.state.groups];     groups[_blueGroupIndex].count++;      this.setState(       {         items: items.concat([           {             key: 'item-' + items.length,             name: 'New item ' + items.length,             color: 'blue'           }         ]),         groups       },       () => {         if (this._root.current) {           this._root.current.focusIndex(items.length, true);         }       }     );   };    private _onRenderDetailsHeader(props: IDetailsHeaderProps, _defaultRender?: IRenderFunction<IDetailsHeaderProps>) {     return <DetailsHeader {...props} ariaLabelForToggleAllGroupsButton={'Expand collapse groups'} />;   }    private _onRenderColumn(item: IDetailsListGroupedExampleItem, index: number, column: IColumn) {     const value = item && column && column.fieldName ? item[column.fieldName as keyof IDetailsListGroupedExampleItem] || '' : '';      return <div data-is-focusable={true}>{value}</div>;   }    private _onShowItemIndexInViewChanged = (event: React.MouseEvent<HTMLInputElement>, checked: boolean): void => {     this.setState({ showItemIndexInView: checked });   };    private _onChangeCompactMode = (ev: React.MouseEvent<HTMLElement>, checked: boolean): void => {     this.setState({ isCompactMode: checked });   }; } 

How to create Material Button Dynamically?

I am trying to create material button dynamically. I have added all the dependency and everything. If I create it in XML file it works perfectly but when I try to create it dynamically it gives the error

Creating Material Button:

 LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,   LayoutParams.WRAP_CONTENT);  Layout.addView(materialButton, layoutParams);```  Style :  ```<style name="AppTheme"  parent="Theme.MaterialComponents.Light.NoActionBar"> 

It gives run time Error “java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).”