magento2 – Magento 2 API usage internally

i am doing several custom modules in Magento 2.

It is a good practice do all the thing orientated to API (thinking in be consume for an mobile app for example ) and also use those api internally in the view model?

Or should i create a controller for return json to the view model and API just for external calls?

For example, i want to show a popup with a list of products using KOjs.

should i use a controller to return the products of that AJAX call o can i use the magento 2 API “rest/V1/products”

YellowPages Plugin – How To Reduce Data Usage

Rainbow 

Hi All,

Glad to be here, first post haha Big Grin 

Looking for ways to reduce data used by SB’s YellowPages scraper plugin.
The problem is that I use a proxy provider that charges per 1GB and the scraper is blazing through data.
To get 50k leads I am probably paying about $50 USD.

PS: Any way to enable captcha solving for YellowPages scraper?

c# – GUID Usage Suggestion

I am building an education website where:

  1. A student (I will call him/her a user) goes to an “educational center” then pay money for a “Attempt code” (From 5 to 8 digits “Unique”)
  2. User opens the website and then enter the “Attempt code” to get a “Code” Generating Attempt
  3. User is then able to generate a “Code” (From 13 to 15 digits “Unique”) to view a certain session materials (Mostly Videos) for a week

Till now everything works fine but after he enters the “Code” to view a material and it is correct, User is redirected to a link as follows : { example.com/student/viewmaterial/12 }
which I want to change because if he shared such a link or even he opened it after the week it should not open.

So I thought of using GUIDs as follows:

First, I created a table in my database with the following columns

  • student_id (unique for each student)
  • material_id (the 12 that was shown in the link and it is unique for each material)
  • GUID (which is going to replace the (12) in the link
  • valid_till (A date till which the GUID will be valid)

Second, every time a User Enters a code and it is correct I insert (or update) a record in the table with a new GUID using Guid.new() as follows

string Newguid = Guid.NewGuid().ToString('N');
sql.AddMaterialGUID(studentid , materialid , Newguid , DateTime.UtcNow.AddDays(1));
return RedirectToAction("ViewMaterial", new { id = Newguid });

which will redirect him to a link : { example.com/student/viewmaterial/guidhere }

Third, every time someone opens the link above I check that

  • The Guid Is Still Valid (I ask him to retype the code if not)
  • The student_id is the same for this user (I ask him to type his code if not)

This way I am able to fully control the access to this material BUT is this the way of using GUIDs ? Is there another way of doing ? Am I missing something here ?

Sorry For the long question I just want to describe the full situation as much as I can

sharepoint online – Prevent User with Read Permission to have access to site content and site usage

I have created a group and assign the Read permission to it. I modified the the Read permission to the below to prevent the site usage and site content access.

List Permissions:

  1. View Items
  2. Open Items

Site Permissions:

1.View Pages

2.Use Remote Interfaces

3.Open

Now the permission work perfectly my users do not have access to site usage and content. But my navigation on my home page does not show up. Basically the navigation is just 3 links pointing to three views of the same list. I do get access to the list when i manually visit the list thought.

I am using modern pages and list. When i set the permission “VIew application pages” my navigation come back but then i get the issue of my users being able to access site usage and site content

Perl usage of split function with varied characters in strings

the strings that I need to regex from is as below:

colour -name red -value 8,0,2 -code 0
colour -name blue -value 9 -code 1
colour -name yellow -value 7,3,2.5 -code 1

The required output is hash of colour name and value

red 8,0,2 blue 9 yellow 7,3,2.5

Piece of code:

#/usr/perl;

my %result = {};
my @word = split ' ', $line ; #$line has each of the line of data that is read from text
$result{$word[2]} = $word[4];

But this is not giving the required output for the values where there are commas.
TIA.

magento 2.2.5 – Apply coupon code on order excluding usage checks

I want to apply coupon codes on edited orders regardless if that coupon is active/expired.

Right now my investigations lead me to that fact that setCoupon method of orders checks the validity of coupon automatically. But I want sort of admin rights on that i.e If I am admin than coupon usage checks should automatically be exempted.

linux – Davfs2 100% cpu usage

I’ve created new vps on hetzner. Connected hetzner storagebox via davfs2 to him.

There is a lot of pictures and files (css,js etc.. over 300 000) on the remote drive.

So the problem is, after about few seconds after I mount remote drive, the server is dying.
Huge load average and 1/4 cpu 100% load.

I’m not using any specific davfs2.conf configuration.

I know there is mostly no any details. But I really know nothing about this problem.

PS: also I use this drive for nextcloud server. Works well, without any problems…

How to get SharePoint site usage report at individual user level?

Except for the M365 Audit log report, there is no data collected on a per user basis for SharePoint online. The Audit log report collects EVERYTHING about that user’s activity, not just in SharePoint, so it is understandable that it is only available to admins, and it would typically only be used in security and discovery scenarios.

AFAIK, SharePoint 2010 on premises was the last version that provided site statistics with named users, but only visit counts as a total, nothing more granular. Reporting on a user’s activity reveals a lot of information that has a confidential nature. I guess this is one of the reasons that this kind of data collection is no longer used or available to site owners.

So, if you have a security or discovery concern, talk to your IT folks. But other than that, you won’t be able to find user based usage stats for SharePoint online.

networking – WireGuard on Linux: usage of ‘peer’ in network configuration

For some point-to-point links we can use the peer keyword. For example when using WireGuard, a link can be specified to have a peer, but this also work without.

To obtain a working WireGuard link, I can use one of the following 2 lines:

ip address add dev wg0 192.168.2.1/24
ip address add dev wg0 192.168.2.1 peer 192.168.2.2

What is the point to use peer as I see on some WireGuard tutorials?