Bootstarp 5 modal with ajax

<button type="button" class="btn btn-xs btn-icon btn-outline-primary mr-1 waves-effect waves-light" data-toggle="modal-feeed" data-target="#modal_sm" data-feed="accounts/balance/add/{{ $reseller['id'] }}"><i class="feather icon-dollar-sign"></i></button>

The above code is working for Bootstrap version 4.

but it comes to Bootstrap 5 then it’s not working. only modal is pop up but ajax not working

code sample for Bootstrap 5

<button type="button" class="btn btn-xs btn-icon btn-outline-primary mr-1 waves-effect waves-light" data-bs-toggle="modal" data-bs-target="#modal_sm" data-bs-feed="accounts/balance/add/{{ $reseller['id'] }}"><i class="feather icon-dollar-sign"></i></button>

How to execute react callback when a toolbar button is pressed as a part of CKEditor 5

There is a React project and CKEditor 5 custom classic build.

Let’s say we have a React component App which renders <CKEditor5 /> as a part of JSX. As for CKEditor itself, its toolbar has a custom button.

export const App = () => {
  // It should be executed on click
  const callbackToRun = useCallback(() => {
    // any logic to execute on toolbar's button click
  }, []);

  return (
    // CKE has a custom button in a toolbar. We'd like to run a callback when it is pressed.
    <CKEditor5 />
  );
}

What is an optimal approach to run a React logic (aka function/callback) that resides in the parent React component ‘App’ when we click on a button on CKE5 toolbar?

From what I think, there are such options as:

  1. Pass a callback as a part of config, extract it from a config when we click on a toolbar button inside a custom command.
export const App = () => {
  const callbackToRun = useCallback(() => {}, []);

  return (
    <CKEditor5 config={callbackToRun} />
  );
}

Next, we implement a basic command that extracts callback from a config and run it. The command is bound to a button click as a part of UI CKEditor5 logic (skipping this part of code, it is pretty common).

import { Command } from '@ckeditor/ckeditor5-core';

export class HandleToolbarButtonClickCommand extends Command {
    execute() {
        this.editor.config.get('callbackToRun')();
    }
}
  1. Second possible approach is to get an instance of editor to React parent component. Then listen to execute event or similar event.
export const App = () => {
  const editorInstance = useRef(null);
  const handleReady = (editor) => editorInstance.current = editor;

  const callbackToRun = useCallback(() => {}, []);

  // ??? Should we listen to execute command somehow or toolbar button click somehow?
  useEffect(() => {
    // Pseudo code below
    // editorInstance.listenTo(..., callbackToRun);
  }, []);

  return (
    <CKEditor5 onReady={handleReady} />
  );
}

What is the best way to handle a such situation when the part of react logic must be executed on a CKEditor5 toolbar button click?

How to shorten stringto dots inbetween beginning and ending of string

I wonder how I would shorten the text seen below to fit its container. The width of the container varies, depending on screen size. In order to fit its container, the strings inbetween the first and last words shall be replaced by as many dots as needed in order for it to fit the container, so something like Sydney - ... - Quito. Ideally, it only replaces whole words (like Doha, Singapur, …) and preserves the dash - after the first word/before the last word.

.container {
    background-color: hotpink;
    width: 200px;
    white-space: nowrap
}
<div class='container'>
  <p class='route'>Sydney - Doha - Singapur - Capetown - Quito</p>
</div>

Is there a CSS and/or JvaScript solution for this?

Firebase signInWithPopup function closes immediately in nextjs project

I’m using the signInWithPopup function to sign in. It works in the development stage (local server).

  const firebaseAuth = getAuth(app);
  const provider = new GoogleAuthProvider();
  const [{ user, cartShow, cartItems }, dispatch] = useStateValue();

  const [isMenu, setIsMenu] = useState(false);

  const login = async () => {
    if (!user) {
      const {
        user: { refreshToken, providerData },
      } = await signInWithPopup(firebaseAuth, provider);
      dispatch({
        type: actionType.SET_USER,
        user: providerData[0],
      });
      localStorage.setItem("user", JSON.stringify(providerData[0]));
    } else {
      setIsMenu(!isMenu);
    }
  };

I uploaded my project to Vercel. I tried using different browsers such as Chrome, Edge, Opera. Also, I gave permission for ‘Pop-ups and redirects’. But it didn’t work. The popup window closes shortly after I call it.

