Is there a JavaScript reference library specific to HTML5 Canvas in Adobe Animate?

I have returned to Adobe Animate after a hiatus of man years thanks to Apple killing Flash off. Now swfs and AS2 are dead, I am using it to create projects using JavaScript and Canvas.

Is there a JavaScript reference library specific to HTML5 Canvas in Adobe Animate? Either online or a book.

There does not seem to be much reference out there other than the odd YouTube video. The videos needs to be watched, which takes time, and they may not necessarily have the answer I am looking for.

jQuery document ready function not run at all in another .js file

We include jQuery and document ready code at the bottom of the page here:

<script src="https://songer.datasn.com/themes/stage2/_public/js/jquery-2.1.3.min.js"></script>
<script src="https://songer.datasn.com/themes/stage2/_public/js/main.js"></script>
<script src="/outsource/main-site-js/main-2.js"></script>

Which loads jQuery first and then 2 separate .js files that use $(document).ready(function() { .... }) to do stuff.

We have this in main.js:

$( document ).ready(function() {
    console.log('Document ready function in main.js --- Run!');
});

And these in main-2.js:

console.log('Hello from main-2.js');

if (window.jQuery) {
    console.log('jQuery is loaded!');
} else {
    console.log('jQuery is not loaded.');
}

console.log($);
console.log(jQuery);
console.log($( document ));

$( document ).ready(function() {
    
    console.log('Document ready function in main-2.js --- But not run, why?');
    
});

console.log('End of js file');

The weird issue is that the closure function for ready() is run in main.js but NOT main-2.js. Why?

See console log screenshot:

enter image description here

Why doesn’t the ready() closure run in main-2.js? The jQuery is apparently loaded and there are no obvious errors.

Vue Js placing a dynamic variable within a data set. error: Unquoted attribute value cannot contain

How do you place dynamic values within a database on a vue template. I am trying to add an id number to my delete button.

I keep getting this error:

Unquoted attribute value cannot contain U+0022 ("), U+0027 (')

This works:

<button
 type="button"
 @click.prevent="heart"
 :data-id=1"
 >
Delete
</button>

However when I try adding a dynamic variable to the data-id, it crashes the page:

<button
type="button"
@click.prevent="heart"
 :data-id="{{member.member_id}}"
>
Delete
</button>

i tried json encoding the value:

:data-id={{json_encode(member.member_id)}}"

it gave this error: Unquoted attribute value cannot contain U+0022 (“), U+0027

Checking if a file descriptor is writable in PHP

I know there are already 3 standard streams: STDIN (0), STDOUT (1), and STDERR (2). I am testing the possibility of utilizing non-standard streams (> 2) in PHP.
My intention is to write to a non-standard FD (FD 3) if it is writable, otherwise fallback to an alternative (which defaults to STDERR). I have tried the following code, which is working perfectly fine:

<?php
//This is done so that notices regarding invalid FDs are thrown as errors
set_error_handler('errorHandler');
function errorHandler($severity, $message, $filename, $lineno) {
  if (error_reporting() == 0) return;
  if (error_reporting() & $severity) {
    throw new ErrorException($message, 0, $severity, $filename, $lineno);
  }
}

file_put_contents("php://fd/1", "Writing to STDOUT!n");
file_put_contents("php://fd/2", "Writing to STDERR!n");
write2Fd(3, "Writing to FD 3!n");

function write2Fd(int $fd, string $contents, int $alt = 2) {
    try {
        //Try writing to the given FD
        file_put_contents("php://fd/$fd", $contents);
    } catch(Exception $e) {
        //Fallback to alternative FD
        file_put_contents("php://fd/$alt", $contents);
    }
}
?>

I am running the program on a Linux (Arch) system in Bash shell with the following command:

php test.php 3>fd3out.txt

This output is shown in the terminal:

Writing to STDOUT!
Writing to STDERR!

And this text is found inside the fd3out.txt file:

Writing to FD 3!

The code is inspired from this answer, which achieves the same task in Python.

Using try-catch seems to be a hacky way to solve the problem of checking whether a stream is writable or not. I have also tried alternative solutions which involve using file_exists and is_writable:

function write2Fd(int $fd, string $contents, int $alt = 2) {
    $file = "php://fd/$fd";
    if (file_exists($file) && is_writable($file)) file_put_contents($file, $contents);
    else file_put_contents("php://fd/$alt", $contents);
}

But for some reason, both the checks return false even if FD 3 is created by the parent process.
What is the correct way to check if a stream is available and whether it is writable or not in PHP?

Update PHP 8.3.6 to 8.3.21 [closed]

How can I make Apache recognize a PHP version? I did the make install and when I run php -v, the version appears, but Apache still shows version 8.3.6.

Currently there is no way to do it by apt and I can’t add the ondrej/php repository, I searched in the PHP documentation, but it doesn’t say how to do this either.

Fatal error: Class ‘mysqli’ not found in OpenCart after PHP update? can advise? [duplicate]

Fatal error: Uncaught Error: Class ‘mysqli’ not found in /home/u963972343/domains/upgraded.co.in/public_html/system/library/db/mysqli.php:7 Stack trace: #0 /home/u963972343/domains/upgraded.co.in/public_html/storage/modification/system/library/db.php(35): DBMySQLi->__construct(‘localhost’, ‘u963972343_upgr…’, ‘Vansh@1401’, ‘u963972343_upgr…’, ‘3306’) #1 /home/u963972343/domains/upgraded.co.in/public_html/system/framework.php(80): DB->__construct(‘mysqli’, ‘localhost’, ‘u963972343_upgr…’, ‘Vansh@1401’, ‘u963972343_upgr…’, ‘3306’) #2 /home/u963972343/domains/upgraded.co.in/public_html/system/startup.php(104): require_once(‘/home/u96397234…’) #3 /home/u963972343/domains/upgraded.co.in/public_html/index.php(25): start(‘catalog’) #4 {main} thrown in /home/u963972343/domains/upgraded.co.in/public_html/system/library/db/mysqli.php on line 7″ my website www.upgraded.co.in built on opencart version3.0.3.2, i already tried (changing PHP version, clearing cache, restoring backup) but still not able to acess my admin panel nor my website. can anyone provide me the 100% woking fix for this tht can be done either through hostinger or suggest your way. thanks in advance.

Gedmo/Doctrine Tree Extension Cannot use object as array

I’ve created an entity with a closure table and a repository alongside. I’m trying a basic example of building a tree but am seeing the error Cannot use object of type AppEntityDiscussionComment as array when calling getCommentTreeForDiscussion

Entity:

#[GedmoTree(type: 'closure')]
#[GedmoTreeClosure(class: CommentClosure::class)]
#[ORMEntity(repositoryClass: CommentRepository::class)]
#[ORMHasLifecycleCallbacks]
class Comment implements Identifiable
{
    use IdentifiableEntity;
    use TimestampableEntity;

    #[ORMColumn(type: 'text')]
    private string $content;

    #[ORMManyToOne(targetEntity: User::class)]
    #[ORMJoinColumn(nullable: false)]
    private User $author;

    #[ORMManyToOne(targetEntity: Discussion::class, inversedBy: 'comments')]
    #[ORMJoinColumn(nullable: false)]
    private Discussion $discussion;

    #[GedmoTreeParent]
    #[ORMManyToOne(targetEntity: self::class, inversedBy: 'replies')]
    #[ORMJoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
    private ?Comment $parent = null;

    #[ORMOneToMany(targetEntity: self::class, mappedBy: 'parent', cascade: ['persist', 'remove'])]
    private Collection $replies;

    #[GedmoTreeLevel]
    #[ORMColumn(type: 'integer')]
    private int $level = 0;

    #[ORMManyToMany(targetEntity: User::class)]
    #[ORMJoinTable(name: 'comment_likes')]
    private Collection $likedBy;

    // --- Getters / Setters

Closure:

#[ORMEntity]
class CommentClosure extends AbstractClosure
{
    #[ORMManyToOne(targetEntity: Comment::class)]
    #[ORMJoinColumn(name: 'ancestor', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
    protected $ancestor;

    #[ORMManyToOne(targetEntity: Comment::class)]
    #[ORMJoinColumn(name: 'descendant', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
    protected $descendant;
}

Repository:

class CommentRepository extends ClosureTreeRepository
{
    public function __construct(EntityManagerInterface $manager)
    {
        parent::__construct($manager, $manager->getClassMetadata(Comment::class));
    }

    public function getCommentTreeForDiscussion(Discussion $discussion): array
    {
        $roots = $this->findBy(['discussion' => $discussion, 'parent' => null], ['createdAt' => 'ASC']);

        return $this->buildTree($roots);
    }
}

Does Upstash’s context.call method support ReadableStream.?

I am using upstash context.call method to call my langgraph server. My langgraph server has an agent that autocompletes the notetext. when I do console.log on my body of context.call i can see the responses but I only see the workflowrunId when i call the route through frontend. Pls help what’s the issue here?


import { serve } from '@upstash/workflow/nextjs';
//import { TextDecoder, TextEncoder } from 'util';

export const { POST } = serve<{ noteText: string }>(
  async (context) => {
    const { noteText } = context.requestPayload;

    const { status, headers, body } = await context.call<ReadableStream>('langgraph-request', {
      url: `${process.env.LANGGRAPH_RUN_URL}/runs/stream`,
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${process.env.LANGSMITH_API_KEY}`,
      },
      body: {
        assistant_id: 'autocomplete_agent',
        input: { note_text: noteText },
        stream_mode: ['updates'],
      },
    });
    console.log('body:', body);

    return body;
  },
  {
    failureFunction: ({ failStatus, failResponse, failHeaders }) => {
      console.error('Autocomplete workflow failed:', {
        status: failStatus,
        response: failResponse,
        headers: failHeaders,
      });
    },
  }
);

My frontend code:

const getSuggestion = debounce(async (noteText: string, cb: (suggestion: string) => void) => {
      try {
        const response = await fetch('/api/workflow/autocomplete/', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ noteText }),
        });

        if (!response.ok || !response.body) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
        console.log('response body frontend:', response.body.readStreamableValue);

        const reader = response.body.getReader();
        const decoder = new TextDecoder();

        let suggestion = '';

        while (true) {
          const { done, value } = await reader.read();
          if (done) break;
          
          // Directly append the decoded text
          suggestion += decoder.decode(value);
          console.log('suggestion:', suggestion);
          cb(suggestion); // Update UI progressively
        }
        
        cb(suggestion); // Final update
      } catch (err) {
        console.error('Autocomplete failed:', err);
        cb('');
      }
    }, 300);
        
My console.log from route:body: event: metadata
data: {
data:   "run_id": "2d6cf720-42e0-43b1-8650-6196b93db2c5",
data:   "attempt": 1
data: }

event: updates
data: {
data:   "autocompleteNote": {
data:     "note_text": "A ",
data:     "suggested_completion": "<cusor-position> patient presents with persistent symptoms of fatigue and malaise. Vital signs are stable, and a thorough physical examination reveals no acute distress. Laboratory tests, including complete blood count and metabolic panel, are pending. The patient has been advised to maintain hydration and rest while awaiting results. Follow-up appointment scheduled for next week to review test outcomes and adjust management plan as necessary."
data:   }
data: }
but from fronted fetch, this is not being returned. I am simply getting workflowRunId. Please help what could be the issue


React: “Element type is invalid” when trying to render a modal component

I’m working on a React project and encountering this error when trying to open a modal:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Here’s my file structure:

src/
├── Components/
│   ├── Modals/
│   │   ├── MainModal.jsx
│   │   └── CategoryModal.jsx
└── Screens/
    └── Dashboard/
        └── Admin/
            └── Categories.jsx

CategoryModal.jsx

import React from "react";
import MainModal from "./MainModal";

function CategoryModal({ modalOpen, setModalOpen }) {
  return (
    <MainModal modalOpen={modalOpen} setModalOpen={setModalOpen}>
      <div className="inline-block sm:w-4/5 border border-border md:w-3/5 lg:w-2/5 w-full align-middle p-10 overflow-y-auto bg-main text-white rounded-2xl">
        <h2 className="text-3xl font-bold">Create</h2>
      </div>
    </MainModal>
  );
}

export default CategoryModal;

Categories.jsx

import React, { useState } from "react";
import SideBar from "../SideBar";
import { CategoriesData } from "../../../Data/CateporiesData";
import { HiPlus } from "react-icons/hi";
import Table2 from "../../../Components/Table2";
// Make sure this path is correct - verify the actual location of your CategoryModal component
import CategoryModal from "../../../Components/Modals/CategoryModal";

function Categories() {
  const [modalOpen, setModalOpen] = useState(false);

  const openModal = () => {
    setModalOpen(true);
  };

  return (
    <SideBar>
      {/* Modal component */}
      <CategoryModal modalOpen={modalOpen} setModalOpen={setModalOpen} />
      <div className="flex flex-col gap-6">
        <div className="flex items-center justify-between gap-2">
          <h2 className="text-xl font-bold">Categories</h2>
          <button
            onClick={openModal}
            className="bg-main flex cursor-pointer items-center gap-2 font-medium transition hover:bg-subMain border border-red-500 text-white py-2 px-4 rounded"
          >
            <HiPlus /> Create
          </button>
        </div>

        <Table2 data={CategoriesData} users={false} />
      </div>
    </SideBar>
  );
}

export default Categories;

MainModal.jsx

import { Dialog, Transition } from "@headlessui/react";
import React, { Fragment, useRef } from "react";
import { IoClose } from "react-icons/io5";

function MainModal({ modalOpen, setModalOpen, children }) {
  const cancelButtonRef = useRef();
  return (
    <>
      <Transition show={modalOpen} as={Fragment} appear>
        <Dialog
          as="div"
          className="fixed inset-0 z-30 overflow-y-auto text-center"
          initialFocus={cancelButtonRef}
          onClose={() => setModalOpen(false)}
        >
          <div className="min-h-screen px-4">
            <Transition.Child
              as={Fragment}
              enter="ease-out duration-300"
              enterFrom="opacity-0"
              enterTo="opacity-100"
              leave="ease-in duration-200"
              leaveFrom="opacity-100 scale-100"
              leaveTo="opacity-0"
            >
              <Dialog.Overlay className="fixed inset-0 bg-black opacity-60" />
            </Transition.Child>
            
            {/* This element is to trick the browser into centering the modal contents. */}
            <span
              className="inline-block h-screen align-middle"
              aria-hidden="true"
            >
              &#8203;
            </span>
            
            <Transition.Child
              as={Fragment}
              enter="ease-out duration-300"
              enterFrom="opacity-0 scale-95"
              enterTo="opacity-100 scale-100"
              leave="ease-in duration-200"
              leaveFrom="opacity-100 scale-100"
              leaveTo="opacity-0 scale-95"
            >
              {children}
            </Transition.Child>
            
            <div className="absolute right-5 top-5">
              <button
                onClick={() => setModalOpen(false)}
                type="button"
                className="inline-flex transition justify-center px-4 py-2 text-base font-medium text-white bg-subMain rounded-full hover:bg-white hover:text-red-500"
              >
                <IoClose />
              </button>
            </div>
          </div>
        </Dialog>
      </Transition>
    </>
  );
}

export default MainModal;

I’ve confirmed:

The component is exported with export default

The import path is correct (triple-checked)

I restarted the dev server

But the error persists.

Any ideas why this might be happening?

Scriptable iPad app: OpenAI call returns “No question generated” and Dictation always fails with “Recognizing the audio failed”

I’m building a daily reminiscence app for my grandfather on iPad using Scriptable. It:

  1. Loads a simple JSON profile
  2. Calls the OpenAI Chat API to generate a gentle question
  3. Presents it via Alert + Speech
  4. Uses Dictation.start() to capture his spoken answer
  5. Writes both Q&A into a local JSON log

Most of the code is working, but I keep hitting two errors in my Console log:


Console log
2025-05-10 17:17:15: Reminiscence app starting: 5:17:15 PM
2025-05-10 17:17:15: Generating question…
2025-05-10 17:17:16: OpenAI API Error: Error: No question generated
2025-05-10 17:17:16: Presenting question: Margaret, do you remember any special songs you enjoyed when you were younger?
2025-05-10 17:17:19: Starting dictation…
2025-05-10 17:17:25: Dictation error: Error: Recognizing the audio failed. Please try again.
2025-05-10 17:17:25: Saved conversation entry
2025-05-10 17:17:25: Presenting thanks for response: [No response recorded]


What I’ve tried so far

  • OpenAI “no question generated”
    • Verified OPENAI_API_KEY is set and valid
    • Logged out the raw response from https://api.openai.com/v1/chat/completions
    • Fallback to hard-coded questions works if I disable useOpenAI
  • Dictation error
    • Confirmed Scriptable has microphone permission
    • Tried both FileManager.local() and FileManager.iCloud() (for writing)
    • Wrapped await Dictation.start() in try/catch

My two big questions are

  1. OpenAI: Why does my call sometimes throw “No question generated”? Is my request payload malformed, or is Scriptable handling the JSON response incorrectly?
  2. Dictation: What steps are required to get reliable speech-to-text in Scriptable? The prompt appears, but Dictation.start() always fails with “Recognizing the audio failed.”

Any pointers on how to debug these two errors (or better patterns for calling OpenAI + Dictation in Scriptable) would be hugely appreciated. Thank you!

Fetch API Accumulative Memory Spike When Refreshing

I’m having an issue where I am fetching from a website in my Vue project, and the memory usage grows every refresh – when I first run the project in development mode and check the memory usage in my browser, the page sits at around 40 MB ram usage. However after refreshing somewhat frequently it goes over 1 GB ram usage, after which it does tend to reset. I am not sure if this is intended garbage collection but I would like to prevent the memory usage from peaking so high if possible. Any help would be appreciated!

Here is my API code which fetches the information:

export async function api(subDirectory) {
  try {
    const res = await fetch(
      `https://wheelcollectors.com/collections/${subDirectory}/products.json?limit=1`
    )

    const data = await res.json()

    const availableProducts = data.products.filter(
      (product) => product.variants[0].available === true
    )

    return availableProducts
  } catch (error) {
    console.error("Error fetching data:", error)
    return [] // Important to avoid undefined returns
  }
}

And here is where that API function is called on my home page.

<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { api } from '../api.js'

let products = ref([])

onMounted(async () => {
    let data = await api("hot-wheels-premium-collection")
    //console.log(data)

    products.value = data.map((item) => {
        let name = item.title.split("*")[0]
        let brand = item.title.split("*")[2]
        let link = `https://wheelcollectors.com/products/${item.handle}`
        
        return {
            brand: brand,
            name: name,
            price: parseFloat(item.variants[0].price),
            link: link
        }
    })
})
</script>

<template>
    <div class="container">
        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>Brand</th>
                    <th>Name</th>
                    <th>Price</th>
                    <th>Link</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="(product, index) in products" :key="index">
                    <td>{{ product.brand }}</td>
                    <td>{{ product.name }}</td>
                    <td>${{ product.price.toFixed(2) }}</td>
                    <td><a :href="product.link" target="_blank">View Product</a></td>
                </tr>
            </tbody>          
        </table>
    </div>
</template>