Transaction Graph and Non-Serializable Transactions

For those who want to understand the basics, there isn’t a better example I could think of to start with.


The good news is that Serializability might sound a bit complex at first but not it’s not as complicated as the classic ‘what came first – hen or egg’ problem.

Sustainable Software Engineering – What is it?

Sustainable Software Engineering is a set of principles and methods that ensure minimal direct or indirect negative impact to the environment and in turn to living beings while building and using software.

Here are the eight principles of sustainable software engineering as defined by Microsoft

  1. Carbon: Build applications that are carbon efficient. Applications that bring maximum value being carbon efficient
  2. Electricity: Build applications that are energy-efficient. Application that consumes less electricity.
  3. Carbon Intensity: Consume electricity with the lowest carbon intensity. Clean electricity.
  4. Embodied Carbon: Build applications that are hardware efficient. Write efficient code, which can extend the expiry date of hardware.
  5. Energy Proportionality: Maximize the energy efficiency of hardware. Running servers at a high rate of utilization.
  6. Networking: Reduce the amount of data and distance it must travel across the network.
  7. Demand Shaping: Build carbon-aware applications. Reducing consumption, reduce the demands. Shape demand to meet supply.
  8. Optimization: Focus on step-by-step optimizations that increase the overall carbon efficiency

As software engineers, you and me have a significant part to play in the climate solution.

Thank you Microsoft for the clarity and these principles that we can in fact implement in our day-to-day work. I am very happy and excited that the software development community does care for the world we live in.

The Brain in your Gut

‘We are what we eat’ and ‘We are what we think’ – is more or less the same with this insight into how the gut is connected to your brain. These two faculties that otherwise thought to have different functions in one’s body are not really independent of each other.

It is thus very important to watch what we eat, as everything we eat in turn affects our emotions and moods. There is enough research done in this area and you can find a lot of articles and details around this connection. Here is one such nice article by Harvard Health Publishing.

The biochemical reactions within our body is a complex process and it is not practically possible to directly control or fine tune these reactions, but with some level of awareness and general understanding of the positive and negative consequences of what we do with the body, we can drive our mind and body to be unhealthy or healthy. The latter being a wise option of-course.

Practicing a few healthy habits will train the subconscious leading the body and mind to a healthier way of living.

The mind is in the body or body in the mind? This has more complex (but not complicated) perspective with the spiritual and metaphysical dimensions involved so not going deeper in that for now. 🙂

Aggregate function – using $project and $group

If you want the aggregated data to be stored in a specific column format then use $project.

Here is an example:-

pipeline1 = [
                    {
                        '$group':
                            {'_id': {
                                'device_id': '$device_id',
                                'date': {'$dateToString': {'format': '%Y-%m-%d', 'date': '$timestamp'}},
                            },
                                'avg_v': {'$avg': "$value"},
                                'min_v':{'$min':"$value"},
                                'max_v':{'$max':"$value"}
                            }

                    },
                    {
                        '$project':
                            {
                                '_id': 0,
                                'device_id': '$_id.device_id',
                                'avg_value': '$avg_v',
                                'min_value': '$min_v',
                                'max_value': '$max_v',
                                'date': '$_id.date'
                            }
                    }
                 ]

The aggregated data structure will be as shown below in database:-

_id: 61af14c283751487558e8494
device_id: "DT002"
avg_value: 23
min_value: 19
max_value: 26
date: "2020-12-05"

Musings

Every individual lives in their own world and so do I, there as as many worlds as there are living beings on this earth (and beyond?). We humans interact with each other and with the worldly objects at different levels. Those levels or what I call as ‘circles’ is the only scope that we understand of each other or about the objects, however our expectations and desires assume we perceive everything the same way which is often the cause for all sorts of problems and misunderstanding. Once we realize that my world and your world are different, life becomes a lot easier and we start communicating in a more effective way.

The Zen of Python

>>> import this

The Zen of Python, by Tim Peters

  1. Beautiful is better than ugly.
  2. Explicit is better than implicit.
  3. Simple is better than complex.
  4. Complex is better than complicated.
  5. Flat is better than nested.
  6. Sparse is better than dense.
  7. Readability counts.
  8. Special cases aren’t special enough to break the rules.
  9. Although practicality beats purity.
  10. Errors should never pass silently.
  11. Unless explicitly silenced.
  12. In the face of ambiguity, refuse the temptation to guess.
  13. There should be one– and preferably only one –obvious way to do it.
  14. Although that way may not be obvious at first unless you’re Dutch.
  15. Now is better than never.
  16. Although never is often better than right now.
  17. If the implementation is hard to explain, it’s a bad idea.
  18. If the implementation is easy to explain, it may be a good idea.
  19. Namespaces are one honking great idea — let’s do more of those!

Happy Onam Kerala!

In spite of the terrible flood that displaced thousands of people and many others loosing their lives, the beautiful state of Kerala is indeed blessed with wonderful people having very high spirits, and I’m sure the state is soon to be reborn with new energy, new hope and a brighter future. All the best Kerala and a very happy onam to one and all!

Remote Sensing Project

So this is from the archives, when I was little I drew this for a Remote Sensing Project of Birla Institute of Scientific Research, Jaipur.

Hope you like it.

12888747_936947133079229_6805602049230370816_o

The first and the last words got cropped off, first one is खारा (khara) meaning “salty”,  last is परिवार (parivar) meaning “family” and the missing word in between is उगे (uge), that means “grow” in English.