Books recommendation series: Essentialism: The Disciplined Pursuit of less

Book

Essentialism: The Disciplined Pursuit of less
Greg Mckeown
Essentialism – The Disciplined Pursuit of Less

Theme

The theme of the book is to find out what is truly essential? Focus on essential and eliminate everything else. Greg McKeown defines Essentialism as “Less but better”.

Takeaway

The key takeaway is that only once you give yourself the permission to stop trying to do it all, to stop saying yes to everyone, can you make your highest contribution towards the things that really matter. How often we say “yes” to everything, there is so much going on in our lives that nothing ever gets our true focus and attention. How can we give our best in any area when we’re being pulled in so many different directions? We can’t. We need to identify what is truly important, learn to say no to things that don’t fit into the “essential” category and simplify our lives. This book is an essential read for anyone who feels overcommitted, overloaded, or overworked.

Suggestions

Very good read. Highly recommended.

Note: My friend Rishi has done a detailed review of this book. Check this out here:

http://jigyasu.com/books/book-review-essentialism-by-greg-mckeown.html

Happy reading!

git push up to a certain commit

This is a quick share on git.
Scenario: I want to push my local changes to git but am having a few commits which I don’t want to push now. In other words, I just want to push changes till a certain commit.
Solution:
$git push <remotename><commit SHA>:<remote_branch_name>

To elaborate
First, fetch the SHA of the commit you want to push
$ git log

Copy the SHA and use the command below (Make sure that you replace the SHA of your commit with the given in the example).

$git push origin 7120f221660dad58d41b9ac729a22f08572b109:master

You are good to go. Your local commit of the given SHA is now pushed to server master keeping your local commits local only.

Please share in comments if you any other alternate way.

Thanks

Algorithms performance: big O notation: simplified short notes

 The big O notation is used to analyze runtime time complexity. big O notation provides an abstract measurement by which we can judge the performance of algorithms without using mathematical proofs. Some of the most common big O notations are:

  • O(1) : constant: the operation doesn’t depend on the size of its input, e.g. adding a node to the tail of a linked list where we always maintain a pointer to the tail node.
  • O(n): linear: the run time complexity is proportionate to the size of n.
  • O(log n): logarithmic: normally associated with algorithms that break the problem into similar chunks per each invocation, e.g. searching a binary search tree.
  • O(n log n): just n log n: usually associated with an algorithm that breaks the problem into smaller chunks per each invocation, and then takes the results of these smaller chunks and stitches them back together, e.g, quicksort.
  • O(n2): quadratic: e.g. bubble sort.
  • O(n3): cubic: very rare
  • O(2n): exponential: incredibly rare.

Brief explanation:     
Cubic and exponential algorithms should only ever be used for very small problems (if ever!); avoid them if feasibly possible. If you encounter them then this is really a signal for you to review the design of your algorithm always look for algorithm optimization particularly loops and recursive calls. 

The biggest asset that big O notation gives us is that it allows us to essentially discard things like hardware means if you have two sorting algorithms, one with a quadric run time and the other with a logarithmic run time then logarithmic algorithm will always be faster than the quadratic one when the data set becomes suitably large. This applies even if the former is ran on a machine that is far faster than the latter, Why?

Because big O notation isolates a key factor in algorithm analysis: growth. An algorithm with quadratic run time grows faster than one with logarithmic run time.

Note: The above notes are for quick reference. Understanding algorithmic performance is a complex but interesting field. I would recommend picking a good book to understand the nitty-gritty of big O and other notations.

Python learning: scrapbook

While browsing my Evernote I found a scrapbook which I have made while learning Python some years back. Thought to share if this helps someone. I am pasting directly (no editing so there might be some spell and grammar mistake).

  • Python 2 division, just use integer part (3/2=1) whereas Python 3 uses real division 3/2 = 1.5
  • Strings in Python are immutable means you can’t change the in-place value of a char. Once string is created you can’t change/replace its elements
  •  s= “Hello World” s[::-1] this will reverse string s “dlroW olleH” double colon is used to tell the range and also how many elements can be skipped
  • if you want to use Python 3 functions in Python 2 then use ‘from __future__ import print_function‘ and similarly other functions 
  • List are mutable but tuples are not mutable (does not support item assignment) aka immutable, fewer methods in tuples then why to use instead of a list? The key is immutability. in a program if you want sequence/Val does not to get changed then tuple is a solution e.g.; storing calendar dates which know will not change during your programs. 
  • Set is a collection of un-ordered unique items it looks like a dictionary (in notation) but only keys which are unique. It can help in removing repeated items means you can use set to cast list.
  • List comprehensive are an excellent way to write clean and efficient code – they are actually de-constructed for loop flatted out in a list
  • Lambda expressions can be used to shorten function this is really useful when used with map(), reduce() and filter() functions
  • First class functions: Treat functions like any other object, we can pass functions, we can return functions, we can assign functions to a variable
  • Closure: Closure takes advantage of first-class functions and returns inner functions and variables local to them.
  • Decorators: It is a function which takes another function as an argument and returns as a function without changing the source code of the original function. Decorator allows easily to add functionality inside our wrapper without modifying original function. 

