Angular Get checkbox checked value instead of boolean value

Currently I am working on servicenow, here we are using anularjs. I am unable to get checkbox checkvalue

Here is my code,

$scope.userFavourite = function(favourite){
        alert(favourite);
    }
    
<labe for="tea"><input type="checkbox" ng-model="Food" value="food" ng-true-value="food" ng-click="userFavourite(value)"/>Food</labe>
  <labe for="tea"><input type="checkbox" ng-model="Books" value="tea" ng-true-value="tea" ng-click="userFavourite()"/>Books</labe>
  <labe for="tea"><input type="checkbox" ng-model="Travel" value="travel" ng-true-value="travel" ng-click="userFavourite(Travel)"/>Travel</labe>
  
  
    
  

Thanks your value time spending on this

How to change styling of paragraphs and list items in docx for JavaScript?

I am making a markdown to docx converter using docx for JavaScript https://github.com/lancejpollard/md2docx.js/blob/make/index.ts . See the simple doc at the bottom for the styles I tried applying.

const doc = new Document({
  title: 'Sample Document',
  description: 'A brief example of using docx',
  numbering: {
    config: [
      {
        reference: 'bullet',
        levels: [
          {
            level: 0,
            format: LevelFormat.BULLET,
            text: '*',
            alignment: AlignmentType.LEFT,
            style: {
              paragraph: {
                indent: {
                  left: convertInchesToTwip(0.5),
                  hanging: convertInchesToTwip(0.25),
                },
              },
            },
          },
          {
            level: 1,
            format: LevelFormat.BULLET,
            text: '*',
            alignment: AlignmentType.LEFT,
            style: {
              paragraph: {
                indent: {
                  left: convertInchesToTwip(1),
                  hanging: convertInchesToTwip(0.25),
                },
              },
            },
          },
          {
            level: 2,
            format: LevelFormat.BULLET,
            text: '*',
            alignment: AlignmentType.LEFT,
            style: {
              paragraph: {
                indent: {
                  left: 2160,
                  hanging: convertInchesToTwip(0.25),
                },
              },
            },
          },
          {
            level: 3,
            format: LevelFormat.BULLET,
            text: '*',
            alignment: AlignmentType.LEFT,
            style: {
              paragraph: {
                indent: {
                  left: 2880,
                  hanging: convertInchesToTwip(0.25),
                },
              },
            },
          },
          {
            level: 4,
            format: LevelFormat.BULLET,
            text: '*',
            alignment: AlignmentType.LEFT,
            style: {
              paragraph: {
                indent: {
                  left: 3600,
                  hanging: convertInchesToTwip(0.25),
                },
              },
            },
          },
        ],
      },
      {
        reference: 'number',
        levels: [
          {
            level: 0,
            format: 'decimal',
            text: '%1.',
            alignment: AlignmentType.START,
            style: {
              paragraph: {
                indent: { left: 720, hanging: 260 },
              },
            },
          },
          {
            level: 1,
            format: 'lowerLetter',
            text: '%2)',
            alignment: AlignmentType.START,
            style: {
              paragraph: {
                indent: { left: 1440, hanging: 980 },
              },
            },
          },
          {
            level: 2,
            format: 'upperLetter',
            text: '%3)',
            alignment: AlignmentType.START,
            style: {
              paragraph: {
                indent: { left: 2160, hanging: 1700 },
              },
            },
          },
          {
            level: 3,
            format: 'decimal',
            text: '%4.',
            alignment: AlignmentType.START,
            style: {
              paragraph: {
                indent: { left: 2880, hanging: 2420 },
              },
            },
          },
        ],
      },
    ],
  },
  styles: {
    paragraphStyles: [
      {
        id: 'Heading1',
        name: 'Heading 1',
        basedOn: 'Normal',
        next: 'Normal',
        quickFormat: true,
        run: {
          size: 32,
          bold: true,
          italics: true,
          color: '#ff0000',
        },
        paragraph: {
          spacing: {
            after: 120,
          },
        },
      },
      {
        id: 'Heading2',
        name: 'Heading 2',
        basedOn: 'Normal',
        next: 'Normal',
        quickFormat: true,
        run: {
          size: 28,
          bold: true,
        },
        paragraph: {
          spacing: {
            before: 240,
            after: 120,
          },
        },
      },
      {
        id: 'Heading3',
        name: 'Heading 3',
        basedOn: 'Normal',
        next: 'Normal',
        quickFormat: true,
        run: {
          size: 24,
          bold: true,
        },
        paragraph: {
          spacing: {
            before: 240,
            after: 120,
          },
        },
      },
      {
        id: 'Heading4',
        name: 'Heading 4',
        basedOn: 'Normal',
        next: 'Normal',
        quickFormat: true,
        run: {
          size: 20,
          bold: true,
        },
        paragraph: {
          spacing: {
            before: 240,
            after: 120,
          },
        },
      },
      // {
      //   id: 'paragraph',
      //   name: 'Paragraph',
      //   basedOn: 'Normal',
      //   quickFormat: true,
      //   paragraph: {
      //     spacing: {
      //       line: 276,
      //       before: 20 * 72 * 0.1,
      //       after: 20 * 72 * 0.05,
      //     },
      //   },
      // },
    ],
  },
  sections: [
    {
      children: document,
    },
  ],
})

