Blog Archives

Review of N.R. Narayana Murthy’s Visionary Book, ‘A Better India: A Better World’

A Better India- A Better World is a stimulating book by an important business leader. When an Indian assistant first lent it to me, I wasn’t excited to read it but felt necessitated. I was very much completely astounded. N.R. Narayana Murthy, the founder and chairperson of Infosys organizes a rather comprehensible and positive vision to the world according to himself. If only many more business leaders thought like him, one might even feel tempted by this thing called “compassionate capitalism.” Narayana Murthy has thought much about India, his homeland, and its contradictions.

'Better India: A Better World' by N.R. Narayana Murthy (ISBN 0143068571)

If the eyes of all men were naturally jaundiced, all white objects would appear uniformly yellow. In the introduction to A Better India- A Better World, Narayana Murthy outlines,

The enigma of India is that our progress in higher education and in science and technology has not been sufficient to take 350 million Indians out of illiteracy. It is difficult to imagine that 318 million people in the country do not have access to safe drinking water and 250 million people do not have access to basic medical care. Why should 630 million people not have access to acceptable sanitation facilities even in 2009? When you see world-class supermarkets and food chains in our towns, and when our urban youngsters gloat over the choice of toppings on their pizzas, why should 51 per cent of the children in the country be undernourished? When India is among the largest producers of engineers and scientists in the world, why should 52 per cent of the primary schools have only one teacher for every two classes? When our politicians and bureaucrats live in huge houses in Lutyens’ Delhi and the state capitals, our corporate leaders splurge money on mansions, yachts and planes, and our urban youth revel in their latest sport shoes, why should 300 million Indians live on hardly Rs 545 per month (US$10 at current exchange rate), barely sufficient to manage two meals a day, with little or no money left for schooling, clothes, shelter and medicine?

His starting point is Franklin D. Roosevelt’s “four freedoms”—freedom of speech and expression, freedom of religion, freedom from want, and freedom from fear. He later elaborates on what a “civilized society” entails: “a society where everybody has equal opportunity to better his or her life; where every child has food, shelter, healthcare, and education; a society where duties come before rights; where each generation makes sacrifices to make life better for the next generation.” Obviously, many of these tenets are increasingly not present in today’s USA and, worse; many Americans on the right would dispute these principles as smacking of socialism. In this case, an effect has been given for a cause.

Could we be certain that the admeasurements of these two different meridians were made without error, this would, undoubtedly, be a demonstrative proof of the irregularity of the earth’s figure. Narayana Murthy is a well read and well-travelled, learned man who clearly thinks a lot about societal issues. In the introduction, his acknowledged three books that have influenced him deeply: The Protestant Ethic and the Spirit of Capitalism by Max Weber; My Experiments with Truth by Mahatma Gandhi; and Peau Noire, Masques Blancs by Franz Fanon. This rather eclectic selection shows the breadth of his reading and attests to an open mind. He builds his own philosophy on these disparate strains of thought, emphasizing the importance of values and leadership. He sets out early in the book that, “I do not know of any community—a company, an institution or a nation—that has achieved success without a long journey of aspiration, hard work, commitment, focus, hope, confidence, humility and sacrifice”. This question cannot be resolved exactly, without the author’s help. The first time he was restored, he thought he actually touched whatever he saw; but by degrees his experience corrected his numberless mistakes.

His student years in France in the 1970s were very important in forming his thinking. In the first chapter, a lecture to students, he compares France to India for its civil-mindedness: “In France, everybody acted as if it was their job to discuss, debate and quickly act on improving public facilities. In India, we discuss debate and behave as if the improvement of any public facility is not our task, and consequently, do not act at all.” His deduction: being a developing country is a mindset. Here he breaks clear of the Left, placing the onus on the individual, as well as the society as a whole, to take responsibility for its own destiny. He tells a story of how he lost any compassion for the Left after having been imprisoned by Bulgarian authorities when traveling back from Paris to India in 1974.

