How to resolve a shift/reduce conflict for greedy modifiers in a Tree-sitter grammar for VB.NET?

I am developing a Tree-sitter grammar for VB.NET and have run into a persistent parsing issue with member declarations that have multiple modifiers. The parser fails to be “greedy” and consumes only the first modifier, misinterpreting the second modifier as a variable name.

This appears to be a classic shift/reduce conflict, but the standard solutions I’ve tried (using prec, prec.dynamic, and the conflicts array) have not resolved the issue, often because they interfere with other precedence rules in the grammar.

The Problem

Given a simple VB.NET class, the parser should correctly handle fields with both single and multiple modifiers.

Minimal VB.NET Example:

Public Class MyTestClass
    ' This line with a single modifier parses correctly.
    Private _someField As String

    ' This line with multiple modifiers fails.
    Private ReadOnly _anotherField As Integer
End Class

When parsing the line Private ReadOnly _anotherField As Integer, the parser incorrectly stops after Private and tries to parse ReadOnly as the field’s name.

Incorrect AST Output:

The resulting Abstract Syntax Tree for the failing line looks like this, clearly showing the error

(field_declaration
  (modifiers
    (member_modifier)  -- "Private"
  )
  (variable_declarator
    (identifier)       -- "ReadOnly"
  )
  (ERROR)              -- "_anotherField As Integer"
)

The modifiers rule is not greedy, and an ERROR node is produced.

Relevant Grammar Snippet (grammar.js)
Here are the key rules from my grammar.js that are involved in this issue.

module.exports = grammar({
  name: 'vbnet',
  // ... other rules and extras

  rules: {
    // ...

    member_modifier: $ => choice(
      ci('Public'), ci('Private'), ci('Protected'), ci('Friend'),
      ci('Protected Friend'), ci('Private Protected'), ci('ReadOnly'),
      ci('WriteOnly'), ci('Shared'), ci('Shadows'), ci('MustInherit'),
      ci('NotInheritable'), ci('Overrides'), ci('MustOverride'),
      ci('NotOverridable'), ci('Overridable'), ci('Overloads'),
      ci('WithEvents'), ci('Widening'), ci('Narrowing'),
      ci('Partial'), ci('Async'), ci('Iterator')
    ),

    modifiers: $ => repeat1($.member_modifier),

    _type_member_declaration: $ => choice(
      // ... other members like empty_statement, inherits_statement
      prec(2, $.constructor_declaration),
      prec(1, $.method_declaration),
      prec(1, $.property_declaration),
      // ... other members with precedence
      $.field_declaration // Lower precedence
    ),

    field_declaration: $ => seq(
      optional(field('attributes', $.attribute_list)),
      field('modifiers', $.modifiers),
      commaSep1($.variable_declarator),
      $._terminator
    ),

    variable_declarator: $ => seq(
      field('name', $.identifier),
      optional($.array_rank_specifier),
      optional($.as_clause),
      optional(seq('=', field('initializer', $._expression)))
    ),

    // ... other rules
  }
});

function ci(keyword) {
  return new RegExp(keyword.split('').map(letter => `[${letter.toLowerCase()}${letter.toUpperCase()}]`).join(''));
}
// ... other helpers

The Question

How can I modify this Tree-sitter grammar to correctly and “greedily” parse multiple consecutive modifiers in a field_declaration, while still correctly resolving the ambiguities between different types of member declarations (e.g., a field_declaration vs. a method_declaration)?

Is there any way I can view documentation while hovering over the element after importing from a CDN?

I’m new to the club here, so this is my first question here.

My problem is using a CDN for jQuery which in terms of function, works, but the documentation while hovering over a jQuery element doesn’t work. It just says “any”. Or type s for show(), just doesn’t autocomplete.
For those who don’t know I use VScode’s IntelliSense.

From there, after I tried the CDN, I decided to use npm. The autocompletion and documentation while hovering over the element works.

With CDN

With npm

npm‘s documentation does work but it throws this error in ChromeDevTools.