I have some questions about how to style some stuff.

  1. How do you add padding before/after a whole list (but not list items or nested lists)?
  2. How do you neatly indent any combination of nested numbered/bulleted lists so each list item is 16px (or equivalent) from the left, and nested ones are 16px further from the parent?

Basically I want like 16px of spacing between paragraphs and lists in a document, and to customize the spacing underneath and above headers based on their font size.

My document looks like this so far, but I would like it to look nicer. Notice how the nested lists aren’t indented at all, and indentation is ugly.

enter image description here

Thanks for the help! Trying to make the list item indentation to look/work like StackOverflow’s markdown indentation for the questions/answers. Basically.

  • nested list
    • list item
    • numbered
      1. one
      2. two

can you gift me one iPhone plZ 🥺 [closed]

Mere pass ak bhe iPhone nahe kya aap mujhe ak iPhone gift kare ge

Can you gift me one iPhone please. iPhones are a very big company, so you can gift us a phone, this will be your gift to us. I will tell this site to someone else. If you gift me, thank you sir.

How to modify HTML structure to ensure two form tags work independently?

I’m working on a web project where I have two form tags on the same page, each serving a different purpose. However, it seems like the inner form tag is not functioning correctly. I suspect it might be due to the nested structure of the forms.

Here’s the structure:

<!DOCTYPE html>
<html lang="en-US">
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Product Cart | BeautySpot - HTML Template for Beauty Salons</title>
        <link rel="shortcut icon" href="images/favicon.ico">

        <!-- STYLESHEETS : begin -->
        <link rel="stylesheet" type="text/css" href="assets/css/general.css"><!-- Default styles generated from assets/scss/general.scss (do not edit) -->
        <link rel="stylesheet" type="text/css" href="assets/css/color-schemes/default.css"><!-- Default color scheme generated from assets/scss/color-schemes/default.scss (change to other pre-defined or custom color scheme) -->
        <link rel="stylesheet" type="text/css" href="style.css"><!-- Place your own CSS into this file -->
        <!-- STYLESHEETS : end -->

    </head>
    <body>

        <!-- WRAPPER : begin -->
        <div id="wrapper">

            <!-- HEADER : begin -->

            <%- html.header %>

            <!-- HEADER : end -->

            <!-- CORE : begin -->
            <div id="core" class="core--narrow">
                <div class="core__inner">

                    <!-- PAGE HEADER : begin -->
                    <div class="page-header">
                        <div class="page-header__inner">
                            <div class="lsvr-container">
                                <div class="page-header__content">

                                    <h1 class="page-header__title">Your Cart</h1>

                                    <!-- BREADCRUMBS : begin -->
                                    <div class="breadcrumbs">
                                        <div class="breadcrumbs__inner">
                                            <ul class="breadcrumbs__list">

                                                <li class="breadcrumbs__item">
                                                    <a href="index.html" class="breadcrumbs__link">Home</a>
                                                </li>

                                                <li class="breadcrumbs__item">
                                                    <a href="product-archive.html" class="breadcrumbs__link">Store</a>
                                                </li>

                                            </ul>

                                        </div>
                                    </div>
                                    <!-- BREADCRUMBS : end -->

                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- PAGE HEADER : end -->

                    <!-- CORE COLUMNS : begin -->
                    <div class="core__columns">
                        <div class="core__columns-inner">
                            <div class="lsvr-container">

                                <!-- MAIN : begin -->
                                <main id="main">
                                    <div class="main__inner">

                                        <!-- PAGE : begin -->
                                        <div class="page product-post-page product-post-order product-post-order--cart">
                                            <div class="page__content">

                                                <!-- PRODUCT CART : begin -->
                                                <form class="product-cart" method="post" action="http://localhost:4000/checkout">

                                                    <!-- CART LIST : begin -->
                                                    <ul class="product-cart__list">

                                                        <% products.forEach(product => { %>
                                                        <!-- CART ITEM : begin -->
                                                        <li class="product-cart__item">

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--thumb">

                                                                <!-- ITEM THUMB : begin -->
                                                                <p class="product-cart__item-thumb">
                                                                    <a href="product-single.html" class="product-cart__item-thumb-link">
                                                                        <img src="<%= product.image %>" class="product-cart__item-thumb-img" alt="<%= product.name %>">
                                                                    </a>
                                                                </p>
                                                                <!-- ITEM THUMB : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--title">

                                                                <!-- ITEM TITLE : begin -->
                                                                <h4 class="product-cart__item-title">
                                                                    <a href="product-single.html" class="product-cart__item-title-link"><%= product.name %></a>
                                                                </h4>
                                                                <!-- ITEM TITLE : end -->

                                                                <!-- ITEM STATUS : begin -->
                                                                <p class="product-cart__item-status product-cart__item-status--in-stock"><!-- You can use "in-stock", "on-order" and "unavailable" modifiers -->
                                                                    <%= product.status %>
                                                                </p>
                                                                <!-- ITEM STATUS : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--quantity">

                                                                <!-- ITEM QUANTITY : begin -->
                                                                <p class="product-cart__item-quantity quantity-field">

                                                                    <input type="text" class="quantity-field__input" value="1">

                                                                    <button type="button" class="quantity-field__btn quantity-field__btn--add" title="Add one">
                                                                        <span class="quantity-field__btn-icon" aria-hidden="true"></span>
                                                                    </button>

                                                                    <button type="button" class="quantity-field__btn quantity-field__btn--remove" title="Remove one">
                                                                        <span class="quantity-field__btn-icon" aria-hidden="true"></span>
                                                                    </button>

                                                                </p>
                                                                <!-- ITEM QUANTITY : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--price">

                                                                <!-- ITEM PRICE : begin -->
                                                                <p class="product-cart__item-price">
                                                                    <%= product.price %>
                                                                </p>
                                                                <!-- ITEM PRICE : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--remove">

                                                                <!-- ITEM REMOVE : begin -->
                                                                <div class="product-cart__item-col product-cart__item-col--remove">
                                                                    <form action="/remove-from-cart" method="POST">
                                                                        <input type="hidden" name="productName" value="<%= product.name %>">
                                                                        <button type="submit" class="product-cart__item-remove-btn">
                                                                            <span class="product-cart__item-remove-btn-icon" aria-hidden="true"></span>
                                                                        </button>
                                                                    </form>
                                                                </div>
                                                                <!-- ITEM REMOVE : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                        </li>
                                                        <!-- CART ITEM : end -->

                                                        <% }); %>

                                                    </ul>
                                                    <!-- CART LIST : end -->

                                                    <!-- CART SUMMARY : begin -->
                                                    <div class="product-cart__summary">

                                                        <!-- CART COUPON : begin -->
                                                        <p class="product-cart__coupon">
                                                            <input type="text" class="product-cart__coupon-input" placeholder="Coupon Code">
                                                            <button type="button" class="product-cart__coupon-btn lsvr-button lsvr-button--type-2">Apply Coupon</button>
                                                        </p>
                                                        <!-- CART COUPON : end -->

                                                        <!-- CART TOTAL : begin -->
                                                        <p class="product-cart__total">
                                                            <span class="product-cart__total-label">Total</span>
                                                            <strong class="product-cart__total-price">$121.60</strong>
                                                        </p>
                                                        <!-- CART TOTAL : end -->

                                                    </div>
                                                    <!-- CART SUMMARY : end -->

                                                    <!-- ORDER FOOTER : begin -->
                                                    <div class="product-order__footer">

                                                        <!-- FOOTER BACK : begin -->
                                                        <p class="product-order__footer-back">
                                                            <a href="product-archive.html" class="product-order__footer-back-link">Back to Store</a>
                                                        </p>
                                                        <!-- FOOTER BACK : end -->

                                                        <!-- FOOTER CHECKOUT : begin -->
                                                        <p class="product-order__footer-checkout">
                                                            <button type="submit" class="product-order__footer-checkout-btn lsvr-button">To Checkout</button>
                                                        </p>
                                                        <!-- FOOTER CHECKOUT : end -->

                                                    </div>
                                                    <!-- ORDER FOOTER : end -->

                                                </form>
                                                <!-- PRODUCT CART : end -->

                                            </div>
                                        </div>
                                        <!-- PAGE : end -->

                                    </div>
                                </main>
                                <!-- MAIN : end -->

                            </div>
                        </div>
                    </div>
                    <!-- CORE COLUMNS : end -->

                </div>
            </div>
            <!-- CORE : end -->

            <!-- FOOTER : begin -->
            
            <%- html.footer %>

            <!-- FOOTER : end -->

        </div>
        <!-- WRAPPER : end -->

        <!-- SCRIPTS : begin -->
        <script src="assets/js/jquery-3.5.1.min.js" type="text/javascript"></script>
        <script src="assets/js/third-party-scripts.min.js" type="text/javascript"></script>
        <script src="assets/js/scripts.js" type="text/javascript"></script>
        <!-- SCRIPTS : end -->

    </body>
