Monday, April 27, 2015

A MP on a Bicycle

Indian Parliament, as we know it, is a place where you get paid for shouting regularly, being absent for any length of time and doing very little work, of course. MPs are a spoiled breed who are getting richer and absent-minded day by day. If you have to seen any motivation from public figures, the last thing you should do is to look up to them. Is everything doomed for bad? Well, some hope still remains.

Next time you visit the Parliament, take a look at the parking area allotted to MPs. Year-on-year increase in the variety, cost and number of high-end luxury vehicles can be clearly observed. Yet, one MP comes to the Parliament on a bicycle. To shoo away the non-believers, he has put up a label on both the bicycle and its parking slot. Let us read further about him.

The bicycle and a board displaying the name of Arjun Ram Meghwalin Hindi


Arjun Ram Meghwal is a 62-year old BJP MP from Bikaner, Rajasthan. He was a weaver, became an IAS and then 2009 saw him enter the Parliament. “I was born in a traditional weaver family of Kismidesar village (Bikaner), where any student of my age hardly goes to school. During my school and college days I used to weave to support my family and my education,” says Meghwal. He got married when he was in Class 7. After marriage, he continued his studies and graduated in Arts (BA) & Law (LLB) from Sri Dungar College, Bikaner (Rajasthan). What’s more he managed to do his postgraduation from the same college.




All the makings of another rags-to-riches story, but not just any other such story. He is humble, down-to-earth, accessible to all and sundry in his constituency and an unfailing eagerness to work for the people. On winning the Lok Sabha election, he said, "I consider this a new beginning and I still have miles to go in the service of people".

To read more about this astute politician, who once was District Collector, Churu, Rajasthan, visit Official MP Bio Data.

Saturday, April 11, 2015

Adding 2 Binary Numbers in C

//This function adds two binary numbers.
void  AddBinaryNumbers(int iarrNumber1[], int iNoOfDigitsInNumber1, int iarrNumber2[], int iNoOfDigitsInNumber2, int iarrSum[], int iNoOfDigitsInResult)
{
   //The loop counter
   int         iLoopCounter                        = 0;
   //The carry over digit
   int         iCarryOverDigit                     = 0;

   //Iterating through the bigger number
   for (; iLoopCounter < iNoOfDigitsInResult; iLoopCounter++)
   {
      //The sum of two digits
      int  iSumOfDigits = iarrNumber1[iLoopCounter] + iarrNumber2[iLoopCounter] + iCarryOverDigit;

      switch (iSumOfDigits)
      {
         case 0:  //The resultant bit is 0.

                  iarrSum[iLoopCounter] = 0;
                  break;

         case 1:  //The resultant bit is 1.

                  iarrSum[iLoopCounter] = 1;
                  break;

         case 2:  //The resultant bit is 0 and the carry over is 1.

                  iarrSum[iLoopCounter] = 0;
                  iCarryOverDigit = 1;
                  break;

         case 3:  //The resultant bit is 1 and the carry over is 1.

                  iarrSum[iLoopCounter] = 1;
                  iCarryOverDigit = 1;
                  break;
      }
   }

   //Computing the last digit if needed
   iarrSum[iNoOfDigitsInResult - 1] = iCarryOverDigit;
}