The error

My index.html code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <title>jQuery Test</title>
</head>
<body>
    <h1>This is a test for jQuery.</h1>
    <br>
    <div class="show-images">
        <h1>jQuery works!</h1>
        <img src="images/5290058.png" alt="photo" id="image1">
    </div>
    <!-- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script> -->
    <script src="script.js"></script>
</body>
</html>

and my styles.css code:

body {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

h1 {
    text-align: center;
    font-weight: 900;
}

.show-images {
    text-align: center;
    display: none;
}

#image1 {
    border-radius: 15px;
    border: 3px solid black;
}

What is wrong with my npm and CDN, or am I just dumb and it is always like this?

Serial Key create (no random) [closed]

Not a random key,

I want to generate a specific key

example :
1967-1583-1558-1485

9892-4817-4575-7760

7834-0038-6240-4510

I just want it to give me the keys I added

Is it possible to do something like this?

function makeid(length) {
  var result = "";
  var characters = '0123456789';
  for (var i = 0; i < length; i++) {
    result += characters[Math.floor(Math.random() * characters.length)];
  }
  result = result.match(/d{1,4}/g).join("-");
  return result;
}

console.log(makeid(16));

Node.Js , req.body is undefined

I am recently working on an online shop written by node.js. There is a problem with my req.body. When I console.log it, it returns my id, but when I am trying to use it. I got an undefined error.
my code :

exports.postDeleteProduct = (req,res,next)=>{
     console.log("Form Here ", req.body);
     const prodId = req.budy.productId;
     Product.deleteById(prodId)
     res.redirect('/')
}

and the output is :

Form Here { productId: ‘ 0.7391966785957089’ }
TypeError: Cannot read properties of undefined (reading ‘productId’)
at exports.postDeleteProduct (C:UsersTAMDesktopprojectsNode.jsexpresscontrollersadmin.js:85:30)

How to create a smooth infinite horizontal scroll (loop) with JSON-fetched content in JavaScript?

I’m building a portfolio website where I show client reviews inside a horizontally scrollable section. I’m fetching the review cards dynamically from a review.json file.

Everything works — drag, auto-scroll,except for the illusion of infinite scrolling. When I reach the left or right, it resets abruptly or hits a visual edge unless I clone the content 1000 times (which obviously lags the browser). But there’s no real infinite illusion unless I use 50–100+ DOM clones, which is not efficient.

JSON

[
  {
    "name": "Alice Novak",
    "role": "COO of FutureTech",
    "image": "images/alice.png",
    "linkedin": "https://linkedin.com/in/reviewerLINKEDIN1",
    "text": "Professional, fast and reliable results. Highly recommend."
  },
  {
    "name": "Carlos Duran",
    "role": "Founder of WebWave",
    "image": "images/carlos.png",
    "linkedin": "https://linkedin.com/in/reviewerLINKEDIN2",
    "text": "Super helpful in scaling our outreach. Great comms."
  },
  {
    "name": "Linda Park",
    "role": "Lead at PixelNest",
    "image": "images/linda.png",
    "linkedin": "https://linkedin.com/in/reviewerLINKEDIN3",
    "text": "Very creative! A lot of attention to detail in the work."
  }
//Many more random examples below
]

JS

<script>
  // Global flag to notify scroll script
  window.reviewsReady = false;

  fetch('review.json')
    .then(res => res.json())
    .then(data => {
      const track = document.getElementById('scrollCards');
      track.innerHTML = ''; // clear any fallback

      data.forEach(review => {
        const card = document.createElement('div');
        card.className = 'review-card';
        card.innerHTML = `
          <div class="review-header">
            <div class="linkedin-pic">
              <img src="${review.image}" alt="propic" class="pic-prof" />
            </div>
            <div class="review-info">
              <h2 class="review-name">${review.name}</h2>
              <h2 class="review-role">${review.role}</h2>
            </div>
            <div class="linkpic-url">
              <a href="${review.linkedin}" target="_blank" rel="noopener noreferrer">
                <img src="https://static.vecteezy.com/system/resources/previews/018/930/480/non_2x/linkedin-logo-linkedin-icon-transparent-free-png.png" alt="LinkedIn" class="linkedin-icon" />
              </a>
            </div>
          </div>
          <h2 class="review-text">${review.text}</h2>
        `;
        track.appendChild(card);
      });

      // Notify that reviews are loaded
      window.reviewsReady = true;
    })
    .catch(err => console.error("Failed to load reviews:", err));
