The Oh F**k Incidence – 2


“Hi!”, she said when she finally came to the cafe.

“Oh… hi!”, a rush of memories washes over me. “Oh… fuck.”, stop thinking. Just let her… be.

“Damn, she looks like a dream”, I think to myself. “You cool.”, I say to her. Stop all bodily functions… “don’t fuck up… don’t fuck up…”.

“So how are you?”, she asks.

C’mon… think something… speak, you idiot. “I’m good…”. Ok… that was a reply, should I ask her something? It won’t seem rude, would it? “How are you?”, I ask.

“I’m good too dear!”, she flashes a smile. I jump a heartbeat and the rest of the world, blurs. In that moment, she was the one true reality.

Some 4 years ago, a feeling was sowed in me. I have been through much and I have seen some things and went through transformations umpteen times but that feeling never faded. How many times has that feeling, that one inkling of hope of seeing her again, helped me breathe. How many countless times have I hated that feeling wishing that it dies. How many countless times I have cherished it wishing it back. All squashed and mashed and served in a single serving. All the feelings of helplessness of her absence colliding with the happiness of her presence. Pleasure and pain entwined in one.

What did I say then? “Your bindi is off-center.”

That spotless, radiant face, that was burned in my brain’s firmware, was live.

Astonishing as it may seem but yet very true, it was amazing to meet after a long time in such a manner. We lived through our lives, taking steps and making decisions that led to that cafe in a city so far away that neither of us ever hoped we will meet.

Her eyes were inquisitive. A certain mischief or so I could see. A contagious smile hung on her lips. There was a controlled excitement in her… like some savory champagne ready to be uncorked. A warmth surrounded her, like a lover’s hug. A certain accent in her voice that seemed exotic as she talked of things that were on the deeper side of understanding.

A moment so happened that I took her hand. A spark went down my spine… like the centers of energy in the body, opening. A brief period of completeness… of certain peace.

As I sit here bleeding these words, I think of what I could have done differently to have a version of the future where that brief period of completeness was not so brief. Letting the could-have-beens and the would-have-beens go, I sit here with the feeling… a feeling that is going to be hated, cherished, bleed and healed. A feeling that is now the very essence of my being.




Since my last post about Tromsø, I have been to many places and travelled quite much. I went to Brussels and Berlin, to Milan and to Munich and roamed in and around Stuttgart almost everyday. Travelling is addictive. Even walking around your own city, you maybe struck by serendipity at some unknown corner you never saw before. You meet people from all walks of life and when you listen to their experiences, the perspectives you hold about your life changes. You become less judgemental and more accepting. You know you cannot do anything to help a person but a soothing word can inspire confidence, in you as well as the person you’re talking to. You may also get the best kisses and hugs if you’re drunk enough. And you make friendships that will last a lifetime.

Travelling gives you a chance to be with yourself and better understand yourself. When you’re sitting besides the sea on a jutty you can reflect on what you have done and what you want to do. Every once in a while, a man must be completely on his own with nothing but his limbs and his own brain. Severe all connections with the world to reconnect in a more personal way that touches your existence. On this note, I took a journey to a city which has topped the list of my favorite cities.

grafitti - 1

Some graffiti!

Copenhagen, the Danish capital, is one of the most beautiful cities I have been to. I find that Scandinavia is quite different from Europe. The people are more traditional and more cultured and have a sense of “coziness”. I found Danish people very approachable and once you get to know them… they are fun loving and hearty. They are quite family oriented like we Indians and love to spend time with family and friends. And Danish girls are… well, beautiful. I went to Sweden and have been to Norway too. I cannot comment on Sweden because I did not linger there much but Norwegians are simply lovely. I found them helpful albeit reserved.


Danish people in Nytorv.

Copenhagen is located on the island of Zealand. It was a 10th Century Viking fishing village. The nearest Viking site (yet) to explore is Roskilde which I will cover in my future travels. Legend has it, that the Swedish king Gylfi offered all the land that the Norse Goddess Gefjun could plough in a night. The goddess turned her four sons into oxen and carved out the island of Zealand. You can see the likeness of the goddess sculpted as a fountain in the Nordre Toldbod area. It is a lovely place with vast open sea to look upon and breathe in some fresh sea breeze whilst smoking a cigarette.


