event observer – Not able to get parent_item_id for cart items retrieved from Order – Magento 2.3.5

I’m trying to get parent_item_id but it is returning null for all simple child products.

    $order = $observer->getEvent()->getOrder();
    $items = $order->getAllVisibleItems();
    foreach ($items as $item) {
            $itemsData() = (
                'name' => $item->getName(),
                'sku' => $item->getSku(),
                'quote_item_id' => $item->getQuoteItemId(),
                'parent_item_id' =>$item->getParentItemId(),
                'qty_ordered' => $item->getQtyOrdered(),
                'product_type' => $item->getProductType(),
                'weight' => $item->getWeight(),
                'price' => $item->getPrice()
            );        
    }

I’m getting all item attributes in my $itemsData array except parent_item_id, though I’ve 4 children of a Bundle product and 1 child of a configurable product in Cart.

I’m doing it in sales_order_place_before observer. I tried getAllItems() and getItems() as well but no luck. Also confirmed from database, parent_item_id exists there for quote_item_id, but just not able to retrieve via getter method.

session – Cart lost for logged in customer. Retrieved only after adding item

We run a B2B webshop in Magento 2.3.5 and customers have to log in to be able to add items to the cart (Amasty Hide Price-module). However we are experiencing problems with disappearing carts:

  1. Customer logs in
  2. Customer places several items in cart.
  3. Customer logs out / is logged out after some time.
  4. Customer logs back in: cart is empty.
  5. Customer places random item in cart: this item is in the cart together with the previously entered items.

I think it is a session / cookie issue but I can’t quite figure out what / why this is happening and how to solve it. Any help would be greatly appreciated!

python – Maian Tool Repository on Docker: How to store contract retrieved from etherscan.io and what is ‘test.sol’

I am trying to execute MAIAN tool repository on docker. The link at :

https://github.com/ivicanikolicsg/MAIAN/issues/26

They provided details of how to execute the MAIAN tool from docker. I am in the MAIAN tool repository on docker.
They have first tried to access the contract from docker:

Retrieving contracts using Etherscan

The name of the contract is KaratBankCoin. They have not told where to store the contract.

Later on they used the command:

python maian.py -c 2 –soliditycode test.sol KaratBankCoin

I am getting the error :

==================================================================================================== [ ] Compiling Solidity contract from the file test.sol … [-]
Contract file test.sol does NOT exist [-] Contract KaratBankCoin does
NOT exist

Because I don’t know what is test.sol and I don’t know how and where to store the KaratBankCoin contract retrieved from mainnet.

They have not provided any details about test.sol and how to store KaratBantCoin because we are in the Maian tool’s repository.

Somebody please guide me.

Zulfi.

javascript – When returning a 2D array from a custom Google Sheets function, the values that are retrieved from a class are left blank

I’m sorry if the title is a bit confusing. Basically I have a custom Google Sheets function that receives a cell range as the argument. I have a class names Employee with a constructor that takes an ID as an argument and saves the value in a variable. In the custom function I create an array called Employees and for each value in the range I add a new instance of the Employee class with that value as the constructor argument. I then create an empty array called IDs and loop through each element in the Employees array and add the ID value saved in the class to the new array. If I return the IDs array, then when I call the function on google sheets, the list of items will appear vertically. However, if I instead create a 2D array and add the IDs variable as one of the elements while creating a new array with fixed elements as the second value. If I return that new 2D array, when I call the function the Ids array should be printed horizontally on the adjacent cells and the values of the second array should be printed underneath. However, the IDs are not printed, only the values of the second array are printed. If after looping through the Employees array and adding their Ids to the IDs array I add a a constant value, then only that value is printed when calling the function. This only happens when I return a 2D array, If I just return the IDs, they are all printed.

In the function bellow, when calling the chart function on Google Sheets, the ids array will be left blank on the sheet.

class Employee{
  constructor(employee){
    this.employeeID = employee;
  }
}
function chart(employeeIDs){
  employees = ();
  for(x = 0; x < employeeIDs.length; x++)
    employees.push(new Employee(employeeIDs(x)));
  ids = ();  
  for(x = 0; x < employees.length; x++)
    ids.push(employees(x).employeeID);
  vehicles = ("Car", "road", "bus", "Plane", "Submarine");
  return (ids, vehicles);
}

If I change the return to…

return ids

Then when the function is called the list of items in ids are printed.
If I add additional values to the ids array after adding the values from the Employee class, such as…

ids = ();  
for(x = 0; x < employees.length; x++)
  ids.push(employees(x).employeeID);