The next event that left an indelible mark on me occurred in 1974. The location: Nis, a border town between former Yugoslavia, now Serbia, and Bulgaria. I was hitchhiking from Paris back to Mysore, India, my home town.

By the time a kind driver dropped me at Nis railway station at 9 p.m. on a Saturday night, the restaurant was closed. So was the bank the next morning, and I could not eat because I had no local money. I slept on the railway platform until 8.30 pm in the night when the Sofia Express pulled in.

The only passengers in my compartment were a girl and a boy. I struck a conversation in French with the young girl. She talked about the travails of living in an iron curtain country, until we were roughly interrupted by some policemen who, I later gathered, were summoned by the young man who thought we were criticising the communist government of Bulgaria.

The girl was led away; my backpack and sleeping bag were confiscated. I was dragged along the platform into a small 8×8 foot room with a cold stone floor and a hole in one corner by way of toilet facilities. I was held in that bitterly cold room without food or water for over 72 hours.

I had lost all hope of ever seeing the outside world again, when the door opened. I was again dragged out unceremoniously, locked up in the guard’s compartment on a departing freight train and told that I would be released 20 hours later upon reaching Istanbul. The guard’s final words still ring in my ears — “You are from a friendly country called India and that is why we are letting you go!”

The journey to Istanbul was lonely, and I was starving. This long, lonely, cold journey forced me to deeply rethink my convictions about Communism. Early on a dark Thursday morning, after being hungry for 108 hours, I was purged of any last vestiges of affinity for the Left.

I concluded that entrepreneurship, resulting in large-scale job creation, was the only viable mechanism for eradicating poverty in societies.

Deep in my heart, I always thank the Bulgarian guards for transforming me from a confused Leftist into a determined, compassionate capitalist! Inevitably, this sequence of events led to the eventual founding of Infosys in 1981.

Cofounder and executive chairman N.R. Narayana Murthy came out of retirement in 2013 to help right the Infosys ship. His return resulted in improved financial performance, although it has been marked by numerous high-profile executive resignations. Murthy again stepped down and re-entered retirement to make way for CEO Vishal Sikka in August 2014. Microsoft Founder Bill Gates said, “Narayana Murthy overcame many obstacles and demonstrated that is possible to create a world-class, values-driven company in India. Through his vision and leadership Murthy sparked a wave of innovation and entrepreneurship that changed the way we view ourselves and how the world views India.”

Review of N.R. Narayana Murthy's Visionary Book, 'A Better India- A Better World' This is a collection of 38 essays and speeches given at a variety of fora during the 2000s and selected for the book by the author himself. They are divided into sections:

  • Address to students;
  • Values;
  • Important national issues;
  • Education;
  • Leadership challenges;
  • Corporate and public governance;
  • Corporate social responsibility and philanthropy;
  • Entrepreneurship;
  • Globalization;
  • three short chapters on Infosys.

In such a collection, it is inevitable that there are overlaps between the chapters and many recurrent themes. I’ll pick a few themes that I found interesting here below.

He addresses students in a variety of schools, ranging from prestigious institutions like INSEAD, Indian Institute of Technology, IESE Business School in Barcelona and NYU, to various other universities in India. He exhorts his values: “You must believe in and act according to the principle that putting public interest ahead of private interest in the short term will be better for your private concerns in the long run.” … “Ego, vanity, and contempt for other people have clouded our minds for thousands of years and impeded our progress. Humility is scarce in this country.” … “No county that has shunned merit has succeeded in solving its problems.” … “The reason for the lack of progress in many developing nations is not the paucity of resources but the lack of management talent and professionalism.” The winds of the temperate zone are composed of the eddies of these two united.