//The main function
void main()
{
   //The two arrays holding the two numbers
   int     *piarrNumber1                       = NULL;
   int     *piarrNumber2                       = NULL;
   //The array holding the sum of the two input numbers
   int     *piarrSum                           = NULL;
   //The size of the arrays
   int     iNoOfDigitsInNumber1                = 0;
   int     iNoOfDigitsInNumber2                = 0;
   int     iNoOfDigitsInResult                 = 0;
   //The loop counter
   int     iLoopCounter                        = 0;

   do
   {
      //Asking for the number of digits in the first number
      printf("\nEnter the number of digits in the first number.\n");
      scanf("%d", &iNoOfDigitsInNumber1);
      piarrNumber1 = (int *) calloc(iNoOfDigitsInNumber1, sizeof(int));

      //Asking for the user input
      printf("\nEnter the binary digits of the first number separated by space.\n\n");
      for (iLoopCounter = iNoOfDigitsInNumber1 - 1; iLoopCounter >= 0; iLoopCounter--)
         scanf("%d", &piarrNumber1[iLoopCounter]);

      //Verifying the input
      for (iLoopCounter = 0; iLoopCounter < iNoOfDigitsInNumber1; iLoopCounter++)
      {
         if (0 > piarrNumber1[iLoopCounter] || 1 < piarrNumber1[iLoopCounter])
         {
            printf("\nThe digit %d at index %d is not a binary digit.\n", piarrNumber1[iLoopCounter], iLoopCounter + 1);
            free(piarrNumber1);
            piarrNumber1 = NULL;
            break;
         }
      }
   }
   while (!piarrNumber1);

   do
   {
      //Asking for the number of digits in the second number
      printf("\nEnter the number of digits in the second number.\n");
      scanf("%d", &iNoOfDigitsInNumber2);
      piarrNumber2 = (int *) calloc(iNoOfDigitsInNumber2, sizeof(int));

      //Asking for the user input
      printf("\nEnter the binary digits of the second number separated by space.\n\n");
      for (iLoopCounter = iNoOfDigitsInNumber2 - 1; iLoopCounter >= 0; iLoopCounter--)
         scanf("%d", &piarrNumber2[iLoopCounter]);

      //Verifying the input
      for (iLoopCounter = 0; iLoopCounter < iNoOfDigitsInNumber2; iLoopCounter++)
      {
         if (0 > piarrNumber2[iLoopCounter] || 1 < piarrNumber2[iLoopCounter])
         {
            printf("\nThe digit %d at index %d is not a binary digit.\n", piarrNumber2[iLoopCounter], iLoopCounter + 1);
            free(piarrNumber2);
            piarrNumber2 = NULL;
            break;
         }
      }
   }
   while (!piarrNumber1);

   //Allocating sufficient space for the array
   if (iNoOfDigitsInNumber1 < iNoOfDigitsInNumber2)
      iNoOfDigitsInResult = iNoOfDigitsInNumber2 + 1;
   else
      iNoOfDigitsInResult = iNoOfDigitsInNumber1 + 1;
   piarrSum = (int *) calloc(iNoOfDigitsInResult, sizeof(int));

   //Adding the two numbers
   AddBinaryNumbers(piarrNumber1, iNoOfDigitsInNumber1, piarrNumber2, iNoOfDigitsInNumber2, piarrSum, iNoOfDigitsInResult);

   //Displaying the result
   for (iLoopCounter = 0; iLoopCounter < iNoOfDigitsInResult; iLoopCounter++)
      printf("\n%d", piarrSum[iLoopCounter]);
}

Humidity -- A Brief Primer

Moisture

It is a small amount of water present in any object such as air, soil, grains etc.

Atmosphere

It is an envelope of gas that surrounds the Earth and extends from the Earth's surface out thousands of kilometres, becoming increasingly thinner (less dense) with distance but always held in place by Earth's gravitational pull.

The atmosphere is a mixture of gases that we call air. On a dry volume basis, it consists of about 78 percent nitrogen and 21 percent oxygen. The remainder of about one percent consists of argon, carbon dioxide and very small amounts of other gases. The atmosphere is rarely, if ever, completely dry. Water vapor is almost always present up to about four percent of the total volume. In desert regions, when dry winds are blowing, water vapor in the air will be nearly zero. This climbs in other regions to about three percent on extremely hot and humid days. The upper limit, approaching four percent, applies to tropical areas.

Evaporation

It is the process by which any liquid is transformed into a gaseous state. The evaporation process requires an input of energy from the environment. For example, the evaporation of one gram of water requires 600 calories of heat energy.

Condensation

It is the process by which any gas is transformed into a solid or liquid state. The condensation process releases energy into the environment.

Precipitation

It is water released from clouds in the form of rain, freezing rain, sleet, snow, or hail. It is the primary connection in the water cycle that provides for the delivery of atmospheric water to the Earth. Most precipitation falls as rain.

Transpiration

It is the process by which moisture is carried through plants from roots to small pores on the underside of leaves, where it changes to vapor and is released to the atmosphere. Transpiration is essentially evaporation of water from plant leaves. Transpiration also includes a process called guttation, which is the loss of water in liquid form from the uninjured leaf or stem of the plant, principally through water stomata.



Saturation

When a gas holds the maximum water vapour possible at a given temperature, it is said to be saturated. If extra water is added to a saturated gas or if its temperature is reduced, some of the water vapour will condense.

Partial Pressure

A gas mixture such as air is made up of several pure gas components such as oxygen, nitrogen and others. The total pressure of the gas mixture is said to be the sum of partial pressures of the component gases. In room air, the partial pressure of water vapour is around 1000 Pa.

Saturation Vapour Pressure

The partial pressure of water vapor in saturated air is called the saturation vapor pressure. The higher the air temperature, the greater the saturation vapor pressure, as expressed by the Clausius-Clapeyron relation, which gives the saturation vapor pressure over a plane surface of pure water. Saturation vapor pressure increases rapidly with temperature.

Humidity

It is the amount of water vapour or moisture present in the atmosphere. The main source of moisture in the atmosphere is the evaporation of water from the Earth's surface and the transpiration by plants. Studies have revealed that about 10 percent of the moisture found in the atmosphere is released by plants through transpiration. The remaining 90 percent is mainly supplied by evaporation from oceans, seas, and other bodies of water (lakes, rivers, streams).

When warm air containing a lot of water vapor (high humidity) moves into colder temperatures (either high in the atmosphere or even on the outside of your glass of iced tea), the colder temperatures cause water vapor to condense into a liquid. The colder temperatures cause water vapor to condense into water droplets and can result in fog.