WebAudioAPI: Non-started oscillators still consume resources, stutter and crash – too many?

Really a number of questions about the Web Audio API here, like: Is there a limit to how many nodes you can have in a graph? How do I know if I am approaching the limit? Why do non-started nodes still consume resources?

Here is a JSFiddle for reference: https://jsfiddle.net/Lv84woph/

When you hit “play” it plays a sequence of 12 chords. The function creates 36 OscillatorNode (3 notes per chord). If you increase repetitions to 2, it will play the sequence twice – scheduling 72 notes total, doubling the play time.

If you increase repetitions to 200, it will schedule 7200 and might stutter or play and then cut off – signs of resource starvation. If you increase it to 1000 then it’ll probably crash the page.

Note that at no point is polyphony ever greater than 3 notes at once: adding more repetitions just causes more oscillators started at the end of the sequence (not overlapping). These should be inactive, not playing, contributing nothing to resource usage. Why, then, do these new nodes cause problems for the entire graph?

One way to work around this would be to run a companion scheduler with setTimeout() and have that put new notes in (e.g. have it schedule the next pattern loop), to avoid creating too many at once. An approach like this for creating a metronome is described here: https://web.dev/audio-scheduling/ However, how do I know how many notes is “safe”? It varies by device, so, will the browser tell me?

And why should I have to care about this at all? If the WebAudio API’s entire thing is “create as many nodes as you want, one for every note in fact, they’re basically free” then why does scheduling e.g. a MIDI file’s worth of nodes flatly not work?

I’m getting error cannot find namespace “PowerBI”

I’m getting error cannot find namespace “PowerBI”

I’m new to javascript and i was trying this:
Create a dialog box class for your dialog box. The initialState parameter in openModalDialog is passed to the dialog contractor upon its creation. Use the initialState object to pass parameters to the dialog box, in order to affect its behavior or appearance.

The dialog code can use these IDialogHost methods:

IDialogHost.setResult(result:object) – The dialog code returns a result object that will be passed back to its calling visual.
IDialogHost.close(actionId: DialogAction, result?:object) – The dialog code can programmatically close the dialog and provide a result object back to its calling visual.

 " import DialogConstructorOptions = powerbi.extensibility.visual.DialogConstructorOptions;

import DialogAction = powerbi.DialogAction;

export class DatePickerDialog {
static id = “DatePickerDialog”;

constructor(options: DialogConstructorOptions, initialState: object) {
    const host = options.host;
    
    // … dialog rendering implementation …
    
    myCalender.onValueChange((currentValue) => {
        pickedDate = currentValue.toLocaleDateString()
        host.setResult({ date: pickedDate });
    });

    myCalender.handleConfirm( () => {
        host.close(DialogAction.Close, {date: pickedDate});
    })
}

} ”
This was my code.

React game play table

I want to create one game like this,

https://www.figma.com/file/ZIsHtyoU6lcwuiOnItr7RM/User-Join-Figma?type=design&node-id=0-1&t=XdbIRP5vyVKmtdqH-0