</script>

<script>
function initReviewScroller() {
  const wrapper = document.querySelector('.review-scroll-wrapper');
  const track = document.getElementById('scrollCards');

  const originalCards = Array.from(track.children);
  const MULTIPLIER = 20;
  for (let i = 0; i < MULTIPLIER - 1; i++) {
    originalCards.forEach(card => track.appendChild(card.cloneNode(true)));
  }

  const allCards = track.querySelectorAll('.review-card');
  const cardWidth = allCards[0].offsetWidth + 30;
  const totalCards = allCards.length;
  const totalWidth = cardWidth * totalCards;

  wrapper.scrollLeft = totalWidth / 2;

  let isDragging = false;
  let dragStartX = 0;
  let scrollStart = 0;
  let pauseAuto = false;

  wrapper.addEventListener('mousedown', (e) => {
    isDragging = true;
    pauseAuto = true;
    dragStartX = e.pageX;
    scrollStart = wrapper.scrollLeft;
  });

  wrapper.addEventListener('mouseup', () => {
    isDragging = false;
    pauseAuto = false;
  });

  wrapper.addEventListener('mouseleave', () => {
    isDragging = false;
    pauseAuto = false;
  });

  wrapper.addEventListener('mousemove', (e) => {
    if (!isDragging) return;
    const dx = e.pageX - dragStartX;
    wrapper.scrollLeft = scrollStart - dx;
  });

  wrapper.addEventListener('scroll', () => {
    const current = wrapper.scrollLeft;
    if (current <= cardWidth) {
      wrapper.scrollLeft += totalWidth / 2;
    } else if (current >= totalWidth - wrapper.clientWidth - cardWidth) {
      wrapper.scrollLeft -= totalWidth / 2;
    }
  });

  function autoScrollStep() {
    if (!pauseAuto) {
      wrapper.scrollBy({ left: cardWidth, behavior: 'smooth' });
    }
    setTimeout(autoScrollStep, 5000);
  }

  setTimeout(autoScrollStep, 500);
}

// Wait for reviews to load
function waitForReviews() {
  if (window.reviewsReady) {
    initReviewScroller();
  } else {
    setTimeout(waitForReviews, 100);
  }
}
waitForReviews();
</script>

HTML

<section class="reviews-section">
  <div class="reviews-container">
    <h2 class="review-title">
      Review of <span class="review-title-gold">our clients</span>
    </h2>

    <div class="review-scroll-wrapper">
      <!-- Cards go here (injected by JS) -->
      <div class="card-holder" id="scrollCards">
        <!-- JS will populate .review-card items dynamically -->
      </div>
    </div>
  </div>
</section>

I want infinite scrolling illusion left and right like a belt/slider — but without needing to clone content 1000 times. Using 20 clones already gets heavy.

Is there a better way to simulate this:

Without huge DOM bloat?

With real-time reset logic or mirrored cloning? I seen this on some websites but I have no idea how this can be done… Is this some library or something special?

Co-exist React component and normal class

I have many components
typically, such as

const EditTools = forwardRef((props,ref)=>{
    useEffect(()=>{
    });
    return <div>something</div>;
});

However sometimes I want to make normal javascript class for storing data. (because it doesn’t need return!!)

export default class GlobalParam{ 
   stati totalItems = 2;
   static getTotalData(){
   }
}

And this is not react components so it can be read from anywhere in script

import GlobalParam from './GlobalParam'

However I wonder , is this the good design?

In react program, I should use only react components?

