Recommendation for Free Lazy Loading Extensions Magento 2

i’m looking for recommendation for free lazy loading extension that is likely works for magento 2.2.9 with infortis ultimo theme.

here are some list i found:

-welt MAGENTO 2 LAZY LOAD PRODUCTS AND IMAGES.

-bss Magento 2 Lazy Load

-magezon Magento 2 Lazy Load Extension

-Magento 2 Image Lazy Load Extension

have anyone try any of them, and recommended or not recommended?

Throttling the factory function of a Lazy instantiated with LazyThreadSafetyMode.PublicationOnly

When you use the constructor of Lazy<T> requesting the valueFactory and mode parameters (I mean this one) you can specify LazyThreadSafetyMode.PublicationOnly.

This way you can prevent the Lazy instance of caching any exception thrown by valueFactory, but at the same time you lose the ability of guarantee that the factory function is executed only once. The documentation states (bold is mine):

When multiple threads try to initialize a Lazy instance simultaneously, all threads are allowed to run the initialization method (or the default constructor, if there is no initialization method). The first thread to complete initialization sets the value of the Lazy instance.

Sometimes this is fine, some other times it’s better to avoid this or, at least, to limit the concurrent execution of the factory function (imagine a thousand threads concurrently executing a database query or calling a web service). I usually implement this kind of constrained concurrency by using the SemaphoreSlim class.

My question is really simple:

is there any kind of issue or contradiction in employing a SemaphoreSlim (or a similar mechanism) in order to limit the concurrent execution of the factory function for a Lazy<T> instance having LazyThreadSafetyMode.PublicationOnly as its thread-safety mode ?

I can’t see any issue, but I prefer asking the community because I’m not an expert.

Trouble implementing lazy loaded feature module Angular 8

So basically I am trying to create a lazy loaded feature module in my application I have been following the official angular docs – but for some reason its not working.

I have set up my feature module DashboardModule as shown below

import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common';  // MODULES import { DashboardRoutingModule } from './dashboard-routing.module';  // COMPONENTS import { DashboardComponent } from './dashboard/dashboard.component'; import { DashboardAlertComponent } from './dashboard-alert/dashboard-alert.component'; import { DashboardSummaryComponent } from './dashboard-summary/dashboard-summary.component'; import { DashboardTasksComponent } from './dashboard-tasks/dashboard-tasks.component'; import { HoldingPageComponent } from './holding-page/holding-page.component';  @NgModule({     imports: [CommonModule, DashboardRoutingModule],     declarations: [         DashboardComponent,         DashboardAlertComponent,         DashboardSummaryComponent,         DashboardTasksComponent,         HoldingPageComponent,     ] }) export class DashboardModule {} 

then in my DashboardRoutingModule

import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router';  import { ActivityComponent } from '../activity-components/activity/activity.component'; import { IsLockedRouteGuard } from '@app/shared/common/auth/is-locked-route-guard'; import { DashboardSummaryComponent } from './dashboard-summary/dashboard-summary.component'; import { SyncComponent } from '@app/popup-components/sync/sync.component'; import { DashboardAlertComponent } from './dashboard-alert/dashboard-alert.component'; import { ChartContainerComponent } from '../chart-components/chart-container/chart-container.component'; import { DashboardTasksComponent } from './dashboard-tasks/dashboard-tasks.component';   @NgModule({     imports: [         RouterModule.forChild([             { path: 'activity', component: ActivityComponent, canActivate: [IsLockedRouteGuard] },             { path: 'snapshot', component: DashboardSummaryComponent },             { path: 'sync', component: SyncComponent },             {                 path: 'alerts',                 component: DashboardAlertComponent,                 canActivate: [IsLockedRouteGuard]             },             { path: 'charts', component: ChartContainerComponent, canActivate: [IsLockedRouteGuard] },             { path: 'tasks/:sort', component: DashboardTasksComponent, canActivate: [IsLockedRouteGuard] },         ])     ],     exports: [RouterModule] }) export class DashboardRoutingModule {}  

so as per the angular docs this has been set up correctly..

now in my AppRoutingModule

import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; import { AppRouteGuard } from './shared/common/auth/auth-route-guard';  @NgModule({     imports: [         RouterModule.forChild([             {                 path: 'app',                 component: AppComponent,                 children: [                     {                         path: '',                         children: [{ path: '', redirectTo: '/dashboard/alerts', pathMatch: 'full' }]                     },                     {                         path: 'main',                         canActivate: [AppRouteGuard],                         loadChildren: () => import('./main/main.module').then(m => m.MainModule),                         data: { preload: true }                     },                     {                         path: 'dashboard',                         loadChildren: () => import('./main/dashboard/dashboard.module').then(m => m.DashboardModule)                     },                 ]             }         ])     ],     exports: [RouterModule] }) export class AppRoutingModule {} 

but whats happening is when I try and go to /dashboard.. I get this error

Component HoldingPageComponent is not part of any NgModule or the module has not been imported into your module.

but I am clearly importing it in the DashboardModule as shown above.. what am I doing wrong??

Thanks

angular 8 fails going to lazy loaded modules directly after prod deploy

I have downloaded lazy-loading-ngmodules.zip from https://angular.io/guide/lazy-loading-ngmodules. I ran the app using ng serve with no problem. I can browse url http://localhost:4200 and click on Customers and Orders which both are lazy loading modules. I also can directly browse the url – http://localhost:4200/customers.

Then I built production version using ng build –prod and hosted it on IIS. I can browse the url http://localhost:80 and click on Customers and Orders to navigate to lazy loading modules. No problems!!! However, if I browse directly to the url http://localhost:80/customers, I got HTTP 404 Error. Why??? I need to directly browse to the lazy loading modules. How should I do it?

