Can you recommend a good LAMP working environment ( i.e. Frameworks, Libraries)?

I am getting back into programming again after a long hiatus.

I am working on a personal website that will sell music.

Previously I was making websites from scratch using LAMP stack and maybe occasional use of JQuery. I am basically a beginner.

The most ambitious website I created was a shopping website selling limited items, only a few pages and every page was written from scratch copying code from other pages and repeating them on every page (all the design elements and formatting).

Can anyone recommend a good group of libraries or Framework, without a long learning curve, to aid me in my development. I just want to avoid having to repeat elements on multiple pages and be able to modify the look/’theme’ of my website from a central place.

This is not for an enterprise, just a small business and I will be the only coder.

I have tried development without the use of Frameworks or libraries.

errer when running minecraft mod

Execution failed for task ‘:runClient’.

Process ‘command ‘C:Program FilesJavajdk-17binjava.exe” finished with non-zero exit value 1

  • Try:

Run with –stacktrace option to get the stack trace.
Run with –scan to get full insights.

minecraft to load properly

Automatically editing mod-edited posts?

Does anyone want to write to a bot that automatically edits my answers/questions for me? The mods like M&M and pogman keep reverting my openai protest edits, and I’m gonna have to go to sleep eventually.

The bot should either let you log-in, or maybe use your firefox cookies to pretend to be you.

React Table not Updating Automatically after CRUD Operations

I’m developing a web app using React where I have a table that displays a list of clients. The table should update automatically after performing CRUD operations on the clients. However, I’m encountering a specific issue: after adding or deleting a client, the table doesn’t update automatically. It only works correctly when I edit an existing client. To make the other methods work, I have to leave the page and come back to the section.

As I mentioned, the request reaches the API and returns the expected information, but updating the table fails, even though the method is theoretically implemented.

This is my code:

const loadClients = async () => {
  try {
    const clientsData = await salesApi.getClients();
    const sortedClients = clientsData.sort((a, b) => a.id - b.id);
    setClients(sortedClients);
  } catch (error) {
    console.error('Error fetching clients:', error);
  }
};

const handleEditClick = (client) => {
  setEditingClient(client);
};

const handleCancelEdit = () => {
  setEditingClient(null);
};

const handleClientSubmit = async (formData) => {
  try {
    await salesApi.addClient({
      firstName: formData.firstName,
      secondName: formData.secondName,
      firstLastName: formData.firstLastName,
      secondLastName: formData.secondLastName,
      identificationNumber: formData.identificationNumber,
      isCreditCandidate: formData.isCreditCandidate,
    });
    console.log('Client successfully registered:', formData);
    loadClients();
  } catch (error) {
    console.error('Error adding client:', error.message);
  }
};

const handleSaveEdit = async (editedClient) => {
  try {
    console.log('Data to send to server:', editedClient);

    await salesApi.updateClient(editedClient);

    console.log('Client successfully updated:', editedClient);

    loadClients();
  } catch (error) {
    console.error('Error updating client:', error);
  }
};

const handleDeleteClient = async (clientId) => {
  try {
    console.log('Attempting to delete client with ID:', clientId);
    const response = await salesApi.deleteClient(clientId);

    console.log('Delete response:', response);

    if (response.status === 200) {
      console.log('Client successfully deleted:', clientId);
      loadClients();
    } else {
      console.error('Error deleting client:', response.statusText);
    }
  } catch (error) {
    console.error('Error deleting client:', error);
  }
};

return (
  <MainPageContainer>
    <h1>Clients</h1>
    {(editingClient || !editingClient) && (
      <ClientsRegistration
        onSubmit={(formData) => {
          if (editingClient) {
            handleSaveEdit({ ...editingClient, ...formData });
          } else {
            handleClientSubmit(formData);
          }
        }}
        onCancel={handleCancelEdit}
      />
    )}
    <ClientsTable
      clients={clients}
      onEditClick={handleEditClick}
      onDeleteClick={handleDeleteClient}
      handleSaveEdit={handleSaveEdit}
    />
  </MainPageContainer>
);
};

Any advice or help on how to approach this issue would be greatly appreciated.

Extract a string from a format