Note: These are notes for quick reference. If you are serious in learning Python I encourage you to take a book or a tutorial.

Enjoy learning! More to come …

Microsoft Visio and infamous Windings font

Another Microsoft misery 😢 😢

This time, I am struggling to handle the bullets in SVG output of my drawing.  What I found is that  MS Visio still uses windings/symbol fonts to make the bullets. Don’t know why? When are they going to change this and start using standard Unicode chars? Can anyone from MS please explains to me why they don’t believe in standardization?

IMHO Please use Unicode everywhere be it HTML generated from Word or Visio etc. 

Thanks for reading!

IE11 issue with “arrow” and “includes” Javascript method and an alternate solution

Again one more Microsoft problem 😢 😢

Yesterday, I  suddenly observed that one part of my newly developed feature was not working in IE11. This is a simple feature which contains two select boxes, user can select the one or multiple items from the first select box and copy to another select box. I have added a kind of logic there which checks before copying if the item(s) to be copied are already in list 2, if true, alert the user and skip copying duplicates. While developing I checked this feature in chrome, Edge and Firefox and all work perfectly!  I couldn’t check in IE11 and that was my mistake as IE is infamous for such issues. While debugging I saw that IE11 was crashing on the places where I have used the functions  => and .include. Actually, the arrow function is not supported in IE 11. You can refer to this compatibility table: https://kangax.github.io/compat-table/es6/ to get an overview of what is supported where and to what extent in a detailed fashion. You may read more on arrow functions at below link: 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Check below a small demo which shows the problem and an alternate which solves the IE11 issue.

Demo:

**********************************

JSFiddle (Fails in IE11)

JSFiddle (Works in IE11)

**********************************

Github:

code (Fails in IE11) 

code (Works in IE11) 

 

**********************************

Happy coding!

Perl development journey and books collection

While doing routine cleaning of my personal library I was surprised to see the Perl book collection I have made over the period of time. My Perl dev journey started in a full-fledged manner way back in fall 2007. Prior to that was mainly developing using C, C++, assembly language. My first impression with Perl was not very exciting mainly due to ugly syntax and the way the OO is achieved and being from C++ background initially it was really difficult to grasp. But over the years working with language and while developing a large scale web application I learned a lot of nitty-gritty of the language and still learning…  Today I can vouch for Perl for its speed, portability, great module system CPAN and excellent dedicated community. Thanks to all the module authors and contributors on Perl Monks and StackOverflow. You guys are amazing! 
Now, the books which helped me immensely to wrote better Perl programs.

New coder and Experienced coders

I’ve found that a big difference between new coders and experienced coders is faith: faith that things are going wrong for a logical and discoverable reason, faith that problems are fixable, faith that there is a way to accomplish the goal. The path from “not working” to “working” might not be obvious, but with patience, you can usually find it.

Read the above quote somewhere on medium, myself as a programmer can easily sync with the saying. Have observed this many many times in my coding experience of the last two decades. To add, patience is needed much more while dealing with critical real-time production bugs.

I personally feel that analysis of the problem with a cool head and focus and pateince is is the key to debug and resolve critical problems.

Happy Coding!

Books recommendation series: Predictive analytics

Book

Predictive analytics, The Power to Predict Who will Click, Buy, or Die
Eric Segel
https://www.predictiveanalyticsworld.com/book/

Theme

This book deals with quantitative efforts to predict human behavior. The book focuses on a large number of prediction efforts that are much more successful now than efforts some decade back. This is mainly due to faster computing resources and lots of data availability. During the past decade has been an explosion in computation and information technology. With it has come vast amounts of data in a variety of fields such as medicine, biology, finance, and marketing. As a result, banks, retailers, political campaigns, doctors and hospitals, and many more organizations have been quite successful of late at predicting the behaviors of particular humans. These efforts have been helpful at winning customers, elections, battle with disease etc. The book provides plenty of case studies from above fields.

Takeaway

This is fun to read, a fascinating book as this is not very technical so suitable for all masses. Case studies are very good and give you great insight into predictive analytics.
I highly recommend this book for aspiring Data Scientists/Managers/CEO’s or anyone interested in understanding the science of analystics.

Overall good read. Very much recommeded. I personally liked the topics and case studies on risk and fraud detection very well written and visulized.

Suggestions

  • This is not technical so don’t expect details on ML algorithms etc
  • I found sometimes the case-studies are over-simplified in actual I think they are not that simple while implementing.
  • I found that one can pick a chapter and read, you don’t have to follow the order.
  • Don’t expect that you will learn to do analytics, making a model just by reading this. This book is mainly focussed for non-techies readers. If you are a techie focus more time on ML algorithms and use this book as a part-time bed time read.

Happy reading!