The Gefjun Fountain.

nyhavnNight - 1

Nyhavn at night.

Nyhavn (New Harbour) is one of the best and the poshest areas of the city. Fortunately, I got a hostel here and I didn’t mind spending EUR40 for 2 days for a bunk bed there. With colorful buildings lining the banks of a canal, the “new port” is full of awesome places where you can eat and have the famous Carlsberg beer while soaking in the sun. From the numerous restaurants that line the canal, I ate an excellent chicken salad and a decadent Creme Brulee Tart in the Heering restaurant. Established in 1695, the restaurant has an history as old as the Harbour itself. In mid 1660s, Nyhavn was notorious for beer, sailors and prostitution (recall Tortuga). Over the years, Nyhavn has become colourful and a major tourist attraction and one of the start points of the famous Canal tours (must take!). You can buy a combined ticket which includes a hop-on hop-off bus tour and the canal tour.


A Creme Brulee Tart. A Chicken Salad.


lilHavfrue - 1

The Lille Havfrue.

The bus tour was informative and I got to see many cool places. It was quite fascinating to see famous spots like the “Lille Havfrue” or the little mermaid. The part naked body of a mermaid inspired Disney to make the famous movie: The Little Mermaid. It is a tribute to the Danish author Hans Christian Andersen and the real story of the Little Mermaid is quite heartbreaking. The sculpture was mutilated several times and resurrected. The sculpture is the part of the Langelinie Promenade (or park). On a sunny day, one can sit (or sleep) on benches on the pier or at the end of the pier facing the sea.

gotn - 1

The Ghost of the Navigator! The pier on Langelinie Promenade.

Going around the city in the tour bus, I also saw the famous Niels Bohr Institute. History has it that when the Nazis attacked Denmark, they were taking every thing that was shiny and valuable. So was the Nobel prize held by German Physicists Max von Laue and James Franck. Along with chemist George de Hevesy (who himself became a Nobel Laureate) they dissolved their medal in Aqua Regia and were able to keep the medal safe from the Nazis. Later, the gold was precipitated out and the medal was moulded again.

Another main attraction is the Tivoli Gardens. Constructed in early 1840s by Georg Carstensen, it seems something right out of a fairy tale. It is the oldest (and still functional) amusement park in the world. It still houses an old wooden roller coaster and if you’re brave and adventurous enough, you can take a ride. I’m not, so I didn’t.


A few from Tivoli Garden.


The most famous, part-illicit, part-hippie area of the city is the Freetown Christiania. Consisting of former military barracks, the town is a totally autonomous neighbourhood near Christianshavn. After the barracks were abandoned by the military in the 60s and 70s, it became a safe haven for homeless people. In 1971, it was declared a “free town” by a prominent Danish journalist Jacob Ludvigsen with a mission statement saying that the idea was to create a town where everyone is responsible for the well being of the entire community. Nowadays, the town is famous for the sweet smell of independence and happiness of an illicit herb *wink wink*. Photography is prohibited inside Christiania sadly.


Upon entering Christiania.

The best thing about my abode there was, Christiania was just a 20 minute walk. It was good because I was able to compensate for the prohibition of photography inside Christiania by taking some good photos of the “kissing bridge” and the new Opera House. The kissing bridge, completed in 2016 (yes!) is named so because it resembles two tongues entwined in a kiss!


The kissing bridge (left) and the Opera House (right).

a view - 1

The Standard Restaurant.

Apart from being a tourist destination, Copenhagen is economically well off too. Life Sciences is a key area of research and Copenhagen is scattered with companies dealing with biologique and biotechnology. Apart from that, Copenhagen (and Denmark in general) is also known for it’s shipping industry. Maersk, the largest shipping company in the world, is headquartered in Copenhagen (Vikings were themselves erudite ship builders and navigators anyway). That being said, Denmark has some of the highest per capita income and with their recent economic reforms, is an attractive place for “foreign labours”.