In above figma I’ve shown how it should be, In user1’s screen the first player should be bottom of the screen (Like in circle, he should be in 0deg. In all other players screen who ever the owner of the screen, he should be in bottom of the screen.

I don’t know how to make this, If 4 players are in the table, in their screens they should be in the bottom of the screen to play their cards. All other players allocated accordingly behalf of players count

Bug with google pay button by Stripe

when i use Payment Request Button cho my website(nuxtjs, stripe), with google pay button.
This button work for me but some people has a bug in console:

Unable to download payment manifest "https://pay.google.com/about/".

and they cant see this button.

Please help me resovle it

I spend 4 hours in internet and cant find anything to fix it

Why is my HTML form refreshing instead of alerting once it’s submitted, despite adding onsubmit=”return false”>? and is throwing some error?

Why is this simple HTML and Javascript not working?

I just need to alert once the form is submitted. It instead is refreshing and throwing an error and sometimes throwing a CORS error also, if use type as module.

HTML File

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Home</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <link rel="stylesheet" href="styles.css" />
    <script type="JavaScript" src="script.js"></script>
  </head>
  <body>
    <form onsubmit="addUser(); return false">
      <label for="fname">First name:</label><br />
      <input type="text" id="fname" name="fname" value="" required /><br />
      <label for="lname">Last name:</label><br />
      <input type="text" id="lname" name="lname" value="" required /><br />
      <label for="lname">Phone number:</label><br />
      <input type="number" id="phone" name="phone" value="" required /><br /><br />
      <input type="submit" value="Submit" />
    </form>
  </body>
</html>

JavaScript File

function addUser() {
  console.log('Hello');
  alert('Hello');
}

Suddenly i am getting a runtime error when using fontawesome Library in my react Application

I am getting this run time error so anyone has any idea what is is?(https://i.stack.imgur.com/9eeWu.png)](https://i.stack.imgur.com/9eeWu.png)

I am using fontawesome library for icons in my react application but don’t know from past 2 days am getting this runtime error.

I have also deleted the node modules and package-lock.json multiple time but still same issue is there so nay help or lead would be helpful.

Thanks in advance for the help.

how do i zoom in and out with charts asp net mvc?

i want to be able to zoom in and out of a chart in aspnet mvc.
can anybody help me? I would appreciate it. I want to create a chart in aspnet mvc where I can view the values every few minutes (on the x axis, the date and time axis) and when I zoom in, be able to view the values that were added in seconds?
those are my controller and view so far which displays every value added to my table every few seconds:
controller:

public IActionResult ShowData()
        {
            // Retrieve chart data and pass it to the view
            List<object> chartData = GetData();
            ViewBag.ChartData = chartData;

            return View();
        }

  [HttpPost]
  public List<object> GetData()
        {
            List<object> data = new List<object>();       
            List<string> labels = mvcDemoDbContext.Trss
           .OrderBy(p => p.Date)
           .Select(p => p.Date.ToString("HH:mm:ss"))
           .ToList();
            data.Add(labels);

            List<long?> values = mvcDemoDbContext.Trss.OrderBy(p => p.Date).ThenBy(p => p.Id).Select(p => p.TRSValue).ToList();
            data.Add(values);

            return data;

        }

and view:

<div class="chart-container">
        <canvas id="myChart"></canvas>
    </div>
@section scripts {
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>    
    <script type="text/javascript">
        // Retrieve chart data from ViewBag
        var chartData = @Html.Raw(Json.Serialize(chartData));

        // Extract labels and values from chartData
        var labels = chartData[0];  //0
        var values = chartData[1];   //1

        // Create a chart using Chart.js
        var ctx = document.getElementById('myChart').getContext('2d');
        var myChart = new Chart(ctx, {
            type: 'line',
            data: {
                labels: labels,
                datasets: [{
                    label: 'TRS Values',
                    data: values,
                    backgroundColor: 'rgba(0, 123, 255, 0.3)',
                    borderColor: 'rgba(0, 123, 255, 1)',
                    borderWidth: 1,
                    pointRadius: 0,
                    fill: 'start'
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                scales: {
                    x: {
                        display: true,
                        title: {
                            display: true,
                            text: 'Date'
                        }

                    },
                   
                    y: {
                        display: true,
                        title: {
                            display: true,
                            text: 'TRS Value (%)'       
                        }
                    }
                }
            }
        });
  },
                error: function (xhr, status, error) {
                    console.log(error);
                }
            });
        }


        // Refresh data every 20 seconds
        setInterval(refreshData, 20000);

        refreshData();
    </script>
}

Thank u so much in advance!

How to view a pdf file through url in angular 14

How can I show a pdf file through a URL I have used the iframe but it is directly downloading the file,
I have checked it with ng2-pdf-viewer but it is not opening the URL, the URL is like this:-
https://borrowerfiles.file.core.windows.net/files/Ter_Stegen_6464910d6803200f51fa5e04_CE1000434/individual_kyc/4e7ebfbc-2138-4444-9eab-6e82ea1be577_19_05_23_083548.pdf?sv=2020-02-10&se=2023-05-24T05%3A59%3A17Z&sr=s&sp=r&sig=VQ668g6Dtbl1hQFxLQ82VQthnHje2VCq2W72TBI2qjk%3D

I have tried ng2-pdf-viewer, and I tried ngx-extended-pdf-viewer but this is a throwing error in angular 14 on compile time the error was Module ‘”ngx-extended-pdf-viewer”‘ has no exported member
‘PdfViewerModule’;