Title: How Ideas Spread
Author: Jonah Berger
Continuing with my reading and listening of topics that are not strictly technical, I recently heard this 6h audio-book.
Clearly targeted for marketing, it talks about varied topics of how products, brands, and even gossips and memes become widely spread sometimes, while other times just fade away. It is a mixture of different strategies, studies and sometimes a bit weird statistics (the baby names stuff sounds like not the best example of correlation and causality), explaining good and bad examples of advertisement campaigns, the delicate good versus bad feedback  or how social networks and influencers might affect sales but can also have adverse effects.
A mixed bag and not too deep, but includes interesting advices to better market products and increase brand awareness.
This is a trivial example, but nonetheless useful, of why measuring code changes is relevant when we are adding complexity.
After reading about Chrome's new native image lazy-load attribute, I decided to implement it as a Pelican plugin (source code here), because despite I use Firefox, Chrome is currently the dominant browser.
I already had to iterate a few times over the original < 40 lines implementation which simply added the attribute:
I had to ignore base64-encoded inline images, plus raw markup not being really images (e.g. code containing
<img>), plus small clean-ups.
As all the post images don't have
height attributes, Chrome was reflowing and sometimes even requesting them twice due to CSS computations, so I built a small json-backed image dimensions cache that fetches post images, checks their size using
PIL, and adds the appropriate markup attributes.
Afterwards, as the post images have a maximum width, for big ones I had them vertically stretched, so I had to add another check to restrict the width and if so, recalculate the "resized height" too, keeping the original image proportions.
Notice how what was a simple "add an attribute to each image" grew to a 120 lines plugin? It is still quite small and manageable, but it has to handle error scenarios, different nitpickings that most posts won't require, and the caching not only relies on external IO (both local files and network requests) but also measures around 40% of the code.
So, when today I was thinking about how could I try to improve its speed, my first requisite was measuring the performance gain vs complexity added. Each article (post/page) in Pelican triggers an execution of the plugin logic, which already only loads and saves the cache once per post (instead of once per image). This still means acquiring two file handles, reading/writing and closing. With the existing code and this blog, this was the original metric:
Processed 500 articles, 0 drafts, 2 pages, 7 hidden pages and 0 draft pages in 8.20 seconds
Pelican plugins do not keep state by themselves, which is nice but hinders in-memory caching. A hack that I came up to overcome this limitation was storing the cache at
instance.settings["IMAGE_CACHE"], because Python dictionaries are always by ref arguments. This way I could only load once the cache from file, while still storing it per article to play safe. A few lines of code added, and I measured how faster it got:
Processed 500 articles, 0 drafts, 2 pages, 7 hidden pages and 0 draft pages in 8.18 seconds
😐 Now, I don't know you, but to me waiting 20 milliseconds more when regenerating the blog... it is not much of a difference. And if I kept the optimization, I would be reducing but not fully removing the disk IO operations, while adding another crossed boundary to care about: runtime settings mutation. If It had went down a few seconds it might be worth it, but for a 0.24% gain on a personal project, I'd rather keep the plugin code simple.
And of course, if I hadn't measured it I would have just left it because it's awesome to optimize and your own code never fails even when doing hacky things and squeezing the maximum is always great and... The fact is that both my SSD hard drive and Linux are smarter than me and reading 500 times a json file so quickly and consecutively is surely buffered and cached by the drivers and will only reach the physical storage at the end, so why bothering in this scenario.
Update: What I did actually implement is a small
ImageCache class with a simple
dirty flag to avoid unnecessary writes if cache hasn't changed. this took down 50% of IO operations and around 2 seconds in exchange of a few extra lines of code and an actually cleaner logic segregation.
Speaking and pronunciation is probably the area I'm worst at regarding English, so after doing a course about British English pronunciation, I recently grabbed and just finished another: English Fluency Master.
3 hours of tips and tricks to improve fluency: word blending and "jumping", proper pronunciation of sounds, intonation, tone, stress, and some tongue twisters. But what I liked most about the course is the teacher, Luke. The way he explains everything, repeating multiple times at different speeds, with jokes and funny voices, remarking what we should avoid, etc., is a perfect combination of informal but helpful teaching.
Equal parts enjoyable and useful, definitely recommended.
Author: Cal Newport
I got this book because I've been since quite some time cautious about my digital footprint, both regarding social networks and privacy in general. But as I am an advocate of focused work (versus multitasking and the like), I wanted to see if it could help me make a better use of my time, focus better and get less distracted.
And what a discovery! I would say the digital minimalism concept clicked in my mind, but it seems I was already partially applying it, so as you can imagine my feedback is very positive. From opening your eyes about the darker side of social networks, social mobile apps, advertising and many technological companies, to multiple practice exercises for the reader to try and see by himself/herself how much time one can waste in this noisy "social interactions" instead of on higher quality in-person ones, it probably won't leave anyone at the very minimum asking some questions.
It doesn't directly tries to force you to stop doing things, but instead to take some time to think about how you use them. With historical examples, interviews, online articles and scientific papers, plus of course the author's opinion and reasoning, there are many examples of why we tend to lose time on typically dumb things and then wonder why we don't have time to do "other things".
I totally recommend reading the book, as I see almost on a daily basis examples of people afflicted with digital distractions, and I also think it is becoming more worrying also for the newer generations who, as the book points out, have never been in a world without always-on connection.
Calculate costs of things not regarding money, but in amount of life it's going to take you (now or afterwards). Some tasks might yield small economic benefits but require way more of your time and thus, not be worth it.
Minimalistic usage of apps and services is equivalent to going shopping with a shopping list: you reduce distractions and chances to be lured into buying more.
I am skipping doing the digital de-clutter 30-day but it is very interesting as an exercise. I think I already control very much all of my "digitally dangerous" activities (mostly just RSS reading).
Solitude is critical for human beings.
The FIRE movement (Financial Independence, Retire Early) looks curious but not suited for everyone.
In general, it is not about avoiding technology, but about using it consciously instead of letting it use us and steal our time.
Thanks to the book, I now have removed Instagram from the tablet (will install it when I paint some miniature and need to upload a photo), and my RSS feeds reader from the phone, as it is true I got used to opening it when going to the bathroom and other "boring moments" that I can instead let my mind rest.
But apart from that, to be sincere I already was a kind of half digital minimalist... I try to work and study using pomodoros deleted my Facebook account years ago, I use Twitter in an very unorthodox way  and automatically delete old content, and even at work I employ drastic life hacks to mitigate when I get distracted.
: By not following anyone in Twitter directly but through lists, I was able to greatly reduce noise and it gave me the power to filter what topics to read. Although eventually I ended up directly not using lists, and now just use it to reply if somebody mentions me or otherwise just announce blog posts or very rarely dumping some thoughts.
Author: Paul Arden
Continuation of It's Not How Good You Are. It's How Good You Want To Be, this book is precisely more of the same: More ideas and tips to be different, to take risks, to start doing more what you like and what you think you should be doing and less what others (or society, or anybody) tells you to do. Some sentences are still very radical as in the first book, but this time at least have some explanation, like "don't go to university unless the subject of your learning is close to your heart."
The section about bad (and good) ideas is great, and it has some fun anecdotes. Again a short read (~130 pages), I felt this one is a more generic book about letting yourself go and become free to do what you really want to do, not only about unleashing creativity.
Just a few highlights I liked and wanted to keep:
Getting what you want means making the decisions you need to make to get what you want. Not the decisions those around you think you should make.
Everything we do we choose. [...] You are the person you chose to be.
The effort of coming to terms with things you do not understand makes them all the more valuable to you when you do grasp them.
Ideas have to be applied before they are recognized as good ideas. Even a bad idea executed is better than a good idea undone.
Solving the problem is the exciting part, not knowing the answer.
Simply change your life: The world is what you think of it. So think of it differently and your life will change.
Meetings are for those with not enough to do.