Narayana Murthy is a fan of globalization and refers to the “global bazaar” and Thomas Friedman’s “flat world” in several places. In this context, he calls for “an environment of tolerance and respect for multi-culturalism.” He sees global warming and environmental degradation as major threats and sees that the answers must lie in global cooperation: “The solution is not to force developing nations to forgo what the developed world has enjoyed for over a century. It is to come together as one planet and use innovation in technology to produce alternate energy solutions and reduction of carbon emissions.” His thinking reflects the intergenerational equity perspective embedded in the original definition of sustainable development: “After all, this is the only planet we have. Conduct yourself as if you have borrowed it from the next generation. Remember that you will have to give it back to them in good shape.” The time of feeling the pulse is in a morning, some time after getting up, and before reduction of carbon emissions.

A Better India- A Better World is also very critical of laissez-faire capitalism, a theme that resonates throughout the book: “Unfortunately, the greed of several corporate leaders, the meltdown of Wall Street, the increasing differences between the salaries of CEOs and ordinary workers, and the unbelievable severance compensation paid to failed CEOs have called into question whether capitalism is indeed a solution for the benefit of all, or if it is an instrument for a few cunning people to hoodwink a large mass of gullible middle-class and poor people. Never before in the history of capitalism have so few people brought so much misery to so many.” His views of how to manage a company are in line with his broader beliefs: “The only way you can save capitalism and bring it back to its shining glory is by conducting yourselves as decent, honest, fair, diligent, and socially conscious business leaders. In every action of yours, you have to ask how it will make the lowest level worker in your corporation and the poorest person in your society better. You have to learn to put the interest of the community—your corporation, your society, your nation and this planet—before your own interest.” In light of these issues, Infosys has launched a number of initiatives to improve its performance. The company has some way to go before rectifying its position, but a number of signs are promising, with revenue growth, margins, client mining, and employee attrition improving. Again emphasizing the need for sacrifice, he states that, “(T) to succeed in these days of globalization, global warming and laissez-faire capitalism, every worker in your corporation will have to accept tremendous sacrifices in the short term and hope that goodness will, indeed, succeed in the long term and make life better for every one of them.” Certainly not the thinking en vogue on this continent!

Review of N.R. Narayana Murthy's Visionary Book, 'A Better India- A Better World' Narayana Murthy is also rather harsh on India. In a chapter entitled “What Can We Learn from the West,” he chastises his own nation for faulty values: “Indian society has, for over a thousand years, put loyalty to family ahead of loyalty to society.” … “Unfortunately, our attitude towards family life is not reflected in our attitude towards the community. From littering the streets to corruption to violating contractual obligations, we are apathetic to the community good.” … “Apathy in addressing community matters has held us back from making progress which is otherwise within our reach. We see serious problems around us but do not try to solve them. We behave as if the problems do not exist or as if they belong to someone else.” He continues, “Our intellectual arrogance has also not helped our society. I have travelled extensively and, in my experience, have not come across another society where people are as contemptuous of better societies as we are, with as little progress as we have achieved.” He identifies things that India should learn from the West, including accountability, dignity of labor (“everybody in India wants to be a thinker and not a doer”), and professionalism (punctuality, respect for other people’s time, respecting contractual obligations), concluding that “the most important attribute of a progressive society is respect for others who have accomplished more than they themselves have, and the willingness to learn from them.” The conduct of the appetite regulates the health; and this is not enough regarded.

Elaborating on individual responsibilities, he adds one more: discipline. “There are several ingredients for national development—natural resources, human resources, leadership, and finally, discipline.” … “The utter lack of discipline exhibited by our people is rendering these other three powerful factors ineffective for fast-paced economic growth. We see umpteen examples of undisciplined behavior around us every day. What is even sadder is that this behavior has become the norm even among the powerful and the elite.” … “Discipline is about complying with the agreed protocols, norms, desirable practices, regulations and the laws of the land designed to improve the performance of individuals and societies. Discipline is the bedrock of individual development, community development, and national development.” In this category, Narayana Murthy includes aspects, such as lack of discipline in thought, or intellectual dishonesty (objectivity to focus on outcomes and results, rather than politics or focus on caste and religion; corruption). To achieve discipline, India needs role models (honest, accountable, disciplined leaders committed to change), swift and harsh punishment of offenders, transparency, political reform, and an improved bureaucracy. Manmohan Singh, former Prime Minister of India, wrote, “Narayana Murthy is a role model for millions of Indians. An iconic figure in the country, he is widely respected and looked up not only for his business leadership but also for his ethics and personal conduct. He represents the face of the new, resurgent India to the world.”

