Kartones Blog

Be the change you wanna see in this world

Book Review: The One Thing

Review

The One Thing - book cover

Title: The One Thing: The Surprisingly Simple Truth Behind Extraordinary Results

Author: Gary W. Keller, Jay Papasan

I am a bit wary of self-help books as I usually feel I either fully trust them or won't get anything of use (and that some are mere money grabbers). Thankfully, this title is not one of them. It is "only" about focusing your energies, work efforts and even lifestyle one one thing at a time, plus creating a plan to achieve "the one thing" that really drives you, and then proceeding towards that ultimate goal by applying some efficiency techniques.

At around 220 pages, it both contains some really interesting tips, advices and tactics, but also lots of bloating, small stories which sometimes are given a (at least for me) fragile interpretation to adapt to that "one thing seeking" and sometimes multiple paragraphs going in circles around a single concept. It is not bad, and maybe is just that I prefer more condensed information, but my general feeling is that the book could be half the size.

That said, you might fully or partially agree with the topics exposed but I think that there are some good ways of increasing your focus to achieve more.

Notes

  • No one succeeds alone. No one
  • "Where I'd had huge success, I had narrowed my concentration to one thing, and where my success varied, my focus had too"
  • Extraordinary results are directly determined by how narrow you can make your focus
  • Success is built sequentially. It's one thing at a time
  • "Things which matter most must never be at the mercy of things which matter least" -Johan Wolfgang von Goethe
  • Equality is a lie
  • When everything feels urgent and important, everything seems equal
  • The 80/20 Principle (aka Pareto's Principle)
  • Prioritize a to-do list so it becomes a success list. Also, go small, go extreme and say no/discard
  • Multitasking is a lie
  • Disciplined life is a lie. We don't need more discipline, but to direct and manage it better
  • Success is about doing the right thing, not about doing everything right
  • Once a new behaviour becomes a habit, it takes less discipline to maintain
  • It takes an average of 66 days to acquire a new habit
  • The act of living a full life by giving time to what matters is a balancing act
  • In your personal life go short and avoid long periods where you're out of balance. [...] Nothing gets left behind
  • In your professional life go long and embrace long periods out of balance. [...] is required [to remove lesser priorities]
  • Life is the art of progressing
  • Think big - Act big - Succeed big
  • The quality of an answer is determined by the quality of the question
  • Asking questions improves learning and performance by as much as 150%
  • Sometimes questions are more important than answers -Nancy Willard
  • Out putpose sets our priority and our priority determines the productivity our actions produce
  • Financially wealthy people are those who have enough money in without having to work to finance their purpose in life
  • Planning is bringing the future into the present so that you can do something about it now -Alan Lakein
  • Purpose without priority is powerless
  • Hyperbolic discounting: the farther away a reward is in the future, the smaller the intermediate motivation to achieve it
  • Goal setting to the now: someday goal -> five-year goal -> one-year goal -> monthly goal -> weekly goal -> daily goal -> right now
  • Getting the most out of what you do, when what you do matters
  • Time blocking: Way of making sure that what has to be done gets done
  • Resting is as important as working
  • Recommendation: block four hours a day
  • Be a "maker" in the morning and a "manager" in the afternoon
  • When stuff pops out in your head, write it down on a task list and get back to what you're supposed to be doing
  • See mastery as a path you go down instead of a destination you arrive at
  • 10,000-hour rule: It takes 10k hours to achieve mastery at something
  • A different result requires doing something different
  • absorb setbacks and keep going. [...] persevere through problems and keep pushing forward
  • Circumstances won't change by themselves
  • The four thieves of productivity:
  • Inability to say "no"
  • Fear of chaos
  • Poor health habits
  • Environment [that] doesn't support your goals
  • When you say yes to something, it's imperative that you understand what you're saying no to
  • You can't please everyone, so don't try
  • The art of being wise is the art of knowing what to overlook -William James
  • High achievement and extraordinary results require big energy
  • Spend the early hours energizing yourself
  • Surrond yourself only with people who are going to lift you higher -Oprah Winfrey
  • To get through the hardest journey we need take only one step at a time, but we must keep on stepping -Chinese proverb
  • Twenty years from now you will be more dissapointed by the things that you didn't do than by the ones you did do -Mark Twain
  • A life worth living might be measured in many ways, but the one way that stands above all others is living a life of no regrets
  • Life is too short to pile up woulda, coulda, shouldas

Talk: Python static typing with MyPy

Talk cover slide

Just a quick post to remark that this week I gave a talk at Python-Madrid local meetup, and the topic I chose was Python type hints and static typing using MyPy.

Although I explained more in detail most slides, I tried to make them so even without listening to me they carry some understandable content. If anybody is interested on reading them, the direct link is https://slides.kartones.net/027.html (as usual on my slides.kartones.net section).

I wish to repeat the talk again and I even sent it as a proposal for a London Python-related event so fingers crossed :)

