Loading a cache weak in typing

In Java, I use a LoadingCache which offers weak touches
and I need something similar in Typescript, so I wrote the following:

function loadingWeakCache(loader: (k: K) => V) : ((k: K) => V) {
    const cache = new WeakMap();
    return function(k: K) : V {
        let v = cache.get(k);
        if (v !== undefined) return v;
        v = loader(k);
        cache.set(k, v);
        return v;

It seems to be working and I would like it to be reviewed*

Unfortunately, I have to cache a function with two arguments. My first attempt was

function pairLoadingWeakCache(loader: (k1: K1, k2: K2) => V) : (k1: K1, k2: K2) => V {
    const cache = new WeakMap V>();
    return function(k1: K1, k2: K2) : V {
        let second = cache.get(k1);
        if (second !== undefined) return second(k2);
        const v = loader(k1, k2);
        second = loadingWeakCache(k => loader(k1, k));
        cache.set(k1, second);
        return second(k2);

which was wrong because it prevented the second key from being recovered since it was referenced since the closure. I only present it here because it is a clever but broken idea that someone might come up with. I rewrote it as

function pairLoadingWeakCache(loader: (k1: K1, k2: K2) => V) : (k1: K1, k2: K2) => V {
    const cache = new WeakMap>();
    return function(k1: K1, k2: K2) : V {
        let second = cache.get(k1);
        if (second === undefined) {
            second = new WeakMap();
            cache.set(k1, second);
        } else {
            const v = second.get(k2);
            if (v !== undefined) return v;
        const v = loader(k1, k2);
        second.set(k2, v);
        return v;

and I would like it to be seen again* as well as.

*Please just ignore my conditions on one line, as this is my highly preferred way.

sharepoint online – Call the typing function on the button onclick event in SPFx (no Javascript framework)

I'm having trouble calling the typed method at the click of a button in SPFx without a JavaScript framework.

for example:

private _renderListCustomer(items:ISPListCustomerItem()):void{

   let html:string=``;



type NewType = ISPListCustomerItem;



html+= ``;


Customer Id Name Address Type Update
${item.CustomerID} ${item.CustomerName} ${item.CustomerAddress} ${item.CustomerType}
`; const listContainer:Element=this.domElement.querySelector("#spListContainer"); listContainer.innerHTML=html; } Method to called // Id:number public BindItem(id:number):void{ pnp.sp.web.lists.getByTitle("Customers").items.getById(id).select("*,CustType/Id,CustType/CType").expand("CustType").get(). then((item:ISPListCustomerItem)=>{console.log(item); document.getElementById('txtTitleUpdate')("value")=item.Title , document.getElementById('txtCustomerIDUpdate')("value")=item.CustomerID, document.getElementById('txtCustomerAddressUpdate')("value")=item.CustomerAddress, document.getElementById('txtCustomerNameUpdate')("value")=item.CustomerName, document.getElementById('txtCustomerTypeUpdate')("value")=item.CustomerType, document.getElementById('ddlCustTypeUpdate')("value")=item.CustType.ID}). catch((error)=>{ alert(error); error; }) }

But the method is not called at the click of the button.

Any help would be appreciated, thanks in advance.

8 – List of options without typing during autocomplete

Is it possible to display options when the user clicks on the input field instead of displaying after typing at least one corresponding character?

AutoComplete begins to display options after the user has typed a character, but it is difficult for new users to guess what options are available for the associated field.

Thank you

catalina – How to execute the administrator level command via a remote connection without typing a password?

I would like to allow a remote script to access my Mac (Catalina 10.15.2) at the root level.

I know I can enable keyboardless access at the user level, using publickey authentication, via ssh. This is handy because it allows me to run scripts remotely on my Mac, via ssh, from a script running on another host.

Is there a way to execute root commands, via ssh, without typing a password, without enabling login for the root account?

Are there any other authentication methods for sudo besides the password?

I will do data entry, scraping of emails and typing. for $ 10

I will do data entry, scraping of emails and typing.

Hello, Ashok Kumar is your data entry assistant and lead generation expert.
I am a dedicated person who believes that the job must be done on time or before.
I love learning new skills and I am delighted to work with people.
I have experience in data entry jobs with more than three and a half years of experience.
Feel free to leave a message and let's get started.
I am also available for permanent daily work.


We work on any type of data entry for $ 10

We work on any type of data entry

I have an excellent knowledge of data entry with typing speed, I can help you with any type of web research work and Excel data preparation.

I assure you 100% of the quality of the work delivered. I can perform any type of copying of past data on websites and timely delivery of work.


Translate and localize professionally in Russian, Ukrainian for $ 2

Translate and localize professionally in Russian, Ukrainian

Why would you choose me?

1. You will get your job done within a certain time. Punctuality is my specialty.
2. I will refund your money if you are not satisfied with my work.
3. I have 3 years of translation experience. What do you get from the offer?
1. Linguistic expertise.
2. Japanese cultural expertise.
3. Personal support for your cause.
4. Quality work.
5. I speak both fluently. English and Japanese. So no communication problems.

I don't let my clients down. I won't let you down.


Typing – How to Separate Presentation and Smart Components for Angular Forms

It is often mentioned to separate intelligent components and presentation in Angular.

Then I have a form and company validators behind them. Also, have html that shows how the form is rendered.

The thing is, if someone wants to use the form with the same validators, but a totally different html rendering?

How to separate the form below, so that form fields and validators are separated and not strongly coupled to html format?

    private formBuilder: FormBuilder,
    private cdr: ChangeDetectorRef
  ) {
    this.propertysitusaddressform = this.formBuilder.group({
      'firstName': (null, (Validators.maxLength(32))),
      'lastName': (null, (Validators.maxLength(32))),
      'phone': (null, (Validators.maxLength(32))),
      'streetName': (null, (Validators.required, Validators.maxLength(64))),
      'streetType': (null, (Validators.maxLength(8))),
      'city': (null, (Validators.maxLength(32))),
      'state': (null, (Validators.maxLength(16))),
      'postalCode': (null, (Validators.maxLength(16))),



How to disable the new Slack format when typing?

After an update, Slack now formats the messages as you type them, which greatly disrupts the way I type. How can I turn off this feature and only display message formatting after clicking Send?

I will do excel, spss, minnitab data entry, data analysis, pdf conversion into words. Type the content of the image for $ 5

I will do excel, spss, minnitab data entry, data analysis, convert pdf to word.Image by typing content

I will be virtual assistant for data entry work, collage jobs, MS Excel Works, MS Word Works,Online jobs.

If you are looking for an excellent virtual assistant at a very reasonable price, so hire me please.
My services

Convert a PDF to MS Word

Convert a PDF to MS Excel

Retype the scanned document

Retype the image containing the text Creating a PowerPoint presentation

Retype any other format in word / excel

Data entry copy and paste

Long-term data entry works

The Minitab data analysis works

IBM SPSS Data Analysis works

MS Excel everything works

Why should you choose me

Fast and reliable communication

100% guaranteed stratification

I learned Exel, Word, Minitab and IBM SPSS software for my degree.

If you have any questions, do not hesitate to send me a message.

Best regards,

Udaya Sanjeewa.