Review of N.R. Narayana Murthy's Visionary Book, 'A Better India- A Better World' The part focusing on important national issues considers a wide range, including the role of population in economic development in India. Talking about population growth as a strain to development risks being attacked from both the Left and the Right these days, but Narayana Murthy barges right into the issues. He highlights the need for “good human capital” but also warns “a failure to stabilize India’s population will have significant implications for the future of India’s economy” and that “high population densities have also led to overloaded systems and infrastructure in urban areas.” He links the population debate to environment and resources, in particular energy demand, noting how the combined demands from India and China will put pressure on world resources: “The rapid growth in emerging economies cannot be sustained in the face of mounting environmental deterioration and resource depletion.” He sees a clear role for the government, which must “focus on conservation-friendly policies. For example, subsidies on conventional fuel make it difficult for renewable energy sources to compete and should be removed at least for rich and middle-class people.” … “The government can play a key role as a regulator in making Indian industry environmentally responsible.” Would someone please tell that to the politicians in Washington, DC?

The fourth theme is a cornerstone of the Indian spiritual tradition: self-knowledge. Indeed, the highest form of knowledge, it is said, is self-knowledge. I believe this greater awareness and knowledge of oneself is what ultimately helps develop a more grounded belief in oneself, courage, determination, and, above all, humility, all qualities which enable one to wear one’s success with dignity and grace.

So, how to deal with the issue of excessive population growth? Well, there is the need to meet unmet need of contraception and the issue of how Indian states have failed to implement family planning programs. Narayana Murthy recognizes that there’s been a significant decrease in population growth in certain southern states, such as Kerala, Tamil Nadu, Karnataka and Andhra Pradesh, where “state governments here focused on human development, opened up local economies, and improved social services … Rising female literacy in these states contributed to the success of family planning … A focus on women’s and children’s health also contribute to population control.” He concludes, in line with what is also known from empirical literature: “human development goes hand in hand with lower population growth.” What he doesn”t mention is that states like Kerala have for decades been run by parties from the Left.

A Better India- A Better World chapter “Framework for Urban Planning in Modern India” also recognizes the importance of planning but calls for “radical, immediate reform in the planning and management of our cities” that “must adequately address the shortage of low-cost housing.”

Review of N.R. Narayana Murthy's Visionary Book, 'A Better India- A Better World' Moving to corporate governance, he extols the virtues of good corporate governance to enhance corporate performance while ensuring that corporations conform to the interests of investors and society by “creating fairness, transparency, and accountability in business activities among employees, management and the board.” Infosys has many long-standing client relationships, a well-managed global delivery model, and a comprehensive services portfolio. “The abuse of corporate power results from incentives within firms that encourage a culture of corruption. … Clearly, good governance requires a mindset within the corporation which integrates the corporate code of ethics into the day-to-day activities of its managers and workers.” “Corporate leaders have to create a climate of opinion that values respectability in addition to wealth.” To recapitulate all that has been said upon the subject of compassionate capitalism: long continued tones are nothing more than a repetition of the same stroke and tone. Like the two halves of an ellipse, with their ends turned the contrary way.

So what is the “compassionate capitalism” that Narayana Murthy longs for? As said by him, it is about “bringing the power of capitalism to the benefit of large masses. It is about combining the power of mind and heart; the good of capitalism and socialism … The benefits of growth have to be distributed widely.” While this does not exist anyplace, Narayana Murthy does pay some respect to what he calls the “Swedish model.”