Update: This blog post about gradual programming explains very interestingly my point of why Python type hints are interesting as a "gradual typing". I highly recommend you to read it.


Rate limits with Python

Rate Limiting is something that most projects get as a feature late, but that the earlier it comes the better for everyone. Any non-trivial service you use will have rate limits, whenever is a soft limit ("your XXXXX service can only handle Y operations per second on your current pricing tier") or a hard limit ("any table on the database cannot have more than 12k columns per table"), and this is good, because unbounded resources are points of failure. Without restrictions on an HTTP API, you're not only allowing abusive clients to DOS the platform, you're also risking any internal developer mistake to take it down, any big process (like a batch update or a yearly report).

So basically we can agree that every system should have resource limits. There are many different ways to put them in place, but commonly either the software you build (e.g. Python services) will use some component(s) (or implement their own), or use features of the web servers to limit certain type of actions based on some criteria.

Recently at work we wanted to build an internal REST API that would perform small tasks like Google Cloud Tasks (where you queue a task and when dequeued it calls an HTTPS endpoint and you're the one in charge of executing the task on one of the instances behind that hopefully load-balanced URL). To simplify the scenario, let's say we wanted to perform lots of jobs that individually should execute quickly but if massively batched could hurt a database. The best way to avoid problems is making hard for them to happen, so I wanted to put a limit to the amount of requests that the endpoint can receive, so the resources "breathe" enough to never reach too high values.

A good summary of choices regarding rate limit algorithms can be found in the following article: https://konghq.com/blog/how-to-design-a-scalable-rate-limiting-algorithm/

For example, to us didn't mattered much if we implemented a fixed or sliding window algorithm, we don't need that much precision, but one aspect was important: It had to be distributed, because the hosts are load balanced and sometimes there are few instances, but other times there are around a dozen, so leaving 2 tasks per second with 12 instances consumes more resources than when having 3 and could cause system instability. We prefered to be more accurate with load/usage predictions, so that ruled out alternatives like implementing rate limiting at Nginx.

Checking Python libraries the main requisites were for the chosen one to be distributed and easy to use (a decorator being the best option). After some digging, the winner was django-rate-limit, which offered:

  • very easy setup as a django 1.11 middleware
  • a fixed window distributed rate limit (using Redis for the distributed storage)
  • a simple yet configurable decorator to mark http endpoints at the django views. As an added bonus it automatically returns 429 HTTP responses when the rate is exceeded, so no manual handling of exceptions!
  • request-path rate-limit key, which while not perfect (no way to rate limit by ip or other custom mechanism like user_id or cookie), was good enough as a staring point and could be implemented in the future without much effort

The library implements one of the two official Redis recommendations of building a rate limiter pattern with INCR so it was good enough and race conditions small enough to not pose an issue.


We already have it working and I even did some quick django tests and confirmed everything works as expected.

As a fun fact, as the library requires Python 3, this was the main reason that I decided to give a try to migrating ticketea.com to Pyton 3.


Migration of ticketea.com website to Python 3

Today I wrote a new blog post at ticketea's engineering blog, this time about how we migrated ticketea.com to Python 3 in two weeks.

It was an interesting task, and I think went well because "ignorance is bliss", as I hadn't used Python 2 I wasn't biased by fear nor knew the real reach of possible failures, so I just went on, fixing every single error and testing and testing and testing again until all looked fine, and then more tests.

Some libraries already had Python 3 branches (outdated but with quite some work done) and QA helped me so the merit is not mine alone, but I'm quite happy with the result and it is a pleasure to focus on just Python 3.6 (plus now we can start adding type hinting and other fancy stuff).

Fun fact: All of this originated with the desire to add rate limiting to a new (internal) API I was building. I will actually write here a small blog post about rate limits because I found two very good links with nice explanations and I think can be of use for others in search of similar features.


Newsletters I read

Apart from hearing podcasts frequently (e.g. commuting to work), reading books and lots of RSS and articles (it is hard to take out the FOMO anxiety, but I'm now below 100 feeds), I discovered a while ago that subscribing to some weekly newsletters provides me with nice summaries of topics in different areas. I might read all the articles, or maybe just give a quick glance of what's new.

At the time of writing this blog post, I'm subscribed to the following newsletters related with tech:

English
Spanish
  • Bonilista: Miscellaneous topics, from tech and business to political rants
  • Mixx.io: Tech and tech-related business news

I'm open to suggestions of additional (tech) sources so feel free to drop me a comment ;)


Previous entries