Category: Technology

  • Create shortcut to call people from a list in iPhone

    I usually keep my family members as part of favourites on iPhone. But for work I need to call my work colleagues multiple times over the course of my day. I do not want them to be added to my favourites. But I do need a shortcut to be able to quickly call them when required. Well, Shortcuts to the rescue. I created a simple Shortcut that will show me a list of my work colleagues that I need to call and then call them looking up in the Contacts.

    Here’s how I did it.

    Download the Shortcuts app and open it. Create a new shortcut by tapping on the ‘+’ icon.

    Tap on ‘Add Action’ and search for ‘List’. Tap to add it.

    Once ‘List’ is added to you shortcut, add the names of people that you want to call. Make sure the name is same as they appear in your Contacts app. This is critical because if shortcut is not able to find the name in your Contacts, then it ends up showing Contacts search.

    Add another action by tapping on the ‘+’ button. Search for ‘List’ again, but this time select ‘Choose from List’ option.

    This will allow you to add a custom message to your prompt. Make sure the ‘Select Multiple’ option is turned off.

    Add another action by tapping on the ‘+’ button. Search for ‘Contacts’ and tap on ‘Find Contacts’.

    Configure the ‘Find Contacts’ action. Tap on ‘Add Filter’ to say ‘Name is Chosen item’. Limit the results to just one contact.

    Add another action by tapping on the ‘+’ button. Search for ‘Call’ and tap on ‘Call’.

    Once the action is added, your shortcut in done.

    Run this shortcut and you will be shown list of people. Tapping on any of them will call them.

  • Using Emmet in VS Code to boost your productivity

    A bit ashamed of myself that I come know about this feature so late. Here is the official documentation for Emmet in VS Code. This 7 minute video should give you a glimpse of its power.

  • Create List in SharePoint Online based on another list

    This has stumped me every now and then, so noting this down to help me remember it in time of need.

    SharePoint Online provides a way to create a List based on another list. But this option is only available when you go to “Site Contents” or /_layouts/15/viewlsts.aspx page and click on “New > List”. It also shows up option to create List based on Excel.

  • Get MUTF_IN codes for mutual fund to use in GOOGLEFINANCE function in Google Sheets

    Update 30-Jul-2023

    I am not sure if this was already there, but when I wrote this blog I couldn’t find this option. The below post becomes excessive in light of this new information.

    Go to https://www.google.com/finance/ and start searching for the mutual fund. The search results in the dropdown and page shows the MUTF_IN code. And that’s it!

    I have been searching for a long time on how to get the MUTF_IN code for Indian mutual funds. It has been a hit-and-miss for me trying to search on Google. Finally, I think, I figured out a sure shot way to get the MUTF_IN code.

    Go to Morning Star India. Search for your mutual fund in the search box and go to the search result page.

    Get the name of the mutual fund as it appears in the Morning Star page. For some reason Morning Star does not allow you to copy text from its site so you will have to type it. For those who are aware about Inspect Element I don’t think I need to say anything else.

    Type this name in Google search and you should get MUTF_IN code. You can then use the MUTF_IN code in the GOOGLEFINANCE in Google Sheets.

    Additional points to note

    1. This seems to work only for equity funds. Not debt or arbitrage funds (honestly, I don’t even know what an arbitrage fund is).
    2. If there is an hyphen (-) in the name of mutual fund as per Morning Star India, add space before and after it when searching it on Google.

  • Return key vs Enter key

    Windows won the OS wars and that’s why I don’t know these subtle differences.

    All keyboards have a dedicated Return key — it’s the big key you’re thinking of above the right Shift key. On a Mac, the key code when you press Return is 36, and the glyph for the key is ↵.

    A dedicated Enter key is generally only present on extended keyboards with a numeric keypad — it’s the key in the lower-right corner and is generally the only oversized key on the keyboard that is larger vertically, not horizontally. Its Mac key code is 76 and its glyph is ⌅. Just look at such a keyboard: the Return key says “Return”, and the Enter key says “Enter”.

    Return and Enter Are Two Different Keys
  • Animations in Office UI Fabric

    Working on an assignment and rummaging through Google search results I ran into this page. Apparently, Office UI Fabric supports animation. But the documentation does not list out any details as to what classes to use, neither are there any examples. More search and I find this issue having similar complaint as mine. The issue also lists a sample code using CSS-in-JS to implement animation. Lets take a look.

    First lets import animation modules from Office UI Fabric.

    import { AnimationStyles, AnimationClassNames, AnimationVariables } from 'office-ui-fabric-react/lib/Styling';

    Lets take a look at what each modules does.

    AnimationStyles

    This module contains all the standard Office UI Fabric animations as JSON objects with predefined keyframes. Below are the styles we can use.

    slideRightIn10
    slideRightIn20
    slideRightIn40
    slideRightIn400
    slideLeftIn10
    slideLeftIn20
    slideLeftIn40
    slideLeftIn400
    slideUpIn10
    slideUpIn20
    slideDownIn10
    slideDownIn20
    slideRightOut10
    slideRightOut20
    slideRightOut40
    slideRightOut400
    slideLeftOut10
    slideLeftOut20
    slideLeftOut40
    slideLeftOut400
    slideUpOut10
    slideUpOut20
    slideDownOut10
    slideDownOut20
    scaleUpIn100
    scaleDownIn100
    scaleUpOut103
    scaleDownOut98
    fadeIn100
    fadeIn200
    fadeIn400
    fadeIn500
    fadeOut100
    fadeOut200
    fadeOut400
    fadeOut500
    rotate90deg
    rotateN90deg

    To use AnimationStyles you use the CSS-in-JS approach with the JavaScript spread operator.

    const btnStyleSlideIn: IButtonStyles = {
        root: {
            ...AnimationStyles.slideLeftIn400
        }
    };

    Below is the sample React code implementation.

    public render(): React.ReactElement {
        const btnStyleSlideIn: IButtonStyles = {
            root: {
                ...AnimationStyles.slideLeftIn400
            }
        };
        return (<>
            <PrimaryButton text="Animate"
                onClick={(_) => {
                    this.setState({
                        enableAnimation: true
                    }, () => {
                        setTimeout(() => {
                            this.setState({
                                enableAnimation: false
                            });
                        }, 2000)
                    });
                }}
                disabled={this.state.enableAnimation} />
            <Button text="I am sliding in to left"
                iconProps={{ iconName: 'ChevronLeft' }}
                styles={this.state.enableAnimation ? btnStyleSlideIn : {}} />
        </>);
    }

    AnimationClassNames

    This module contains all the standard Office UI Fabric animation class names. It is similar to AnimationStyles but it just gives you class names rather than the JSON object. Below is the sample React code implementation.

    public render(): React.ReactElement {
        return (<>
            <PrimaryButton text="Animate"
                onClick={(_) => {
                    this.setState({
                        enableAnimation: true
                    }, () => {
                        setTimeout(() => {
                            this.setState({
                                enableAnimation: false
                            });
                        }, 2000)
                    });
                }}
                disabled={this.state.enableAnimation} />
            <Button text="I am sliding in to left, using CSS class"
                iconProps={{ iconName: 'ChevronLeft' }}
                className={this.state.enableAnimation ? AnimationClassNames.slideLeftIn400 : ""} />
        </>);
    }

    AnimationVariables

    This module exports duration values and easing functions which can be used in custom animations. You can use these values in your animations. If you log it to browser console you should see something similar to below output.

    {
        durationValue1: "0.167s",
        durationValue2: "0.267s",
        durationValue3: "0.367s",
        durationValue4: "0.467s",
        easeFunction1: "cubic-bezier(.1,.9,.2,1)",
        easeFunction2: "cubic-bezier(.1,.25,.75,.9)"
    }

    Below is a sample React code implementation.

    public render(): React.ReactElement {
        const kf: string = keyframes({
            "12.5%": { left: -5 },
            "25%": { left: 5 },
            "37.5%": { left: -2.5 },
            "50%": { left: 2.5 },
            "62.5%": { left: -1 },
            "75%": { left: 1 }
        });
        
        const btnStyleShakeIt: IButtonStyles = {
            root: {
                animationDuration: AnimationVariables.durationValue1, // Use Office UI Fabric animation duration
                animationName: kf
            }
        };
    
        return (<>
            <PrimaryButton text="Animate"
                onClick={(_) => {
                    this.setState({
                        enableAnimation: true
                    }, () => {
                        setTimeout(() => {
                            this.setState({
                                enableAnimation: false
                            });
                        }, 2000)
                    });
                }}
                disabled={this.state.enableAnimation} />
            <Button text="Shake it!"
                styles={this.state.enableAnimation ? btnStyleShakeIt : {}} />
        </>);
    }

  • Testing SPFx web part on Modern page – not on workbench

    For a long time I have been developing and testing my SPFx web part on workbench.aspx, which is a terrible option considering you only have limited screen space and you don’t get to see how your web part will look like once it is added to the page. Well, there is a way to test and debug your web part on Modern page.

    First, lets create sppkg package to deploy. For that, run the below commands.

    1. gulp clean
    2. gulp bundle
    3. gulp package-solution

    Note that I am not using the --ship option while running the bundle and package-solution tasks. This will give you a warning – [package-solution] This is not a production build (--ship or --production), therefore the "includeClientSideAssets" setting will be ignored. That’s what we want.

    Second, deploy your generated sppkg package to App Catalog and add web part to your page. When you load the page it will give error.

    This is because our code was not added to sppkg package as we did not use the --ship option.

    Third and final step, run gulp serve command and view the page. You can now test and debug the web part on the page.

  • TextEdit on Mac without formatting

    By default TextEdit shows rich text formatting options and saves file in RTF format. If you are looking for no-frills plain text editor, go to Format > Make Plain Text or press command + shift + T. The menu and key are essentially a toggle which switch between rich text and plain text. To make the plain text permanent go to TextEdit > Preferences… and select Plain text under the Format section.