Review of N.R. Narayana Murthy's Visionary Book, 'A Better India- A Better World' N.R. Narayana Murthy returns to the leitmotif of the lack of credibility of capitalism today: “Greedy behavior from corporate leaders has strengthened public conviction that free markets are tools for the rich to get richer at the expense of the welfare of the general public.” Lest capitalism is rejected as the most accepted model for growth in developing countries and by the alienated poor, the business leaders have to regain the trust of society and abide the value system of the community where they operate. Touching on a debate that rages in both America and Europe, Narayana Murthy weighs in on executive compensation: “Business leaders should shun excessive managerial compensation. Managerial remuneration should be based on three principles—fairness with respect to the compensation of other employees; transparency with respect to shareholders and employees; and accountability with respect to linking compensation with corporate performance … We have to create a climate of opinion which says respect is more important than wealth.” Certainly. A number of high-profile client-facing executive departures could negatively affect the firm’s standing with legacy clients.

At the end of A Better India- A Better World, this rather prescient and socially aware business leader sees globalization in an virtually absolutely favorable light, concluding that “we need a flat world because is spreads the American beliefs in free trade to the rest of the world; it benefits consumers from all over the globe; it helps create a world with better opportunities for everyone; and, finally, it brings global trade into focus, shunning terrorism and creating a more peaceful world”. Let us for a moment compare this universe to a palace, erected by the divine Architect, and the unphilosophical spectator to a foreigner, who sees but the external part of the building. “Humble and self-effacing, Murthy is known to fly economy class and lives in a modest home in Bangalore—proof, say his fans, that you can combine business success with Gandhian humility.” said Time magazine of Narayana Murthy. Murthy, [says the Time magazine], has not sold his soul for money and success. One of country’s most admired men, he is vigilant about his employees’well-being, granting stock options, building exercise facilities and spreading values as much as wealth.

Tagged
Posted in Management and Leadership Software and Programming

Benefits of Moving More Services Online

Moving More Services Online

Many companies are looking to regenerate positive momentum. The business conditions we face are clearly not for the faint of heart. The times are daunting, volatile, and uncertain. Uncertainty makes planning harder to do, but more important.

For the last 20 years, planning was relatively easy. Economic trends were positive, steady, and predictable. It was a time of optimism in the technology and equity markets. The Internet frenzy was in full swing, and many believed that the tech sector was immune to downturn. Traditional assets were viewed as a liability. Virtual companies flourished, unencumbered by the economic rules other businesses had to live by. The promise appeared unlimited.

Reality, however, intervened with the economic and market downturn in 2001. Many business leaders paused, reflected, and decided to trek back to solid ground. Perspective on the Internet, too, clearly changed. But just as the most vocal advocates of the Internet were guilty of overstatement back then, so too are today’s doomsayers. The Internet has made a lasting impression on our personal and our business lives.

Today’s winners will have the greatest flexibility in their technology, infrastructure, and business model. They don’t just respond to change, they embrace change and become better and stronger.

Tagged
Posted in Business and Strategy Software and Programming

Be More Proactive by Systems Thinking

Be More Proactive by Systems Thinking

How often do you find yourself “putting out fires?” Do you want to position yourself for more proactive and effective thinking?

Systems thinking allows you to look at organizational dynamics. Instead of getting caught up in the details of a situation, you engage in systems thinking to shift your thinking from details to dynamics. You see the interrelationships in any situation, allowing you to think cross-functionally.

Three steps are involved:

  • Step 1: Observing patterns. Ask, “How many times have I seen this kind of behavior?” Is there a pattern emerging?
  • Step 2: Uncovering underlying structure. What is causing this behavior? The structure of the system influences the behavior of its members. Consider, for example, a compensation system that rewards individual behavior even though one of your goals is team-based work.
  • Step 3: Increasing your leverage in the system. Once you begin to see the patterns and underlying structures, you can then resolve your challenges for the long term by looking for the highest leverage in any situation. This leverage helps you to think strategically and solve problems for the long term because you are focused on fundamental causes-and implement solutions that benefit the whole organization rather than just individual departments due to the systems perspective of interconnectedness.

