Model don’t load in Forge Viewer – always gets OBJECT_TREE_UNAVAILABLE_EVENT

I’m working on a 3-legged application where I list the different models available in my hub and load both the viewer and the selected model.

In general, everything works fine except for certain models. Every time I try to load one of those problematic models, I get the following error.
enter image description here

I’m using the OBJECT_TREE_CREATED_EVENT, but it never gets triggered. Instead, I always hit the OBJECT_TREE_UNAVAILABLE_EVENT.

I’ve tried different approaches when initializing the viewer, but none of them work.

For context, I can access the model through ACC, and when I check the object count, it returns over 29 million objects.

enter image description here

Could this issue be related to the extremely high number of objects? And if so, is there any way to work around or solve this?

Model won’t load in Forge Viewer – always gets OBJECT_TREE_UNAVAILABLE_EVENT – possible object count issue?

I’m working on a 3-legged application where I list the different models available in my hub and load both the viewer and the selected model.

In general, everything works fine except for certain models. Every time I try to load one of those problematic models, I get the following error.
enter image description here

I’m using the OBJECT_TREE_CREATED_EVENT, but it never gets triggered. Instead, I always hit the OBJECT_TREE_UNAVAILABLE_EVENT.

I’ve tried different approaches when initializing the viewer, but none of them work.

For context, I can access the model through ACC, and when I check the object count, it returns over 29 million objects.

enter image description here

Could this issue be related to the extremely high number of objects? And if so, is there any way to work around or solve this?

Simple way to convert generated blob from docx.js to PDF?

I created a website (html+javascript) which can generate a report with docx.js pressing the “Download DOCX” button.

You can see the current website here:
https://tkfdm.github.io/FAIR-Data-Assessment-Tool/

And the index.html here (line 1310~1569):
https://github.com/tkfdm/FAIR-Data-Assessment-Tool/blob/b5d1e6e440573bb2e9f537f22bc324f94d720e54/index.html

