Ionic Capacitor (Angular): how to prevent closing of keyboard after “submit” with enter key

In Ionic Capacitor (I am using Angular): How do I keep displaying the keyboard open, prevent it from closing, when the user submits the form or input?

I know there are questions like this one on StackOverflow, but they refer to Ionic Cordova and not Ionic Capacitor.

I want this to work on native IOS/Android, I don’t care about PWA. (and dont care about Desktop-Web of course, since it doesnt even have a keyboard on the screen).

Blazor Java script interop

I have this javascript library that is written in TypeScript

(function(f) {
    if (typeof exports === "object" && typeof module !== "undefined") {
        module.exports = f()
    } else if (typeof define === "function" && define.amd) {
        define([], f)
    } else {
        var g;
        if (typeof window !== "undefined") {
            g = window
        } else if (typeof global !== "undefined") {
            g = global
        } else if (typeof self !== "undefined") {
            g = self
        } else {
            g = this
        }
        g.richTextEditor = f()
    }
}
)(function() {
    var define, module, exports;
    return (function() {
        function r(e, n, t) {
            function o(i, f) {
                if (!n[i]) {
                    if (!e[i]) {
                        var c = "function" == typeof require && require;
                        if (!f && c)
                            return c(i, !0);
                        if (u)
                            return u(i, !0);
                        var a = new Error("Cannot find module '" + i + "'");
                        throw a.code = "MODULE_NOT_FOUND",
                        a
                    }
                    var p = n[i] = {
                        exports: {}
                    };
                    e[i][0].call(p.exports, function(r) {
                        var n = e[i][1][r];
                        return o(n || r)
                    }, p, p.exports, r, e, n, t)
                }
                return n[i].exports
            }
            for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)
                o(t[i]);
            return o
        }
        return r
    }
    )()({
        1: [function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: true
            });
            exports.showHello = void 0;
            const greet_1 = require("./greet");
            function showHello(divName, name) {
                const elt = document.getElementById(divName);
                elt.innerText = (0,
                greet_1.sayHello)(name);
            }
            exports.showHello = showHello;

        }
        , {
            "./greet": 2
        }],
        2: [function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: true
            });
            exports.sayHello = void 0;
            function sayHello(compiler) {
                return `Hello from ${compiler}`;
            }
            exports.sayHello = sayHello;

        }
        , {}]
    }, {}, [1])(1)
});

and I am trying to execute showHello function in this library using JSInterop in Blazor using following code

public class TypeScriptInterop
{
    private readonly Lazy<Task<IJSObjectReference>> _moduleTask;

    public TypeScriptInterop(IJSRuntime jsRuntime)
    {
        _moduleTask = new(()=>
        jsRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Blazored.RichTextEditor/js/bundle.generated.js").AsTask());
    }

    public async ValueTask TsButtonClicked()
    {
        var javaScript = await _moduleTask.Value;
        if (_moduleTask.IsValueCreated)
        {
            Console.WriteLine("Captured Js");
        }
        await javaScript.InvokeVoidAsync("richTextEditor.showHello", "greeting", "Ubhaya");
    }
}

when I run this I get the error message saying

WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not find ‘richTextEditor.showHello’ (‘richTextEditor’ was undefined).

but if I use <script src="./_content/Blazored.RichTextEditor/js/bundle.generated.js"></script> inside the index.html in blazor wasm project. it works correctly.

I am trying to create a Blazor component library. is there a way to do this in my current approach since I want to use JS isolation.

How to preserve GPT-3/4 base knowledge when adding indexed data?

I’m conducting experiments with LangchainJS, Pinecone, and OpenAI.

My goal is to use the model (for now GPT-3, as I still don’t have GPT-4 API access) to assist me in my coding job by adding new data on specific frameworks.

I have already indexed the craft.js documentation and codebase, and by using both ConversationalRetrievalQAChain or Agent by creating a tool for this specific index, the model is quite capable of answering my questions.

The issue I’m facing is that I feel it loses its base capacities. For example, it is never able to generate code based on that information, or worse, if I ask it to generate code on another framework (e.g., Next.js), it either tells me it doesn’t know or gives me a nonsensical response like “Even though we can create Next.js components using Craft.js, it is not the best tool to achieve this task.”

But if I try this prompt:

Generate a Next.js component that allows file uploads.

in the playground or with model.call(prompt), it generate a nearly perfect code.

It seems that when I add embeddings to the model, it becomes overly focused on this new data and loses some of its power.

Is there a way to maintain the power of the base model and add new knowledge to it? If so, what is the best approach to achieve this?

Want to open a quick create form after creating a new account in Microsoft Dynamics 365 Sales

I want to open a Quick Create Task form with the regarding field prepopulated with the newly created account’s name. When a new account is being created in dynamics 365 sales it open a quick create for for the task but it is not being prepopulated with the account name that i just created. the account name should be prepopulated in the regarding field which is a lookup field to the accounts on the task form.

function taskFormAccount() {
    var formType = Xrm.Page.ui.getFormType();
    if (formType === 1) {
        Xrm.Navigation.openForm({
            entityName: "task",
            useQuickCreateForm: true
        });
    }
}

Update this code so that when account is created it should open quick create form of task prepopultaed with account lookup in the regarding field in Task form in dynamcs 365 sales

how to remove child data from array javascript

How to remove selected item and nested item too from array using javascript

function filterID(id, data) {
  return data.reduce((arr, item) => {
    if (item.id != id) {
      if (item.children) item.children = filterID(id, item.children)
      arr.push(item)
    }
    return arr   
  }, [])
}

https://jsfiddle.net/p5fxhcbk/1/

Please help on this

Thank You

it should also removed JZLS37EVZQM22H9Q4659 item as well since it is child element of JZLS37EVZQM22H9Q4655

Why redux store deletes when click on tag?

I want to replace the tag element with something else if possible in such a way to be able to keep the redux store. I tried Link or NavLink but it is not working. I want to keep the redux store without a persistent feature.
My app works fine on all screens without a persistent store but when I click on a tag the store is deleted and I have to login back.

How to show YouTube settings menu with custom button?

I want to show YouTube settings menu with custom button, how can i do that?

chrome.runtime.onMessage.addListener((obj, sender, response) => {
const { type, value, videoId } = obj;

if (type === 'UPPER') {
  const upper = document.querySelector('.ytp-settings-menu');
  upper.style.removeProperty('display');
}

});

Can’t scroll to field when call field.focus() in ios browsers in web application

I create a form validation for my app. Now I test it for mobile devices. There is form with several fields and a “Submit” button below. When I click the button and the required field is empty, field.focus() method invoked. Focus causes scrolling to the field by design. It works fine on android devices on any browser, but there’s no scroll to field on ios browsers (safari and chrome as well), only when I already focused on this field. When field was not focused originally, it works fine.

There’s a picture to better understand the problementer image description here