I am currently working in javascript and am curious on how to find part of a string in a format. How would I extract the information as a string if its in another string such as
“[AUTOFLIP] (Method): (Item)! (Buy Value) -> (Sell value)”
How would I find everything in parentheses if I know everything out of it will remain the same (the values are both shortened numbers)?

I tried to use indexOf to get the last letter of the words before/after the item I wanted to find and then use substring to find whats betweeen them but that didnt end up working well

React TinyMCE editor state is not updating like a normal input component

I have been at this for a while so any help is appreciated!

I have an rich text editor modal with a input box that contains an existing title, and a TinyMCE editor that contains an existing note entry/body. The input text can be edited, but when changes are made to the text body they are immediately reverted, the state is not being set with the new changes.

export const EditorModalContext = createContext(undefined);

function App() {
    const [openEditor, setOpenEditor] = useState(false);
    const [notes, setNotes] = useState([])
    const [currentNote, setCurrentNote] = useState({
        _id: "",
        title: "",
        entry: "",
    });

    const handleOpenEditor = () => setOpenEditor(!openEditor);

    const editorRef = useRef(null);

    const getNotes = useCallback(async () => {
        try {
            const res = await axios.get("/notes");
            setNotes(res.data);
        } catch (err) {
            console.error(err);
        }
    }, []);

    useEffect(() => {
        getNotes();
    }, [getNotes]);

    const onChange = (e) => {
        setCurrentNote((prev) => {
            let currentNote = { ...prev };
            currentNote[`${e.target.id}`] = e.target.value;
            return currentNote;
        });
    };

    return (
        <div className="flex flex-col gap-4 p-4">
            <Dialog>
                <Input
                    variant="outlined"
                    placeholder="Title"
                    value={currentNote.title}
                    id="title"
                    onChange={onChange}
                />
                <Editor
                    tinymceScriptSrc="/tinymce/tinymce.min.js"
                    onInit={(evt, editor) => (editorRef.current = editor)}
                    disableEnforceFocus={true}
                    value={currentNote.entry}
                    id="entry"
                    onChange={onChange}
                />
            </Dialog>
            <EditorModalContext.Provider value={{ setOpenEditor, setCurrentNote }}>
                <Header />
                <NoteCards notes={notes} />
            </EditorModalContext.Provider>
        </div>
    );
}

export default App;

This is more or less the code with some unecessary bits removed. The currentNote is first set in another component and is passed as context when the editor modal is opened using a button in that component.

Does this have something to do with how TinyMCE designed its editor or do I have a runtime error somewhere in my code?

VueJS User cant alter checkbox state

I have the following script which use to work perfectly fine.

<div id="inspectionList" class="row m-0 p-0" v-if="app.getOption('InspectionChecklists')">
<div v-for="(checklist, index) in (JSON.parse(app.getOption('InspectionChecklists')))[app.store.AddAsset_Module][1]">
     <div class="col-12 m-2 p-1 mb-2" v-for="(inspection, index) in checklist">

          <input
          type="checkbox"
          v-bind:name="index"
          v-bind:class="'form-check-input'"
          v-bind:id="index"
          v-bind:value="index"
          v-model="app.store.AddAsset_Type_inspections"
          style="height:30px; width:30px; accent-color: #5873fe;">
           <label v-bind:for="index" style="position:relative; top:-5px">{{inspection.n}}</label>
     </div>
</div>

</div>
<div id="debugInfo"  v-if="app.store.debug">
Debug: {{ app.store.debug }}
<span>Checked names: {{ app.store.AddAsset_Type_inspections }}</span>
</div>

The script generates a list of checkboxes, and automatically checks any of them that are in the array store in app.store.AddAsset_Type_inspections

app.store.AddAsset_Type_inspections has the following data for example:

Checked names: [
259,
9,
68,
45,
41,
264,
55,
13,
262,
271,
270,
1,
23,
260,
3,
44,
63,
24,
56,
261,
19,
30,
18,
31,
17,
2,
14,
29,
46,
36,
26,
8,
25,
33,
35,
28,
282,
52,
50,
51,
49,
53
]

For some reason, after updating VueJS core library to 3.4.27, the checkboxes automatically check as needed – however users cant manually check or uncheck any of the check boxes.

