Saturday, 24 July 2021

Minimum Index Sum of Two Lists Algorithm Javascript

Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by unique strings.

You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them in alphabetical order. 

You could assume there always exists an answer.


Example 1:

Input: list1 = [Shogun, Tapioca Express, Burger King, KFC] , list2 = [Piatti, The Grill at Torrey Pines, Hungry Hunter Steakhouse, Shogun]

Output: [Shogun]

Explanation: The only restaurant they both like is "Shogun".

Thursday, 10 June 2021

How to use componentWillUnmount with Functional Components in React

How to manage componentWillUnmount with useEffect

If you add a return function inside the useEffect function, it is triggered when a component unmounts from the DOM. This looks like:


import React, { useEffect } from 'react';

const ComponentExample => () => {

    useEffect(() => {

        return () => {

            // Anything in here is fired on component unmount.

        }

    }, [])

Thursday, 20 May 2021

Angular 8 - Communicating Between Components with Observable & Subject

 

Observable.subscribe()

The observable subscribe method is used by angular components to subscribe to messages that are sent to an observable.

Subject.next()

The subject next method is used to send messages to an observable which are then sent to all angular components that are subscribers (a.k.a. observers) of that observable.


Sunday, 16 May 2021

Render the view outside of view folder in ASP.NET mvc

 In normal case your project views(.cshtml) are in view folder of project but if you want to render the view from another folder with the same functionality of views. Then you have to just copy the web.config of views folder to your new folder and add the respective path like this.

View("~/Content/itemtemplate/Adtemplate.cshtml", model); 



Wednesday, 12 May 2021

Details Summery Tag in HTML

 The <details> tag specifies additional details that the user can open and close on demand.

The <details> tag is often used to create an interactive widget that the user can open and close. By default, the widget is closed. When open, it expands, and displays the content within.

Tip: The <summary> tag is used in conjuction with <details> to specify a visible heading for the details.


Click Here for Example  

Monday, 10 May 2021

This project references NuGet package(s) that are missing on this computer.

Find the .nuget folder in your project folder. Sometimes when you copy the project you might be miss that folder because of its hidden in your project directory.

If you dont miss the folder and still you get the error, hope you can find solution from this link 

Saturday, 1 May 2021

will-change css property

The will-change CSS property hints to browsers how an element is expected to change. Browsers may set up optimizations before an element is actually changed. These kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required. 


  • Don't apply will-change to too many elements. The browser already tries as hard as it can to optimize everything. Some of the stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this can cause the page to slow down or consume a lot of resources.



Saturday, 20 February 2021

Datatable does not contain a definition for asenumerable

 Add System.Data.DataSetExtensions from "nuget" or "add reference"

using System.Data.DataSetExtensions;

Wednesday, 13 January 2021

AAPT: error: attribute android:requestLegacyExternalStorage not found

 

You need to compile against SDK 29 and maybe use the most recent build tools for aapt to know this attribute, because it's introduced in Android 10.

Add this to build.gradle

subprojects {

    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 29
                buildToolsVersion "29.0.2"
            }
        }
    }
}


android:requestLegacyExternalStorage="true" to <application> tag in AndroidManifest.xml