some part of my javascript code are not working? [closed]

i am running a code to convert tempretures to each other at the same time .
when i am running my codes part of js code is running but part of it doesnt.

const celvalue = document.getElementById('cel-num');
const farvalue = document.getElementById('far-num');
const kelvalue = document.getElementById('kel-num');

function tempfunccel() {
  const tempfar = celvalue.value * (9 / 5) + 32;
  const tempkel = celvalue.value + 273.32;
  farvalue.value = tempfar.toFixed(2);
  kelvalue.value = tempkel.toFixed(2);
}
<div class="box">
  <label for="" >celsius:</label>
  <input  type="number" class="inp" id="cel-num" onchange="tempfunccel()">
</div>
<div class="box">
  <label for="">fahrenheit:</label>
  <input type="number" class="inp" id="far-num" onchange="tempfuncfar()">
</div>
<div class="box">
  <label for="">kelvin:</label>
  <input type="number" class="inp" id="kel-num" onchange="tempfunckel()">
</div>

in function line 1 and 3 are working but line 2 and 4 are not working

Why is my crypto.getRandomValues() base36 ID generator producing duplicates despite 2.8 trillion possibilities?

Here is the function:

export function generateId(): string {
  const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  let result = "";

  const randomArray = new Uint8Array(8);
  crypto.getRandomValues(randomArray);

  for (let i = 0; i < 8; i++) {
    result += chars[randomArray[i] % 36];
  }

  return result;
}

It should generate 8-character random base36 IDs, e.g. QZ08HNDL. Base36 uses 0-9 and A-Z (36 characters). If the id is 8 characters = 36^8 = ~2.8 trillion possibilities.

But I’ve had some “INVALID_RECORD: record is invalid and can’t be saved. ID is not unique” errors reported in the last few days, and I’m not sure if it’s because this function is generating duplicates. How likely is it? Are there flaws in this function?

How to design extensible data aggregation code to avoid manual updates in multiple places?

I have a data aggregation function that collects statistics from multiple sources. The problem is that whenever I add a new metric, I need to manually update the code in three different places, which is error-prone and hard to maintain.

Current Code Structure:

// Part 1: Initialize data object
const storeData = {
    collectors_count: 0,
    toys_count: 0,
    toys_inspected: 0,
    toys_cleaned: 0,
    inspection_percent: 0,
    cleaning_percent: 0,
};

// Part 2: Accumulate data from each source
for (const collector of collectors) {
    const details = await db.getCollectorDetails(collector.id);
    
    if (!details) continue;

    storeData.collectors_count++;
    storeData.toys_count += details.toy_count;
    storeData.toys_inspected += details.inspected_count;
    storeData.toys_cleaned += details.cleaned_count;
}

// Part 3: Calculate derived metrics
storeData.inspection_percent = (storeData.toys_inspected / storeData.toys_count) * 100;
storeData.cleaning_percent = (storeData.toys_cleaned / storeData.toys_count) * 100;

return storeData;

The Problem:

  • When I want to add a new metric (e.g., toys_repaired), I have to:
  • Add it to the initial object with value 0
  • Add accumulation logic in the loop: storeData.toys_repaired += details.repaired_count
  • Possibly add calculation logic if it’s a derived metric: storeData.repair_percent = ...

This becomes tedious with many metrics and I sometimes forget to update all three places.

Is there a way to refactor this code to be more extensible and maintainable?

How to make it so that the arrays inside the array don’t get changed?

I am trying to make a loop that will fill in an array of arrays that will contain every possible colour value in rgb form given the bit depth. However, I have noticed that even after an array is pushed into the larger array, whenever the code adds to a new array, it also increments by the same value. I believe this is because technically all the arrays have the same name, but I don’t have an alternative to that.

this is the code I’m using:

var colours = []
var c = [0, 0, 0]
for (let x = 0; x < 4; x++) {
  c[1] = 0
  for (let y = 0; y < 4; y++) {
    c[2] = 0
    for (let z = 0; z < 4; z++) {
      const v = c
      colours.push(v)
      c[2] += 85
    }
    c[1] += 85
  }
  c[0] += 85
}
console.log(colours)

previously there were another bunch of errors, but I resolved them by resetting certain things after every loop. I also tried to duplicate the array using const v but it doesn’t work. currently, when I run this the console shows this:

// [object Array] (64)
[// [object Array] (3)
[340,340,340],// [object Array] (3)
[340,340,340],// [object Array] (3)
[340,340,340],// [object Array] (3)

for 64 rows, but what I’m looking for is something like this:

[[0,0,0],[0,0,85],[0,0,170],[0,0,255],[85,0,0]]

containing every combination until [255,255,255]

Wat to Wasm 3.0

I want to work in the latest “Wasm” 3.0
But the latest version of “wabt” doesn’t convert “wat” which is for the “wasm” 3.0.
Is there is ant other alternative way? and i also want that way to be in the browser, as i am also making a thing which needs “wat” content to converted to “wasm” 3.0 in the browser itself

I tried “wabt”, and “wasm-tools”

“Wasm-tools” have “wat” to “wasm” 3.0 but it doesn’t have the browser conversion.

Expo vs React Native CLI in 2025 – Which one should I choose for a production fintech app? [closed]

I’m starting a new production-grade fintech app in 2025 (similar to a payments/marketplace product).

I’m confused whether I should use Expo or stick with React Native CLI.

My requirements include:

  1. OTA updates for faster bug fixes and translations

  2. Biometric authentication (Face ID / Fingerprint)

  3. Payment gateway integration (using WebView, but possibly native SDKs in the future)

  4. Webhooks, redirects, and deep linking support

  5. Long-term maintainability and enterprise-grade stability (financial product use case)

From what I know, Expo has improved a lot in 2025 with config plugins and prebuilds, but I want to be sure:

  • Are there still any limitations of Expo compared to bare RN?

  • Is Expo stable enough for fintech/enterprise apps in 2025?

  • Which approach is better for a long-term project with heavy native dependencies?

Country code gets populated in the local number part intermittently when using MuiTelInput

When the user selects the country code from the dropdown. It gets populated in the local number part. I have to reconstruct the phone number for

import Keyboard from 'react-simple-keyboard';
import 'react-simple-keyboard/build/css/index.css';
import { MuiTelInput } from 'mui-tel-input';
    const getCountryCode = (phoneStr) => {
    const match = phoneStr.match(/^+d+/);
    return match ? match[0] : '';
};

const getLocalNumber = (phoneStr) => {
    const countryCode = getCountryCode(phoneStr);
    return phoneStr.replace(countryCode, '').replace(/D/g, '');
};
<MuiTelInput
                key={telInputKey}
                fullWidth
                value={formData.phone}
                onChange={(value) => {
                const countryCode = getCountryCode(value) || '+39';
                let localNumber = getLocalNumber(value);
                localNumber = localNumber.replace(/D/g, '').slice(0, 10); // Force 10 digits max
                const newPhone = `${countryCode} ${localNumber}`;
                setFormData({ ...formData, phone: newPhone });
                }}
                onFocus={() => setFocusedField('phone')}
                defaultCountry={country}
                forceCallingCode
                label={t('labelPhone')}
                sx={{ width: '25rem'}}
            />

I have a onscreen keyboard to get the input from the user

if (button === '{bksp}') {
      if (focusedField.startsWith('phone')) {
        setFormData(prev => {
          const countryCode = getCountryCode(prev.phone) || "+39";
          let localNumber = getLocalNumber(prev.phone);
          localNumber = localNumber.slice(0, -1);
          const newPhone = localNumber ? `${countryCode} ${localNumber}` : countryCode;
          return { ...prev, [focusedField]: newPhone };
        });
      }

Modal window in wagtail page editing interface

I want to add a custom BlockFeature and for that i need a modal window for input. I don’t understand how to make a modal input window so that the entred data will go straight to my custom blockfeature props.

The feature i’m working on is an ordered list that starts with a given number (). So yeah, basically, i need that modal window to enter the starting number

@hooks.register('register_rich_text_features')
def register_ol_custom_feature(features):
    feature_name = "ol-custom"
    type_ = "ol-custom"
    control = {
        "type": type_,
        "label": "ol+",
        "element": "ol",
        "description": "Set start",
    }

    features.register_editor_plugin(
        'draftail',
        feature_name,
        BlockFeature(
            control,
            js=["static/js/orderedListCustom.js"],
        ),
    )

    db_conversion = {
        "from_database_format": {
            "ol[start]": BlockElementHandler(type_)
        },
        "to_database_format": {
            'block_map': {
                type_: lambda props: DOM.create_element(
                    "ol",
                    {"start": props.get("start") if "start" in props else 1}
                )
            }
        },
    }

    features.register_converter_rule("contentstate", feature_name,  db_conversion)
    features.default_features.append(feature_name)

I tried several js codes that i found online or got from ai, none of them worked (my bad, i suck at js). Also came across one post on here, but it didn’t help (:
In the end, i’m not even sure what things i need to consider/add/alter, what’s the workflow here.
Can anyone help?

How to disable radio button on all levels in a recursive Angular form component based on a specific level’s value

this is kind of a continuation of an improved version of an old question of mine
so basically I have a recursive Angular form and I’m using to manage a folder hierarchy. Each folder has a radio button for selecting between Exclusive and Regular folder.

Now I’m trying to add a validation so that

  • When a folder is selected as Exclusive at any level in the hierarchy the Exclusive button should be disabled for all other folders at any level. (basically 1 exclusive folder in the folder hierarchy)
  • The Regular option should remain available at all levels regardless of whether Exclusive is selected at any other level

How should I even approach a problem like this because the notification should happen from parent to child level and also from child level to parent level. Is this possible to be done with @Input() or is there a better approach.

I present demo version here for clarity. still a bit long to read but here is reproducible demo in stackblitz with same code

form component

import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, FormArray, Validators, AbstractControl } from '@angular/forms';
import { duplicateFolderName } from '../validators/duplicate-folder-name.validator';

@Component({
  selector: 'my-form',
  templateUrl: './form.component.html',
  styleUrls: ['./form.component.css'],
})
export class FormComponent implements OnInit {
  myForm!: FormGroup;
  isHierarchyVisible = false;

  constructor(private fb: FormBuilder) {}

  ngOnInit() {
    this.myForm = this.fb.group({
      folderHierarchy: this.fb.array([]),
    });
    if (!this.folderHierarchy.length) this.isHierarchyVisible = false;
  }

  addFolder() {
    this.folderHierarchy.push(
      this.fb.group({
        name: [null, [Validators.required, duplicateFolderName()], { updateOn: 'blur' }],
        isExclusive: false,
        subFolders: this.fb.array([]),
        level: 0,
      })
    );
    this.isHierarchyVisible = true;
  }

  removeFolder(index: number) {
    this.folderHierarchy.removeAt(index);
    if (!this.folderHierarchy.length) this.isHierarchyVisible = false;
  }

  get folderHierarchy() { return this.myForm.get('folderHierarchy') as FormArray; }
  getForm(control: AbstractControl) { return control as FormGroup; }
}

<p>folder form. type in form name and press enter</p>
<form [formGroup]="myForm">
  <div formArrayName="folderHierarchy">
    <label for="folderHierarchy">create folder </label>
    <div>
      <button type="button" class="btn btn-custom rounded-corners btn-circle mb-2" 
              (click)="addFolder()" [disabled]="!folderHierarchy.valid">Add</button>
      <span class="pl-1">new folder</span>
    </div>
    <div *ngIf="!folderHierarchy.valid" class="folder-hierarchy-error">invalid folder hierarchy</div>
    <div class="folderContainer">
      <div *ngFor="let folder of folderHierarchy.controls; let i = index" [formGroupName]="i">
        <folder-hierarchy (remove)="removeFolder(i)" [folder]="getForm(folder)" [index]="i"></folder-hierarchy>
      </div>
    </div>
  </div>
</form>

folder-hierarchy component

import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
import { duplicateFolderName } from '../validators/duplicate-folder-name.validator';

@Component({
  selector: 'folder-hierarchy',
  templateUrl: './folder-hierarchy.component.html',
  styleUrls: ['./folder-hierarchy.component.css'],
})
export class FolderHierarchyComponent {
  @Output() remove = new EventEmitter();
  @Input() folder!: FormGroup;
  @Input() index!: number;
  @Input() parentDirectory?: FormGroup;

  constructor(private fb: FormBuilder) {}

  addSubFolder(folder: FormGroup): void {
    (folder.get('subFolders') as FormArray).push(
      this.fb.group({
        name: [null, [Validators.required, duplicateFolderName(this.parentDirectory)]],
        isExclusive: false,
        subFolders: this.fb.array([]),
        level: folder.value.level + 1,
      })
    );
  }

  updateIsExclusive(folder: FormGroup, value: Event, isExclusive: boolean): void {
    folder.get('isExclusive')?.setValue(isExclusive ? (value.target as HTMLInputElement).checked : !(value.target as HTMLInputElement).checked);
  }

  getControls(folder: FormGroup): FormArray {
    return folder.get('subFolders') as FormArray;
  }

  removeSubFolder(folder: FormGroup, index: number): void {
    (folder.get('subFolders') as FormArray).removeAt(index);
  }

  removeFolder(folder: FormGroup): void { this.remove.emit(folder); }

  disableAdd(folder: FormGroup): boolean { return this.folder.invalid || folder.invalid; }

  get nameControl(): FormControl { return this.folder.get('name') as FormControl; }
}

<div *ngIf="folder" #folderRow class="folder-row" [formGroup]="folder">
  <div class="folder-header">
    <div class="folder-name-container">
      <label for="folderName" class="folder-name-label">Name:</label>
      <input #folderName id="folderName" [ngClass]="nameControl.errors ? 'invalid-input' : ''"
        class="folder-name-input" placeholder="Folder Name" type="text" maxlength="50" autocomplete="off"
        name="name" formControlName="name" (keyup.enter)="folderName.blur()" />
    </div>
    <div class="folder-type-container">
      <div class="folder-type-option">
        <input type="radio" [value]="true" [checked]="folder.value.isExclusive" (change)="updateIsExclusive(folder, $event, true)" />
        <label for="exclusive">Exclusive</label>
      </div>
      <div class="folder-type-option">
        <input type="radio" [value]="false" [checked]="!folder.value.isExclusive" (change)="updateIsExclusive(folder, $event, false)" />
        <label for="regular">Regular</label>
      </div>
    </div>
    <button type="button" class="btn-remove-folder" (click)="removeFolder(folder)">Remove</button>
    <button type="button" class="btn-add-subfolder" [disabled]="disableAdd(folder)" (click)="addSubFolder(folder)">Add Subfolder</button>
  </div>
  <div *ngIf="folder && folder.value.subFolders.length > 0" class="subfolder-container">
    <div *ngFor="let subFolder of getSubFoldersControls(folder); let i = index" class="subfolder-item">
      <folder-hierarchy (remove)="removeSubFolder(folder, i)" [folder]="subFolder" [parentDirectory]="getSubFolderParent(subFolder)"></folder-hierarchy>
    </div>
  </div>
  <div *ngIf="nameControl.errors?.required" class="folder-hierarchy-error">Name is required.</div>
  <div *ngIf="nameControl.errors?.duplicateName" class="folder-hierarchy-error">Name already exists</div>
</div>

Help is much appreciated

Using the fill prop in Next Image but the images are not showing

I’m mapping the images to display them. I’m using fill prop of Next Image but the images are not showing in the browser. It’s showing the moment I use width and height props.
I could have gone with the height and width props but that doesn’t help in maintaining consistent dimensions for the images.

I’m not getting what’s the issue

Here’s the code:

<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
  {japandiImages.map((image, index) => (
    <div key={index} className="relative w-full h-64">
      <Image
        src={image.src}
        alt={image.alt}
        fill
        sizes="(max-width: 768px) 100vw, (max-width: 1200px) 33vw, 33vw"
        className="object-cover rounded-lg shadow"
      />
    </div>
  ))}
</div>

Here’s the link to the GitHub repo in case you wanna see the whole code. The problem is in the route folder named Japandi:
Link to the repo

  1. I tried using width and height props of Next Image and it works. However, I can’t use them because they make the dimensions inconsistent for the images.

  2. On some YT video, they say to use sizes props along with fill. I tried that too, but it’s still not working.

Magento error on static-content:deploy -f

I’m getting this error Unexpected input in styles-l-temp.less

frontend/Pearl/weltpixel/en_US          2964/3067           ===========================> 96% %   3 secs
Compilation from source: /opt/bitnami/apps/magento/htdocs/app/design/frontend/Pearl/weltpixel/web/css/styles-l-temp.less
ParseError: Unexpected input in styles-l-temp.less on line 1, column 1
1| #@import '../WeltPixel_FrontendOptions/css/source/module/_store_completehome_extend.less';
2|
3|


  [MagentoFrameworkExceptionFileSystemException]
  Cannot read contents from file "/opt/bitnami/apps/magento/htdocs/pub/static/frontend/Pearl/weltpixel/en_US/c
  ss/styles-l-temp.css" Warning!file_get_contents(/opt/bitnami/apps/magento/htdocs/pub/static/frontend/Pearl/w
  eltpixel/en_US/css/styles-l-temp.css): failed to open stream: No such file or directory

So, i remove the #@import to @import and execute these commands:

sudo rm -rf /opt/bitnami/apps/magento/htdocs/var/cache/*
sudo rm -rf /opt/bitnami/apps/magento/htdocs/var/page_cache/*
sudo rm -rf /opt/bitnami/apps/magento/htdocs/var/view_preprocessed/*
sudo rm -rf /opt/bitnami/apps/magento/htdocs/pub/static/frontend/*

Now, when execute static-content:deploy -f command is shows this error:

bitnami@ip-172-26-13-233:/opt/bitnami/apps/magento/htdocs$ sudo /opt/bitnami/apps/magento/htdocs/bin/magento-cli setup:static-content:deploy -f

Deploy using quick strategy
frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
adminhtml/Magento/backend/en_US         2383/2383           ============================ 100% %  2 secs          frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
adminhtml/Magento/backend/en_US         2383/2383           ============================ 100% %  2 secs          frontend/Magento/blank/en_US            3037/3037           ============================ 100% %  3 secs          
adminhtml/Magento/backend/en_US         2383/2383           ============================ 100% %  2 secs          
frontend/Magento/luma/en_US             3053/3053           ============================ 100% %  4 secs          
frontend/Pearl/weltpixel/en_US          2951/3067           ==========================>- 96% %   3 secs
#0 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/View/Asset/Publisher.php(73): MagentoFrameworkViewAssetFile->getSourceFile()
#1 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/View/Asset/Publisher.php(61): MagentoFrameworkAppViewAssetPublisher->publishAsset(Object(MagentoFrameworkViewAssetFile))
#2 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Service/DeployStaticFile.php(89): MagentoFrameworkAppViewAssetPublisher->publish(Object(MagentoFrameworkViewAssetFile))
#3 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Service/DeployPackage.php(189): MagentoDeployServiceDeployStaticFile->deployFile('css/styles-l-te...', Array)
#4 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Service/DeployPackage.php(136): MagentoDeployServiceDeployPackage->processFile(Object(MagentoDeployPackagePackageFile), Object(MagentoDeployPackagePackage))
#5 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Service/DeployPackage.php(107): MagentoDeployServiceDeployPackage->deployEmulated(Object(MagentoDeployPackagePackage), Array, false)
#6 [internal function]: MagentoDeployServiceDeployPackage->MagentoDeployService{closure}()
#7 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/State.php(186): call_user_func_array(Object(Closure), Array)
#8 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Service/DeployPackage.php(108): MagentoFrameworkAppState->emulateAreaCode('frontend', Object(Closure))
#9 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Process/Queue.php(300): MagentoDeployServiceDeployPackage->deploy(Object(MagentoDeployPackagePackage), Array)
#10 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Process/Queue.php(219): MagentoDeployProcessQueue->execute(Object(MagentoDeployPackagePackage))
#11 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Process/Queue.php(162): MagentoDeployProcessQueue->assertAndExecute('frontend/Pearl/...', Array, Array)
#12 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Strategy/QuickDeploy.php(76): MagentoDeployProcessQueue->process()
#13 /opt/bitnami/apps/magento/htdocs/vendor/magento/module-deploy/Service/DeployStaticContent.php(109): MagentoDeployStrategyQuickDeploy->deploy(Array)
#14 /opt/bitnami/apps/magento/htdocs/setup/src/Magento/Setup/Console/Command/DeployStaticContentCommand.php(140): MagentoDeployServiceDeployStaticContent->deploy(Array)
#15 /opt/bitnami/apps/magento/htdocs/vendor/symfony/console/Command/Command.php(241): MagentoSetupConsoleCommandDeployStaticContentCommand->execute(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#16 /opt/bitnami/apps/magento/htdocs/vendor/symfony/console/Application.php(844): SymfonyComponentConsoleCommandCommand->run(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#17 /opt/bitnami/apps/magento/htdocs/vendor/symfony/console/Application.php(193): SymfonyComponentConsoleApplication->doRunCommand(Object(MagentoSetupConsoleCommandDeployStaticContentCommand), Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#18 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Console/Cli.php(104): SymfonyComponentConsoleApplication->doRun(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#19 /opt/bitnami/apps/magento/htdocs/vendor/symfony/console/Application.php(117): MagentoFrameworkConsoleCli->doRun(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#20 /opt/bitnami/apps/magento/htdocs/bin/magento(30): SymfonyComponentConsoleApplication->run()
#21 {main}


  [MagentoFrameworkExceptionFileSystemException]
  Cannot read contents from file "/opt/bitnami/apps/magento/htdocs/pub/static/frontend/Pearl/weltpixel/en_US/c
  ss/styles-l-temp.css" Warning!file_get_contents(/opt/bitnami/apps/magento/htdocs/pub/static/frontend/Pearl/w
  eltpixel/en_US/css/styles-l-temp.css): failed to open stream: No such file or directory


setup:static-content:deploy [-f|--force] [-s|--strategy [STRATEGY]] [-a|--area [AREA]] [--exclude-area [EXCLUDE-AREA]] [-t|--theme [THEME]] [--exclude-theme [EXCLUDE-THEME]] [-l|--language [LANGUAGE]] [--exclude-language [EXCLUDE-LANGUAGE]] [-j|--jobs [JOBS]] [--symlink-locale] [--content-version CONTENT-VERSION] [--refresh-content-version-only] [--no-javascript] [--no-css] [--no-less] [--no-images] [--no-fonts] [--no-html] [--no-misc] [--no-html-minify] [--] [<languages>]...

I was trying to add another store with a subdomain. The domain completehome.completeattire.com was created, and the issue occurred when I started the service.

How to create a plugin to “Ensure all French translations from the theme .po files are imported into the Polylang database automatically” [closed]

HI I am working on a creating of a plugin where site is built using child of a classic theme

where I need to Ensure all French translations from the theme .po files are imported into the Polylang database automatically

Current status:I Manual conversion of _()/e() to pll()/pll_e() in the theme is done and working.

So Now i my requirement is to Create a one-time plugin to import existing .po translations into Polylang GUI/database.

The Purpose of it is to Avoid manual entry errors, reduce deployment downtime, and ensure translations work correctly in live/production.

Scope: Use existing .pot, .po, .mo files from the theme. No additional files are required. in my wp-contents/Language contain the theme and plugin folders where the all .po, .mo files are present

so on enabling this plugin all French translations must be verified and confirmed functional before task completion.

Also English strings may appear on French pages if the import is not done properly. The plugin is single-use, not continuous.

Why is there no newline being presented here?

I wrote the following bit of code to read through a passed in email stream (or .eml file while I’m testing).

During the test, it’s supposed to read through each line of a stream but it seems it’s just outputting as one line, even thouhg there is a newline in the stream.

My code is as follows:

function sendMailForward($email) {
    // Load recipients from ENV (comma-separated list)
    $newRecipients = preg_split("/,s*/", $_ENV['ADMIN_EMAIL'] ?? '', -1, PREG_SPLIT_NO_EMPTY);

    // For StackOverflow: This passes in a comma-separated list of emails, this line is not part of the problem.

    $raw_email = "";
    while (!feof($email)) {
        $raw_email .= fread($email, 1024);
    }
    fclose($email);

    // Extract headers for a clean subject and sender
    $headers = [];
    $lines = explode("n", $raw_email); // This line, somehow, doesn't see newlines in the stream.
    foreach ($lines as $line) {
        echo "New line!n"; // This was me trying to test and what should show up multiple times, only shows up once.
        if (strpos($line, ":") !== false) {
            $parts = explode(":", $line, 2);
            $key = trim($parts[0]);
            $value = trim($parts[1]);
            $headers[$key] = $value;
        }
        // Stop at the first blank line, which marks the end of headers
        if (trim($line) == "") {
            break;
        }
    }

    $original_subject = isset($headers['Subject']) ? "FWD: " . $headers['Subject'] : "FWD: No Subject";
    $original_from = isset($headers['From']) ? $headers['From'] : "unknown sender";

    $subject = $original_subject;
    $message = "--- Original message from $original_from ---nn" . $raw_email;
    $extra_headers = "From: [email protected]"; // Customize 'From' address


    foreach ($newRecipients as $recipient) {
        $to = $recipient;
        // Send the email
        mail($to, $subject, $message, $extra_headers);
    }
}

What should I change in the above code? Should I force a newline to be appended? Or is there something else happening that I should be aware of.

(If it also helps, the rest of the email is non-existent too.)

Per request below. This is the email I’m using to test.


From: "Megan at TCGplayer" <[email protected]>
To: "TCGPlayer Account" <[email protected]>
Subject: Test Email for Forwarding
Date: Sat, 28 Sep 2025 08:00:00 -0400
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Hello,

This is a test email to verify the mail forwarding module.

Best regards,
Test System

EDIT 2: Someone asked for how is the code being used.

// Read original message from stdin
$rawEmail = file_get_contents('php://stdin');

sendMailForward($rawEmail);

Simply put just invoking it.

my wordpress site gets a 500 error that keeps coming back [closed]

I am hosting a website and every now and then I get the 500 error on the website.
I went through all of it:

  • checking permissions and chmoding
  • removing the .htaccess and rewriting it
  • disabling plugins (i only have the acf plugin )

when i fix the error, it comes back the next day without me even touching the files :/