At the end – after the whole document is constructed – it simply creates the blob/docx file:

        Packer.toBlob(doc).then(blob => {
            const url = URL.createObjectURL(blob);
            const a = document.createElement("a");
            a.href = url;
            a.download = `${getTimestampString()}-fair-assessment-report.docx`;
            a.click();
            URL.revokeObjectURL(url);

My question is now if there is an easy way to transform this docx/blob into a pdf file. I know, that docx.js itself doesn’t offer this functionality, but are there other frameworks?

Is it possible to mock vite’s mode environment variable inside of Cypress tests?

In my application, we are applying a different header color based on the environment the application is run in. To do this, I am using the env variable MODE set by my vite config.

  useEffect(() => {
    if (import.meta.env.MODE === 'production') {
      import('./Header.prod.css')
    } else if (import.meta.env.MODE === 'beta') {
      import('./Header.beta.css')
    } else {
      import('./Header.dev.css')
    }
  }, [])

I was able to confirm that the above code works to set the color on the header.

However, I would like to write a Cypress Component visual regression test to make sure that the correct color is being set based on the value of import.meta.env.MODE, and when I try to set the value of MODE in my Cypress test the value of import.meta.env.MODE does not change.

  it(
    'should have beta styling when vite mode is beta',
    {
      env: {
        MODE: 'production'
      }
    },
    () => {
      cy.mount(<Header />)
    }
  )

Is there any way to set the value of import.meta.env variables inside of Cypress tests (i.e. not setting it at build time) so that I can test that the correct header color is being applied?

How do I make the text box grow once the user has reached the end of the text box in CSS, Javascript and HTML [closed]

I want my text box to grow as the user types in it.

I already tried some suggestions but they don’t seem to be working.
The rest of this is placeholder text so I don’t have to type anymore: This is a block of placeholder text intended to fill space while the final content is being written. It doesn’t carry specific meaning but gives a clear sense of how real content will look once it’s added. Designers and developers often use placeholder text to test layouts, check font styles, or preview how a page will appear. It helps keep the creative process moving without waiting for complete text to be ready.

You can use this kind of generic content in websites, brochures, documents, or anywhere a visual draft is needed. It can also help clients focus on the structure and design without being distracted by real content. Placeholder text like this allows for flexibility and clarity during the early stages of design and development.

Feel free to adjust the length, tone, or structure of this text to better match the project you’re working on. Whether you’re creating a blog, an app, a presentation, or even a printed flyer, having realistic placeholder text helps everything feel more complete. Use it to explore different styles, test formatting, or collaborate with others before finalizing the content. Why does this text have to be so long I just want to ask a question and gain reputation!

How to redirect to a custom Thank You page after checkout now that additional scripts is deprecated?

I’m currently working on a Shopify store using the Basic plan.

Until now, I was redirecting users to a custom Thank You page after checkout using the “Additional Scripts” section available in the Checkout Settings.

window.location.href = "https://myshop.com/thank-you"

This worked perfectly for redirecting users after order completion.

However, Shopify has announced that Additional Scripts is being deprecated, and they recommend migrating to Custom Web Pixels for post-checkout tracking and logic.

I implemented a custom web pixel and was able to successfully receive checkout events like checkout_completed. However, I’ve hit a major blocker:

Redirection to a custom Thank You page doesn’t work from the web pixel script.

After some research, I found that Shopify Web Pixels run inside a sandboxed iframe, so the script cannot access or control the parent DOM — meaning no redirection is possible using window.top or window.location.

What is the correct or recommended way to implement a custom Thank You page (or redirect to one) after checkout in Shopify, now that Additional Scripts is deprecated?

Any help, workarounds, or official documentation links would be greatly appreciated!

I tried web pixel to listen the customer’s checkout event and added redirected logic

analytics.subscribe('checkout_completed', (event) => {

  console.log("Checkout completed event received:", event);
  window.top.location.href = "https://myshop.com/thank-you";

}

Expected Result: Need to redirect to custom thank you page URL

jquery data table features not working with dynamic table

My datatable is working fine, all the features like pagination, sorting, searching are working with static table data content.
But when I fetch data from database and render in datatable features like pagination, sorting, searching and other CSS are not working.

My view page code::

<div class="table-responsive">
                            <table id="example" class="table table-striped table-bordered" style="width:100%">
                                <thead>
                                    
                                    <tr>
                                        <th
                                        >Index</th>
                                        <th>Name</th>
                                        <th data-orderable="false">Image</th>
                                        <th data-orderable="false">Edit</th>
                                        <th data-orderable="false">Delete</th>
                                    </tr>
                                </thead>

                                <tbody>
                                </tbody>
                                
                                <tfoot>
                                    <tr>
                                        <th>Index</th>
                                        <th>Name</th>
                                        <th>Image</th>
                                        <th>Edit</th>
                                        <th>Delete</th>
                                    </tr>
                                </tfoot>
                            </table>
                        </div>
                        

<script>
$(document).ready(function () {

    $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

    $('#example').DataTable();

    fetchproduct();

        function fetchproduct() {
            $.ajax({
                type: "GET",
                url: "/fetchproducts",
                dataType: "json",
                success: function (response) {
                    $('tbody').html("");
                    $.each(response.products, function (key, item) {
                        $('tbody').append('<tr>
                            <td>' + item.id + '</td>
                            <td>'+ item.name +  '</td>
                            <td> <img src="images/'+item.image_path+'"> </td>
                            <td><button type="button" value="' + item.id + '" class="btn btn-primary editbtn btn-sm">Edit</button></td>
                            <td><button type="button" value="' + item.id + '" class="btn btn-danger deletebtn btn-sm">Delete</button></td>
                        </tr>');
                    });
                }
            });
        }
});
</script>

</body>
</html>

Controller code and route::

public function fetchproduct()
    {
        $products = Product::all();
        return response()->json([
            'products'=>$products,
        ]);
    }
    
// route
Route::get('products', [ProductController::class, 'index'])->name('products.index');
Route::post('products', [ProductController::class, 'store'])->name('products.store');
Route::get('fetchproducts', [ProductController::class, 'fetchproduct']);

When I load the datatable, all the data is rendered at once. Pagination feature is not working. Also sorting and searching are also not working. Why is it so?

I am designing UI for grading functionality allowing sorta exam paper manager to customize the grading rules, Is there some avaiable solution or lib [closed]

I am currently trying to design a grading functionality for some web app, which allows the teachers to create their own papers and specify/set the grading logic(based on several dimensions)

The tech stack for the front is Vue

For now, I am stuck at the last step – the design of UI,especially the grading part, what I want to implement is like below (suppose the grading is based on the scores of two dimensions say, D1 D2),

A: D1 >= 75 && D2 >= 80 && Total >= 75(total is calculated by some weights and each dimensions scores)

B: D1 >= 60 || D2 >= 70 || Total >= 60

C: …..

D:

Like the above what I want to implement is to allow the paper manager customize the logic of each grading, which means they can fill out the upper/lower bound of each dimension and total score and also set AND/OR logic to chain the whole together, additionaly, you need absoultely need to do some validation like make sure for each student’s score, there will be only and exact one coresponding grading.

Is there any existing well-built solution/library for that based on Vue?

Please let me know if need more info/details.

Scrolling and section freezing are not working as expected

I have a question that I hope you can help me with.

I am working on a function that when scrolling will fix the section on top.
similar to css sticky.
However, when scrolling, scrollTop is always greater than elementOffset, which causes the section to float past the section before window.scrollTo(0, elementOffset), which makes fixing the section unnatural.
I cannot use position sticky because the section needs to have a fixed height.
I hope to get help from you.
Thanks

    <script>
      document.addEventListener("DOMContentLoaded", () => {

        const scrollElement = document.getElementById("scroll_element");
        const elementOffset = scrollElement.offsetTop;

        function handleScroll() {
          const scrollTop =
            window.pageYOffset || document.documentElement.scrollTop;
          if (scrollTop >= elementOffset) {
            window.scrollTo(0, elementOffset);
          }
        }

        window.addEventListener("scroll", handleScroll);
      });
    </script>

Anchor links not working for home page but working for others

I have a website made from a single page template but I’m expanding it to be multi-page. In my nav-bar I have links to subsections of my pages using references like <a href="./index.html#sectionid"> and <a href="./other-page.html#sectionid2">. My anchor links are pointing to section elements like this <section id="sectionid>.

I expected that no matter what page I was on, the nav bar link would would take me to the referenced page and sub-section. But specifically when I’m not on the home page and linking to a subsection of the home page, this doesn’t happen. It links to the top of the home page.

Links work correctly if:

  • I am on the index page and click the link to other-page.html#sectionid2.
  • I am on the index page and click the link to index.html#sectionid.
  • I am on literally any page and click the link to other-page.html#sectionid2.

But the links DON’T work correctly if:

  • I’m on any non-index.html page and I click the link to a subsection of the index page (index.html#sectionid). It takes me to the top of my index page, not to the subsection.

It DOES work when I:

  • disable javascript
  • add a breakpoint in main.js and step through it (what??)

I reviewed my main.js file and nothing seems to be hijacking the links, but there are some frameworks at play (bootstrap, smooth scrolling, aos, and a preloader). But just to be sure, I tried commenting out sections of my javascript file one by one, and no individual javascript function seemed to be the cause – the behavior persisted.

Other things I checked that weren’t the issue/didn’t yield results:

  • typos in anchor or id
  • uniqueness of id value
  • base tags (I have none)
  • using name=”sectionid” instead of id=”sectionid”
  • updating hrefs to absolute links instead of relative
  • compared the html on the pages where anchor tags work from other pages to the html on my home page – no significant differences
  • clearing my cookies/cache
  • a different browser – I’m in the latest version of chrome and I tried safari just for kicks

Function in external file doesn’t run when button is pressed despite being bound in onclick in HTML/JS

When I run this, it doesn’t run the function when I click the button, however it is run once when the website is loaded/reloaded even though (as far as I can tell) the code doesn’t do that at any point. I am using the DuckDuckGo browser. I don’t have much experience in HTML or JS. This is just for personal use, and doesn’t need to be supported on anything except DuckDuckGo.

Here is the HTML (filepath is index.html):

<html lang="en">
    <link rel="stylesheet" href="CSS/index.css">
    
    <body>
        <script src="Scripts/scrambleGen.js"></script>
        <div>
            <p id="scramble"></p>
            <button id="nextScramble">Next</button>
            <script>
                document.getElementById("nextScramble").addEventListener("click", scrambleGen(document.getElementById("scramble")));
            </script>
        </div>

        <div>
            <p id="timeInput"></p>
        </div>
    </body>
</html>

Here is the JS (filepath is “Scripts/scrambleGen.js”):

function scrambleGen(textBox)
{
  scramble = "";
  const moves = ["R","R2","R3","L","L2","L3","U","U2","U3","D","D2","D3","F","F2","F3","B","B2","B3"];
  lastMove = "";
  for (let i = 0; i < 30; i++)
  {
    move = moves[randomInt(0,17)]
    if (lastMove.substring(0,1) == move.substring(0,1))
    {
      move = move.substring(0,1) + (parseInt(move.substring(1), 10) + parseInt(lastMove.substring(1), 10)).toString();
    }
    else
    {
      if (lastMove[1] != undefined) 
      {
        if (((parseInt(lastMove.substring(1), 10) % 4).toString(10)) == 1)
        {
          scramble += lastMove.substring(0,1);
          scramble += " ";
        }
        else if (((parseInt(lastMove.substring(1), 10) % 4).toString(10)) == 2)
        {
          scramble += lastMove.substring(0,1) + "2";
          scramble += " ";
        }
        else if (((parseInt(lastMove.substring(1), 10) % 4).toString(10)) == 3)
        {
          scramble += lastMove.substring(0,1) + "'";
          scramble += " ";
        }
      }
      else 
      { 
        scramble += lastMove; 
        scramble += " "; 
      }
    }
    lastMove = move;
  }
  textBox.innerText = scramble;
}
function randomInt(min, max) 
{
  return Math.floor(Math.random() * (max - min + 1) ) + min;
}

Capitalised String

How do I make the first character of every word of a string uppercase in JavaScript.

for example: “this is my string” to “This Is My String”

I’ve already written the following solution, and it works perfectly. I’m just posting this to become a part of the community and ask if there are any edge cases, improvements, or alternative approaches you’d recommend.

let str = "this is my string";
let result = str
  .split(" ")
  .map(word => word.charAt(0).toUpperCase() + word.slice(1))
  .join(" ");
console.log(result); // "This Is My String"

javascript onload attribute is not working when injecting a link element to the head

I am trying to avoid getting a csp (Content Security Policy) error when deferring css with a script that has a nonce attribute.
This is my attempt:

function x_style_loader_tag($html, $handle, $href) {
$async_loading = array(
        'cookie_notice'
);
if( in_array($handle, $async_loading) ) {
    $script = '<script nonce="'.apply_filters("TOA_PLUGIN/nonce_scriptx", NULL).'">'.
        'let s = document.createElement('link'); '.
        //'s.id = "'.$handle.'"; '.
        's.rel = "stylesheet"; '.
        's.href = "'.$href.'"; '.
        's.media = "print"; '.
        's.onload = "this.onload=null;this.media='all'"; '.
        'document.head.appendChild(s); '.
        '</script>';
    $html = $script;
}
return $html;
}
add_filter('style_loader_tag', 'x_style_loader_tag', 10, 3);

Inspecting the <head> i get:

<link rel="stylesheet" href="http://localhost:8888/wordpress/wp-content/themes/archiv/css/cookie_notice.css" media="print">

The attribute media="print" hasn’t been swapped to media="all" by the onload attribute in the javascript. How do i have to write this onload attribute to make this work?

How to scale QPS for an SSR application

I’m trying to estimate how many QPS an SSR application can theoretically handle.

Let’s say a request into an SSR server (like next or nuxt) and reponse a html took 6ms, and there’s no asynchronous logic, just 6ms for node enviroment execute the JS code.

In my understanding, JS as a single thread language, only excute a code segment at a time, so the QPS is 166.66 (1000ms / 6ms)

And if there’s a asynchronous logic in serverside enviroment like
await new Promise((resolve, reject) => setTimeout(() => resolve(), 200))
then the QPS should be 133 (1000ms – 200ms / 6ms)

But when I try to use ab like

ab -n 100 -c 100

the QPS of result is way more higher than my estimate

I don’t know am I even right ?