Monday, May 21, 2018

How to find what you want to do in life - Excellent advice from Hunter S Thomson

Hunter S Thomson is an american journalist. In a letter he wrote to his friend Hume Logan, he gives excellent advice about finding what you want to do in life.

Basically the advice boils down to this -

You can either float with the tide or swim towards a goal. But since our goals change as we get more experience and insight, the goals are never constant. They keep changing so our focus shouldn't be on the goals. We don't want to be a fireman or banker or teacher etc., we want to be ourselves.

So the idea is not to reach a pre-defined goal but to choose a way of life you ENJOY. So choose your lifestyle and not the goal.

Next if there are eight pre-defined paths laid down for you in life and you feel they are all not satisfying to you, then it is upto you to design the ninth path for yourself. But if you procrastinate in this CHOOSING you will have circumstances making the choice for you.

What this means is that you don't just have to take the handed down paths to you but you can look for new paths that fit your lifestyle.  This is an amazing point.

I like learning new things, reading and sharing stuff. I should choose a way that allows me to keep doing that!

This is from a book called letters of note via farnum street

Monday, May 14, 2018

Shipped - LitInspire

Real artists ship - Steve Jobs

Things happen when we complete things, not just start and leave them. With that in my mind, I was trying hard to complete things which I start.

So I created a Google assistant app to inspire people with inspiring quotes and passages from books, blogs and lives :)

You can see it at

https://assistant.google.com/services/a/uid/0000007c9354f92c?hl=en-US


Currently it has only a few quotes but I will keep adding more quotes and improve it further.

Try it and let me know what you think! Get inspired. 

Monday, May 7, 2018

Thoughts on ideal daily routine

Lose an hour in the morning and chase it all day - Yiddish saying via Tim Ferris, Jason Fried

Morning:

The linked medium post got me thinking about my morning routine. There were days where I followed my routine and it worked wonders in my day and there were times when I got distracted and it ended up ruining my day. So I'm thinking back to see what was the routine on the day that worked well and what was the routine on the day that didn't work so well so that I can redesign my ideal routine and commit to it.

News:

The biggest ruiner of my day is reading news online first thing in the day. I know that has ruined my day many times and sometimes and just fool myself into thinking that I can do it for five minutes and close it. But it reality I have never closed it before 20 minutes. I only have one hour a day to study for myself and I waste 20 minutes out of that. So this is the first thing I have to avoid at any cost. On the contrary, the best start for the day was when I started working directly on my most important priority of the day.

Journalling:

Next thing that made a good day was to journal - just think about yesterday and today and to clearly spell out what I'm doing today, how I'm going to accomplish as said by Ben Hardy will really make me very productive.

Work:

Deadlines:

Next is to overcome Parkinson's law by scheduling minimum amount of time for any work. Deadlines help. I become more focused when I have deadlines and when the deadlines are near.

Next is the good water and food rule. When I'm well rested and had good food, I don't get distracted often.

Gratitude:

Whenever I feel grateful for what I have, I'm motivated. Also when I'm excited about starting something new at work, I'm excited too - especially new ideas.

Overexcitement:

When I start reading any exciting news article - it is so exciting to me that I will do that at the expense of other things - so this is something which is very damaging to my scheduled tasks and productivity. But these are the things that are very very interesting to me that if I stop doing them completely it feels something is missing and I will crash hard if I just abstain from it for a few days. I have to schedule sometime for these daily so that I can feel that I'm aware of the latest happenings around the world and exciting things in the areas I'm interested in.

Also when I'm working on something with full focus, there is less chance of missing something or skipping something. So I'm fully present in my work and do my best work which is of course obvious.

Distractions masked as focus:


Another thing that distracts is when I'm working on some development which needs more focus and my brain thinks it is easy to get distracted so I try to focus by listening to something but to identify that something takes time and most of the times it is podcasts or youtube videos. Sometimes these are boring and I again change it and try changing them etc. Also when I'm listening to podcasts or other prosy stuff on youtube, my attention is obviously distracted. The only safe thing that works is classical or lyric less music - so there should be an easy and simple way to always select and listen to that in one click so that I don't get distracted on youtube or google play music trying to find the right music.

Fear:

Another thing that distracts is if I find something which scares me which is generally about money, health or work. This kind of triggers a fight or flight response which overwhelms anything else I know of. So it is obviously better if I don't know of things that trigger this kind of response.