It is a beautiful place and I believe that this is how an ideal city should be. I find that, a city which has the sea nearby is usually jocund. My previous experience with Mumbai was the same. When you’re feeling down and out, you just sit on the bank on some pier and let the sea breeze take all of your worries away… . I saw much but there is still left to see much more!



The Arctic



Exploration has enticed every human… to see what is on the other side of that majestic peak or what lies beyond the horizon where the sun sets. Being footloose is exciting and undertaking soul stirring journeys is what everyone dreams of. And north is pristine. Enigmatic, when you look up at a star lit sky, with the Milky Way cutting right across the middle. Mesmerizing, when you see green lights dancing above you, hypnotized by their subtle movements.

In my general mood of ennui, I went on a journey that turned out to be one of the best experiences of my life. I met awesome people and made friends who have become an integral part of my very existence… even if I don’t see them ever again. I learned about different cultures and told about mine own. Traded words, inspired some and got inspired by some and after all that, I’m left with memories that none can wash away.

The place


Lying above the Arctic Circle, Tromsø is known as the gateway to Arctic. It has been inhabited since the ending of the last ice age and in the 17th century was known as the “Paris of the North” (because people from south found them more sophisticated than they anticipated.). Currently, the town is inhabited by around 80,000 people and is known for its’ stunning scenery (the Norwegian Fjords), exotic delicacies (Reindeer burger. Not chicken… Reindeer.) and of course, the Northern Lights.

The town is not large and you can get to anywhere from anywhere on foot. The Tromsdalen valley hosts the magnificent Ishavskatedralen or the Arctic Cathedral on one end of the Tromsø Bridge. The bridge is one of its kind and is one the most important landmarks of Tromsø and connects the island of Tromsø to mainland Norway. The cathedral (well not exactly a cathedral) was constructed in 1965 by a Norwegian architect, Jan Inge Hovig.


The Ishavskatedralen. The Tromsdalen on the left. Fjellheisen on the right.

Atop the bridge, due to it’s peculiar central arch which adds to the height, one gets to see a spectacular view of the Tromsøysundet strait. You can see a panoramic view of the whole city and it looks stunning.


The Tromsøysundet strait. It’s 2 in the afternoon.

Walking for a while, away from the cathedral, you can take the rope-way up to the Fjellheisen. I was told that I could get some picturesque views of the city from top of that mountain. But it was snowing heavily up there. The view was picturesque up there, let alone the view of the city. It was white all around and it looked something right out of a fairy tale. And it was cold. Very. Very. Cold.

Atop the Fejllheisen.

Atop the Fejllheisen. A slight motion blur cuz I was shivering.

The experience

I embarked on a backpacking journey which means that I lived in a hostel. It is the second oldest wooden house in Tromsø. It was an obvious choice given the cheap prices it offered and a chance to mingle with people from all over the world. It is cozy and there is already a dearth of warmth in the Arctic. Its’ a chill place where you can go and meet new people and make new bonds with someone who you never knew existed. I met some amazing people from different countries and had a great time with them.



You may discuss about how the electoral system in the United States work or maybe learn that “yavla fitta” means “Fucking Cunt” in Norwegian. You may meet a chef from Spain who is a great photographer and a Hebrew girl crazy about nuerosciences who makes excellent onion and carrot soup. You may even find that the theories which you have used to guide yourself through life inspires others to inculcate your practices in their lives. And in the end you’re all together in that small living room cracking jokes and laughing out loud like you’ve all known each other for ages. The world is not as fucked up as news channels portray it to be.

You may realize that you believe in destiny after all. You may realize that letting go is a part of life. You may realize that you can fall for a person within seconds of seeing them and you will surely realize that most expected things come to happen at the least expected times. You’ll realize that if you just listen to your heart and use your mind, you can do anything in life.

The Lights


tripod shook a bit due to a sudden gust of wind but you can see the Big Dipper.

Big and educated minds say that Aurora Borealis is formed when, due to heavy solar activity, particles from the sun excite the oxygen and nitrogen atoms in the atmosphere. The excited atoms loose energy while coming back to their stable states and emit this energy in form of lights. This is all false, I tell you.