There are 3 types of humidity.

Specific Humidity

Specific humidity is the concentration, by mass, of water vapor in a sample of moist air. It is, therefore, the ratio of the mass of water vapor in a sample to the total mass of the sample moist air, including both the dry air and the water vapor. The mixing ratio is the ratio of the mass of water vapor to the mass of dry air in the sample. As ratios of masses, both specific humidity and mixing ratio are dimensionless numbers. However, because atmospheric concentrations of water vapor tend to be less than a few percent at the surface, and much lower at higher elevations, they are both often expressed in units of grams of water vapor per kilogram of (moist or dry) air. 

Absolute Humidity
 
Absolute humidity is the water vapor density, defined as the ratio of the mass of water vapor to the volume of associated moist air and generally expressed in grams per cubic meter.

Relative Humidity

It is the ratio of the actual vapor pressure to the saturation vapor pressure at the air temperature, and the result is expressed as a percentage. Because of the temperature dependence of the saturation vapor pressure, for a given value of relative humidity, warm air has more water vapor than cooler air. When air is cooled, at constant pressure and water vapor content, to the saturation (or condensation) point, the resulting air temperature is the dew point temperature. The difference between the actual temperature and the dew point is called the dew point depression.

Hygrometer

It is a device used to measure Humidity. It can measure a wide range of humidity depending on the sensitivity needs. Here is a table which indicates the types of Hygrometers and the principles of sensitivity employed by them.


Humidity and Economy

Humidity affects many properties of air, and of materials in contact with air. Water vapour is key agent in both weather and climate, and it is an important atmospheric greenhouse gas. A huge variety of manufacturing, storage and testing process are humidity-critical. Humidity measurements are used wherever there is a need to prevent condensation, corrosion, mould, warping or other spoilage of products. This is highly relevant for foods, pharmaceuticals, chemicals, fuels, wood, paper, and many other products.

Air-conditioning systems in buildings often control humidity, and significant energy may go into cooling the air to remove water vapour. Humidity measurements contribute both to achieving correct environmental conditions and to minimising the energy cost of this.
 
Humidity and Humans

The usual values of humidity that we come across in daily weather updates is relative humidity. Human body temperature is dependent on the air as it absorbs and removes moisture from our skin to cool us down.  If the relative humidity is high, the amount of water evaporating from our skin is limited so we feel warm and stifled.

The discomfort associated with high humidity is somewhat analogous to the wind chill effect, where high winds make people feel colder. Various indices, comparable to the wind chill index, have been developed to quantify the humidity effect; these include the apparent temperature, heat stress index, "humiture", and "humidex". Some of these can be adjusted to take into account the effects on solar radiation, wind speed, and barometric pressure on human comfort.

The U.S. National Weather Service currently employs the "heat index." As relative humidity increases, so does human discomfort. For example, at an air temperature of 90oF (32oC) and 50% relative humidity, the air "feels" as if it were 96oF (36oC). The reason is that the moister the air, the larger the resistance to moisture loss (and therefore to heat loss via evaporation) from the human body to the air, because the air is closer to saturation. The humidity effect on comfort operates at low temperatures as well: people are more comfortable in cold air when humidity is high than low.

At very high temperatures, air is rarely if ever close to saturation because the saturation vapor pressure is very large. Thus there are blank entries in the Table for high temperature and high relative humidity combinations. In the United States, the highest dew point temperatures to persist for at least 12 hours are in the upper 70'soF, which, combined with a temperature of 90oF, corresponds with relative humidities about 70%. Only where both air and nearby water surfaces become very warm (such as in the Persian Gulf or the Red Sea, or immediately following a rain shower that saturates the soil on a hot summer day) are higher temperatures and relative humidities seen.

Following is a very good indicator of the effects of humidity variations on humans.


A pleasant indoor climate is essential for a sense of well-being in the home. Room humidity can have a major impact on the quality of the living environment. A relative humidity (RH) of 40-60% is generally considered to be optimal for a comfortable and healthy home. Too much moisture can lead to mold and overheating. Too little causes dry eyes, chapped lips and an environment in which bacteria and viruses can thrive.

Humidity and Plants

Plants also respond to changes in humidity. Transpiration of water vapor through leaf stomata depends on the gradient of moisture between the leaf interior (which is saturated) and the overlying air, as well as the availability of moisture in the soil. The lower the atmospheric humidity, the greater the transpiration rate. The transpiration rate is determined by a balance between the amount of energy available to convert water from the liquid to vapor phase and the moisture gradient.

Transpiration rates also depend on the resistance to water movement between the leaf and the air. By analogy with the flow of electricity through a circuit with elements of different electrical resistance, the flow of water is modeled by considering the resistance of the leaf stomata, the leaf cuticle, and the air in the boundary layer adjacent to the leaf. Extension of this leaf model to crop fields or to natural plant ecosystems can be problematic, and more sophisticated micrometeorological methods are used.