Escaping effort:

Also the main reason for getting is distracted is the inability to wait - inability to wait while project is building, inability to wait for a few seconds to put some mental effort and the concept of avoiding effort. Our brain wants to put minimal effort into things and each time we have to think to make an effort, it becomes a challenge. So if we develop it into a habit it will be easier. So this should be added to my do not do list.

Evening:

Then after I come home, it will be great to teach something to my son. If I spent time with him it is very satisfactory. One of the worst days is when  just switch on the TV and sit infront of it mindlessly playing things from youtube there. Often times just scheduling something in the evening can get me out of this trap.

Summarizing the best things in my routine are

- Starting the work directly
- Journalling
- Scheduling minimum amount of time to complete the work
- working without distractions
- Playing study music (classical or lyric less)
- Getting used to waiting
- Scheduling something in the evening
- Count your blessings

The do not do items are

- Do not Open a browser first
- Do not browse while waiting for application to come up
- Do not get the music from youtube or play podcasts
- Do not research on  non office work especially exciting news or scary things in office.
- Do not work without deadlines or a plan

If we think of everything we have to do, we feel overwhelmed. If we do the one thing we need to do, we make progress.

Monday, April 30, 2018

Recommitting

I have committed to complete the Google Home app by end of April, but I haven't been able to complete it even though it is end of April because of a few reasons.

But being a professional, I can't leave something undone. I want to complete what I start. So am recommitting to completing the app as soon as possible.

I don't want to run fast only to sleep like the hare. i.e is I want to go sustain-ably like the tortoise.
The major reason why I couldn't complete is as planned is because of lack of focus or distractions.
I forgot my commitments to myself. I ignored the deep work rules even though they were just on the back of my mind.
And then distractions are just a click away. All of these cause a very familiar situation - no time. Planned work undone and amateurish plan for the next day.
But what we shouldn't forget is that there are enough hours of the day if we know how to make full use of them. 8 hours of work + 8 hours of sleep = 8 hours of remaining time. Anything worthwhile has to be done in those 8 hours only.

How can I make the best use of those eight hours? Where is the time to read news and gossips ?
Where is the time to get distracted ? couple of hours with family. 2 hours commute time.
one hour hygiene, couple of hours for speaking with parents, having food and  one hour for studying.

It seems we cannot afford to get distracted on weekdays. There is really no time. Every distraction time has to come at the expense of something else.

Now why do you want to do anything ? I feel as an engineer I can use my skills to automate stuff and save time in the lives of our fellow humans.

Ofcourse as a human, I want to use the little time on earth to make it worthwhile by doing things which inspire me and by giving something back for this awesome time on earth.

So I recommit to living fully, starting with why on everything I do, do it with complete focus and not rush but do it well.


Monday, April 16, 2018

Developing a Google Assistant app using NodeJs, Dialogflow and Firebase Functions

What is Google Assistant?

Google Assistant is a virtual personal assistant developed by google available on variety of devices like mobile phone, smart home device, on a smart watch or on a TV or even the web. It can engage in two way conversations and can work entirely with voice. 

What can it do?

With the assistant, you can control smart home devices, do most of the functions on your phone like placing a call, sending a text etc with just your voice, play content and also interact with apps. It also has routines which is a sequence of things which can be done with a single command. So existing content can be packaged into an assistant app or apps can be built without writing any code using templates or by writing custom apps. 

How to develop custom apps for Google Assistant?

For more flexibility we can also develop apps using the APIs provided by Google. There are two APIs we can use are Actions SDK and Dialogflow 
Using the actions SDK, your app can perform actions. An action defines an entry point into your app’s functionality and maps an intent that describes the action to the fulfillment that processes the intent. The fulfilment gets the user input as string, processes the input and provides a response. This interaction continues back and forth till the action is complete. 
Dialogflow is a conversational platform that lets you design and build actions by wrapping the functionality of the Actions SDK and providing additional features such as an easy-to-use IDE, natural language understanding (NLU), machine learning, and more. So it sits above the actions SDK and works with actions SDK. 

Developing the App

Here I will show how to create an app called InspireMe using the Dialogflow API. User can talk to this app to get inspirational quotes and passages. 

The flow of the app works like this 