Thanks in advance!!!

How much benefit can an Evil Truenamer give to a low level party via lazy sacrificing?

The Truenamer Handbook gives the following interesting piece of advise:

Pop open the Book of Vile Darkness and read the rules for sacrifices. Then remember just how good Truenamers are at getting their Knowledge checks up to stupidly high levels. Between the INT focus, the fact that you’re likely to take little other than Knowledge skills, the Knowledge Focus class feature, Universal Aptitude, and Hidden Truth, you can get a terrifyingly high K: Religion check (that’s the one used in sacrifices, of course) as early as level 3 or so. Consider a perfectly reasonable illumian Truenamer with 16 INT and the Naen sigil . . . for almost no investment, you get 6 (ranks) + 3 (INT) + 3 (Knowledge Focus) + 2 (Naen) + 5 (Universal Aptitude) + 10 (Hidden Truth) = +29 before you even roll. By the time you add all the little trappings listed on pg. 27 of the BoVD, you’ll be almost guaranteed to hit the highest level of rewards. And that’s at level 3, with the only real investment being maxed ranks in K: Religion (doesn’t hurt) and putting your Knowledge Focus class feature into Religion (which, again, is not much of a loss). Even if you don’t add all the trappings, just leave one critter you kill every day alive (but probably unconscious) long enough to whip out your dagger and chant the name of your vile master a few times, and you’ll be guaranteed to roll high enough to get a free Planar Ally. How sweet is that? Sure, you have to be unrepentantly evil, and your GM has to go along with it, but all the rules are right there.

Let’s assume that we have a DM that following the sacrifice rules RAW and that the Truenamer is as described above (i.e. low leveled and gets +29 to these checks without even trying) and performs the lazy sort of sacrifice given above once per day for their low leveled party. How much benefit will the party get from this? For simplicity, lets just say that they sacrifice something commonplace in an evil campaign, like a low leveled human.

For reference, I’ve uploaded a screenshot of the two relevant tables here. Of particular interest, I can’t help but notice that many of these benefits are treated as if they came from a level 20 caster. Could this be game-breaking?

JavaFX lazy loading of images in TableView

This code is based off https://stackoverflow.com/questions/25711103/javafx-combobox-lazy-loading-images but modified to work with a TableCell

Firstly, the model object should have an observable File property which represents the image to load.

We need some background executors

ExecutorService exec = Executors.newCachedThreadPool(); 

Then in the initializer:

TableColumn<Model, File>= new TableColumn<>(""); colImage.setPrefWidth(64); colImage.setCellFactory(param -> {      //Set up the ImageView     final ImageView imageview = new ImageView();     imageview.fitWidthProperty().bind(Bindings.subtract(colImage.widthProperty(), 7));     imageview.setPreserveRatio(true);      //Loading task     ObjectProperty<Task<Image>> loadingTask = new SimpleObjectProperty<>();      //Set up the Table     TableCell<Model, File> cell = new TableCell<Model, File>() {         @Override         public void updateItem(File item, boolean empty) {             //Stop already running image fetch tast             if (loadingTask.get() != null &&                     loadingTask.get().getState() != Worker.State.SUCCEEDED &&                     loadingTask.get().getState() != Worker.State.FAILED) {                  loadingTask.get().cancel();             }             loadingTask.set(null);             //Load image if not null             if (empty || item == null) {                 imageview.setVisible(false);             } else {                 imageview.setVisible(true);                 Task<Image> task = new Task<Image>() {                     @Override                     public Image call() throws Exception {                         System.out.println("fetch image");                         Image image = SwingFXUtils.toFXImage(ImageIO.read(item), null);                         return image;                     }                 };                 loadingTask.set(task);                 task.setOnSucceeded(event -> {                     imageview.setImage(task.getValue());                     System.out.println("got image");                 });                 exec.submit(task);             }         }     };     // Attach the imageview to the cell     cell.setGraphic(imageview);     return cell;  }); colImage.setCellValueFactory(cellData -> cellData.getValue().fileProperty()); tableView.getColumns().add(0, colImage); 

How it works:

When the file property is updated the updateItem method spawns a Task that loads the image and updates the ImageView. However, TableCells are reused and thus an image might be still loading when updateItem is called again. To prevent this, the Task for that TableCell is stored in a property, and cancelled if it is still running when updateItem is called again.

Adapting Lazy Concurrent List-Based Set Algorithm for Insert on tail and Iteration

I have recently read the “A Lazy Concurrent List-Based Set Algorithm” paper and found an implementation (in Java, however the implementation language is not important).

I have a usecase where my need is to insert new list entries only after the current tail, and also iterate the list while being able to concurrently delete the current entry, and finally remove a single entry from the list. The paper already shoz hoz to implement the remove function.

Regarding the insert at the tail, I figured out that the sumple way would be to lock the tail directly and perform the operation. In pseudocode:

function add_tail(T item) {     tail = list.tail     lock(tail)     entry = new_entry()     tail.next = entry     list.tail = entry     unlock(tail) } 

Is this correct, and would it work with the remove function described by the paper ?

Regarding the iteration, while being able to delete inspected entries, I tried to adapt the remove function. In pseudocode:

tail = list.tail for curr, pred = list.head, list.head; curr != tail; curr = curr.next {     lock(pred)     lock(curr)      if true {         // entry must be removed         pred.next = curr.next     }     unlock(curr)     unlock(pred) } 

Again, can it works concurrently with the remove function and the add_tail function ?