In reality, the lights are actually maidens dancing across the heavens. Really… how else can you explain the mesmerizing patterns the lights make when they move? When they are spread all across the night sky with stars shining at the back, you can imagine any theory that fits your sense of wonder.


The start of the show.

To see the northern lights, one must find a spot isolated by city lights and a clear night. The tour guide took us to a remote area almost touching the border Finland. It was a clear night and I could see zillions of stars in the night sky. We had to wait for quite some time in bone chilling cold of negative temperatures before the maidens could dance for us. And oh, did they dance!


Once they start to dance, you can only sit underneath them and gaze at them. They are hypnotizing… you just stop thinking and you are just there in that moment. They swirl and whirl and create patterns and seem to have a life of their own. The whole sky was covered with the lights… shooting from behind a hill… two different strands of lights merging into one… breaking apart and fragmenting and then recombining. Once you see them, you cannot “unsee” them.


here, I saw two separate “strands” of lights combining. I almost cried.

The purple-ish tint is a rarity and I got to see that and capture it. It was bewildering to behold such a sight. I think not that I will ever lay my eyes on anything more beautiful than this. When the lights flash across the sky, it stirs up emotions you never knew existed inside you. You cannot relate it to anything that you’ve experienced before and hence it is unmolested by any feeling that you have inside of you. You cannot explain something like that… it is an unadulterated emotion. A feeling that you can experience only on your own.

Sitting under the lights with a group of people around a bonfire just gazing up at the light show above was the most amazing experience I have ever had in my life. We roasted marshmallows in freezing cold and shared stories and experiences while the lights danced above us. It was a moving, touching feeling and I was a different person when we left that spot after a few hours.

Au revoir


It was an amazing experience I had last weekend. It was a childhood dream of seeing the Aurora and I saw them. I felt them. I can still see them dancing in front of me whenever I close my eyes. But as all good things must come to an end, so this trip had to end too. It is not my last time here. I’m going to be here again and probably will get to meet more awesome people from around the world and feel more deeply about the world. This trip has left me with a deep experience and gave me some great insight of life. I have learned that the core of a person’s character comes with what they have experienced and I have made a resolution to travel more… far and wide. To end with:

“Still round the corner there may wait,
A new road or a secret gate.
And though I oft have passed them by,
A day will come at last when I,
Shall take the hidden paths that run
West of the Moon, East of the Sun.” ~ J. R. R. Tolkien.

A pretty girl



This pretty girl I like.

Dear You,

Greetings pretty girl. Lately, my writings have started to get some recognition. I went for a trip to a beautiful place and my mates asked me to lay down the experience in words. I have found that I bleed words best when I bleed for you, so bear with me while I tell you how Venezia was like. I wish your eyes too could behold what mine did. I’m sure that that brownish tint would have lit up seeing everything.

A bit of history before we take a walk. Venice (or Venezia in Italian) is a port city and one of the main trading centers of early Italy (early like 9-12th century early). The city is actually group of islands (117) on a lagoon bearding the Adriatic sea. The city (or islands) is connected via bridges and waterways. It was once (and still is) a flourishing trade center and one of the most important trading destinations as in those times, sea was the only way of trading between countries. Being in the Adriatic sea, Venice was always in close touch with Byzantine and Muslim Empires. At the apex of its wealth and power, Venice boasted of 3500 ships with around 40,000 sailors. The city since then has become one of the most beautiful tourist destinations and also a commercial hub for modern Italy.

Wikipedia has more history for perusal if you care to take a look. We started from the main train station (yes, Venezia has a train station) and went first to the Lido Beach. It is on the opposite end of the main city and is mostly meant for private leisure. You can see the Mediterranean sea from there. It takes not much except a deep breathe to give up your heart to the sea. We had not much day time as it was a one-day tour and since we were there early, the place was just booting up. Also, I think not that I’ll ever get to “leisure privately” so we left for the main city.


The Mediterranean.