Systems thinking helps you to anticipate rather than react to events. The more you can anticipate what is going on, the more power you will have in dealing with an emerging challenge.

Tagged
Posted in Management and Leadership Mental Models and Psychology Software and Programming

How Larry Page, Sergey Brin, and Marissa Mayer Process Emails

How Marissa Mayer Handled Email while at Google

How Marissa Mayer Handled Email while at Google In an interview with tech journalist David Kirkpatrick for Fortune Magazine’s “Secrets of greatness: How I work” series, Marissa Mayer revealed how she processes emails. Marissa was then the Vice President of Search Products and User Experience, and is presently the CEO of Yahoo!

I don’t feel overwhelmed with information. I really like it. I use Gmail for my personal e-mail—15 to 20 e-mails a day—but on my work e-mail I get as many as 700 to 800 a day, so I need something really fast.

I use an e-mail application called Pine, a Linux-based utility I started using in college. It’s a very simple text-based mailer in a crunchy little terminal window with Courier fonts. I do marathon e-mail catch-up sessions, sometimes on a Saturday or Sunday. I’ll just sit down and do e-mail for ten to 14 hours straight. I almost always have the radio or my TV on. I guess I’m a typical 25- to 35-year-old who’s now really embracing the two-screen experience.

How Larry Page / Sergey Brin Handle Email at Google

Ever wonder how CEOs of large companies manage and process the hundreds or thousands of emails they receive daily?

Larry Page and Sergey Brin, co-founders of Google In a thread on managing loads of email, Quora user David Shin, who previously worked at Google, remembers Page and Brin being asked this question during a Q&A session at Google. When someone asked how they manage their email, one of them (he can’t remember which) responded like this:

When I open up my email, I start at the top and work my way down, and go as far as I feel like. Anything I don’t get to will never be read. Some people end up amazed that they get an email response from a founder of Google in just 5 minutes. Others simply get what they expected (no reply).

Tagged
Posted in Software and Programming

C/C++ Implementation for Longest Common Substring Algorithm

C++ The longest common substring problem is to find the longest string that is a substring of two or more given strings.

You can build a generalized suffix tree for a set of strings with multiple strings using this implementation. A suffix tree contains all the suffixes of the given text as their keys and positions in the text as their values.

string longestCommonSubstring(const string& str1, const string& str2)
{
  if(str1.empty() || str2.empty())
  {
    return 0;
  }
  int *curr = new int [str2.size()];
  int *prev = new int [str2.size()];
  int *swap = NULL;
  int maxSubstr = 0;
   string longest;
  for(unsigned int i = 0; i < str1.size(); ++i)
  {
    for(unsigned int j = 0; j < str2.size(); ++j)
    {
      if(str1[i] != str2[j])
      {
        curr[j] = 0;
      }
      else
      {
        if(i == 0 || j == 0)
        {
          curr[j] = 1;
        }
        else
        {
          curr[j] = 1 + prev[j-1];
        }
          if(maxSubstr < curr[j])
        {
          maxSubstr = curr[j];
             longest.clear();
        }
          if (maxSubstr == curr[j])
          {
            longest += str1.substr(i - maxSubstr + 1, i + 1);
          }
      }
    }
    swap=curr;
    curr=prev;
    prev=swap;
  }
  delete [] curr;
  delete [] prev;
  return longest.substr(0, maxSubstr);
}
Tagged
Posted in Software and Programming

C/C++ Implementation of Levenshtein Distance Algorithm for Approximate String Matching

C++ The Levenshtein is a measure of how costly it is to adapt a string into another one. If you assign a cost to adding a single character, switching one character for another, and removing a character then you can compute the cost between any two given strings.

Changing a character can be seen as removing a char and adding another one so when adding has cost 1 and removing has cost of one a modification has cost of 2.

