Best options to page a dynamically updating list

We’ve got a list of very dynamic items. New items are frequently added to the list (maybe one every few seconds).

The items can also be re-arranged (say they’ve been sorted by ‘last updated’ and one is updated by the system).

Our problem comes with paging this list. If the user has it sorted by “latest”, and they’re looking at the top 20 paged items for, say, 20 seconds, then scroll down – 5-10 items might now have been created.

If we naively query the database to get items “20-40” (the next ‘page’, although it’s actually a scroll), we’ll get duplicate items.

We’ve spent quite a lot of effort in our backend to be able to query our list from a specific date – we send a “get me items 20-40 FROM THIS TIME” to the back end.

However, that’s quite a difficult requirement for the database schema and back-end, we can’t support some things we want to because we have to try keep duplicate records for this ‘history’.

Are there any generally accepted strategies for dealing with this kind of situation?

How to add a menu item in breadcrumb only on specific, dynamically created pages

I have set breadcrumbs to appear only on bbpress and buddypress. Within bbpress the breadcrumb looks something like this:

Home > FTBMates > Q&A

…where ‘FTBMates’ is my forum root.

Meanwhile in Buddypress the breadcrumb is something like this:

Home > Members > Membername

I would like to add ‘FTBMates’ into the breadcrumb before ‘Members’, so it looks something like this:

Home > FTBMates > Members > Membername

I would like this additional FTBMates item added in every page of Buddypress.

I found some code that claims to do this for me:

add_filter('bcn_after_fill', 'my_static_breadcrumb_adder'); function my_static_breadcrumb_adder($  breadcrumb_trail) { if($  breadcrumb_trail->breadcrumbs[count($  breadcrumb_trail->breadcrumbs)-2]->get_id() === 5450){     $  new_breadcrumb = new bcn_breadcrumb('Rental', NULL, array('rental'), '/rental/');     array_splice($  breadcrumb_trail->breadcrumbs, -1, 0, array($  new_breadcrumb)); } } 

The problem is that some of the Buddypress pages, like the member profile page, for example, is dynamically created and therefore I can’t replace the get_id part of this code (if I have understood it correctly).

Can anyone point me to code to add to my functions.php file that will add this item into my breadcrumbs only in the buddypress section of my website?

Attach flow dynamically to lists created by site design

I have a site design, that adds a SharePoint list with some columns. I need the ability to select an item from that list/library, and click on Flows, and choose my flow and run it.

The case I have is that the sites will be created by users, and the site design will be applied to them which creates those lists. Is there a way to attach the flow to those newly created lists so the Flow would appear in the list of Flows and bind it dynamically to it?

MS Flow to Move file inside Sub-Folder in Document Library dynamically

I am creating MS Flow to move files between libraries. Source & destination libraries contains same folder structures & Subfolders. When file is created in source sub-folders, it should move to respective subfolders dynamically to Destination Library based on where they created on source.

In Move File Scope, i chose Destination Folder: FolderPath/FileNamewithExtension

but I got error.

Please advise me on this.

How to pass a attribute code dynamically in extension_attributes.xml

How to pass a attribute code dynamically in extension_attributes.xml

extension_attributes.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">     <extension_attributes for="Magento\Quote\Api\Data\AddressInterface">         <attribute code="How_to_pass_code_dynamically_here" type="string" />         <attribute code="How_to_pass_code_dynamically_here" type="string" />     </extension_attributes> </config> 

It should contain getters and setters of address attribute. In this case. <attribute_code="example"> setExample(), getExample()

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