Things i’ve tried:

  • I added a standard <input type="checkbox" name="test"> checkbox, and it is possible to check and uncheck this without an issue.

  • If I remove v-model="app.store.AddAsset_Type_inspections" so that checkboxes don’t automatically get checked, then it’s possible for a user to check and uncheck any of the boxes without an issue.

  • I’ve looked for any console errors, and no errors are generated

Heres a screenshot of the checkboxes which shows the auto-checked ones, and additionally, the highlight after clicking a checkbox that shows the checkbox isn’t disabled.

enter image description here

How to have both popups and side panels for a chrome extension?

I’d like to have a popup that allows the extension to be turn on/off for specific sites, as well as a side panel to display more information.

My current manifest.json is below. At the moment, clicking on the extension icon in the toolbar (top right of chrome) always opens the side panel. I have to disable the side panel before I can see the popup.

"action": {
    "default_title": "Click to open extension",
    "default_popup": "popup.html"
  },
  "host_permissions": [
    "https://developer.chrome.com/*"
  ],
  "side_panel": {
    "default_path": "sidepanel.html"
  },

Angular17 hosting project presents this error: ReferenceError: caches is not defined

I made a project using the MapTiler library. And when putting the project on the hosting service, the error appears:

ReferenceError: caches is not defined
    at main-FAGKM46X.js:584:229302
    at Generator.next (<anonymous>)
    at main-FAGKM46X.js:584:228898
    at new t (polyfills-RT5I6R6G.js:2:2236)
    at xp (main-FAGKM46X.js:584:228718)
    at UT (main-FAGKM46X.js:584:229256)
    at main-FAGKM46X.js:584:230307
    at Generator.next (<anonymous>)
    at main-FAGKM46X.js:584:228898
    at new t (polyfills-RT5I6R6G.js:2:2236)

With this error, the map style does not load either.

The program accesses an API that takes the current location of the ISS and shows it on the map

Component HTML

<div class="map-container">
    <div class="info-container" >
        <span>Latitude: {{locateISS?.iss_position?.latitude}}</span>
        <span>Longitude: {{locateISS?.iss_position?.longitude}}</span>
        <span>Velocidade: {{speed}}km/h</span>
    </div>

    <div class="map-wrap">
        <div class="map" #map></div>
    </div>
    <div class="icon" #icon></div>
</div>