The difference between two strings can also be measured in terms of the Levenshtein distance: the distance measure if you think the cost as the “distance” between two strings.

Text comparison is becoming an ever more relevant matter for many fast growing areas such as information retrieval, computational biology, online searching. Levenshtein distance can be used mostly to edit distance, explaining the problem and its relevance.

int levDistance(const std::string source, const std::string target)
{
  // Step 1
  const int n = source.length();
  const int m = target.length();
  if (n == 0) {
    return m;
  }
  if (m == 0) {
    return n;
  }
  // Good form to declare a TYPEDEF
  typedef std::vector< std::vector > Tmatrix;
  Tmatrix matrix(n+1);
  // Size the vectors in the 2.nd dimension. Unfortunately C++ doesn't
  // allow for allocation on declaration of 2.nd dimension of vec of vec
  for (int i = 0; i <= n; i++) {
    matrix[i].resize(m+1);
  }
  // Step 2
  for (int i = 0; i <= n; i++) {
    matrix[i][0]=i;
  }
  for (int j = 0; j <= m; j++) {
    matrix[0][j]=j;
  }
  // Step 3
  for (int i = 1; i <= n; i++) {
    const char s_i = source[i-1];
    // Step 4
    for (int j = 1; j <= m; j++) {
      const char t_j = target[j-1];
      // Step 5
      int cost;
      if (s_i == t_j) {
        cost = 0;
      }
      else {
        cost = 1;
      }
      // Step 6
      const int above = matrix[i-1][j];
      const int left = matrix[i][j-1];
      const int diag = matrix[i-1][j-1];
      int cell = min( above + 1, min(left + 1, diag + cost));
      // Step 6A: Cover transposition, in addition to deletion,
      // insertion and substitution. This step is taken from:
      // Berghel, Hal ; Roach, David : "An Extension of Ukkonen's
      // Enhanced Dynamic Programming ASM Algorithm"
      // (http://www.acm.org/~hlb/publications/asm/asm.html)
      if (i>2 && j>2) {
        int trans=matrix[i-2][j-2]+1;
        if (source[i-2]!=t_j) trans++;
        if (s_i!=target[j-2]) trans++;
        if (cell>trans) cell=trans;
      }
      matrix[i][j]=cell;
    }
  }
  // Step 7
  return matrix[n][m];
}
Tagged
Posted in Software and Programming

C/C++ Functions to Convert to UPPER CASE and lower case

C++ C and C++ implementations that follow the standard library provide two functions in the header ctype.h to convert to upper and lower cases.

char upperA = toupper('x');
char lowerA = tolower('X');

But if you want to write your own function to convert cases, here are two functions that use the string.h header.

C and C++ Functions to Convert to lower case

string lowercase(string s)
{
        for (unsigned int i = 0; i < s.size(); i++)
                if (s[i] >= 0x41 && s[i] <= 0x5A)
                        s[i] = s[i] + 0x20;
        return s;
}

C and C++ Functions to Convert to UPPER CASE

string uppercase(string s)
{
        for (unsigned int i = 0; i < s.size(); i++)
                if (s[i] >= 0x61 && s[i] <= 0x7A)
                        s[i] = s[i] - 0x20;
        return s;
}
Tagged
Posted in Software and Programming

Definition: Stochastic Processes

Stochastic Processes

A stochastic process is a series of trials the results of which are only probabilistically determined. Examples of stochastic processes include the number of customers in a checkout line, congestion on a highway, and the price of a financial security.

In a stochastic or random process there is some indeterminacy. The term stochastic is usually applied to sequences of trials ordered in time. As an example consider a time-ordered sequence of tosses of a fair die with specified probabilities for any given face coming up in a given toss.

Two fundamentally important kinds of stochastic processes are:

  • Bernoulli Sequences, in which the trials are all probabilistically independent of one another, and Markov processes.
  • Markov Processes, where the probabilities for the outcome of a trial may depend conditionally on the outcome of the previous trial, but they are probabilistically independent of the outcomes of any trials before the one immediately preceding the trial in question.