</html>

Despite setting different action attributes and ensuring proper method attributes, it seems like the inner form is not working as expected. How can I modify the HTML structure to ensure that both form tags work independently without interfering with each other’s functionality?

Any insights or suggestions would be greatly appreciated. Thank you!

Dynamically Avoiding Routes in Tour Guide App

I’m working on a tour guide project where users can leave comments about road conditions. I want to dynamically adjust the route based on these comments, avoiding certain coordinates (e.g., accidents). How can I implement this using map.js?

avoid routes on the base of specific coordinates

How to join django and js

i have 2 questions.
I have been struggling with this problem for 2 days.

1.What to write in the url when using fetch on a local server

  let formData = new FormData();
  formData.append('sentence', textarea.value);
  let response = await fetch('', {
      method: 'POST',
      body: formData
    });
  console.log(response);
  
}```

   [enter image description here](https://i.stack.imgur.com/kjCFx.png) 

2.How to handle a request using django

```def check_name_s(request):
    if request.method == 'POST':
        print(loads(request.body))
    return 0```

   [enter image description here](https://i.stack.imgur.com/ZihbW.png)


I dont understand how to join.When i click on the post button, the request is sent, but with a 403 error.Sorry i have never worked with js and django

Unable to Remove Products from Cart in Express.js Application

I’m currently working on an Express.js application where users can add products to their cart and remove them as well. However, I’m facing an issue where the product removal functionality doesn’t seem to work as expected.

Here’s a brief overview of how my setup looks:

I have an Express.js route defined for handling POST requests to remove products from the cart.
When a user clicks the remove button for a product, it should send a POST request to the ‘/remove-from-cart’ endpoint with the product name.
In my route handler, I retrieve the product name from the request body, filter out the corresponding product from the session cart, and then redirect the user back to the cart page.

Here is my code for the cart page:

<!DOCTYPE html>
<html lang="en-US">
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Product Cart | BeautySpot - HTML Template for Beauty Salons</title>
        <link rel="shortcut icon" href="images/favicon.ico">

        <!-- STYLESHEETS : begin -->
        <link rel="stylesheet" type="text/css" href="assets/css/general.css"><!-- Default styles generated from assets/scss/general.scss (do not edit) -->
        <link rel="stylesheet" type="text/css" href="assets/css/color-schemes/default.css"><!-- Default color scheme generated from assets/scss/color-schemes/default.scss (change to other pre-defined or custom color scheme) -->
        <link rel="stylesheet" type="text/css" href="style.css"><!-- Place your own CSS into this file -->
        <!-- STYLESHEETS : end -->

    </head>
    <body>

        <!-- WRAPPER : begin -->
        <div id="wrapper">

            <!-- HEADER : begin -->

            <%- html.header %>

            <!-- HEADER : end -->

            <!-- CORE : begin -->
            <div id="core" class="core--narrow">
                <div class="core__inner">

                    <!-- PAGE HEADER : begin -->
                    <div class="page-header">
                        <div class="page-header__inner">
                            <div class="lsvr-container">
                                <div class="page-header__content">

                                    <h1 class="page-header__title">Your Cart</h1>

                                    <!-- BREADCRUMBS : begin -->
                                    <div class="breadcrumbs">
                                        <div class="breadcrumbs__inner">
                                            <ul class="breadcrumbs__list">

                                                <li class="breadcrumbs__item">
                                                    <a href="index.html" class="breadcrumbs__link">Home</a>
                                                </li>

                                                <li class="breadcrumbs__item">
                                                    <a href="product-archive.html" class="breadcrumbs__link">Store</a>
                                                </li>

                                            </ul>

                                        </div>
                                    </div>
                                    <!-- BREADCRUMBS : end -->

                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- PAGE HEADER : end -->

                    <!-- CORE COLUMNS : begin -->
                    <div class="core__columns">
                        <div class="core__columns-inner">
                            <div class="lsvr-container">

                                <!-- MAIN : begin -->
                                <main id="main">
                                    <div class="main__inner">

                                        <!-- PAGE : begin -->
                                        <div class="page product-post-page product-post-order product-post-order--cart">
                                            <div class="page__content">

                                                <!-- PRODUCT CART : begin -->
                                                <form class="product-cart" method="post" action="http://localhost:4000/checkout">

                                                    <!-- CART LIST : begin -->
                                                    <ul class="product-cart__list">

                                                        <% products.forEach(product => { %>
                                                        <!-- CART ITEM : begin -->
                                                        <li class="product-cart__item">

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--thumb">

                                                                <!-- ITEM THUMB : begin -->
                                                                <p class="product-cart__item-thumb">
                                                                    <a href="product-single.html" class="product-cart__item-thumb-link">
                                                                        <img src="<%= product.image %>" class="product-cart__item-thumb-img" alt="<%= product.name %>">
                                                                    </a>
                                                                </p>
                                                                <!-- ITEM THUMB : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--title">

                                                                <!-- ITEM TITLE : begin -->
                                                                <h4 class="product-cart__item-title">
                                                                    <a href="product-single.html" class="product-cart__item-title-link"><%= product.name %></a>
                                                                </h4>
                                                                <!-- ITEM TITLE : end -->

                                                                <!-- ITEM STATUS : begin -->
                                                                <p class="product-cart__item-status product-cart__item-status--in-stock"><!-- You can use "in-stock", "on-order" and "unavailable" modifiers -->
                                                                    <%= product.status %>
                                                                </p>
                                                                <!-- ITEM STATUS : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--quantity">

                                                                <!-- ITEM QUANTITY : begin -->
                                                                <p class="product-cart__item-quantity quantity-field">

                                                                    <input type="text" class="quantity-field__input" value="1">

                                                                    <button type="button" class="quantity-field__btn quantity-field__btn--add" title="Add one">
                                                                        <span class="quantity-field__btn-icon" aria-hidden="true"></span>
                                                                    </button>

                                                                    <button type="button" class="quantity-field__btn quantity-field__btn--remove" title="Remove one">
                                                                        <span class="quantity-field__btn-icon" aria-hidden="true"></span>
                                                                    </button>

                                                                </p>
                                                                <!-- ITEM QUANTITY : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--price">

                                                                <!-- ITEM PRICE : begin -->
                                                                <p class="product-cart__item-price">
                                                                    <%= product.price %>
                                                                </p>
                                                                <!-- ITEM PRICE : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                            <!-- ITEM ITEM COL : begin -->
                                                            <div class="product-cart__item-col product-cart__item-col--remove">

                                                                <!-- ITEM REMOVE : begin -->
                                                                <div class="product-cart__item-col product-cart__item-col--remove">
                                                                    <form action="/remove-from-cart" method="POST">
                                                                        <input type="hidden" name="productName" value="<%= product.name %>">
                                                                        <button type="submit" class="product-cart__item-remove-btn">
                                                                            <span class="product-cart__item-remove-btn-icon" aria-hidden="true"></span>
                                                                        </button>
                                                                    </form>
                                                                </div>
                                                                <!-- ITEM REMOVE : end -->

                                                            </div>
                                                            <!-- ITEM ITEM COL : end -->

                                                        </li>
                                                        <!-- CART ITEM : end -->

                                                        <% }); %>

                                                    </ul>
                                                    <!-- CART LIST : end -->

                                                    <!-- CART SUMMARY : begin -->
                                                    <div class="product-cart__summary">

                                                        <!-- CART COUPON : begin -->
                                                        <p class="product-cart__coupon">
                                                            <input type="text" class="product-cart__coupon-input" placeholder="Coupon Code">
                                                            <button type="button" class="product-cart__coupon-btn lsvr-button lsvr-button--type-2">Apply Coupon</button>
                                                        </p>
                                                        <!-- CART COUPON : end -->

                                                        <!-- CART TOTAL : begin -->
                                                        <p class="product-cart__total">
                                                            <span class="product-cart__total-label">Total</span>
                                                            <strong class="product-cart__total-price">$121.60</strong>
                                                        </p>
                                                        <!-- CART TOTAL : end -->

                                                    </div>
                                                    <!-- CART SUMMARY : end -->

                                                    <!-- ORDER FOOTER : begin -->
                                                    <div class="product-order__footer">

                                                        <!-- FOOTER BACK : begin -->
                                                        <p class="product-order__footer-back">
                                                            <a href="product-archive.html" class="product-order__footer-back-link">Back to Store</a>
                                                        </p>
                                                        <!-- FOOTER BACK : end -->

                                                        <!-- FOOTER CHECKOUT : begin -->
                                                        <p class="product-order__footer-checkout">
                                                            <button type="submit" class="product-order__footer-checkout-btn lsvr-button">To Checkout</button>
                                                        </p>
                                                        <!-- FOOTER CHECKOUT : end -->

                                                    </div>
                                                    <!-- ORDER FOOTER : end -->

                                                </form>
                                                <!-- PRODUCT CART : end -->

                                            </div>
                                        </div>
                                        <!-- PAGE : end -->

                                    </div>
                                </main>
                                <!-- MAIN : end -->

                            </div>
                        </div>
                    </div>
                    <!-- CORE COLUMNS : end -->

                </div>
            </div>
            <!-- CORE : end -->

            <!-- FOOTER : begin -->
            
            <%- html.footer %>

            <!-- FOOTER : end -->

        </div>
        <!-- WRAPPER : end -->

        <!-- SCRIPTS : begin -->
        <script src="assets/js/jquery-3.5.1.min.js" type="text/javascript"></script>
        <script src="assets/js/third-party-scripts.min.js" type="text/javascript"></script>
        <script src="assets/js/scripts.js" type="text/javascript"></script>
        <!-- SCRIPTS : end -->

    </body>
</html>

Here’s the relevant part of my app.js file:

app.post('/remove-from-cart', (req, res) => {
  const { productName } = req.body;

  // Remove the product from the session cart
  if (req.session.cart) {
      req.session.cart = req.session.cart.filter(product => product.name !== productName);
  }

  // Redirect back to the cart page
  res.redirect('/cart');
});



However, despite implementing this functionality, when I click the remove button, instead of removing the product from the cart, it redirects me to the checkout page.

I’m struggling to figure out why the product removal isn’t working as expected. Could someone please help me troubleshoot this issue? Any insights or suggestions would be greatly appreciated. Thank you!

No such file or directory using fs to load a file in same directory

I am using ExpressJS and NodeJS. I am trying to load a json file from my server as a test. The json file is in the same location as the javascript file that is trying to read the json file but it says it cannot find the file even when i used relative path.

fs.readFile('./customers.json', 'utf8', (err, data) => {
    if (err) {
        console.log("ERROR: " + err);
    } else {
        jsonData = JSON.parse(data);
        res.json(data);
    }
});

The error i get when i go to localhost:3000/customers:

[0] ERROR: Error: ENOENT: no such file or directory

Am i using the wrong path i am a bit confused what is wrong here since they are both in the same folder:

enter image description here

SolidJS + Leaflet: Picking Location on Map

The handlePicker function is not fully working. It does not pick the location with marker. Is there any library for Solidjs or Solution

import { Title } from "@solidjs/meta";
import L, { LatLng } from "leaflet";
import { FaSolidLocationCrosshairs } from "solid-icons/fa";
import { createEffect, createSignal, onMount } from "solid-js";
import useMap, { buildMap } from "~/components/useMap";
export default function PublishPage() {
    const [latlng, setLatlng] = createSignal<LatLng>()
    let mapDiv: HTMLDivElement;
    let map: L.TileLayer | undefined;
    let pin: any;

    onMount(() => {
        map = buildMap(mapDiv)
    })

    function handlePicker(ev: any) {
        console.log(ev.latlng)
        setLatlng(new LatLng(ev.latlng.lat, ev.latlng.lng))
        if (typeof pin == "object") {
            pin.setLatLng(ev.latlng);
        } else {
            pin = L.marker(ev.latlng, { riseOnHover: true, draggable: true });
            pin.addTo(map);
            pin.on('drag', function (ev: any) {
                setLatlng(ev.latlng)
            });
        }
    }

    createEffect(() => {

        if (map) {
            map.on("click", handlePicker)

            return () => {
                map?.off("click", handlePicker)
            }
        }
    }, [])

    return (
        <div>
            <Title>Publish App</Title>
            <div class="h-[90vh] flex items-center justify-center text-[#222]">
                <div class="shadow border rounded-lg p-6 w-[80dvh]">
                    <div class="text-center">
                        <h2 class="text-3xl font-bold">
                            Publish
                        </h2>
                    </div>
                    <div class="my-4">
                        <div class="cursor-[pointer_!important]">
                            <div class="w-full h-[20rem] rounded-lg" ref={mapDiv} />
                        </div>
                        <div class="mt-2 flex justify-end">
                            <button class="border shadow px-4 py-2">
                                <FaSolidLocationCrosshairs />
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    )
}

Svg doesn’t open from a blob storage

I am writing a web app that’s supposed to open a svg from a zip using the zip.js library

<img src="" type="image/svg+xml" id="v">

Changing the image type in the html code doesn’t seem to resolve the issue. When I open the blob link it has the svg code so that isn’t the case either.

document.getElementById("v").src = blobURL;

This is the code snippet responsible for setting the image source to the url

How would I redraw the lives count in my game (p5.js)

I’m making a game in which you try to click the darker circle from a group of randomly placed circles. When you click the correct circle, it re-randomizes it. When you click the incorrect circle, it’s supposed to decrease the lives count and redraw it but instead, draws initially and doesn’t update. When you click 3 wrong circles, it clears everything (and will display a “you died” screen) but when you click the right circle, just clears the non-updating lives count but the lives system still works.

const circlesToMake = 50;
let circles, r, g, b, lives;

function setup() {
  createCanvas(600, 450);
  background(32);
  noStroke();
  setupCircles();
  drawCircles();
  fill(0);
  noLoop();
}

function setupCircles() {
  circles = []
  lives = 3;
  r = random(20, 255)
  g = random(20, 255)
  b = random(20, 255)

  while (circles.length < circlesToMake) {
    const circle = {
      x: random(width),
      y: random(height),
      r: 20,
      d: 40
    };

    let overlapping = false;
    for (let j = 0; j < circles.length; j++) {
      const other = circles[j];
      const d = dist(circle.x, circle.y, other.x, other.y);

      if (d < circle.r + other.r) {
        overlapping = true;
        break;
      } else if (circle.x < 0 + circle.d 
        || circle.x > width - circle.d) {
        overlapping = true;
        break;
      } else if (circle.y < 0 + circle.d || circle.y > height - circle.d) {
        overlapping = true;
        break;
      }
    }

    if (!overlapping) {
      circles.push(circle);
    }
  }
}

function drawCircles() {
  clear();
  circles.forEach(c => {
    fill(r, g, b, 200); ellipse(c.x, c.y, c.r * 2, c.r * 2);
  });

  fill(r, g, b, 220); // make the target easy to identify for development purposes
  const target = circles[0];
  ellipse(target.x, target.y, target.r * 2, target.r * 2);
}

function youDied() {
  clear();
  print("e");
}

function draw() {
  text(`lives: ${lives}`, 20, 20);
}

function mousePressed() {
  if (dist(mouseX, mouseY, circles[0].x, circles[0].y) < circles[0].r) {
    setupCircles();
    drawCircles();
  } else {
    const anyClicked = circles.some(c => dist(mouseX, mouseY, c.x, c.y) < c.r);
    if (anyClicked && --lives === 0) {
      youDied();
    }
  }
}

Creating HTML table from Json URL

I need support for creating a table generated from this Json url: ” https://search.lib.ou.ac.lk/cgi-bin/koha/svc/report?id=629try this .

The data generated this format: [[167208,”8170002583″,”Information technology in libraries”],[167215,”9556070346″,”Impediments to regional economic cooperation in South Asia”],[167190,”9789553038630″,”Jene Booster”],

The Structure: | biblionumber | isbn | title

I try this code but it does not work. Please help.

  const requestJSON = async url => {
  const response = await (await fetch(url)).json();
  biblionumber.innerHTML = response.squadName;
  isbn.innerHTML = response.homeTown;
  title.innerHTML = response.formed;
  } requestJSON(requestUrl);
type here

I need to display date into html table

Throwing custom error object appears as [Object object]

Link to the code that reproduces this issue

https://github.com/carlos-dubon/nextjs-error-bug

To Reproduce

// app/page.tsx

async function getData(): Promise<number> {
    throw {
        message: 'MY CUSTOM ERROR',
        name: 'My new error',
        cause: 'custom error',
    };
   return 3;
}

export default async function Home() {
    const pageData = await getData();

    return (
        <div>{pageData}</div>
    );
}

Current vs. Expected behavior

Throwing a custom error object appears as [Object object] in my app/error.ts file. I get a digest but the error is still [Object object] so it isn’t helpful at all. I need this because our apps use a common package for calling our apis, and i can’t simply modify it to suit only our web app.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
Binaries:
  Node: 20.10.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Godaddy, domains API, Automatic subdomain creation node.js

my problem is that I can’t create a CNAME record in DNS for my domain. I want to create subdomains through code using axios queries. But for some reason, I am constantly being told that the domain does not exist or the wrong zone file.

Code:

const axios = require('axios');

class Domains {
constructor(domain, apiKey, apiSecret) {
this.domainName = domain;
this.apiKey = apiKey;
this.apiSecret = apiSecret;
this.apiBaseUrl = 'https://api.ote-godaddy.com/v1';
}

    async createSubdomain(subdomain) {
        const headers = {
            headers: {
                Authorization: `sso-key ${this.apiKey}:${this.apiSecret}`
            }
        };
    
        try {
            const newRecord = [
                {
                    type: "CNAME",
                    data: this.domainName,
                    ttl: 600
                }
            ];
    
            const putResponse = await axios.put(`${this.apiBaseUrl}/domains/${this.domainName}/records/CNAME/${subdomain}`, newRecord, headers);
            
            if (putResponse.status === 200) {
                console.log(`Subdomain ${subdomain}.${this.domainName} successfully created`);
                console.log('Server response:', putResponse.data);
            } else {
                console.error(`Error creating subdomain: ${putResponse.status}`);
            }
        } catch (error) {
            console.error('An error occurred:', error.response ? error.response.data : error.message);
        }
    }

}

module.exports = Domains;

Error

I need to create automatically the subdomain for my domain via node.js script (axios or whatever stands for requests).

Unable to use multiple proxies with puppeteer

What is the best way to set up multiple proxies with puppeteer? I tried the following:

const puppeteer = require('puppeteer');

(async () => {
    const proxies = [
        'socks5://myusername:mypassword@myhost:myport',
        'socks5://myusername:mypassword@myhost:myport',
        'socks5://myusername:mypassword@myhost:myport'
    ];

    const openWindow = async (proxyUrl) => {
        const browser = await puppeteer.launch({
            headless: false,
            args: [`--proxy-server=${proxyUrl}`]
        });

        const page = await browser.newPage();
        page.setDefaultNavigationTimeout(0);

        await page.authenticate({
            username: 'myusername', // Replace with your proxy username
            password: 'mypassword' // Replace with your proxy password
        });

        await page.setViewport({
            width: 992,
            height: 607
        });

        await page.goto('https://dnsleaktest.com');

        console.log(`Window opened with proxy: ${proxyUrl}`);

          };

    // Open windows with proxies
    for (const proxy of proxies) {
        // Open multiple windows per proxy
        for (let i = 0; i < 3; i++) {
            await openWindow(proxy);
        }
    }

    console.log('All windows opened.');
})();

However, it does not work and I get the following message instead:

Error: net::ERR_NO_SUPPORTED_PROXIES at https://dnsleaktest.com

Background: The application previously worked with a single proxy configuration, but the issue arose when attempting to introduce support for multiple proxies.
Each scraper instance runs in its Chrome window, with one proxy configured per window for isolation and parallel scraping purposes.

Single Window Code:

const puppeteer = require('puppeteer');

const proxy = 'myip:myport';
const username = 'myusername';
const password = 'mypassword';

(async () => {
    // Pass proxy URL into the --proxy-server arg
    const browser = await puppeteer.launch({
        args: [`--proxy-server=${proxy}`],
        headless: false,
        ignoreHTTPSErrors: true
    });

    const page = await browser.newPage()
    page.setDefaultNavigationTimeout(0);

    // Authenticate your proxy with the username and password defined above
    await page.authenticate({ username, password });

    await page.goto('https://dnsleaktest.com');

    
})();