  1. Tap on ‘name’ field

  2. Keyboard opens so field goes beyond view

  3. Tap on ‘submit’ and app call field.focus()

  4. I expect view scroll to ‘name’ field (that’s how .focus() should work and it work on android or desktop, but not in ios) but it doesn’t happen

I tried to call field.scrollIntoView(), but it cancells field.focus(). I cant find a way to make them works together

What should I do?

Thank you in advance!

i want to create a 2 mode Go game, currently i want to have a game mode with AI using minimax or pruning Alpha-beta with javascript

The code starts as follows

This code to define the table if possible can you give me a reference to the html code. Thank you

const BLACK = 'black'
const WHITE = 'white'
const PREVIOUS = 'previous'
const L = 'l'
const O = 'o'


let previousStone

let boardState = [
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
    L, L, L, L, L, L, L, L, L, O, O, O, O, O, O, O, O, O,
]

I tried the code and Ai doesn’t work when running with html

MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster even though Allow Access from anywhere is set

I’m getting this error while trying to connect to mongoose.

/home/runner/SkrivInBussar/node_modules/mongoose/lib/connection.js:755
    err = new ServerSelectionError();
          ^

MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/

The thing is that it worked yesterday, and I haven’t changed anything. I have Allow access from anywhere enabled, and my password + user both works. Is the problem due to some rate limit or something?

I’m using a free shared cluster on mongoDB.

await mongoose.connect("mongodb+srv://<user>:<pw>@Bussar.s5cyugd.mongodb.net/bussdb?retryWrites=true&w=majority"

How to find total views in a YouTube PlayList

I am trying to find the total number of views of all videos in a playlist I own in YouTube. I can see that a “total views” number is posted under the playlist name. However this appears to be the number of views generated by entering the playlist first. When I add up the number of views of individual videos I get a substantially larger number because, I assume, most of videos are watched by following a link other than the playlist.

In searching for an answer I see two suggestions

  1. using the following JS in the YT console
ytInitialData.header.playlistHeaderRenderer.viewCountText.simpleText

But this just gives the same number that is available under the playlist name.

  1. using the following
var totalViews = 0;
var videos = document.querySelectorAll('ytd-playlist-video-renderer');
for (var i= 0; i < videos.length; i++)  {
    var viewsElement = videos[i].querySelector('#metadata > span:nth- child(1)');
    if (viewsElement !== null) {
        var views = viewsElement.textContent.trim().replace(/D/g,'');
        totalViews += parseInt(views);
    }
}
console.log('Total views of all videos in the playlist: ' + totalViews);

But this gives a total count of 0.

Oblique responsive line between 2 divs

I would like to draw two oblique lines that would join two corners of two different divs. I need these lines to be responsive. My project currently uses angular but my problem, I think, can be solved with css. I also can’t use external libraries. enter image description here

I tried svg and I don’t know if I used it wrong but it was not responsive.

 <svg width="220" height="240" class="roadLink"><line x1="50" y1="60" x2="530" y2="220" stroke="black"/></svg>
        <div class="mb-2 d-flex">
            <div class=" d-flex justify-content-between roadSize topAnrpBlock">
            </div>
        </div>
        <svg width="140" height="100" class="roadLink"><line x1="50" y1="50" x2="500" y2="200" stroke="black"/></svg>