Water ways substitute roads here. The whole city is connected via canals and bridges. All the canals originate from the Grand Canal. Since there are no roads, we had to take what they call water buses. The buses run along the Grand Canal and sojourn at stops where you can board or get down. It is not-that-costly to go around. You can get a 24-hour bus pass for 20 Euros and get on any bus from any where. We boarded a bus from Lido Beach to Rialto Bridge where we got off and started to tread.


Grand Canal and one of the sub canals


The Rialto bridge was made in late 11th century and was made entirely out of wood. The bridge suffered heavy maintenance losses and several fatalities before it was resurrected as a stone bridge. It stands to this day and the market adjacent to the bridge is as old as the bridge itself. Old eateries and pizzerias still cater to our food fetishes and we had a chance to have an authentic Italian pizza. I know you love to devour good food and trust me we would have eaten 5 each of those slices without wincing. A splendid view of the Grand Canal is what you see atop the bridge and such is the splendor that it will be etched in your memory forever.

View atop the Rialto Bridge. Rialto Market to the left.

View atop the Rialto Bridge. Rialto Market to the left.

We started to tread then. Oh how we got lost! There are narrow streets all through each island and each street along with old Gothic structures scream of the history. You’d think that you’re in a Gothic hopelessly romantic book while roaming these streets (you love that… don’t deny!). Blended with latest fashion houses such as Prada and Promod, the architecture and the feel is like rich old wine in striking new bottle. Only I wish I could have your cordial smile for company!

img_20161001_144304 img_20161001_131159

The streets took us to the Piazza San Marco, the main public center of Venezia. It hosts the magnificent Basilica of San Marco. It is huge and ornate and you can see mosaics depicting godliness of Christ amongst other brilliant sculptures and of course a breathtaking view of the lagoon. The history of the Basilica is something I cannot elucidate here lest the blog becomes too tiring for you. The planning, designing and construction of the whole plaza makes you ponder over how they did it. Imagining such a structure on such a type of land is itself a challenging task let alone the artistry.

img_20161001_152027    img_20161001_152401


We roamed around in the streets some more quaffing each sight that the city had to offer. You tend to travel more into history the deeper you wander. We took several wrong turns and ended up sitting near the steps of some sub canal enjoying the fact that we were in Venice. It didn’t matter because the moment had us all euphoric and there were pretty girls every where *shameless smile*.

There were flea markets and shopping areas too where you can buy some memorabilia at well… not-so-cheap price. It’s a tourist spot, the hawkers WILL rip off tourists and when you’re paying in euros, it pains… really pains. But nonetheless, the memories we took back is what none can take from us.

img_20161001_162619  img_20161001_155740

We started walking back towards the train station where the tour group had to assemble before departure. The evening was awesome and you can imagine such a city at dusk with lights reflecting off of the water and the magic of the night descending upon us. Oh you’d have fallen in love with this place and I’d have been gaping at you trying to contain that lit face with the awesome sights this city has.




Since being boisterous is a direct consequence of hollow knowledge, I’ll write about some cool tech I recently had a chance to look into. To keep things simple and clutter free, I have links to pre-requisite information and for reference and further reading. While working on nothing in the current project, I looked into how a dual clutch transmission works and how data is transmitted in between various subsystems in an automobile.

I’m a bottom feeder. I work nonce and talk much. I need appreciation and want to portray myself as a know-it-all. I enforce my perspective of things on others and get irked when they balk. I’m a sycophantic suck up and I’ll be that because my intelligence limits me to work on meaningful things. I use low cunning and honeyed language to escape work. I’m narcissistic and I cannot bear someone else outshining  me.

Having a keen interest in transmission systems or colloquially, gearbox, it was intriguing to understand how a dual clutch transmission (DCT) sends an upshift recommendation to the instrument cluster. From wikipedia: “A transmission is a machine in a power transmission system, which provides controlled application of the power.”. In a car (or vehicle), the internal combustion engine is the power unit and it provides, through the transmission system, power to the drive wheels. The transmission unit, for example, is designed to deliver more torque in lower gears and higher power in higher gears (gear ratios). From manual transmissions that have dominated road cars till now to the new DCTs, transmission systems have become more complex and more efficient.

