Android NDK console print C/C++ – Chirag Patel

When your Android app has C/C++ code using NDK tools and you want printing output to serial port console, here’s the solution.

// change sharing first
chmod(“/dev/console”, S_IRWXG | S_IRWXO | S_IRWXU);
// open file
int serialFd = open(“/dev/console”, O_RDWR | O_NONBLOCK | O_NDELAY | O_NOCTTY | O_APPEND);
__android_log_print(ANDROID_LOG_DEBUG, “Serial”, “Serial console fd=%d errno=%d(%s)”, serialFd, errno, strerror(errno));
if (serialFd >= 0) {
    write(serialFd, my_buffer, buffer_length);

Beyond Stephen Hawking – Chirag Patel                                2018 April 01

Beyond Stephen Hawking – Chirag Patel                                2018 April 01

#StephenHawking #DarkMatter #DarkEnergy #BeyondBigBang #BigBang #Upanishad

This article is my homage to one of greatest minds of our time – Stephen Hawking.

On 2018 March 02, I read a news article on Stephen Hawking (link: Hawking said that he knew what it was before big bang! About 13.8 billion years ago, the entire universe was a single atom, Hawking said. In that immensely dense particle of heat and energy, the laws of Physics and Time did not exist! In fact, time tends to nothing infinitely in that tiny speck. There was no point of talking about what happened before that as it did not have any observational consequences, said Hawking.

After reading that, instantly, I thought of atharvashira upanishad! It very well describes how this universe is formed and how it came into existence. Stephen Hawking passed away on 2018 March 14. And since then, I wanted to write this article!

We do not know exact time when atharvashira or any upanishad was written. General belief is that the upanishads were written some 2500-3000 years ago. Traditionally, upanishads are collection of explanation of vedas as taught by rushis to their disciples. So, this oral tradition might very well be 5000-6000 year old!

atharvashira upanishad is also known as atharvashiras or atharvashirsa upanishad. It is a collection of 7 verses describing rudra. It is based on atharva veda. These verses use contemporary words to characterize rudra. Let us analyze some of these words that are very modern and can be compared with modern scientific discoveries.

  1. rudra is indestructible (akshara) and destruclible (kshara).

The world as we know is destructible. Everything around us that we can perceive with our sensory organs goes through cycles of life and death.

Now at subtle level, there is energy and there are elementary particles. These can change their forms but are basically indestructible as long the universe exists. Our universe is the result of big bang. So, when time commenced, there has to be some state of matter and energy that existed before. This can be called seed of the universe and this aspect of universe can be said to be indestructible.

  1. Eight planets (graha) and shadow-planets (pratigraha) are rudra.

When this upanishad was written, people must be aware of planets being distinct objects from stars. Indian astronomical texts suggest eight planets – Sun (soorya), Moon (chandra), Jupiter (bruhaspati), Saturn (shani), Venus (shukra), Mercury (budha), Mars (mangala), Earth (pruthvi). Shadows creating lunar and solar eclipses are called shadow planets (raahu, ketu) in that system. People of ancient time must have a method to identify these objects in sky and that seems to be a remarkable fit.

  1. aumkara is omnipresent and eternal and that is rudra.

One can utter aum without using tongue, teeth and palate. It is primordial sound. And thus, it is primordial energy. So, we can say that this energy or sound must have existed always according to atharvashira upanishad. Also, this sound or energy is all pervading per the upanishad.

  1. aumkara is omnipresent because it is present within everything in this universe as non-manifested entity as oil within sesame seeds. aumkara is eternal because it has no beginning and no end while pronouncing. aumkara is brightest white because it is self-illuminating and gives light to everything else.

These three qualities are remarkable in the sense that they also can be attributed to elementary particles. Every particle can be considered to follow a wave like pattern. And thus, it has sound and vision even though we cannot perceive such subtle properties. So, when we utter aumkara, we are being in tune with primordial universe. This has immense effect at cellular level which we cannot feel but its result is evident at gross level.

Also, 72% of this universe is made up of dark energy. Our cells, atoms everything comprise of dark energy. We do not have direct observational evidences yet. Dark energy is hypothesis. But, this part of the verse states us that dark energy is present in everything of this universe.

  1. Fire (agni), air (vaayu), water (jala), earth (bhoomi) and space (aakaasha) are ashes.

When an object is burnt, its residual matter is ash. Ancient belief was that every matter in this universe is made up of five basic elements – earth, water, fire, air and space. In this verse, it is said that these basic elements are ashes. So, there has to be some objects which were burnt and the result is the formation of the basic elements. We know for sure that Earth is resultant of cooled fire ball. When water vapour cools down, it becomes liquid water. But, vapour is formed if liquid water is heated. So, same can be said for fire, air and space.

  1. This universe is born from rudra in form of fire (agni). When rudra goes to sleep, everything is destroyed. Time (kaala) is born from indestructible element (akshara). Time makes it expanding and all pervading. When rudra breathes, darkness (tama) is born. Liquid (aapah) is created from darkness (tama). rudra churns the liquid (aapah) and it becomes thick (shishira). rudra churns it more and it creates foam (fenah). Cosmic egg (anDa) is born from that foam (fenah). brahmaa comes into existence in that egg (anDa). Air (vaayu) is born from brahmaa. aumkaara is born from air (vaayu). aumkaara creates light (saavitree). Light (saavitree) creates sound (gaayatree). And, sound (gaayatree) creates world (loka).

This universe came into existence through big bang. The above verse describes that whole process in detail. Heat energy and matter were a dense tiny speck which must be the seed for this universe. That seed must be some state of matter and energy which is indestructible as it existed before the beginning of time. As time comes into existence, that seed expands. This verse also states cycle nature of this universe. It has end and it has beginning. In the end, universe just vanishes.

Once time starts from seed, dark matter and dark energy comes into existence in the seed. These dark entities become thick after some churning. More churning makes it less dense and it creates foam. From that foam, cosmic egg forms. First, gaseous matter is formed. This gives birth to primordial energy. That energy generates radiation or light. And the radiation or light brings out sound. Sound creates visual forms and thus this world is born.

Modern science is not able to describe this process in detail yet. We can assume that rushi who wrote this upanishad has definitely some insight into the phenomenon.


Fasting – Chirag Patel August 18, 2007

Fasting – Chirag Patel August 18, 2007

Hindus are divided into many different sects. Some sects which are based on “Vaishnava Smpradaya”, asks the followers to do fasting once every month. The Hindu calendar is based on lunar phases. So, every month, the 11th day of waxing moon, is considered the auspicious day to observe fasting.

The basic elements of Hinduism are found in great texts written around 6000 years ago. Bhagavad Gita is one of them which provides very integral terms of Hinduism. This text clearly mandates characteristics of being a Yogi, to lead spiritual path, and to be enlightened. Gita is very much specific about choosing food and having eating habits. According to this great book, offering any substance in pure form to God is the best food. It also cites some substances as leaves, flowers, fruits, and water which are pure and to be offered to God. It states that a true Yogi neither eats more nor eats less.

From later development in vedic texts some 3000 years ago, Patanjali who established a system of “RajaYoga”, declared 8 steps to become a “RajaYogi”. Second step in this system is “Niyama”. This step includes a sub-system called “Tapa”. “Tapa” means habituate mind and body to be in hardship. According to this system, “Tapa” purifies mind and body and makes one ready for advancement in spiritual path.

We can identify two different systems suggested for us – one which favors suffering as habit, and the other that denies any extremities.

Now, let us add a different perspective to this understanding. Physiologically, our body requires energy to digest food. So, if we can fast for half a day or a full day, the saved energy can be utilized for other purposes. People in old time chose some period especially during monsoon which lasts for almost 4 months in India, to do fasting. During this period of year, people feel loss of appetite naturally, and water and/or food have contamination. So, doing frequent fasting during such period allows one to tackle these issues.

In modern era of fasting, people use food cooked with rock salt on the day of fasting. This is not a correct way to do fasting. The whole purpose of fasting is not realized in this case. The best way to fast is to use water only during the day (24 hours period). Some people even prefer not to take water. They do “Nirjala” (literally meaning without water and any food) fasting.

Fasting allows observer to divert attention from food to soul. That allows one to seek path to the truth.


Bhagavatam 1 – Chirag Patel

Bhagavatam Booklet 1 – Chirag Patel




janmaadyasya yatoanvayaaditaratashchvaartheshhvabhijnah svaraaT |

tene brahma hryudaa ya aadikavaye muhyanti yatsoorayah ||

tejo vaarimrudaam yathaa vinimayo yatra trisargoamrushhaa |

dhaamnaa svena sadaa nirastakuhakam satyam param dheemahi ||




One who taught the vedas which confuses learned scholars to brahmaa; One who creates, retains and destroys this world; One who knows everything and who is knowledge; such is God whom we meditate. Like mirage is seen thru’ sun rays, still water is seen as glass, or glass is seen as water – are all illusions but truth; similarly this world created by One with three guNas – sattva, rajas, tamas is illusion and seen as truth. Also, whose grace removes treachery of  maayaa that is ignorance; One who is present as truth in all three states (creation, retention, destruction) and in all three times (past, present, future); we meditate upon such God.


[These very first shlokas mention three states of existence – creation, retention, destruction. It talks about some physical phenomena – mirage and glass. At that time, such observations and terms were in use. God is a concept which does not have physical or any other type of existence. If God exists, God is subject to creation and destruction. The entity which is subject to existence cannot be ever present or cannot be the source of all. The goal of bhagavatam is thus set to find this eternal truth.]


When vyaasa were thinking of future generations, he guessed that in kaliyuga, humans would be short lived, feeble, non-believers and lifeless. So, he divided veda into four divisions. Then, he created mahaabhaarata. He was still agitated internally. One day naarada visited him and asked him to write a book which would describe krushNa‘s glory in detail.


This whole world is naaraayaNa and every soul is also naaraayaNa.


1-5-37 vaasudeva gaayatree mantra given to naarada by sages:


namo bhagavate tubhyam vaasudevaaya dheemahi |

pradyumnaayaaniruddhaaya namah sankarshhaNaayacha ||




I bow to and meditate upon God as vaasudeva, pradyumna, aniruddha, sankarshhaNa.


[These 4 forms of God are grouped as shreevigraha. krushNa or vaasudeva was son of vasudeva. pradyumna and  aniruddha were krushNa‘s sons. balaraama or sankarshhaNa was krushNa‘s brother. sankarshhaNa is considered a form of ahamkaara (self indulgence) to meditate upon, aniruddha is for mind, pradyumna is for intellect and vaasudeva is for consciousness.]


When karmas are offered to God, they do not bind to samsaara (worldly deeds and attachments).


Root cause of every sorrow is mind.


There are seven notes – shhaDaj, rushhabh, gaandhaar, madhyam, pancham, dhaivat, nishhaad.


bhakti (devotion) brings peace to mind and soul effortlessly.


bhaagavata avasthaa is the state when one forgets self (and soul) while remembering brahman such as saakara (sugar stone) melts into milk and becomes milk.


[People at that time had sugar stones made by lumping melted sugar of canes.]


keertana (singing songs in praise of God) detaches one from world and brings to God.


In kaliyuga, praying God’s form brings faster results.


[Praying God in any form is fine. God is above any form. So, any form that one can have the highest regards is the one to devote to.]


vyaasa sat in meditation in his aashrama (specially built huts) named shamyaapraasa at the bank of river sarasvati. He realized God and maayaa and found the truth behind naarada‘s words on bhaagavatam.


vyaasa selected following two shlokas and asked his disciples to keep chanting around son shuka to bring him back to learn bhagavatam. They are:




aho bakee yam stanakaalakooTam jighaansayaapaayayadapyasaadhvee |

lebhe gatim dhaatryuchitaantatoanyam kam vaa dayaalum sharaNam vrajema ||




Alas, how shall I take shelter of one more merciful than One who granted the position of mother to a pootanaa (she-demon) although she was unfaithful and she prepared deadly poison to be sucked from her breast?




barhaapeeDam naTavaravapuhu karNayo karNikaaram

bibhradvaasaha kanakakapisham vaijayanteem cha maalaam |

randhraanveNoradharasudhayaa poorayan gopavrundai –

rvrundaaraNyam svapadaramaNam praavishad – geetakeertihi ||




shreekrushNa had dress like the best actor, he had crown with peacock feather, he had two karNikaar flowers (kanak champaa or bayur tree or dinner plate tree or muchookund) in ears, he wore peetaambara (loin cloth) with golden yellow color, he had vaijayantee (grass seeds found in present day Uttar Pradesh state in India or panya grass seeds or white bead seeds) garland around neck. He was filling flute holes with nectar from his lower lip and gopas (cow herders) were chanting his praise. Such shreekrushNa entered beautiful vrundaavana (region in present day Uttar Pradesh) and started playing flute.


History of Bhagavatam – Chirag Patel

History of Shrimad Bhagavatam – Chirag Patel


naimishhaaraNya (present day Sitapur district in Uttar Pradesh State of India) was the forest where rushi (sage) shaunaka asked narrator suta of bhagavata. It was on the bank of river gomati. There were some 88,000 rushis gathered there.


vyasa rushi wrote bhagavata which is one of 18 major puranas. His son shuka narrated bhagavata to raja (king) parikshita. Afterwards, shuka lived on one bank of river narmada (present state of Gujarat in India) and vyasa lived on the other bank.


There are total 18,000 shlokas (stanza) in bhagavata. The whole book is written as poem. It is divided into 12 skandhas (booklets). Every booklet has adhyaayas (chapters) with many shlokas. There are various chhandas (meters) – more than 35, used in this book. Some chhandas used : shaardoolavikreeDita (first 1-1-1 and last 12-13-19), vasantatilakaa, mandaakraantaa, lalita, aaryaa, narkuTam, anushhTupa, indravajra, upendravajra, vanshastha, svaagataa, pramaaNika, shaalinee, staaviNee, ruchiraa, mattamayoora etc.


There are 84 stutis (praises) in the book. There are many upadeshas (teachings) in the book. Some important ones : kapila to mother devahuti (booklet 3), sanatkumaaras’ (booklet 4), rushabhadeva’s and jadabharata‘s (booklet 5), jiva‘s to king chitraketu (booklet 6),  hiraNyakashipu to family members and prahlaada to friends (booklet 7), krushNa to devotee uddhava (booklet 11). Lord krushNa‘s teachings to his friend and devotee uddhava is the best of all.


satyam param dheemahi – we meditate upon the utmost truth. This is in the very first shloka and in the last shloka of bhagavata. The goal of bhagavata is to find the truth.


Let us begin our journey in search of that eternal truth.

Preface to Bhagavatam – Chirag Patel

Preface to Bhagavatam – Chirag Patel


I was reading The Grand Design by respected Mr Stephen Hawking. He was suggesting that in olden times, philosophy was basis of scientific discoveries. But, in modern times, philosophy has stopped contributing and aligning with scientific discoveries. For recent centuries, philosophy has evolved into theoretical realms. Philosophy is no longer influential force on human life.

Indian scriptures and philosophy is still in practice in modern India and in Indians across the world. People still follow ancient doctrines today unlike the then contemporary cultures (if there ever were). That means those principles and philosophies are as relevant today as they were in ancient times. So, there is some eternal aspect in these philosophies.

There are many commentaries written on Indian philosophical scriptures. This is my attempt to evaluate ancient mind with modern approach. I would like to attempt philosophical avenues of ancient mind into practical life today.

This is the first book in a series of books on the subject. What is better than Shrimad Bhagavatam to begin with! This book has influenced numerous people over millennia. This is my tribute to universal mind. The original text is written in ancient language Sanskrut(Sanskrit). I have made attempt to translate typical words into English to the most truthful manner per my capacity.

I dedicate this series to all who touched me in this life, in previous lives and next lives if any.

May eternal truth flow thru everyone’s mind to ignite yearning so that all experience the one and the truth!

Geography from Purana – Chirag Patel July 02, 2017

Geography from Purana – Chirag Patel July 02, 2017

In ancient puranic texts, we find references to geographical terrains. Also, puranas mention different worlds.

Jambu Dvipa – salty ocean
Plaksha Dvipa – sugarcane juice ocean
Shaalmali Dvipa – alcoholic wine ocean
Kusha Dvipa – ghee ocean
Kauncha Dvipa – milk ocean
Shaaka Dvipa – curd ocean
Pushkara Dvipa – drinkable water ocean

Map of Jambu Dvipa:

Shrungavan – Kuru varsha
Shveta – Hiranmaya varsha
Nila – Ramyaka varsha
Ketumaala – Malyaavat :: Ilaa :: Meru :: Vruta :: Gandhamaadan – Bhadraashva
Nishaadha – Hari varsha
Hemkuta – Kinpurusha varsha
Himaalaya – Bhaarata varsha

7 Upper lokas (worlds):

Mrutyu – humans
Bhuvar – Evil gods
Svarga – Demi gods
Mahar – Aryamaa, pitru (passed away ancestors)
Jana – rushis, Bhrugu etc
Tapa – rushis, Bhrugu etc
Satya – Brahmaa

7 Lower lokas (worlds):

Atal – daitya (demons)
Vitala – demons
Sutala – demons
Talaatala – nishaachara (nocturnal animals)
Mahaatala – nocturnal animals
Rasaatala – nocturnal animals
Paataala – sarpa (snakes)

experience – Bansidhar Patel

Once in the early morning, I had gone for walking exercises. Surprisingly, I saw a child mourning on the roadside near a tree. I went nearer him and asked why he stood alone, he just raised his finger and revealed my attention towards rising sun in the east. I suddenly asked the reason for his crying and he answered, “my mother has gone to meet the sun and not returned till now.” I realized the real situation and my eyes with full of tears. I came back with full of tragedy.

Home remedies Blood pressure, high cholesterol etc


Acidity, it is said, is worse than Cancer. It is one of the most common problems people encounter in their daily life. The home remedy for Acidity is Raw Grains of Rice.

The Process:
1. Take 8 – 10 grains of raw uncooked rice
2. Swallow it with water before having your breakfast or eating anything in the morning

3. Do this for 21 days to see effective results and continuously for 3 months to eliminate acidity from the body

The Cure:
Reduces acid levels in the body and makes you feel better by the day.

Cholesterol problem accompanies with Hypertension and Heart Problems. This is also one of the common problems in people who have High Blood Pressure and Diabetes. The home remedy for Cholesterol problem is RAW SUPARI or
Betel Nuts.
The Process:
1. Take Raw Supari (Betel Nut that is not flavoured) and slice them or make pieces of the same

2. Chew it for about 20 – 40 minutes after every meal

3. Spit it out

The Cure:
When you chew the supari, the saliva takes in the juice that is generated and this acts like a Blood Thinner. Once your blood becomes free flowing, it brings down the pressure in the blood flow, thereby reducing Blood Pressure too.

One of the simple home remedy cure for Blood Pressure is Methi Seeds or Fenugreek Seeds.
The Process:
1. Take a pinch of Raw Fenugreek Seeds, about 8 – 10 seeds

2. Swallow it with water before taking your breakfast, every morning

The Cure:
The seeds of Fenugreek are considered good to reduce the blood pressure.

There are 2 home remedies for Diabetes. One is Black Tea

and the other is Lady Fingers or Okra.

BLACK TEA: Due to high medication, the organ that is worst affected is the Kidney. It has been observed that Black Tea (tea without milk, sugar or lemon) is good for the Kidney. Hence, a cup of black tea every morning is highly advisable.

The Process:
1. Boil water along
with the tea leaves (any tea leaves will do).
2. Drink the concoction without adding milk, sugar or lemon.

The Cure:
Black Tea will help in enhancing the function of the kidney, thereby not affecting it more.

Lady Finger/Okra is considered to be a good home medicine for diabetes.

The Process:
1. Slit the ladies finger into 2 halves vertically and soak it in water overnight.

2. The next morning, remove the ladies fingers and drink the water, before eating your breakfast.

The Cure:
After the ladies fingers are soaked overnight in the water, you can observe that the water becomes sticky in the morning. This sticky water is considered to be good for people who suffer from Diabetes.

One syllable Gujarati words

કાન – kaan – Ear
આંખ – aaKh – Eye
નાક – naak – Nose
હાથ – haaTh – Hand
પગ – pag – Foot
પેટ – peT – Stomach
જીભ – jeeBh – Tongue
દાંત – daat – Tooth
વાળ – vaaL – Hair
નખ – naKh – Nail
ગાલ – gaal – Cheek
હોઠ – hoTH – Lips
ટાલ – Taal – Skull without hair

ગાય – gaay – Cow
ભૂન્ડ – BhoonD – Pig
મોર – mor – Peacock
વાઘ – vaaGh – Tiger
ભેંસ – Bhes – Buffalo
સાપ – saap – Snake
ઊંટ – ooT – Camel
હન્સ – hans – Swan

ઘાસ – Ghaas – grass
ફૂલ – fool – Flower
ઝાડ – JhaaD – Tree
છોડ – CHoD – Plant
વેલ – vel – Vine
વાંસ – vaas – Bamboo
ડાળ – DaaL – Branch
થડ – ThaD – Trunk/Stem
મૂળ – mooL – Root
પાન – paan – Leaf
ફળ – faL – Fruit
બી – bee – Seed

જો – jo – See
ખા – Khaa – Eat
ચાલ – Chaal – Walk
ચલ – Chal – Come
જા – jaa – Go
દોડ – doD – Run
હસ – has – Smile
રડ – raD – Cry
આપ – aap – Give
લે – le – Take
વાંચ – vaaCh – Read
લખ – laKh – Write
ચાખ – ChaaKh – Taste
સૂંઘ – sunGh – Smell
ગન્ધ – ganDh – Odor
વાસ – vaas – Smell
છોડ – ChoD – Leave
હા – haa – Yes
ના – naa – No
બોલ – bol – Speak
રમ – ram – Play
માર – maar – Hit
હાર – haar – Lose
જીત – jeet – Win
ભાગ – Bhaag – Run
ઊઠ – ooTH – Wake up/Stand up
બેસ – bes – Sit
ઊન્ઘ – oonGh – Sleep

મા – maa – Mom
બા – baa – Grandma
ઘર – Ghar – House
પૂલ – pool – Bridge
તોપ – top – Gun
ગામ – gaam – Village
આગ – aag – Fire

બૂટ – booT – Shoes
શર્ટ – SharT – Shirt
પેન્ટ – penT – Pant
પીન – pin – Hairpin
ફ્રોક – frok – Frock
હાર – haar – Garland

ભાત – Bhaat – Rice
ઘઉં – Ghau – Wheat
શાક – Shaak – Vegetables
શીન્ગ – Shing – Beans
દાળ – daaL – Grams
ચા – Chaa – Tea
દૂધ – dooDh – Milk
ઘી – Ghee – Clarified Butter
તેલ – tel – Oil
ગોળ – goL – Jaggery
ખાન્ડ – KhaanD – Sugar

એક – ek – One
બે – be – Two
ત્રણ – traN – Three
ચાર – Chaar – Four
પાંચ – paaCh – Five
છ – CH – Six
સાત – saat – Seven
આઠ – aaTH – Eight
નવ – nav – Nine
દશ – daSh – Ten
વીસ – vis – Twenty
ત્રીસ – tris – Thirty
સો – so – Hundred
લાખ – laaKh – 100,000