User specifies an intent to Google Assistant or explicitly asks for taking with the app - > The welcome intent of the app is triggered - > Fulfilment is triggered for the intent - > Fulfilment picks a quote and returns in the response - > That quote is played in the response -> User is given an option to listen another quote or end the conversation - > If user selects Yes -> another quote is picked and played -> when user says no -> App wishes user a good day and the flow ends. 


The steps to create the app are

1. Create an actions on google project. Save your app name and details
2. Build the project on dialogflow
3. On the dialogflow console, setup the intents for the app and enable fulfilment.
4. Handle the intent fulfilment webhook requests and return responses to the user.


When you setup intents, intents wrap an action. For e.g. when you say you want to listen to a quote, this intent can wrap an action called - LISTEN_QUOTE. When the webhook url gets this request, it processes the request and returns a response to the user.

For each request, we can set a context so that the future requests can have that context. With the context you can take a single request and respond to that in multiple ways based on which context the user is in. In our app, we can have a context called 'ONE_MORE' and each time the user says he/she wants to listen to another quote, the app can deliver a quote and set the context in one_more. In this way all the requests could go into this context and the app can understand the conversation. If this context is not set, then since there is no context for that one more, default fallback intent is executed and it will ask questions to clarify user intent.

The webhook handling app uses nodejs actions on google library to create the responses. You will get the requested action and any parameters from the dialogflow request object. And you will process the response and use either of the ask or tell methods to send the response. The ask method responds to the user and expects the user to tell something back to the app. Tell method says something to the user and stops the conversation i.e doesn't expect anything back.

This app reads quotes from google cloud datastore. For saving the quotes into the datastore, I've written a small express app which takes the quotes from a csv and stores it.

Code for the app:  https://github.com/thisisananth/inspire-me
Code for the admin: https://github.com/thisisananth/inspireme-admin

I've tested it in the test console on actions on google and also on a device. Currently google has changed the test console to only give Dialogflow v2 requests and this app uses v1 requests. Since this was intentded to be a learning project and I reached that goal, I am not updating the app to use the newer version of API.
Overall it was fun developing the app and if the test console worked with V1 api, it would have been cool to deploy the app. I might get back to this later. 

Monday, April 9, 2018

Leading metrics

You have something you want to achieve. It is somewhat big that you cannot complete it in one sitting. How can you make sure you keep track of it and work on it and achieve without wasting any time ?

It is by splitting the work into smaller things, allotting just enough time to complete and then tracking the leading metrics for the work we are doing. 


For e.g. the leading metric for an author in completing a book is number of words written per day. For a software developer, it is number of sub tasks completed/number of problems solved. These are different to the lagging metrics like number of books published or number of software released. Since for a person starting out and even for a person starting a new project, by definition, there will be some time before a project can be released. But to be productive in the time of development, it is important to keep track of the leading metrics. What gets measured, gets managed. 

This can be applied to everything important in your life. Identify the very important things where the result can be known only later. There, develop leading metrics to make sure you are on track. You will be surprised by how much you can achieve because of this. Apply this to your health, contributions, relations and finances. Let me know in comments how you have applied this to your life and how it has helped you. 

Monday, April 2, 2018

To be more productive, radically single task

Multi tasking is a myth. When we do multitasking our brains switch the context and this context switching is very in efficient. You might have noticed it when you go read something online and get back to work. It takes some time to settle in and again get back into work. It seems as if brain has to unload things from what it read online, then load the data related to work to start working and this switching sometimes takes 10 to 15 minutes. If you try to switch again in this time, now there was no way for brain to work efficiently.

The best way so is to do only one thing at a time, complete it and then go to the next, complete it and then go to the next and so on. If you try working like this you will be more productive and also more peaceful and at ease with work. You will also have worked in a more focused way with the whole processing power of the brain available to complete that work. This should help do the work better. It also helps to have pride in the work you do - that way you try to make it the best you can. 

There is nothing else to this. Just radically single task. Basically make a list of things in the order of priority that you want to do. Start with the first one. Finish it and start the second one till the time in the day is over or all your list is done! This will just guarantee that we don't get distracted at all. If you get distracted all you have to do is, just realize, recommit and then be back at what you're doing and restart the radical single tasking mode. 

Try it - it will be beautiful.

This is called the Ivy lee method of productivity. See the full story in James' blog