You can read about various transmissions in the wiki link above, we will be concentrating on DCTs. As the name suggests, the transmission consists of two clutches cleverly mounted over each other. Quintessentially, it is two manual transmissions fused into one. The advantage lies in the fact that each sub unit has alternating set of gear trains and each sub unit has its own clutch (“Dual” clutch).  Refer to the diagram below. This setup, along with the required electronics, gives the driver an option of fully automatic mode where the gearbox ECU handles everything and also a manual mode where the driver is required to shift gears.


I’m an over excited socially overactive low life. I talk about random disconnected things. I like to be the centre of attention and hence usually let my self esteem flood the drains. I’m entertaining, doubt that not! I have no knowledge of all things and all knowledge of no things. I have a limited perspective of things but I think that I have seen and done much. I’m a motor mouth and I care to give no thoughts behind my words.

I’m a pseudo philosophical wannabe. I talk about varied things hanging on the fringes of reality. I do so because I want people to think of me as a stoner without knowing that I’m being thought of as an idiot. But I pay it no heed because I have my own set of pseudo philosophical views conforming to the general dogma surrounding stoners and I have no imagination. I have a bad boy outlook and I think that makes me cool.

In my studies, I looked into how, in manual mode, the driver is notified of an upshift at the best possible moment. Looking a bit deeper into DCT, each clutch hosts a transmission shaft. The transmission shafts are concentric and each transmission shaft is connected to a separate gear train system. The gear train is arranged in a constant mesh with “odd” gears (1, 3, 5 ,7) on the inner shaft and “Even” gears (2, 4, 6 and reverse) on the outer shaft. The gear train transmits power from the engine, via the engaged gear, to the differential that drives the drive wheels.

The gears are engaged by shifting the gear selector. The selected gear is free to spin on the drive shaft. The gear selector is fixed with the drive shaft and hence will turn the drive shaft. When the selector is locked with the gear, it will spin at the same speed and hence driving the drive shaft. The gearbox ECU is intelligent enough to pre-select the next required gear. The setup is such that the next required gear will always lie on the other transmission shaft (DCT is a sequential transmission). Hence it only requires disengaging the current clutch and engaging the other. In the automatic mode, this whole operation is controlled by the gearbox ECU and manual mode, the actual changing of gears is left to the driver.

transmission-dual-clutch (1)

Arrows indicate power transmission.

In automotive electronics, communication between various subsystems is done predominantly using the CAN protocol. Each ECU processes a CAN packet whenever it receives or transmits data. What message a CAN packet will carry and the priority of each message is decided by the designer. Since it is a bus protocol and there are n-number of ECUs interacting with the bus simultaneously, CAN protocol has to decide which data packet will be transmitted on the bus. The protocol ensures that the data with the highest priority wins the bus.

I’m prone to flattery and will tell anyone, who is ready to listen, about things that I do. I like to convolute things and make an impression by giving grandiose solutions to petty problems. I over work, over think and over react. I like sycophantic suck ups because they feed my ego and  I surround myself with such. I make random useless dry jokes and laugh about it, out loud and expect others to do so.

The gearbox ECU assimilates the current driving conditions and predicts the best possible moment to upshift a gear. This message is transmitted from the gearbox ECU to the instrument cluster and the driver is notified visually or audibly about the same. In some applications, flooring the pedal (hard acceleration) sets the “kickdown” mode. The gearbox ECU downshifts to lower gears giving more acceleration and then upshifts again accordingly. DCT allows for lightening fast gear shifts and also hassle free driving while cruising in the automatic mode.

I’m a generic socially acceptable meatbag. I go to social gatherings and I talk shit to people. I talk to shit people too about shit agendas and other shit people. I enjoy having behind-the-back conversations and forming opinions. I form opinions based on other opinions and I’m steadfast on those opinions because I think they are my own opinions. I cannot imagine working more than I’m given to do. I’m old wave but I try to be new school. I’m working hard and getting by until the day I die.

PS: This article is not a tutorial or a study aid. This post is for infotainment purposes and the author takes no responsibility for the dearth of technical information.