Recommended Reading

Tagged
Posted in Mental Models and Psychology Software and Programming

Three Ways to Use AutoHotKey to Rock Your Firefox Experience

AutoHotkey Numeric Keypad for Firefox

We are devoted aficionados of AutoHotkey, an open-source scripting language that can be used to religiously automate repetitive tasks on the Microsoft Windows operating system tasks and save time. AutoHotkey primarily works by overriding the default key commands on any software that runs on Windows. The core of AutoHotkey is a custom scripting language that can help define keyboard shortcuts or hotkeys.

If the keyboard on your Windows computer has a numeric keypad, you can use the keys on the numeric keypad to assist you with using the Firefox browser. By installing and running these scripts to scroll and close tabs, you don’t need to move your hands a long way from the mouse. Here are three simple scripts.

Scroll Down a Firefox Page using the ‘Add’ Key on the Numeric Keypad

This simple script substitutes the ‘Page Down’ key with the ‘Add’ key on the numeric keypad, thus helping you scroll down on Firefox pages.

NumpadAdd::
        Send {PgDn}
Return

Scroll Up a Firefox Page using the ‘Subtract’ Key on the Numeric Keypad

This simple script substitutes the ‘Page Up’ key with the ‘Subtract’ key on the numeric keypad, thus helping you scroll up on Firefox pages.

NumpadSub::
        Send {PgUp}
Return

Close a Firefox Tab using the ‘Pause’ Key

This simple script substitutes the ‘Control + F4′ key combination with the ‘Pause’ key on your keypad, thus helping you close the current tab in the Firefox application.

Pause::
        Send ^{F4}
Return

This AutoHotkey Script Needs ‘MozillaWindowClass’

To restrict the customization of these special keys just to the Firefox browser, you will need to an #IfWinActive block with the ahk_class set to MozillaWindowClass. Here is the full script. Actually, MozillaWindowClass refers to any window in any Mozilla application; hence you will notice that these shortcuts work on the Mozilla Thunderbird email application as well.

#IfWinActive ahk_class MozillaWindowClass
        Pause::
                Send ^{F4}
        Return
        NumpadAdd::
                Send {PgDn}
        Return
        NumpadSub::
                Send {PgUp}
        Return
#IfWinActive

For a basic introduction to the utility of AutoHotkey and a tutorial on installing AutoHotkey and compiling AutoHotkey scripts, see this useful YouTube video or this orderly guide from howtogeek.

Tagged
Posted in Software and Programming

ExifTool: Command Line & GUI to Remove EXIF Image Metadata in Photos

ExifTool: Command Line & GUI to Remove EXIF Image Metadata

Nearly all cell phones, digital cameras, and scanners insert metadata in the digital photos they capture. This is done using the Exchangeable image file format (Exif) data structure or standard.

Some devices just embed the make and model of the camera. Other devices insert more extensive data such as camera settings, GPS location data, and other information that might be specific to that camera or cell phone. Many owners of digital cameras and cell phones are oblivious that their photos are tagged with sensitive information.

Since the Exif data contain information about the photo, the Exif data pose privacy and security concerns. When pictures from these devices are posted online, the Exif metadata can be used to sense the time the photo was taken and the location where it was taken, if the camera or cell phone has the GPS location data feature. The distinctive ID number of the camera device can be used to identify the owner of the camera. It is therefore best to remove Exif data before publishing or posting pictures online and avoid privacy and security concerns.

My favorite software to remove Exif data is ExifTool by Phil Harvey. Exiftool is a cross-platform tool that can remove, modify, and add Exif and other metadata in various file formats. The software is intuitive and easy to use. I use the command line to manipulate whole directories of files using a combination of command options and wildcards.

exiftool.exe -all= -overwrite_original *.jpg
Tagged
Posted in Software and Programming