However, how can I make the react data component without return?

Modal Freeze Nextjs

experiencing this problem on mobile safari where when the modal opens and I choose from any input field that triggers a keyboard, upon keyboard close the whole modal freezes whereby nothing is clickable.

On mobile Chrome and desktop are all working fine

Greatly appreciate any help I can get!

Modal.tsx

import React, { HTMLAttributes, useEffect } from "react";
import ReactDOM from "react-dom";
import Overlay from "./Overlay";

export interface ModalProps extends HTMLAttributes<any> {
  isOpen: boolean;
  pixelUp?: number;
  title?: string | any;
  bottomPadding?: string;
  contentCentered?: boolean;
  children?: any;
  modalClassName?: string;
  zIndex?: number;
}

const Modal = ({
  isOpen,
  pixelUp = 0,
  title = "",
  bottomPadding = "pb-0",
  contentCentered = false,
  modalClassName = "",
  zIndex = 50,
  ...props
}: ModalProps) => {
  useEffect(() => {
    if (isOpen) {
      const scrollY = window.scrollY;
      document.body.style.position = "fixed";
      document.body.style.top = `-${scrollY}px`;
      document.body.style.width = "100%";
      document.body.style.overflow = "hidden";
      return () => {
        document.body.style.position = "";
        document.body.style.top = "";
        document.body.style.width = "";
        document.body.style.overflow = "";
        window.scrollTo(0, scrollY);
      };
    }
  }, [isOpen]);

  if (!isOpen) return null;

  const { className, children, ...restProps } = props;

  return ReactDOM.createPortal(
    <Overlay>
      <div
        className={`fixed inset-0 flex items-center justify-center pointer-events-none`}
        style={{ zIndex }}           // keep the z-index prop working
      >
        {/* Must be 75vh for roster form height fix */}
        <div className={`bg-white rounded-lg shadow-lg w-full max-w-lg max-h-[80vh] overflow-y-auto p-6 ${modalClassName}`} style={{ pointerEvents: 'auto' }} >
          {title ? <div className={`font-bold mb-2 text-center`}>{title}</div> : <></>}
          <div className={`${bottomPadding} max-h-[calc(80vh-3rem)] ${contentCentered ? "text-center" : ""}`}>
            {children}
          </div>
        </div>
      </div>
    </Overlay>,
    document.body
  );
};

export default Modal;

Overlay.tsx


const Overlay = ({ children = null }) => {
  return (
    <div
      className="fixed inset-0 bg-black bg-opacity-50 z-50"
      style={{ touchAction: 'none', overscrollBehavior: 'none' }}
    >
      {children}
    </div>
  );
}

export default Overlay;

Making Custom Script for Bluebeam Revu for Batching Plans for Construction

Hello so I wanted to ask if anyone knew how to create custom scripts for batching documents in Bluebeam Revu.

I’m the bluebeam expert at my construction company and I’m trying to automate some of the process to make it easier for others.

As a base level I would like a button the flattens the document (I don’t need the ability to unflatten it afterwards)

Followed by it running Bluebeam OCR preferrable with the preset settings.

I know bluebeam has it’s owner script editor that can flatten but not run OCR, I think there is also some compatibility with JavaScript so I was also curious about that approach.

Thank you for the help.

JS Date Off By 1 Day When No Time Is Set, When Time Is Set It is Correct Day

I don’t understand the following behavior with JS Date.

When I create a date without a time component it uses local time and returns the previous day.

However, if there is a time component associated with the date already, it will not apply the local time logic and the day will remain the same.

I discovered this recently with a bug I’m addressing in our system where the YYYY-MM-DD date from the database would be a day off.

The dates from the MUI date picker we are using were adding a time component so I think that’s why the getDate and related functions were not returning a day off from the desired output.

But I cannot find anything yet in the docs to determine why a time component is required for that.

console image of date results

Vitest giving TypeError: React.act is not a function with React version 19

I am using React version 19 with Vite and when run Vitest, it’s giving error