Component TS

    import {AfterViewInit, Component, ElementRef, NgZone, OnDestroy, OnInit, PLATFORM_ID, ViewChild, inject, signal } from '@angular/core';    
    import { IssService } from '../../../services/iss.service';
    import { Map, MapStyle, config, Marker, Popup} from '@maptiler/sdk';
    import '@maptiler/sdk/dist/maptiler-sdk.css';
    import { isPlatformBrowser } from '@angular/common';
    import { LocateISS } from '../models/locate.model';

    @Component({
      selector: 'app-iss-map',
      standalone: true,
      imports: [],
      templateUrl: './iss-map.component.html',
      styleUrl: './iss-map.component.scss' 
    })
    export class IssMapComponent  implements OnInit, AfterViewInit, OnDestroy{

      map?:Map
      private issService = inject(IssService)
      locateISS?:LocateISS
      issIcon:any
      speed:Number = 0
      marker:any
      isBrowser = signal(false);
      platformId = inject(PLATFORM_ID)

      @ViewChild('map')
      private mapContainer!: ElementRef<HTMLElement>;

      @ViewChild('icon')
      private elementIcon!: ElementRef<HTMLElement>;
  
      constructor(){
        this.isBrowser.set(isPlatformBrowser(this.platformId))
        if(this.isBrowser())
          inject(NgZone).runOutsideAngular(() => {
            setInterval(() => this.updateMarker(), 1000);
          })
      }
  
      ngOnInit(): void {
        config.apiKey = 'wGRvHdO3WKYFTWYfoxL5'
        this.issService.getLocate().subscribe(locate => this.locateISS = locate)  
    
      }
  
      ngAfterViewInit(): void {
        this.map = new Map({
          container: this.mapContainer.nativeElement,
          style: MapStyle.STREETS,
          center: [ Number(this.locateISS?.iss_position.longitude), Number(this.locateISS?.iss_position.latitude)],
          zoom: 2
        });
        this.issIcon = new Marker({element : this.elementIcon.nativeElement})
        .setLngLat([Number(this.locateISS?.iss_position.longitude!), Number(this.locateISS?.iss_position.latitude!)])
        .setPopup(new Popup().setHTML("<span style='color:black; padding:20px;'>ISS</span>"))
        .addTo(this.map!); 
      }
  
      ngOnDestroy(): void {
        this.map?.remove();
      }
  
      updateMarker(){
       const oldLat = this.locateISS?.iss_position.latitude
        const oldLong = this.locateISS?.iss_position.longitude
        this.issService.getLocate().subscribe(locate => this.locateISS = locate)
        let distance = 60 * 1.1515 * (180/Math.PI) * Math.acos(
          Math.sin(Number(oldLat) * (Math.PI/180)) * Math.sin(Number(this.locateISS?.iss_position.latitude) * (Math.PI/180)) + 
          Math.cos(Number(oldLat) * (Math.PI/180)) * Math.cos(Number(this.locateISS?.iss_position.latitude) * (Math.PI/180)) * 
          Math.cos(Number(oldLong) - Number(this.locateISS?.iss_position.longitude) * (Math.PI/180))
        );
        this.speed = Math.round(distance * 1.609344)
        this.issIcon.setLngLat([Number(this.locateISS?.iss_position.long`), Number(this.locateISS?.iss_position.latitude)])    
      }
    }

I thought it might be something when building the project, I built it again and it didn’t work

How can I append a paragraph to a document with some bold and some regular text using google apps script?

I’m using google app script to automate the process of transforming responses collected from a google form into a google document with some formatting . The script I have iterates over the spreadsheet rows, treating each cell differently based on its index. Here’s a visual of a spreadsheet and the resulting text I want to create inside of google doc:

spreadsheet ‘responses’

|         | What's your favorite animal? | when did you graduate? | Will you come to the party?|
| Janice  | dogs                         | 1992                   | yes                        |
| Soyoung | I like frogs                 | 2003                   | I'll be there              |
| Cary    | not sure!                    |   x                    | I can't come :(            |

inside of document ‘formatted responses’:

Janice

What’s your favorite animal?: dogs

when did you graduate?: 1992

Will you come to the party?: yes

Soyoung

What’s your favorite animal?: dogs

when did you graduate?: 2003

Will you come to the party?: I’ll be there

Cary

What’s your favorite animal?: not sure!

when did you graduate?:

Will you come to the party?: I can’t come 🙁

Currently the script can do everything except bold the questions. I just can’t figure out how to only bold just the questions.

I found the setBold() function on the documentation, but it seems like I can only use it with a Text object, and I can’t figure out to work it into the way I’ve implemented my script already. I’m using appendParagraph() to build the lines of content inside my document because things need to be in order and on the same line…

I found this post and I tried to work in what they did but still using appendParagraph() but it didn’t work. This is the basic format I’m following for adding text into my document, I’d appreciate any suggestions.

// for each user, the header is the question and the cell holds the user's response to that question
var header = headers[cellIndex];
body.appendParagraph(header + " " + cell.toString());

How do I remove an item from firestore using the delete method?

I am trying use the delete method in firestore to delete an item from my site when the user clicks the ‘delete’ button. These are different cards stored inside of a list using a v-for loop in vue.

I tried the following method:
db.collection('personal-collection').doc(this.card.id).delete()

and got the following error in the console.

Console error
Console Error

This is my list that is iterating over each item in the collection:

<div class="row row-cols-1 row-cols-md-4 g-4">
      <collection-card v-if="cards" v-for="card in cards" 
      :key="card.id" :card="card"></collection-card>
</div>

What programming language should I choose? [closed]

I want to build an app that is dedicated for non-profit organizations, so it should be able to run on almost any phone, including the old and cheap ones. What programming language and framework should I study to implement that?

I have prior experience in writing logic and implementing ML algorithms in code but I have almost zero experience with front-end or backend development, so I don’t have any preferences in language or framework. The only requirement is that app written in that language can run on as many devices as possible. I’m okay with making frontend in different languages for Android and IOS but I would like to have universal backend code.

Combine Dropdown Div with a ToolTip

Can’t seem to make it happen for some reason. Either .ToolTip just appears ( instead of a gentle dropdown ), or .ToolTipText won’t appear and .ToolTip have a weird transition ( Like opening/closing from the middle ) – https://jsfiddle.net/Apryed/40exvq6s/2/ .

I combined them this way:

<h3 class="ShowHide">Text to click and display/hide</h3>
    <div class="ToolTip">
        <div class="ToolTipText">Descriptive Text</div>
        <div>
            <label for="date">SaveDate:</label>
            <input type="text" id="date" name="date" required minlength="17" maxlength="17" />
        </div>
    </div>
</div>

Note: I tried a few modifications in css and in DOM style with JavaScript, that I can’t recall them since they were fails ( visibility and z-index most of the time ) .

I was expecting to combine this two things just with HTML5, CSS3 and JavaScript (ES6 Tops) – https://jsfiddle.net/Apryed/gnuebymf/ :

  1. A clickable drop down
  2. A Tool tip with descriptive information

To hide a few things from showing and to describe what should be inserted inside.

Notice how the Drop down gently reveals and hides in comparison to the other fiddle.

AWS Signature V4 hash of Canonical Request is incorrect

I am trying to create a Google App Script which will allow users to upload a spreadsheet to S3. Since I couldn’t find an AWS library for App Script that had been updated recently, I’ve been writing the AWS request code myself following this official guide for AWS Signature V4.

I keep getting an error that my signature doesn’t match what AWS expected, and from the response it seems like this is because the hash of the Canonical Request String from step 1 of the guide is different on my end than AWS’. I’ve double-checked with online calculators and they verify my hash.

This is the string I’m hashing:

PUT
/google-sheets-to-s3/Test_171RLxS8MIlbge87d97jhelAawuadxQ3stAeYMrDdb-4/Test_0.json
content-type:application/json
host:s3.ap-southeast-2.amazonaws.com
x-amz-content-sha256:e62b1de6ef3840adb4dae65f5412d15202ddc241c6ba39e5b73dd51ae5613559
x-amz-date:20240508T211604Z
x-amz-target:PutObject

content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target
e62b1de6ef3840adb4dae65f5412d15202ddc241c6ba39e5b73dd51ae5613559

The hash on my end (and according to online tools) is 89aa70c68b8b9f5fc19ebb4e390ff90a654bf638aa2ce4bceb9863753409941d. However, the response from AWS seems to imply they think the hash should be 3903b5152c9165b7c4044faa3dc84c0f4e0b1177665b821bdac234dc2fc71038.

For reference, the function I’m using to generate the hash strings is

const byte_array_to_string = (v) => v.map(byte => {
    if (byte < 0) {
        byte += 256;
    }

    return byte.toString(16).padStart(2, '0');
}).join('');

const SHA256 = (v) => {
    return byte_array_to_string(Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, v));
};

...
const StringToSign = [
    'AWS4-HMAC-SHA256',
    RequestDateTime,
    CredentialScope,
    SHA256(CanonicalRequest)
].join('n');

I’ve tried converting the string to different encodings to no avail and have also triple-checked that I’m following the guide. I’ve searched and can’t seem to find anything addressing this problem so any help would be appreciated.

Block, Object, undefined key, undefined function

The short short version: it looks a function call but is being interpreted as a function definition. why?

Note: x is not defined prior to execution. Also these code samples run in the node terminal. For them to run in the browser you need to preface it with someVar= or wrap it in parens … not sure why … but this is not my main question.

I have this piece of code

{x(arg){console.log('Hello '+arg)}}.x('world')

Which seems to be equivalent to this piece of code

{x:(arg)=>{console.log('Hello '+arg)}}.x('world')

What is the reason or use case or history of why this behaves this way? I can’t for the life of me see why in the 1st example when the function execution syntax is supplied it doesn’t attempt to call the function, see it’s undefined, and throw an error. Furthermore javascript instead creates an object with a key of the undefined functions name, with the arguments matching the parameters passed, and body as the block that follows this function call. What special context is this?

I tried to run this and expected an error but I got unexpected behavior. I am aware that an object literal that contains a comma separated list of variables will create an object whose keys are the same names as those variables, but this behavior seems to be more than that.