Shitty Code


While working on something, I realised something else. Well… that is how I go about life usually, but this time, a stroke of intelligent design struck me. Also, lately, my blogs have been all about friends and feelings pertaining to happiness and warmth between fellow humans. To restore the balance, I’d like to share a small hack I did. It is very cool in the sense that it uses an obscure concept of C programming.

Suppose that one has multiple sources of data. In words of MVC, suppose that you have multiple data Models. In C, such Models are represented as structures. For every type of Model, a structure can exist that provides a user accessible way to manipulate the data. For brevity, consider two SQL tables in a database. One containing the name and ID number of a person (call it contact) and the other containing height and weight (call it body) of that person.

Now, ways exist to make a C program connect to a data source to fetch data and one can cast that data into a particular structure. Let us assume that, after obtaining data from the tables, we have formatted that data into following structures.

struct contact {
  int id;
  char *name;

struct body {
  float height;
  float weight;

struct contact contacts[n]; // list of contacts of N number of people
struct body bodies[n]; // list of body type of N number of people

A problem arises when one tries to read or update these structures. Each structure needs a dedicated read and write functions because each structure is unique to itself. Like such:

void readContacts(struct contact *contacts) {
  int i = 0;
  int id;
  char *name;
  while(contacts[i] != null) {
    id = contacts[i].id;
    name = contacts[i].name;
  // do something with id and name

void readBody(struct body *bodies) {
  int i = 0;
  float h, w;
  while(bodies[i] != null) {
    h = bodies[i].height;
    w = bodies[i].weight;
  // do something with height and weight... redundant code. <- not cool.

But what if we have a generic type called LIST? In QtC++ and Android, we have ListViews that provide methods to manipulate such lists. We may have different “lists” for different types of Models but functions that manipulate them are same. That is what object orientation is all about… encapsulation and abstraction.

The problem statement hence can be laid down as such: We have lists of disparate data that we want to manipulate using a single abstract and generic data type LIST. This will let us define manipulation functions only once and use them for different lists… data encapsulation, that is to say.

Having understood the problem statement, we conclude that we need a “new” data type LIST. This data type must be able to store the data as well as provide methods to initialise, access and update the stored data. That is, we need a “constructor” to set the data in the list and a “getter” function to get the stored value.

struct _hidden {
 char *data;
 void(*constructor)(char *someData, struct _hidden *this);
 int(*size)(struct _hidden *this);
 char*(*getter)(struct _hidden *this);

As you can see, the above structure has a variable to hold the data and functions (pointers or rather pointer-to-implementation) to manipulate the data. C doesn’t have the concept of “this” pointers, but we need to keep a track of the current object that is being manipulated, struct _hidden *this is used to keep track of the current object.

Defining these functions are trivial:

void psuedoConstructor(char *data, struct _hidden *this) {
  this->data = data;
int size(struct _hidden *this) {return sizeof(this->data);}
char* getter(struct _hidden *this) {return this->data;}

The element of black magic that we now need is a way to set the function pointers defined in our structure to these manipulating functions. We must use such a method so that every time a new LIST object is created, these functions are available for them and that too, exclusively. This hallowed and dark piece of code is manifested as follows:

#define LIST(X) struct _hidden X = {.data = NULL, \
                                 .constructor = psuedoConstructor, \
                                 .size = size, \
                                 .getter = getter} // the crux of the magic

This syntax is used to initialise a structure with default values. If we use this in a macro we can now write a something like: LIST(L1). L1 automatically has all the member functions and can access the hidden data member of this structure. The actual structure (struct _hidden) is abstracted away.

We can now write an example:

#include <stdio.h>
#include <stdlib.h>
#include "shittycode.h" // the header file with all the black magic

struct contact {
 int id;
 char *name;

struct body {
 float h;
 double w;

struct contact contacts[3];
struct body bodies[3];

void makeModel1(){
 int i = 0;
 for(i = 0; i < 3; i++) {
 d1[i].a = i + 1;
 d1[i].name = "Code Ninja";

void makeModel2(){
 int i = 0;
 for(i = 0; i < 3; i++) {
 d2[i].a = i + 2;
 d2[i].b = i * 0.235;

int main() {
 LIST(l1); // generic data type list.
 makeModel1(); // demo model... model can come from any where
 makeModel2(); // demo model... model can be any thing
 l1.constructor((char *)&d1, &l1); // must send a reference to self
 l2.constructor((char *)&d2, &l2);
 struct data1 *r1 = (struct data1 *)l1.getter(&l1);
 printf("%s, %d\n", r1[2].name, r1[1].a); // just checked random entries
 struct data2 *r2 = (struct data2 *)l2.getter(&l2);
 printf("%f, %f\n", r2[2].b, r2[1].a); // use loop to go through each entry
 return 0;

Clearly, L1 and L2 in the above code represent different lists having different data. We can still use same functions on both these objects without a conflict. Also, all the implementation of LIST is abstracted away from the user. They just need to call the appropriate functions related to this particular object.

We can of course have such implementation for anything we can imagine. For example: we can define a BUTTON to simulate a GUI button and associate an “onClick” event with it instead of a “getter”.

This little piece of black magic is available here.



Paean for a dream


Alright, since my last blog post, that social interaction group has become a friend circle. That’s what happens when you go out for a social gathering over a social lubricant in a social setup. The floodgates open and you start talking with your fellow attendees. Although I spilled half a glass of a golden liquid on one of the attendees, I still had a very good time with this social thing I have going on.

We have added a new human to this social circle but The Guy was missing. This new character, along with another, threw a party to commemorate their births. As per my understanding of a social regime, it is canonical to raise a toast, with some liquor, in such cases. After all, we are celebrating the best gift that we can get… the gift of life.

BDayGuys - 1

Usually, when I feel like having  a taste of that bubbling golden liquid, I go out alone to some exclusive bar and get high with myself. That’s the case when I’m very happy and achieved something very great. That golden yellow poison takes me to another level of happiness and I share it with none other than my solitude. This time, sharing it with four other humans, it was exuberant. Awesome location, awesome people and awesome weather were what complimented this time I had with these people.


The evening started with us reaching this cafe in one of the best spots in Delhi. I was already in a good state of mind with my own poison and wanted not to indulge in this social mutual poisoning. But since the canon calls for everyone’s indulgence, I couldn’t say no to my favourite yellow bubbling liquid. Oh how the three ladies looked! Oh how happy The New Human seemed! And all was complimented by that warmth everyone seemed to be radiating!


Out of all the situations I have observed, the social lubricant helps to make a bond between people. Lady D was being facetious (and tipsy) and didn’t mind when we laughed at her naiveness of the moment. Soni and Sweet P were laughing and their auras were a beautiful adjuvant to the awesomeness of the evening. The New Human was a bit too loud to my taste but I like people who hide not their state after being held up by some hard and strong intoxicant. I was, as usual, in the same state of mind I’m always in, albeit a bit more interactive and colloquial.


It would seem incomplete if I say naught about our food fetishes. The food was… satisfactory. I mean, you cannot expect more out of a generic bar other than chicken and cottage cheese. It was savoury no doubts and Lady D’s tinkling laughter made it all the more an occasion to enjoy the hot and spiced platters. Sweet P was in some other state of mind enjoying her trip and The New Human was chugging on his liquor with much fervour and enthusiasm so as to get sincerely intoxicated.

We have come together in this moment in time from different walks in life. Never did we realise that we would be sitting together in a company like such and have some laugh about things. It was an evening worth remembering and since there are only words I have to take your heart away, I quote this:

“Who am I, you ask?

I’m made from all the people I have encountered and all the situations I have experienced.

Inside, I hold the laughter and warmth of my friends.

Inside, there is a cracked heart and bitter words from heated arguments.

Inside, there are emotions I canst not convey and music that gets me through.

I’m made from all these moments I have had and all these people I have been with. That is who I’m.” ~ Ming D. Liu.

I raise my glass to each member of this social group and hope that they are as awesome as they were today for some time to come. I seldom say such things to people but I kind of like being around this set of human entities.

A great night I wish upon you all.