FAIL  src/components/UserPopover/UserPopover.test.tsx > UserPopover > calls only         
onCancel when "Cancel" button is clicked

TypeError: React.act is not a function
 ❯ exports.act node_modules/react-dom/cjs/react-dom-test-utils.production.js:20:16
 ❯ node_modules/@testing-library/react/dist/act-compat.js:47:25
 ❯ node_modules/@testing-library/react/dist/pure.js:307:28
 ❯ cleanup node_modules/@testing-library/react/dist/pure.js:303:22
 ❯ node_modules/@testing-library/react/dist/index.js:28:25
 26|   if (typeof afterEach === 'function') {
 27|     afterEach(() => {
 28|       (0, _pure.cleanup)();
   |                         ^
 29|     });
 30|   } else if (typeof teardown === 'function') {

package.jsonit is not installing dev dependencies, if I use -D or –save-dev

{
  "name": "my-app",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint .",
    "preview": "vite preview",
    "test": "vitest --watch",
    "test:coverage": "vitest run --coverage"
  },
  "dependencies": {
    "@ant-design/icons": "^6.0.0",
    "@testing-library/jest-dom": "^6.6.3",
    "@testing-library/react": "^16.3.0",
    "@testing-library/user-event": "^14.6.1",
    "@types/react": "^19.1.8",
    "@types/react-dom": "^19.1.6",
    "@types/react-test-renderer": "^19.1.0",
    "@vitejs/plugin-react": "^4.6.0",
    "@vitest/coverage-v8": "^3.2.4",
    "ag-grid-react": "^34.0.0",
    "antd": "^5.26.4",
    "happy-dom": "^18.0.1",
    "jsdom": "^26.1.0",
    "react": "^19.1.0",
    "react-dom": "^19.1.0",
    "react-test-renderer": "^18.3.1",
    "vite": "^7.0.0",
    "vitest": "^3.2.4",
    "vitest-browser-react": "^1.0.0"
  },
  "devDependencies": {
    "@eslint/js": "^9.29.0",
    "eslint": "^9.29.0",
    "eslint-plugin-react-hooks": "^5.2.0",
    "eslint-plugin-react-refresh": "^0.4.20",
    "globals": "^16.2.0",
    "less": "^4.3.0",
    "typescript": "~5.8.3",
    "typescript-eslint": "^8.34.1"
  }
}

vite.config.ts

/// <reference types="vitest" />

import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  test: {
    include: [
      "src/**/*.test.ts",
      "src/**/*.test.tsx",
      "src/**/*.test.js",
      "src/**/*.test.jsx",
    ],
    globals: true,
    environment: "happy-dom",
    setupFiles: "./src/setupTests.ts",
    css: true,
    /* browser: {
      enabled: true,
      instances: [{ browser: "chromium" }],
    }, */
  },
});

tsconfig.json

  "compilerOptions": {
    "jsx": "react-jsx",      // For React 17+ (with new JSX transform)
    "module": "ESNext",
    "target": "ESNext",
    "moduleResolution": "Node",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
     "types": ["vitest/globals", "@testing-library/jest-dom"]
  },
  "include": ["src", "src/setupTests.ts"]
}

setupTest.ts

import "@testing-library/jest-dom";
import { render, screen, fireEvent } from "@testing-library/react";
import UserPopover from "./index";
import { describe, it, expect, vi, beforeEach } from "vitest";
import ReactDom from "react-dom/client";

describe("UserPopover", () => {
  const mockLogout = vi.fn();
  const mockCancel = vi.fn();
  const mockThemeToggle = vi.fn();

  beforeEach(() => {
    localStorage.setItem("userName", "Test User");
    mockLogout.mockClear();
    mockCancel.mockClear();
    mockThemeToggle.mockClear();
  });

  const userInfo = {
    email: "[email protected]",
  };

  it("renders user info correctly", () => {
    render(
      <UserPopover
        userInfo={userInfo}
        onLogout={mockLogout}
        onCancel={mockCancel}
        onThemeToggle={mockThemeToggle}
        theme="light"
      />
    );

    expect(screen.getByText("Test User")).toBeInTheDocument();
    expect(screen.getByText(userInfo.email)).toBeInTheDocument();
  });
});

