Author: Naveen

  • A bridge to nowhere

    With the COVID-19 pandemic raging on, I read one of the best metaphors on how suddenly the world can change and impact us in ways we would never have imagined. I couldn’t get link to the web article so all I have is an screenshot of the article on Twitter from Business World written by Prakash Iyer.

    So when they decided to build a new bridge over river Chohuteca in 1996, they wanted to ensure it would withstand the extreme weather conditions. A Japanese firm was contracted and they built a solid bridge, designed to withstand the powerful forces of nature. The new Choluteca bridge – a modern-day marvel of design and engineering – was thrown open to the public in 1998. And as people drove from one side of the Choluteca river to the other, they couldn’t help but admire the new bridge. It was Choluteca’s pride and joy.

    And in October that year, Hurricane Mitch hit Honduras. There was 75 inches of rain in four days – the equivalent of what they receive in six months. There was devastation all around. The river Choluteca swelled and flooded the entire region. 7000 people lost their lives. All the bridges in Honduras were destroyed. All, except one. The new Choluteca bridge remained unaffected.

    But there was a problem. While the bridge was intact, the road leading to it and the road leaving it were both swept away. Leaving no sign that there was once a road there. And that’s not all. The flooding forced the river Choluteca to change course. It created a new channel, and the river now flowed beside the bridge. Not under, but beside the bridge. So while the bridge was strong enough to survive the hurricane, it became a bridge over nothing. A bridge to nowhere.

    The bridge on the river Choluteca

  • Rights issue vs bonus issue

    Rights issue refers to that issue in which a company gives rights to their existing shareholders to purchase additional shares in the company at a discounted price to the market price within a stipulated time frame. On the other hand, bonus issues are distribution of the company’s accumulated earnings, which instead of being given out in the form of dividends is converted into additional or free shares to current shareholders in proportion to each one’s stake without any additional cost.

    In both the cases, the stock price of the company issuing rights shares and bonus issue gets adjusted after the record date, which is a cut-off date set by the company. For example, a 1:4 rights issue would mean an existing investor can buy one extra share for every four shares already held. Usually the price at which the new shares are issued by way of rights issue is less than the prevailing market price of the stock, i.e. the shares are offered at a discount.

    In the case of bonus issue, if the company has announces a 1:1 bonus issue and the stock price is Rs 300, then after a bonus issue, the stock price should logically reduce to Rs 150.

    Rights issue vs bonus issue: Do they come really as a bonanza?

  • Another explanation on why the stock markets are going up in these crazy times

    Well, for starters, the goat is gone. But this Economic Times article by Amit Kapoor & Chirag Yadav sheds a bit more light on why there’s a disconnect between stock market and the economy.

    The behavioural aspect of the trend has been recently outlined by Robert Shiller based on his work on how narratives shape economic outcomes. Shiller argues that the initial market resilience in US until mid-February was the lack of familiarity of investors with pandemics as the event had no historical precedent. Moreover, investors had not anticipated the global spread of the disease and the halting of economic activity in response to it at the scale in which we have seen. The following dip was driven by the stories emerging from China and Italy of hospitals having to choose patients and stores running out of essentials. But eventually, when the government swept into action to provide aggressive stimulus, investors found themselves in familiar territory of previous economic crises. The state-led actions reinforced investor belief to return to the markets, which have staged a prompt and promising recovery.

    It is later in the article the authors explain the disconnect between capital and real markets over the long run.

    The macroeconomic explanation provides a more generalised contextualisation. A prominent change over the last decade has been the excessive liquidity infusion in the global markets driven by the quantitative easing in the developed world, especially US, where interest rates have reached near zero levels. Most of this money has found its way into capital markets for easy returns instead of materialising as real investments. A lot of the money has also flown into the capital markets of developing countries like India. Investors also know that the central banks and government will back their capital with taxpayer money in case of market failure. Thus, capital markets have begun to provide faster and more secure returns than real investments.

  • 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
  • Long term energy storage solution

    I always thought any generated energy can be stored only in batteries.

    The most efficient energy storage technology may be as close as the nearest hill, according to former Energy Secretary Steven Chu, and almost as old.

    “It turns out the most efficient energy storage is you take that electricity and you pump water up a hill,” Chu said Tuesday at the Stanford University Global Energy Forum.

    When electricity is needed, you let the water flow down, spinning generators along the way. Pumped hydro can meet demand for seasonal storage instead of the four hours typical of lithium-ion batteries.

    Steven Chu: Long-Term Energy Storage Solution Has Been Here All Along

    So, you can have a hydro power plant generate electricity with water flowing down and use any excess electricity to pump water back up the reservoir to store the excess energy. Neat!

  • Creating disposable email address on Gmail, with expiration date

    I knew we could create disposable email address on Gmail by appending + to username and adding random characters after that, but didn’t know we could add expiration date to them.

    Let’s say your temporary email address is amit@gmail.com. A website form requires your email address so you can put amit+mmdd@gmail.com in the sign-up field where mmdd is the month and date till when that disposable email will stay valid.

    For instance, if you specify the email address as amit+0623@gmail.com – that alias will be valid until June 23 and any emails sent to that alias after that date are ignored else they are forwarded to your main Gmail address. You can only specify the year in your temporary email amit+12312020@gmail.com in mmddyyyy format.

    How to Create a Disposable Email Address with Gmail

  • How Cooper Black became pop culture’s favorite font

    Never noticed it, but Cooper Black is actually everywhere. Even my daughter’s alphabet letter set is in Cooper Black!

  • The goat is gone

    Considering the raging COVID-19 pandemic, job losses and all around negativity, why are the markets going up? Well, the goat is gone.

    In a certain village, there is a very large and poor family who are living in a cramped room. One day, the head of the family goes to a wise old grandmother of the village and asks for some advice. “There are 12 of us in this tiny room,” he says. “It’s so dirty and cramped, everyone is always fighting, the children are crying, and there is no place for anyone to even lie down. What should I do?”

    The wise old woman says, “Keep your goat also in the room.” The man says, “Are you mad? The goat will make things worse.”

    “Just do it”, says the old woman. The man comes back a few days later and tells her that now, life is absolute hell. “The goat is smelly and there are droppings all over and it kicks everyone and bleats loudly all the time.” The old woman says “OK, fine, if it’s so bad then keep the goat outside”. Now the man comes back after a few days, looking pleased and happy. “It’s wonderful, he says. It’s just the 12 of us and we have the whole room to ourselves! No goat!”

    The goat is gone

  • 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 : {}} />
        </>);
    }

  • Second-Order Thinking

    First-order thinking is fast and easy. It happens when we look for something that only solves the immediate problem without considering the consequences. For example, you can think of this as I’m hungry so let’s eat a chocolate bar.

    Second-order thinking is more deliberate. It is thinking in terms of interactions and time, understanding that despite our intentions our interventions often cause harm. Second order thinkers ask themselves the question “And then what?” This means thinking about the consequences of repeatedly eating a chocolate bar when you are hungry and using that to inform your decision. If you do this you’re more likely to eat something healthy.

    First-level thinking looks similar. Everyone reaches the same conclusions. This is where things get interesting. The road to out-thinking people can’t come from first-order thinking. It must come from second-order thinking. Extraordinary performance comes from seeing things that other people can’t see.

    Second-Order Thinking: What Smart People Use to Outperform

    A more succinct version by the same author.

    Second-order thinking is the practice of not just considering the consequences of our decisions but also the consequences of those consequences. Everyone can manage first-order thinking, which is just considering the immediate anticipated result of an action. It’s simple and quick, usually requiring little effort. By comparison, second-order thinking is more complex and time-consuming. The fact that it is difficult and unusual is what makes the ability to do it such a powerful advantage.

    Chesterton’s Fence: A Lesson in Second Order Thinking