ids.push(12)
vehicles = ("Car", "road", "bus", "Plane", "Submarine");
return (ids, vehicles);
'''
Then only the number 12 is printed at the end, plus the entire contents of the vehicles array.

performance – Benchmark of a query execution’s time elapsed versus the number of rows retrieved

We currently have a Financial report that does a lot of complex aggregate functions, joins around 10+ tables and runs for around 3.5 hours and retrieves around 500,000 records.
One of our clients wants this report to generate faster, but our development manager thinks that 3.5 hours is reasonable considering our current table structures.

I know a query’s performance would largely depend on the number of joins, indexes, partitions and aggregate functions, etc. But I’m curious to know if there’s a benchmark of an acceptable execution time for a certain number of rows retrieved. I remember someone stating that there’s a document about it but I’ve searched all over and couldn’t find any.

Perhaps someone here has any articles to share?

Thank you!

CAML query not able to filter data retrieved from SharePoint

I have been working on a SharePoint Online System which stores data related to various products in different document libraries and lists.
In this SharePoint Online System there is a requirement of implementing an API which will allow users to download folders into a zip from the libraries present in the site.
The API code works well with the libraries which have items less than 5000, but it gives us an error of “list threshold” when the number of item is higher than 5000.

On further investigation I was able to get past the error by traversing the whole list with the help of a CAML query then use LINKQ to filter out item.
But as there are over 80,000 items in the list it takes a long time. To resolve this I made changes in the CAML Query so that I can get only the items that are required from SharePoint rather than applying the LINKQ.
Even after adding condition in CAML system simply ignores the condition and returns all the list items as it was doing before.

This is the code I am working with,

class Program
{
static void Main(string() args)
{
List<ListItem> items = new List<ListItem>();
string subFolders = "Test-Test_123";
using (ClientContext ctx = new ClientContext("https://domain.sharepoint.com/"))
{
string password = "********";
string account = "user@domain.onmicrosoft.com";
var secret = new SecureString();
foreach (char c in password)
{
secret.AppendChar(c);
}
ctx.Credentials = new SharePointOnlineCredentials(account, secret);

Web web = ctx.Web;
ctx.Load(web, wb => wb.ServerRelativeUrl);
ctx.ExecuteQuery();

List list = web.Lists.GetByTitle("product");
ctx.Load(list);
ctx.ExecuteQuery();

CamlQuery camlQuery = new CamlQuery();

camlQuery.ViewXml = "<View Scope='Recursive'><Where><BeginsWith><FieldRef Name='Test'/></BeginsWith></Where><RowLimit>5000</RowLimit></View>";
//Filter path or Name begins with Test
do
{
ListItemCollection listItems = list.GetItems(camlQuery);
ctx.Load(listItems);
ctx.ExecuteQuery();

items.AddRange(listItems);
camlQuery.ListItemCollectionPosition = listItems.ListItemCollectionPosition;

} while (camlQuery.ListItemCollectionPosition != null);
// Returns all records 
var filteritems = items.Where(tt => tt.FieldValues("FileRef").ToString().StartsWith("path to the folder/file to filter out the required items"));
foreach (ListItem item in filteritems)
{
Console.WriteLine(item.FieldValues("FileRef"));
}

}
}
}

Can anyone suggest any way we can overcome this problem or are there any work-arounds to get past this behavior.

Thank you in advance.

direct3d12 – Why can’t I create a D3D12 Device with the highest performance adpater retrieved by EnumAdapterByGpuPreference?

    IDXGIAdapter* higher_performance_adapter;
    dx_result = dxgi_factory->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,
                                                         __uuidof(IDXGIAdapter),
                                                         (void**)&higher_performance_adapter);
    if(SUCCEEDED(dx_result))
    {
      UINT output_index = 0;
      IDXGIOutput* output;
      while(higher_performance_adapter->EnumOutputs(output_index, &output) != DXGI_ERROR_NOT_FOUND)
      {
        DXGI_OUTPUT_DESC output_description = {0};
        output->GetDesc(&output_description);

        ++output_index;
      }

      ID3D12Device* device;
      dx_result = D3D12CreateDevice(higher_performance_adapter,
                                    D3D_FEATURE_LEVEL_12_1,
                                    __uuidof(ID3D12Device),
                                    (void**)&device);
      if(SUCCEEDED(dx_result))
      {

          ...

I’m trying to create a D3D12 device selecting the GPU with the higher performance because passing null to the adapter parameter at D3D12CreateDevice gets the first adapater from EnumAdapters, which is the Intel integrated GPU. But, when I got a IDXGIAdapter object of my dedicated GPU, the EnumOutputs function failed, as well as the D3D12CreateDevice. Why is that? Why these functions fails when using the dedicated GPU, which in my case is a NVIDIA, ?

The returned dx_result is “0x887a0004 : The specified device interface or feature level is not supported on this system. “

That don’t makes sense, since my system supports DirectX12.

react native – Create in app gallery from images retrieved from device custom folder

takePicture = async () => {
        if (this.camera) {
          if (Platform.OS === 'android') {
            await this.checkAndroidPermission();
          }
            const options = { quality: 1 };
            const data = await this.camera.takePictureAsync(options);
            //save photo
            CameraRoll.save(data.uri, {type: 'photo', album: 'Custom Folder Photos'}).then(onfulfilled => {
                ToastAndroid.show(`Vocajam Photos: ${onfulfilled}`, ToastAndroid.SHORT);
            }).catch(error => {
                ToastAndroid.show(`${error.message}`, ToastAndroid.SHORT);
            });
        }
    };


    recordVideo = async () => {
      if (this.camera) {
          if (!this.state.recording)
              this.startRecording();
          else this.stopRecording();
      }
  }

  startRecording = async () => {
    this.setState({ recording: true });
    this.countRecordTime = setInterval(() => this.setState({ seconds: this.state.seconds + 1 }), 1000);
    const cameraConfig = { maxDuration: this.state.maxDuration };
    const data = await this.camera.recordAsync(cameraConfig);
    this.setState({ recording: false });
    CameraRoll.save(data.uri, {type: 'video', album: 'Custom Folder Videos'}).then(onfulfilled => {
        ToastAndroid.show(`Custom Videos: ${onfulfilled}`, ToastAndroid.SHORT)
    }).catch(error => ToastAndroid.show(`${error.message}`, ToastAndroid.SHORT));
}

stopRecording = () => {
    this.camera.stopRecording();
    clearInterval(this.countRecordTime);
    this.setState({ seconds: 0 });