Please suggest how to run unit test

Problem with cookie loaded inside a page from an iframe

There is a system responsible for make available desktop applications as web application
called TSPlus Remote Desktop. It’s work fine outside the iframe but when loaded inside the iframe, is returning message:

Failure by cookies: false>
Serverhash string not found

The server is built using Javascript.
The same number of cookies presented outside the parent page and when utilized inside the iframe.

Outside the iframe the website is loaded properly.
What could be the issue ?

Is it possible in Cypress to wait for an API call only if it was intercepted?

I’m working on a reusable Cypress method to intercept and wait for an API call. The challenge is that the call doesn’t always occur, so I want to avoid unnecessary waits that lead to timeouts. Here’s the workaround I’m using:

 function invokeAndAwaitApi() {
      let apiIntercepted = false;
      cy.intercept(
        'POST',
        '/api/endpoints?id=2352',
        () => (apiIntercepted = true)
      ).as('getInfo');
      cy.get(li#s1-save-item).click();
      cy.then(() => {
        // If the request was fired, wait for the alias
        if (apiIntercepted) {
          cy.wait('@getInfo');
        }
      });
    }

However, I’m not seeing the wait actually trigger, any idea what might be going wrong? Or is there a better workaround for this?

Getting Blank PDF with html2pdf – Tried StackOverflow Solutions Without Success

I’m currently trying to generate a PDF using the html2pdf library, but I keep getting a blank PDF as the output. I’ve followed a few solutions that I found on StackOverflow, but none of them seem to resolve the issue. Despite trying various approaches, the generated PDF remains empty.

Here is the code I’m working with:

function downloadAndEmail() {
  const form = document.getElementById('form-content');
  const clone = form.cloneNode(true);

  // Replace inputs with their values
  const inputs = clone.querySelectorAll('input, textarea');
  inputs.forEach(input => {
    const span = document.createElement('div');
    span.textContent = `${input.value}`;
    span.style.marginBottom = '0.5rem';
    input.parentNode.replaceChild(span, input);
  });

  // Add clone to DOM to render PDF
  clone.style.position = 'absolute';
  clone.style.left = '-9999px';
  document.body.appendChild(clone);

  // Build email body
  const sponsor = document.getElementById('sponsor').value;
  const event = document.getElementById('event').value;
  const startDate = document.getElementById('start-date').value;
  const endDate = document.getElementById('end-date').value;
  const organizer = document.getElementById('organizer').value;

  const emailBody = `
Speaker Request Form Summary:

Sponsor Name: ${sponsor}
Event Name: ${event}
Start Date: ${startDate}
End Date: ${endDate}
Organizer: ${organizer}

Please find the completed form PDF attached.
`;

  // Generate PDF
  html2pdf().from(clone).set({
    margin: 0.5,
    filename: 'speaker-request-form.pdf',
    image: { type: 'jpeg', quality: 0.98 },
    html2canvas: { scale: 2 },
    jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
  }).save().then(() => {
    document.body.removeChild(clone);
    // Launch mail client
    window.location.href = `mailto:abc@gov?subject=Speaker Request Form&body=${encodeURIComponent(emailBody)}`;
  });
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.min.js"></script>
  
  <div id="form-content">
<h2>Speaker Request Form</h2>

<label>Sponsor Name: <input id="sponsor" type="text" /> Event Name: <input id="event" type="text" /> Start Date: <input id="start-date" type="date" /> End Date: <input id="end-date" type="date" /> Event Description: 
<textarea id="description" rows="4">
</textarea>

 Organizer Name: <input id="organizer" type="text" /> Organizer Email: <input id="email" type="email" /> Organizer Phone: <input id="phone" type="tel" /> </label><button onclick="downloadAndEmail()">Download PDF &#38; Email</button></div>