Can mankind bet its future on long distance space travel?

Long distance space travel is the stuff of science fiction. Cosmonauts strap themselves into cryogenic hyper-sleep pods while androids with artificial intelligence pilot the ship to exoplanets several light years away. The cosmonauts remain in suspended animation until they reach a predetermined point on their route. The exoplanets themselves have been found to be habitable for humans, of course, and the space ships travel at speeds comparable to the speed of light.  Then, one fine day, mankind blasts off into space to embrace its future as a multi-planetary species, leaving a barren and desolate Earth behind. But, can mankind really bet its future on this kind of interplanetary or intergalactic travel?

In reality, modest beginnings have been made with both private enterprises and national governments working towards setting up bases on the moon as well as nearby planets like Mars. Elon Musk’s Space X is one of the notable private enterprises planning to colonize Mars (1). Governments planning to set up bases on the moon are those of USA, Russia and China, as well as governments of some European nations (2). These activities are supposed to be a stepping stone to venturing deeper into outer space.

The feasibility of long distance or intergalactic space travel hinges on a number of factors:

Finding habitable exoplanets

Habitable exoplanets are rocky planets orbiting stars outside our solar system, at a distance suitable to remain at an atmosphere that makes it possible for chemicals like liquid water to exist. The region at this distance around the star is called the habitable zone. (3)

Such chemicals are essential to sustain human life. So far, thousands of exoplanets have been discovered by NASA. The size of the exoplanet can also be measured based on how much it dims the brightness of the star when passing or transiting in front of it from our point of view. (3)

It is now known that exoplanets are fairly common in the universe.  However, they must be at a suitable distance from Earth for mankind’s ability to reach in order to colonize it. The reason is that even if the exoplanet is a hundred light years away, then assuming that our spaceship travels near the speed of light, it will still take a hundred years to get there. Most cosmonauts will not live beyond that time span! As for children to be born in space, that is a huge leap into the unknown, to say the least.

Invention of travel at nearly the speed of light – wormholes, space warps, etc

The nearest earth-like exoplanet, Proxima Centauri b, is 4.25 light years away. A conventional space craft will take hundreds of thousands of years to get there, at a conservative estimate! Four and a quarter years is a far more feasible time frame, which means that our ship needs to travel at a speed really close to that of light.

According to Marc Millis, a former NASA propulsion scientist, it would take a billion billion Joules of energy, a little bit less than all the energy consumed by the entire world in one year, to get a spacecraft carrying 500 people from Earth to Alpha Centauri, the planetary system closest to our solar system, in 75 years! Obviously, we need a very powerful source of energy, something yielding a huge amount of energy per unit weight.  The actual technology required is at least 200 years away according to Dr. Marc. (4)

What about speeds of light or greater? According to Albert Einstein’s theory of Special Relativity, an object travelling at the speed of light or more will have infinite mass because of the equation E = mc2 , where E is the energy of the object, m is the mass and c is the speed of light. This equation talks about the energy-mass equivalence whereby an object will have an increase in mass as a result of its motion. Energy and mass are essentially the same entity and can be converted to one another.

One might say that Einstein said nothing about tachyons which are already travelling at speeds greater than or equal to that of light.  But common sense tells us that human beings and their spacecraft are not tachyons!

There is no feasible technology to enable travel at the speed of light, let alone speeds more than that of light. In the light of recent developments, however, a few exotic ideas are being considered. These are wormholes and space warps. (5) (6).  The idea of photons propelling rockets has also been bandied about.

The proof of principle for faster-than-light (FTL) space warp propulsion was published decades ago in a 1994 paper by physicist Miguel Alcubierre. Conventional advanced propulsion  technologies are limited to speeds below the speed of light. Even speeds slightly less than that of light will take centuries of research to attain.  Using an FTL space warp will drastically reduce the time and distances of interstellar flight, according to astrophysicist Eric Davis, a leader in FTL.

In current FTL theories, it’s not the ship but space that moves! We know that space is flexible. Space has been expanding steadily since the Big Bang. If we distort the space around the ship instead of accelerating the ship itself, a warp drive would not break Einstein’s special relativity rules. The ship itself doesn’t need to go faster than light with respect to the space immediately around it, thus remaining within the ambit of Einstein’s theory of relativity.

In a warp drive, space in front of the vessel is contracted while space behind it is expanded, propelling it forward and eventually bringing the vessel to its destination. In wormholes, the ship (or perhaps an exterior mechanism) would create a tunnel through space-time, with a targeted entrance and exit. The ship would enter the wormhole at sub-light speeds and reappear in a different location many light-years away.

According to Davis, a wormhole entrance is a sphere that contains the mirror image of a whole other universe or remote region within our universe, which is incredibly shrunken and distorted.

How can we create these space-time distortions that will allow vessels to travel faster than light? Several research scientists are currently studying the feasibility of a warp drive (and EMdrive and a number of other modes of faster than light travel).

It’s believed, and certain preliminary experiments seem to confirm, that producing predetermined   amounts of “negative energy” would achieve the desired effect. Negative energy has been produced in a lab via the “Casimir effect”. This phenomenon is based on the idea that vacuum, contrary to its portrayal in classical physics, isn’t empty. According to quantum theory, a region of vacuum is actually full of electromagnetic fluctuations. Distorting these fluctuations can create negative energy.

According to Caltech physicist Sean Carroll “In short, it requires negative energy densities, which can’t be strictly disproven but are probably unrealistic; the total amount of energy is likely to be equivalent to the mass-energy of an astrophysical body; and the gravitational fields produced would likely rip any ship to shreds. My personal estimate of the likelihood we will ever be able to build a ‘warp drive’ is much less than 1%. And the chances it will happen in the next hundred years I would put at less than 0.01%.”

Engineers have yet to come up with a technique to create a traversable wormhole with a targeted entrance and exit or distort space as envisioned in the concept of a warp drive.

Moreover, most scientists think that such forms of space travel simply aren’t viable, thanks to the fundamental physics of our universe. Dr. Alcubierre himself listed a number of concerns, starting  with the vast amounts of exotic matter that would be needed. The warp drive is impossible on this ground alone, in his opinion. “At speeds higher than the speed of light, the front of the warp bubble cannot be reached by any signal from within the ship,” he emphasized. “This does not just mean we can’t turn it off; it is much worse. It means we can’t even turn it on in the first place.”

Obviously, warping space requires a lot of mass and energy, and ensuring that the space where you are located isn’t warped is very difficult to say the least. Indeed, the proposition was mostly just an  experiment when it was first proposed – not something Alcubierre thought was actually viable technology.

Therefore, the concepts of warp drives and wormholes remain in the realm of fiction.

Invention of hyper-sleep

Hyper sleep or cryosleep is a state of suspended animation in which human metabolism slows down to a negligibly low rate. When a human being is brought out of this state, all bodily functions begin to work like normal. What is the current state of research in this field?

In Prometheus, the prequel to Ridley Scott’s 1979 film Alien, long space voyages are accomplished by putting the travelers to sleep in pods for two years, only waking them when they reach their destination. The aging process itself has been interrupted to allow humans to undertake multiple long trips to the stars. When Alien was released, hyper-sleep was pure science fiction, but work in a laboratory in Seattle, Washington seems to have brought hyper-sleep a step closer to reality. (7).

Mark Roth of the Fred Hutchinson Cancer Research Center has been publishing papers documenting his research on, in his words, keeping living creatures alive for increasingly long periods of time since 2001. First, he took fifty zebra-fish embryos and deprived them of oxygen, slowing down their movement and development for twenty-four hours. Then the embryos were exposed to a normal environment and raised as sexually mature adults. More complex creatures will die if deprived of oxygen. Roth undertook a journey of discovery to find out whether it is possible to de-animate mammals and eventually people.

However, Mark Roth’s research was not about de-animating people to help them undertake long voyages to the stars. Mark Roth wanted to use suspended animation to help people out when in trauma, so they could then be transported to the best place for treatment without suffering the problems of delay they would otherwise experience. Roth started looking for a way to reduce the human metabolic rate, against received wisdom. He searched for a chemical that would facilitate the survival of people and species through extreme cold and lack of resources without lasting ill-effects. After many failures, he came across hydrogen sulfide, a gas which is used in chemical warfare despite the fact that the human body produces it, the highest concentration being located in the human brain. In chemical accidents, it’s known that if you breathe too much of it you collapse to the ground, you appear dead, but then if you’re brought out into normal air you can be re-animated without harm, if done quickly enough. Trials on yeast, nematode worms, and non-hibernating mice were successful.  However, the metabolic rate reducing effects of hydrogen sulfide inhalation seem to be inversely related to body size.

For example, the rate of metabolic depression in rats was several times lower than that in mice.
Also, the same study on swine and sheep could not confirm significant reduction in metabolic rate, oxygen uptake, etc (8).  Finally, in human volunteers, inhalation of hydrogen sulfide during exercise decreased oxygen uptake. However, this was referred to as a toxic effect on aerobic capacity rather than a regulatory effect on metabolism. It was doubtful whether the “suspended animation” observed in mice could be transferred to humans in a clinical setting.

Another alternative is cryogenic sleep. Bodies are preserved through the process of vitrification. An antifreeze agent is added, which will replace water in the cells. The tissue is then cooled to -220 Fahrenheit, but instead of crystallizing into ice, the chemicals clump together and become solid, like glass. The new glass form prevents the cells from bursting and, theoretically, holds them in stasis forever. But the problem is that scientists are yet to come up with a way to thaw or rewarm human tissue back to life. So far, only 50 ml of tissue has been brought back to normal conditions. (9).

In some cases, it’s preferable to just cool a system down to slow down all the functions of metabolism and essentially slow down aging. In other words, it’s not the long distance voyages but the journey to nearby planet Mars that is within reach through stasis similar to what some animal species on earth do already. These species include bears and ground squirrels.

Bottom-line is that research in suspended animation and cryogenic sleep have yet to make enough progress to make the possibility of sleeping through space voyages of extended duration a reality.

Increasing the human lifespan

One of the ways for human beings to survive long duration space trips is to somehow lengthen the human lifespan. Currently, the maximum age anyone has lived up to is about 119 years (10).  Assuming that a person can be put into service as a crew member at the age of 18 and can serve till 90 years, we can easily calculate that a crew member can put in 72 years of service. Also, it is not sufficient for a crew member to serve on board the ship. A base has to be set up on reaching the destination planet.  An optimum number of crew members must be maintained in various departments. Different individuals will have aptitude in different areas of expertise, not necessarily the required area of expertise. Therefore, it might be necessary to find a way to lengthen the lifespan of human beings.

Many researchers have been working to answer the question: “Can we live longer but stay younger?” Research on aging has been carried out mostly on nematode worms (11), (12) and mice, which are nowhere nearly as complex as humans. Doubling of lifespans of mice is not that impressive.

Many researchers are now inclined to think the problem is “epigenetic”. In other words, there is a problem of reading the genetic code in cells, like problems in reading a compact disc over time.  Harvard molecular biologist George Church observed that it is possible to make aging cells repair themselves. David Sinclair, a Harvard geneticist, is a champion of the “hormesis” approach or inducing metabolic stress by intense short-duration exercise or intermittent fasting.

Anti-aging research seems to be proceeding along two fronts: dietary supplements and genetic engineering. The supplements are supposed to activate the right proteins in our cells. Genetic engineering, on the other hand, involves adding or otherwise manipulating genes in a population of animals. In mice, this can be done by reorganizing the genome in the embryo and using it to breed a genetically altered variant. Genetically altered mice that are known to create more of a single protein, sirtuin 6, have been known to live longer. However, this is not accepted as an indication of increased longevity. It is merely equalizing the lifespans of male and female mice.
Researchers are now working on dogs having an average lifespan of a decade or more.

There are problems with this work, even though the lifespans of the test subjects are higher. There are surprisingly few biomarkers of increased longevity. How does one know if the test subjects live longer except by waiting for decades to see when they die?  Ideally, we need something like a chemical signature in a blood test that correlates with an individual’s lifespan.

Scientists are optimistic about genetic engineering since they have already managed to make aging embryonic stem cells become young again by reprogramming them. This has doubled the lifespan of mice in the lab. We have yet to see such results in experiments on dogs. Human beings are a long shot.

Feasibility of space travel for extended periods of time, effect on human gene activity.

Scientsists have believed that space travel for extended periods of time can harm the human body and possibly even damage human DNA. The latest report by NASA seems to have broken down the old age thought that long hours of space travel is hazardous to the human body. (13)  New results from the NASA “Twins Study” have shown that there are no major warning signs and little reason to think that humans cannot survive a two-and-a-half-year round-trip journey to Mars. Christopher Mason, Associate Professor at Weill Cornell Medicine said “the body has extraordinary plasticity and adaptation to being in zero gravity, at least for a year”.

But, what is this much hyped “Twins Study” conducted by NASA? As part of the Twins Study, NASA astronaut Scott Kelly spent nearly a year in space while his identical twin, Mark remained as a control subject on Earth. By means of this experiment, NASA wanted to look at the effects of space travel on the human body.

The study was a first of its kind effort to compare the molecular profiles of identical twins, one in outer space and the other on Earth. It seems that spending nearly a year in space, triggered Scott’s immune system response, so that more activity was observed at the cellular level in Scott’s body as compared to Mark’s body. It also changed the activity of some of Scott’s genes.

Craig Kundrot, Director of NASA’s space life and physical sciences division, emphasized that so far, the space agency’s research found nothing that would make a Mars mission impossible.

However, a Mars mission would expose astronauts to higher levels of radiation than what is permissible under the current guidelines. Radiation alone is sufficient to damage a human being’s body at the cellular level. Also, the duration parameter of the Twins Study was one year, less than half of what it would take for a Mars mission. So, once again, current research should be regarded with cautious optimism.

Physiological effects of long period travel in micro-gravity

The pull of gravity tells the human body to maintain muscle tone and bone density. According to NASA studies, micro gravity implies that this signal is no longer there. (14) Therefore, muscles begin to atrophy and so do bones. Muscles atrophy as quickly as 5% a week and bones at the rate of about 1% a month. Muscles used to support the body against gravity, such as those in the calves and spine, can lose as much as 20 % of their mass. Blood is affected too. On Earth, blood pools in the feet, resulting in a pressure of about 200 mm of Hg (mercury). In the absence of gravity, the gradient of blood pressure is absent. Blood pressure equalizes throughout the body. Astronauts look odd in these conditions. Their faces, filled with fluid, puff up and their legs become thin. Higher blood pressure in the head gives an alarm signal which reduces blood volume. The heart atrophies because there is less blood to pump.

This atrophication of the human body doesn’t matter as long as the astronauts are in the spaceship. But, what happens when they land on an exoplanet? They need to be able to help themselves, because no one will be around to help them. So, what is the solution? Exercise is the key. Devices that simulate resistance and gravity on the human body need to be created and used.
One promising device is called the Lower Body Negative Pressure device (LBNP) which simulates gravity by applying negative pressure on the lower body. It uses the suction of an ordinary vacuum cleaner. It reduces much of the loss of cardiovascular function of muscle and some indices of bone loss as well. It also restores the blood pressure gradient and increases blood pressure to the legs. Therefore, we have the means to mitigate the harmful effects of microgravity resulting from travel in outer space to some extent.

Psychological effects of long period travel and isolation

Viewing the Earth from space can be spectacular and can even be a spiritual experience. On the other hand, space travel for extended periods of time, are bound to have psychological implications because of the change in physical and social environment. It is important to understand the psychological and sociological effects of spaceflight before any long distance expeditions to the stars can be undertaken. (15), (16), (17) This is because the success of any space mission depends on the astronauts functioning together as a cohesive team. Any friction or conflict can jeopardize the entire mission because the success of the mission depends on cooperation among the team members. Crew members are likely to be chosen carefully, screening them for psychiatric conditions beforehand and assessing their personalities.

However, it has been found that the human brain works differently in micro gravity, perhaps because of the alteration of blood supply to the brain, thus affecting the efficiency with which oxygen is supplied to the brain. Working for prolonged periods in outer space is like being isolated and confined to a tin can, away from friends and family, away from the familiar daily sensations like the ground under your feet and the smell of fresh grass. Prolonged isolation and confinement are stressors which are persistent and pose a significant mental health hazard.

There is also the problem of cultural and language diversity in space missions conducted jointly by different nations. Differing work culture and management styles are also a factor.

There have been incidents in the past in space missions where space crew members reported hallucinations, both visual and olfactory sensations. When the brains of astronauts are affected, so is their decision-making and other cognitive abilities, which will be dangerous to the integrity  of long distance missions where there is no real-time contact with mission control on the ground.

Needs and supplies for extended spaceflight.

During extended periods of space travel, spaceships will have food and water supplies.
However, there must be a mechanism of replenishing reserves of both food and water. This can only be possible through agriculture because of the impracticality of resupplying interplanetary missions, both in terms of cost and weight of the shipments. A farm in space will help create a sustainable environment by recycling waste water, faeces and by generating oxygen which will continuously purify the air. (18) A space farm can turn a spaceship into an artificial ecosystem having both a hydrological cycle and nutrient recycling.

However there are technical challenges in this kind of agriculture. Plants grown onboard a spaceship experience higher radiation, lower gravity and lower pressure. Directional light compensates for the microgravity somewhat. Higher radiation for one, damages the DNA of plants. It could also reduce their nutritive value.

Food can lose its nutritive value significantly even when it is stored for a year or so. Long missions can severely deplete the nutritive value of food stored for that long. Once the crew lands on their exoplanet, agriculture will be a labor-intensive activity for the first colonists.

The crew will be a fixed number to begin with. However, death and senescence will deplete man power. The number of crew members can only be maintained through periodic replenishment through the birth of children. Obviously, we need to figure out a way of producing children both onboard their ship and on the exoplanet the crew intends to colonize. We need physically and mentally healthy individuals.

Conclusion

Although some research has been done, it is still too early to conclude that we will be able to colonize exoplanets. Many of the areas of research have yet to provide promising results when subjects were changed from lab animals to humans. Some people might argue that it is still too early to take a call; that we have a lot of time. This optimism can accelerate the ecological decline of our world due to reckless behavior of people, thus reducing the time we have in hand. Reaching  the conclusion that we can colonize exoplanets, might make people even more irresponsible.

Some areas of research may hit unsurmountable roadblocks because of the laws of the natural world, the universe itself. We can’t count on our scientists to solve every research problem in the world. Hence, we should treat research findings with cautious optimism and make sure that we are able to live on Earth as long as humanly possible, with space colonization as a backup plan.

References:

1.       https://www.businessinsider.in/This-speculative-SpaceX-timeline-reveals-roughly-when-where-and-how-Elon-Musk-plans-to-colonize-Mars/2022-2023-Land-the-first-Big-Falcon-Spaceship-on-Mars/slideshow/66206786.cms

2.      https://www.theguardian.com/science/2019/jan/21/china-steps-up-bid-to-win-the-lunar-space-race

3.      https://spaceplace.nasa.gov/all-about-exoplanets/en/

4.      https://www.popsci.com/science/article/2011-01/interstellar-travel-wont-be-possible-least-200-years-according-new-calculations

5.      https://www.space.com/21721-warp-drives-wormholes-ftl.html

6.      https://dailygalaxy.com/2018/09/nasa-faster-than-speed-of-light-space-travel-will-warp-bubbles-enable-dreams-of-interstellar-voyages/

7.      https://www.telegraph.co.uk/technology/news/9319883/Prometheus-Alien-and-the-science-of-hypersleep.html

8.      https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4060059/

9.      https://www.inverse.com/article/31267-cryogenic-sleep-hibernation-space-travel

10.    https://en.wikipedia.org/wiki/List_of_the_verified_oldest_people

11.    https://www.fightaging.org/

12.    https://medicalxpress.com/news/2019-02-fountain-youth-pill-youre-mouse.html

13.    https://www.indiatoday.in/science/story/long-term-space-flight-travel-has-no-effect-on-human-health-nasa-1458178-2019-02-17

14.    https://science.nasa.gov/science-news/science-at-nasa/2001/ast02aug_1

15.    https://en.wikipedia.org/wiki/
Psychological_and_sociological_effects_of_spaceflight

16.     https://www.nasa.gov/feature/conquering-the-challenge-of-isolation-in-space-nasa-s-human-research-program-director

17.     https://www.theguardian.com/science/2014/oct/05/hallucinations-isolation-astronauts-mental-health-space-missions

18.     https://en.wikipedia.org/wiki/Space_farming

News on Eazy Ad Unblocker

Hello everyone!

A few months ago, I had launched a wordpress plugin called “Eazy Ad Unblocker”.  You can read about it from https://myplugins.net/announcing-eazy-ad-unblocker/. You can download it from https://wordpress.org/plugins/eazy-ad-unblocker/.
You can preview it at https://myplugins.net/demo/
Don’t forget to keep your adblocker on while browsing the preview URL.

The plugin notifies a user of a wordpress site if they are using
an adblocker.They are prompted to disable their adblocker or
whitelist the webmasters site in their adblocker settings. This helps
all those site owners whose paid advertising is being blocked by users
by installing adblocker extensions in their browsers.

Over the past few months, since its launch a few months ago, the plugin seems to be gaining some traction on the web.

Its number of active installations has crossed 100. At the time of writing, 1,714 people had downloaded it. The plugin has also found a mention at https://www.adventurewp.com/best-anti-adblock-plugins-for-wordpress/

Adventure WP describes the plugin as a “dead-simple plugin” which is “very lightweight and simple to set up”.

Furthermore, in their words “Eazy Ad Unblocker” actually provides “less customization while also providing more. but you do have full text input available for your title and main notice text. It also uses the regular
classic-style WordPress text editor so you can include nearly anything in
your anti-adblock notice–images, HTML, video, whatever TinyMCE
allows you to embed.”

On a critical note, they believe that the design of the popup dialog is “a bit dated”. That’s something that needs to be worked on I guess. Also they note, “You don’t have different anti-adblock methods, nor do you have color customization”.

Finally, they note that Eazy Ad Unblocker is an absolutely usable plugin, which does not lock a facility to dismiss the popup behind a pay wall!

Thank you Adventure WP guys!

Note: Please note that “Eazy Ad Unblocker” now has a popup refresh button. Whitelist the site in your adblocker or disable it and then click “Refresh” at the bottom of the popup dialog. The popup will go away.

Photo credit: https://www.adventurewp.com/best-anti-adblock-plugins-for-wordpress/

Sample Code for Algorithm to Create Combinations of Characters

In my post here, I described an algorithm to create all possible combinations from a set of characters. However, it allows repetitions of characters in the generated combinations. e.g aas, aaa and so on.
In this post, I will demonstrate an implementation of this algorithm in PHP, without any parallelization of any kind. I don’t know if it’s even possible to parallelize code in PHP.

You can run this code on LAMPP, WAMP, MAMP or XAMPP if you like. Successive trials of code execution may be faster than previous ones. Maybe, you all won’t like this code since it uses the “goto” keyword which is believed to lead to the creation of spaghetti code.  However, this was the easiest way to implement the algo for me.

<?php 

$dictionary = array('a', 'b', 'c', 'd', 'e');

$startLen = 1;
$stopLen = 4;

$currLen = 1;

//function to create string combination from array of indices
function getStringFromChars($indices)
{
  global $dictionary;
  $str='';

  for($j = 0; $j < count($indices); $j++)
  {
    $str.=$dictionary[$indices[$j]];
  }
  
  return $str;
}

//check condition to stop generating combos
function timeToStop($indices)
{
  
  global $dictionary;
  
  $stop = false;
  
  for($j = 0; $j < count($indices); $j++)
  {
    if($indices[$j] < count($dictionary) - 1)
    {
      return $stop;
    }
  }

  $stop = true;
  
  return $stop;
}

//main function
function generate($startLen, $stopLen)
{
  global $dictionary;
  $attempts = 0;
  
  for($currLen = $startLen; $currLen <= $stopLen; $currLen++)
  {
    step3:
    $chars = array();
    
    $indices = array();
    
    //init the arrays
    for($i = 0; $i < $currLen; $i++ )
    {
      $indices[$i] = 0;
      
      $chars[$i] = $dictionary[$indices[$i]];
    }
    
    step4:
    $working_index = $currLen - 1;
    
    step5:
    $str = getStringFromChars($indices);
    
    step6:
    echo $str;
    echo "<br />";
    $attempts++;
    
    if(timeToStop($indices))
    {
      if($currLen < $stopLen)
      {
        
        continue;
      }
      else
      {
        break;
      }
    }
    
    if($indices[$working_index] < count($dictionary) - 1)
    {
      $indices[$working_index]++;
      goto step5;
    }
    else
    {	
      if($currLen > 1)
      {

      
        while($indices[$working_index] == count($dictionary) - 1)
          $working_index--;
          
        if($working_index == -1)
        {
          if($currLen < $stopLen)
          {
            
            continue;
          }
          else
            break;
        }
        else
        {				
          $indices[$working_index]++;
          //set all indices to the right of working_index to 0
          
          for($k = $working_index + 1; $k < count($indices); $k++)
          {
            $indices[$k] = 0;
          }
          
          goto step4;
        }	
      }
      else
      {
      
        if($currLen < $stopLen)
        {
          
          continue;
        }
        else
          break;
      }
    }
    
  }

  return $attempts;
}

$start = microtime(true);

$atts = generate($startLen, $stopLen);

$end = microtime(true);

$time_taken = $end - $start;

$rate = $atts / $time_taken;

echo "Time(seconds): ".$time_taken;
echo "<br />";

echo "Attempts: ".$atts;
echo "<br />";

echo "Rate: ".$rate." iterations per second";

 

Algorithm to create all combinations from a set of characters

In this post, I shall reveal an algorithm that generates all possible combinations of a given set of characters of a specified range of lengths. The algorithm is as follows:

1.  take dict as a character array of possible characters in your string combinations
take currLen as integer, startLen as integer, stopLen as integer, chars as character array,  indices as integer array

2.  initialize currLen = startLen

3.  Set length of chars array to currLen, length of indices array to currLen

4.  set working_index  = currLen - 1

5.  get string from chars array as follows

i.  set i'th element of chars array to indices[i]'th element of dict

ii. Do the operation in the previous step (i) from i = 0 to i = currLen - 1

iii. concatenate the elements of chars array to generate a string combination of characters

6.  print string in step 5

7.  if all elements of indices equal length of dict - 1

         if currLen < stopLen

              increment currLen by 1

              go to step 3

         else

              quit

8.  if element of indices at position = working_index < length of dict - 1

        increment element of indices at position = working_index by 1

        go to Step 5

    else

        if currLen > 1

             decrement working_index by 1 till element of

             indices at position = working_index equals length of dict - 1

             if working_index equals -1

                 if currLen < stopLen

                     increment currLen by 1

                     go to Step 3

                 else

                     quit

              else

                  increment element of indices at position = working_index by 1

                  set all elements of indices to the right of position = working_index to 0

                  go to Step 4

        else

            if currLen < stopLen

               increment currLen by 1

               go to Step 3

            else

               quit

 

At first glance, this algorithm may look like a brute force algorithm, but I seriously doubt that it can be used to do naughty things like cracking passwords. Of course, to unleash the full power of this algorithm, one needs to parallelize the code in his implementation of this algorithm. That way we can max out the cpu cores and enjoy a very large number of iterations per second.

It may, however, be used to create a reverse lookup database of one way cryptographic hash functions. But, with the use of salts being common nowadays, such a database of all possible plaintexts and their hashes may not be useful after all.

The best part about this algorithm is that it is non-recursive and so avoids an inordinately large number of function calls and a potential call stack overflow. This is true especially when the dictionary of characters is very large.

So, all in all, this algorithm may be used as a fun academic exercise. Or, perhaps one of you guys may come up with a practical use for this algorithm.

Announcing EZee Copyright Protector

Hello again guys!

I wish to announce that I have released a new WordPress Plugin called ‘EZee Copyright Protector’.  You can find this plugin at the URL https://wordpress.org/plugins/ezee-cpyright-protector/.

What does the plugin do? Suppose you have a wordpress website where you have created original content painstakingly and published it. Ordinarily, there is nothing to prevent other webmasters from blatantly copying your content. So unless you have taken precautions to prevent it from happening,
you are in for a nasty shock, which is your content showing up on other sites without your permission.

The EZee Copyright Protector plugin prevents any person with malafide intentions from copying your content. This includes prevention of selection, copying, cutting, pasting, dragging and saving of your content.

On trying any of these operations, a modal popup is presented to the user.
This popup can only be dismissed by clicking the cross on the top right of the popup. The admin of the wordpress site can change the title and text of the copyright notice which appears as a modal popup. This plugin does not claim to support shortcodes from other plugins in its text editor field.

EZee Copyright Protector prevents copying and plagiarism of your original or copyrighted content. It works on Mozilla Firefox, Google Chrome, Microsoft Edge and Opera browsers.

As a user of this plugin, you can change the title of the popup and add text, graphics, audio and video to the body of popup. Only HTML5 based video and audio is allowed. As for images, only formats compatible with wordpress are supported.

This plugin supports internationalization in the frontend as well as wp-admin screens. You can preview this plugin at https://myplugins.net
For more details, go to https://wordpress.org/plugins/ezee-cpyright-protector/

Social Media: Benefits and Dangers

A fairly large proportion of the global population owns computers. The internet has brought different people together, cutting across boundaries of age, race, gender, profession, social and political preferences. People can now access diverse content whether for work or entertainment, from any computing device capable of connecting to the internet. They can send email, visit sites and forums where they can post their opinions. They can chat online and even see the other person’s face.

However there has been a new revolution, particularly in the past two decades, that has brought people even closer. This is the emergence of social media.

What is meant by Social Media?

The term social media is the collective of online communications channels dedicated to community-based input, interaction, content-sharing and collaboration. Websites and applications dedicated to forums, micro-blogging, social networking, social bookmarking, social curation, and wikis are among the different types of social media (Margaret Rouse  https://whatis.techtarget.com/definition/social-media).

Some prominent examples of social networks are:

Facebook: Probably the most famous and popular social media network having hundreds of millions of active users any day. It allows registered users of the age of 13 and above to create profiles, upload photos and videos, send messages and keep in touch with friends, family and colleagues.

WhatsApp: It started out as a mobile social networking app and a web application version was also released a few years ago. Like Facebook, it has hundreds of millions of users. Facebook acquired WhatsApp a few years ago (TOI Tech
https://www.gadgetsnow.com/tech-news/Facebook-buys-WhatsApp-CEO-Mark-Zuckerberg-explains-why/articleshow/30714548.cms).

Twitter: It is a free micro-blogging service that allows registered members to broadcast short posts called tweets, limited in their number of characters. Twitter members can broadcast tweets and keep track of other users’ tweets by using multiple platforms and devices.

Google Plus: It was Google’s social networking project, designed to replicate the way people interact offline more closely than is the case with other social networking services. This website no longer allows new users to sign up and those with consumer accounts (ending in gmail.com) to use its services. It was shut down on April 2, 2019 (Google   “Frequently asked questions about the Google+ shutdown”  https://support.google.com/plus/answer/9217723?hl=en).

Wikipedia: The world’s largest content management system dedicated to recording and spreading knowledge. It is a free, open content online encyclopedia created through the collaborative effort of a community of users. Anyone registered on the site can create an article for publication; however, registration is not required to edit articles.

LinkedIn: A social network for professionals which recently snapped up an educational services provider named Lynda.com (Maya Kosoff  https://www.businessinsider.in/LinkedIn-just-bought-online-learning-company-Lynda-for-1-5-billion/articleshow/46865136.cms).

Reddit:  It is a social news website and forum where stories are socially curated and promoted by site members. The site is composed of hundreds of sub-communities, known as “subreddits.” Each subreddit has a specific topic such as technology, politics or music. Reddit site members, also known as, “redditors,” submit content which is then voted upon by other members. The goal is to send well-regarded stories to the top of the site’s main thread page (Margaret Rouse  https://whatis.techtarget.com/definition/social-media).

Pinterest: It is a social curation website for sharing and categorizing images found online, like pinning interesting images on a board. Pinterest requires brief descriptions but the main focus of the site is visual. Clicking on an image will take you to the original source of the image. For example, clicking on a picture of a pair of shoes might redirect users to a shoe purchasing site (Margaret Rouse  https://whatis.techtarget.com/definition/social-media).

Instagram: Instagram is a photo- and video-sharing social networking service owned by Facebook, Inc.

Blogs: Blogs are regularly updated websites or web pages, typically run by an individual or small group, which are written in an informal or conversational style. For example, https://idratherbewriting.com/ is a blog on technical communication. Blogs allow communication of ideas and facts in a personal way and create a brand for the person or people behind the blog.

Social media have a tremendous impact on society and the user or membership base of such sites and services run into billions. For example, hundreds of millions of photos and videos are shared daily on Facebook alone! The infrastructure that goes behind serving such a large user base with high performance services is mind-boggling. The user base is only going to grow according to future projections (Statista 2019 https://www.statista.com/statistics/278414/number-of-worldwide-social-network-users/) (See Figure 1 for user statistics).

Social media have recently been adversely impacted by government censorship, especially in countries with conservative regimes like China (Wikipedia  https://en.wikipedia.org/wiki/Internet_censorship_in_China). However, the means to circumvent such obstacles to social media access do exist. They are of two kinds: (1) accessing international sites through virtual private networks (VPNs) and (2) home-grown social media services like Weibo in China.

Figure 1. Number of social network users worldwide.                                                    Source: “Number of global social media users 2010-2021”  https://www.statista.com/statistics/278414/number-of-worldwide-social-network-users/

How are Social Media changing Socialization and society?

Social media are changing society and socialization radically. Society is becoming more open and connected. Users tend to share even the most intimate details of their daily life with the online community, bordering on exhibitionism. There is a tendency to befriend someone whom you don’t know all that well. It is as easy as a mutual exchange of messages of consent. It works even if you don’t know that person in the offline world.

Social media give you the ability to create a fake persona. Other people in contact with you will base their opinions and emotional responses on this fake persona. On the other hand, if you give genuine information about yourself, it is easier to spy on you.

You can keep track of contacts all across the world, even when you relocate from one city or country to another. You can update your new location on your profile. You can also keep your contacts posted about the happenings in your life, wherever you are.

How do Social Media Help?

You can stay in touch with contacts whenever you are online and wherever you may be located. You can share photos and keep track of the changing look of the other person or people. One can capture precious moments on video and share them with their online friends.  You can chat with contacts online whenever they are available.

You can form an online community with like-minded people. You can share your interests, hobbies and anything else with other people, reaching across geographical and social boundaries.

Social media are especially useful for staying in touch with friends, family and colleagues. You might even find your former friends, former partners and former colleagues online (See Figure 2 for benefits of social media to seniors).

In testing times like the COVID-19 pandemic, when we cannot step outside our homes and be part of a social gathering because of lockdowns, social media help us remain in touch even when we are under quarantine.

Social media lend a social aspect to entertainment like multiplayer and role-playing games. You can compete with friends or help them in difficult situations and boast of your high scores! Businesses can benefit from users playing games developed by them by introducing in-game advertising and purchases.

Social media help us keep in touch with what is trending and popular. It puts your finger on the pulse of the people. Businesses can benefit from this. They can do targeted advertising, i.e. advertising based on user preferences in things ranging from food to fashion, entertainment and even consumer electronics.

Figure 2.  Benefits of social media to individuals, especially seniors.
Source: “Benefits of social media for seniors”
https://ihps.com/benefits-social-media-seniors/

Knowledge-sharing communities like Quora and Stack Overflow are of tremendous help to people from all fields. Quora is a general-purpose question and answer site. Stack Overflow is for information technology and computer programming specifically. People can post their queries regarding any topic of choice and get answers from community members.

Social media are also helping political activists in gathering more signatories for their causes and petitions. They can post a petition on a social media site/service and tell users about it. These users can then choose to indicate that they support the petition.

Social media help businesses to communicate more with prospective clients. They drive internet traffic to the business’s website, creating more awareness about their products and services. It also helps in revenue growth through more sales.  (See Figure 3 for benefits for business.)

Figure 3. Businesses can benefit from social media marketing in numerous ways.
Source: “7 Side Effects of Social Media”
https://visual.ly/community/infographic/social-media/7-side-effects-social-media/

How do Social Media hurt?

Just as social media can help, they can also hurt. Criminals and malicious individuals can take advantage of their new contacts and commit crimes against them. These crimes include rape and murder, apart from cheating and fraud. The trouble starts when the would-be victims decide to meet their so-called online friends in the real world, not suspecting their mala fide intentions (Press Association https://www.theguardian.com/media/2012/dec/27/social-media-crime-facebook-twitter). (See Figure 4 for Crimes against women in India.)

Criminal gangs spread illegal content using social media including stolen goods and services. For example, they may put up stolen credit card numbers and verification numbers for visitors to misuse them.

Figure 4.  Crimes are committed against women in India.
Source:  “7 Cyber Crimes on Social Media Against Women [India]”  https://www.slideshare.net/soravjain/7-cyber-crimes-on-social-media-against-women-india/

Social media are also used for spreading misinformation or controversial and provocative content. This can lead to communal violence because of the inflammatory nature of the content. Fake news can even influence the outcome of elections, subverting a democracy’s functioning. For example, the presidential elections in USA in 2016 were rumored to be influenced by fake news about certain candidates on sites like Facebook (Danielle Kurtzleben            https://www.npr.org/2018/04/11/601323233/6-facts-we-know-about-fake-news-in-the-2016-election).

No matter how secure creators of social networks try to make their social networking sites, hackers can always devise means to obtain personal information of users and misuse it. They can also target celebrities.

Opportunistic and unethical individuals can create fake profiles in the names of individuals or national ministries or governments. They can then get contact information of people who think they are chatting with the real person(s) (Matthew Herper https://www.forbes.com/2009/04/24/facebook-privacy-herper-business-media-facebook.html#6f99db037288).

Confidential personal data can be sold by unprincipled social networks for financial gains. It may be sold to advertisers. Your profile may be free to create on such sites but you are the product! (Julia Carrie Wong            https://www.theguardian.com/technology/2018/mar/28/facebook-apple-tim-cook-zuckerberg-business-model)

Students lose out on valuable study time spending too much time on sites like Facebook. Employees of corporate organizations damage office productivity by accessing social media sites from office networks which have nothing to do with their work. Creating network access policies against such sites may become futile in certain cases where employees can use their own devices and internet dongle, known as BYOD which stands for “Bring Your Own Device”.

Social communication is becoming addictive because some services are designed for addiction using principles of psychology. Some sites are even known to cause the reward centers of the brain to be affected during usage (Haley Cummings    http://www.collegiatetimes.com/lifestyles/the-effect-of-social-media-on-the-brain/article_f27b5a1e-b999-11e7-bfc2-77d77ccdf0b1.html).

A business’s page or posts can be down-voted deliberately by users with malicious intent. On the other hand, giving businesses control over which reviews to display will give them the power to filter out negative reviews completely.

Employers can base their hiring decisions on the candidates’ social media profiles. So, a person who likes to take a walk on the wild side may not get hired at all, despite having the necessary skill-sets! (Saige Driver   https://www.businessnewsdaily.com/2377-social-media-hiring.html)

There are far-reaching psychological and biological effects of social media use. Cyber-bullying and cyber-stalking have a devastating impact on the lives of the victims.  Even without the presence of a persecutor, you may feel anxious, sleepless and depressed. Night-time use of social media disrupts your sleep cycle and your body’s natural bio-rhythms. Constant bombardment of near-perfect images of celebrities and actors or models, especially on Facebook, Instagram, etc, can give you a negative body-image. You may begin to think you are too fat or thin or ugly, even if you are not! (Anya Zhukova   https://www.makeuseof.com/tag/negative-effects-social-media/)

Figure 5. Social media use can cause anxiety, sleeplessness and depression.
Source:  “7 Negative Effects of Social Media on People and Users” https://www.makeuseof.com/tag/negative-effects-social-media/

Conclusion

Social media bring people together but can also hurt the interests of those people. However, the interaction on social media cannot be a substitute for face-to-face meetings with a close group of friends. Social media can help you stay in touch but can also spread malicious misinformation. It can also put your private/confidential data up for grabs in dubious online communities.

Businesses can tap the consumer market by reaching out to users of social media. They can target users in their advertisements because they know their preferences. This is a potential privacy concern. Social media are like a double-edged sword and must be used cautiously.

You should strike a balance between your online as well as offline lives and apply the same prudence to your online life that you would apply to your life in the offline world.

References

1.      Margaret Rouse  “Social media”  https://whatis.techtarget.com/definition/social-media

2.      TOI Tech  “Facebook buys WhatsApp: CEO Mark Zuckerberg explains why”
https://www.gadgetsnow.com/tech-news/Facebook-buys-WhatsApp-CEO-Mark-Zuckerberg-explains-why/articleshow/30714548.cms

3.      Google   “Frequently asked questions about the Google+ shutdown”  https://support.google.com/plus/answer/9217723?hl=en

4.      Maya Kosoff “LinkedIn just bought online learning company Lynda for $1.5 billion”  https://www.businessinsider.in/LinkedIn-just-bought-online-learning-company-Lynda-for-1-5-billion/articleshow/46865136.cms

5.      Statista 2019  “Number of social media users worldwide from 2010 to 2021 (in billions)” https://www.statista.com/statistics/278414/number-of-worldwide-social-network-users/

6.      Wikipedia  “Internet censorship in China” https://en.wikipedia.org/wiki/Internet_censorship_in_China

7.      Press Association “Social media-related crime reports up 780% in four years” https://www.theguardian.com/media/2012/dec/27/social-media-crime-facebook-twitter

8.      Danielle Kurtzleben  “Did Fake News On Facebook Help Elect Trump? Here’s What We Know”             https://www.npr.org/2018/04/11/601323233/6-facts-we-know-about-fake-news-in-the-2016-election

9.      Matthew Herper  “I Was Impersonated On Facebook”  https://www.forbes.com/2009/04/24/facebook-privacy-herper-business-media-facebook.html#6f99db037288

10.  Julia Carrie Wong    “Apple’s Tim Cook rebukes Zuckerberg over Facebook’s business model”            https://www.theguardian.com/technology/2018/mar/28/facebook-apple-tim-cook-zuckerberg-business-model

11.      Haley Cummings    “The effect of social media on the brain” http://www.collegiatetimes.com/lifestyles/the-effect-of-social-media-on-the-brain/article_f27b5a1e-b999-11e7-bfc2-77d77ccdf0b1.html

12.      Saige Driver   “Keep It Clean: Social Media Screenings Gain in Popularity” https://www.businessnewsdaily.com/2377-social-media-hiring.html

13.      Anya Zhukova   “7 Negative Effects of Social Media on People and Users” https://www.makeuseof.com/tag/negative-effects-social-media/

 

Announcing Eazy Ad Unblocker!

Hello everyone,

I wish to announce that I have released a wordpress plugin named “Eazy Ad Unblocker”. You can find this plugin at the following URL: https://wordpress.org/plugins/eazy-ad-unblocker/

Now, to tell you what this plugin does. Suppose you own a wordpress site and have painstakingly put advertisements on it. Now many of your visitors don’t even look at your ads, let alone clicking on it. Why? Because they install browser extensions that block those ads from being shown on your site!

What “Eazy Ad Unblocker” basically does is to detect if an adblocker is active on the page seen by the visitors. If an adblocker is active, a modal popup shows up on the screen and prevents your visitors from browsing your website in any way, asking them to either deactivate the adblocker or whitelist your site. There is an option in the form of a close button on the popup, so that the visitors to your site do not get locked out completely. The plugin only detects ad blockers. It does not check if ads are actually there on the page.

Advanced and tech-savvy visitors may try to delete the popup and background overlay through web developer tools, inspect element and the like. This is countered effectively by the plugin. Right-clicking in the web page will fail
to invoke the context menu. Trying to invoke web dev tools by using keyboard shortcuts in the web page will also fail.

You will see this feature on many news sites, which implore users to deactivate adblockers or whitelist the site, telling them that the site they are viewing uses adverts for much needed revenue.

As a user of this plugin, you can configure the title, descriptive text and opacity of the modal popup shown to your visitors. You can completely black out your website content partially visible in the popup background by setting opacity to 100 %. You can add photos, videos and audio clips to the body content of the popup. Only formats supported by HTML5 will work in audio and video with this popup. You can also configure whether to show a close button on the top right of
the popup or not.

The plugin supports internationalization, both in the popup content and the wp-admin screen. You can preview the functioning of this plugin at https://myplugins.net/demo/
You can also see more details at https://wordpress.org/plugins/eazy-ad-unblocker/

Why Digital Marketing Is Important For Your Business

In the digital age, it does not make good business sense for your business not to have a digital presence. This is because you will not be able to reach out to the audiences of digital platforms who are your potential customers. Using social media and search engines is now commonplace. You need to market your business to the online audience, or in other words, do digital marketing.

What is Digital Marketing?

Digital marketing is the marketing of products or services using digital technologies, mainly on the Internet, but also on mobile phones, display advertising, and any other digital medium. Digital marketing channels are systems based on the internet that can create, accelerate, and transmit product value from producer to the terminal consumer by digital networks.

A Brief History of Digital Marketing

The term Digital Marketing came into being in the 1990s. The first clickable banner ad went live in 1994, which was a campaign by AT&T and over the first four months of it going live, 44% of its viewers clicked on it.

In the 2000s, with more people using the internet and the advent of the iPhone, more and more people searched for products and made decisions online instead of consulting a sales person. These developments made marketers find digital ways for market development. In 2007, marketing automation came into being. Marketing automation helped companies to partition customers into segments, launch multichannel marketing campaigns and provide personalized information for customers.

Digital marketing became more sophisticated in the 2000s and the 2010s, when the proliferation of devices capable of accessing digital media witnessed a sudden growth. In the 2000s, with the advent of social media, such as LinkedIn, Facebook, YouTube and Twitter, consumers became highly dependent on digital electronics in their daily lives. They began to expect a seamless user experience across different channels for searching product information. This change in customer behavior led to the diversification of marketing technology. Digital media volume was estimated at 4.5 trillion online ads served annually with digital media spending growing at 48 percent in 2010.

Photo credit:  Avantika Monnappa at https://www.simplilearn.com/

Types of Digital Marketing

Types of online digital marketing include:

1.   Search Engine Optimization (SEO): SEO is the art of increasing the visibility of your business site in the organic or non-paid search results of any of the search engines according to keywords entered by the user and the algorithm employed by the search engine. You can get your company’s website to appear at the top of a user’s organic search results by optimizing your website using SEO.

2.   Search Engine Marketing and Pay-Per-Click Advertising (PPC): Search Engine Marketing or SEM covers paid traffic from search engines. To use SEM, you purchase advertisement space that appears on a user’s Search Engine Result Page (SERP). The search engine charges a business a certain amount to display an advertisement in a number of places on an SERP generated from specific keywords or phrases. PPC is a digital marketing method by which search engines charge a company each time their advertisement is clicked.

3.   Social Media Marketing: Using social media marketing you’ll gain more reach when you post quality content. Everything you do to increase traffic or business on your social media channels is a part of social media marketing. Whether you’re on Facebook, Twitter, Snapchat, or LinkedIn, all your efforts on these sites amount to social media marketing. Almost everyone benefits from social media marketing, but Business-to-consumer (B2C) companies stand to gain the most.

4.   Content Marketing: Content marketing is the practice of delivering a piece of high quality content to your users to generate sales and leads. This content can be live anywhere online. Tweets, a YouTube video, an Instagram post and blogs on your website, etc all comprise content marketing. Content Marketing combines exceptional content with other types of digital marketing like SEO and Social Media Marketing.

5.   Affiliate Marketing: Suppose you are a business selling products and services on your site. Now, say a blogger X posts details about your products on his own blog. When internet users click on product advertisements on X’s blog, they are directed to your business site and if users complete a purchase, X gets a commission from you according to an agreement between you and the affiliate, namely X.

6.  Influencer Marketing: Influencer marketing uses people with tremendous online popularity who are considered experts by your target market to drive traffic and sales. Influencer marketing is popular on social media channels like Instagram and Snapchat as well as behemoths like Amazon. Companies hire influencers with large followings to publicize their brand through posts.

7.   Email Marketing: Email marketing allows you to update your email subscribers on a regular basis about your company through newsletters for example. This fosters a relationship with the subscribers. Your email updates provide value to your consumer and as a result, you build trust and brand loyalty.

8.   Viral Marketing: Viral marketing involves a post that is trendy, funny, or strange enough to garner a massive number of shares online. Viral marketing causes an enormous increase in website traffic over a short period of time. B2C companies gain the most from viral marketing.

9.   Mobile Phone Advertising: Each of the types of digital advertising can target a mobile device. Some types of marketing using a mobile such as SMS advertising can prove an asset to local marketing efforts. You can prompt your consumers to use SMS to receive special offers, coupons, and updates from your company.

Why Businesses Postpone the Adoption of Digital Marketing plans

Small businesses may feel that they don’t have the time or the money to be competitive online. They think they can only face so many challenges all at once when they are still learning the ins and outs of business in general. Many of them may prefer to take things slowly and steadily. They wish to stick with one or two basic forms of advertising, assuming that their business will evolve as time passes. Since they are a small business, they may think they only need a small number of customers to begin with. This is not an effective approach. There is no guarantee that your business will attract customers just by existing and even if it does, you may not attract enough customers to make your business profitable and sustainable.

The Benefits and Importance of Digital Marketing

When small businesses get started, they often focus on how to get their first customers through the door. They often rely on traditional forms of advertising, such as print ads or road signs. They may believe that since people know that they offer a good product or service, it’s only a matter of time until customers will find their way to them. Although this strategy may bring in a trickle of business, small businesses should consider the huge marketplace of prospective customers online to improve their business prospects. Any business, no matter how new or how small, should not overlook this vast marketplace. Larger businesses, which have grown in the pre-digital era, have the potential to grow even more through digital marketing. Indeed, they may also need a digital marketing strategy to remain relevant in the face of increased competition and changing technology.

Benefits.

The group of potential customers who are found online is a much larger group of people than what you can attract locally. Using digital marketing, you can reach an enormous audience in a way that is both cost-effective and quantifiable.
Other benefits of digital marketing include:

• The ability to interact with your prospective customers and learn about their preferences. You will be able to improve customer satisfaction by iteratively modifying your product or service according to these insights.

• The ability to reach a global marketplace. This is the largest pool of potential customers.

• Reach more customers for less money than traditional marketing methods.

• Get to know your audience and allow them to know you personally which can help to build a relationship with the customers and create brand loyalty.

• Track responses to your marketing efforts in real time through means such as analytics.

• Communicate your brand identity on social media, thereby piggybacking on the popularity of those social media services.

• Reach out to users of diverse software and devices. Smartphones are a user segment that has witnessed explosive growth recently.

• Compete with larger companies. Don’t get pushed out of the marketplace!

• Get higher marketing Return On Investment (ROI) and conversion rates.

Importance.

The following are the reasons why you can ignore digital marketing only at your own peril:

Your customers are online: To tell you the truth, your customers are already online, even though you don’t know it. And so are your potential customers. If your business is not found online easily, these potential customers will flock to your competitors. At the minimum, they will expect you to have a website and a social media presence.

Your competitors may already be online: To succeed in the business world, you need to look over your shoulder at what your competitors are doing and learn from it. Regardless of your niche, your competitors have likely established a web presence already. You can learn what is working or not working from your competitors. You can study what kind of content they are using, whether they are using more graphics and video, like a YouTube channel. A sound digital marketing strategy will position you to compete in the digital world.
If your prospective customers begin to search for a business similar to yours and are able to find your competitors’ website but not yours, they can’t choose you because they don’t know about you.

You need to be accessible: In today’s digital world, the first place the average consumer looks for what they want is online. They will most likely start their search with Google, no matter what product or service they are looking for. If you have no online presence at all, you won’t be found, and you can’t compete. If you have an online presence but your competitors are easier to find and are found first, you might still go unnoticed. To remedy this, you can hire an SEO expert, for example, to make sure that when prospective customers search with certain keywords, they find your site first.

You want to make customers come to you: By creating a web presence, your business is open 24×7 even when it’s closed for the day! You can create a business environment in which your customers can come to you any time, day or night. Existing and prospective customers can send you emails with questions, make purchases and browse your inventory, at their convenience. Potential customers who have no way to physically come to you can still do business with you, whether they are limited by disability, transportation or are simply living too far away. So, with digital marketing, the scope of your business exceeds the boundaries of your shop floors!

You must get to know your target audience: Digital marketing allows you to gradually get to know your prospective customers and what they are hoping to find. You can start a conversation with them on a blog or social media, or even conduct a survey. Their responses will help you improve your business. By interacting with people digitally, you can start to get to know what they are looking for and what solutions you can offer to them. With digital marketing, there is no guesswork involved. It allows you to methodically find out who your customers are and what they really want.

Be more than just a business concern: By responding to customer feedback, by solving the consumers’ problems and building a relationship with them, you become more than a business. You become a trusted partner. Trust means that not only will more people buy from you, but also your previous customers might buy again from you. A digital presence also puts your dealings on the record.

Conclusion

In the current business environment, it is extremely important to foray into digital marketing and develop a digital marketing strategy due to its immense benefits. Digital marketing has the potential to increase your revenue. If you ignore digital marketing, you may fall behind the competition and lose your business!


REFERENCES:

1. https://en.wikipedia.org/wiki/Digital_marketing

2. https://digitalmarketinginstitute.com/blog/why-digital-marketing-is-important-for-small-business

3. https://www.sparklogix.com/9-types-of-digital-marketing-and-how-to-use-them/

A Simple IP Blocker Plugin for WordPress

In my post here, I had shown how to create a basic “Hello World” plugin that greets the user with a simple “hello world” message in the admin dashboard. Now, let me show you how to create a wordpress plugin that actually does something more useful. In this post, I shall discuss a plugin that restricts the number of login attempts a user can make to login to the admin dashboard of your wordpress site. It makes sense to do this to secure your dashboard from being broken into because an unauthorized user can do just about anything to your site if he manages to access your admin dashboard. This includes defacing your site, deleting your content and God knows what else!

We will call our plugin “Simple IP Blocker”. It will restrict the number of failed login attempts to a fixed number, say three. On the fourth attempt, the user will see an error message “IP address blocked”. The user will be blocked for the remainder of the day on which he made the three unsuccessful login attempts. He will be able to try again on the following day.

Now, let’s get down to the nuts and bolts of the actual plugin. The steps are:

  1. Create a folder for the plugin
  2. Create a PHP file for the code called index.php in that folder.
  3. Create a header for the plugin.
  4. Initialize the required constants.
  5. Create a database table through the activation hook.
  6. Create a function that hooks into wp_login_failed action.
    It logs the failed attempts in the database table and blocks the IP address of the user.
  7. Create a function that displays the logged data from the table.
  8. Hook the function in 7 into the admin_menu action so that the logged data can be displayed.
  9. Create a function that hooks into the login action ‘wp_authenticate’
    that will give an error on trying to login in after ip is blocked.
  10. Activate your plugin and test it.

Let us discuss these steps in detail:

1. Navigate to the wp-content folder in your wordpress installation. Go to the plugins sub folder in it.
Create a folder called “simple-ip-blocker”.

2. Create a blank file titled index.php using your text editor and save it in the folder created in step 1

3. Now, let’s create the header in the index.php file.
Print the following code in after the opening php tag in the index.php file:

<?php 
/ * 
* Plugin Name: My Simple IP Blocker 
*/ 
?>

4. We will initialize the following constants:

<?php 
global $wpdb; 
define("LOGIN_FAILURES", 3); 
define("IPBLOCKER_TABLE", $wpdb-&gt;prefix.'ip_blocker');
?>

5. The above step will create a new line in the plugins section of your wordpress installation and define
the necessary constants.

We need to create a database table to log and count failed login attempts.
We will do this by using the “register_activation_hook” function.
We will create a PHP function named “simple_ip_blocker_create_table”.
In this function, we will write a “CREATE TABLE” MYSQL query. We will execute it by calling $wpdb->query
function on the global $wpdb variable by passing the query in it as a parameter.

We will then pass the “simple_ip_blocker_create_table” function name in the “register_activation_hook” function.

The code is as follows:

<?php 

function simple_ip_blocker_create_table() { 

     global $wpdb, $table_prefix; 
     //mysql query $create_tab_query = 
"CREATE TABLE IF NOT EXISTS `".IPBLOCKER_TABLE."`( 
`id` bigint(20) NOT NULL AUTO_INCREMENT, 
`ip_addr` varchar(20) NOT NULL, `attempts` int(4) NOT NULL, 
`try_date` date NOT NULL, `is_blocked` tinyint(1) NOT NULL, 
PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; 

$wpdb->query($create_tab_query); } 

register_activation_hook( __FILE__, 'simple_ip_blocker_create_table' ); ?>

 

Explanation of table structure:

id – PRIMARY KEY
ip_addr – IP address of user trying to log in.
attempts – number of failed logins per user.
try_date – date on which user s trying to log in.
is_blocked – flag too indicate whether the user is blocked or not.

6. Next, we will create a function that will hook into “wp_login_failed”. We will call
this function simple_ip_blocker_reset_bruteforce. This function will fire whenever the
user tries to login but fails. We will maintain a counter in the $_SESSION. Each failed
login will increment the counter. On reaching 3 attempts, the IP blocked flag, is_blocked
will be marked as 1 to indicate that the particular user is blocked for the remainder of
the day. However, the user can try again on the next day. Each attempt is logged in the
database table we created. For the first failed attempt, a new row will be created in the
table. For subsequent attempts, that row will be updated.For the third failed login,
the “is_blocked” field of that row will be updated to 1.

Check out the code below:

<?php 

function simple_ip_blocker_reset_bruteforce() { 

@session_start(); 
global $wpdb, $table_prefix; 
if(!isset($_SESSION["brute_count"])) { 
$_SESSION["brute_count"] = 1; 
$query = "INSERT INTO ".IPBLOCKER_TABLE."(ip_addr, attempts, try_date, is_blocked) VALUES(%s, %d, %s, %d)"; 
$try_date = gmdate("Y-m-d"); 

$wpdb-&gt;query( $wpdb-&gt;prepare( 
        $query, 
        $_SERVER["REMOTE_ADDR"], 
        $_SESSION["brute_count"], 
        $try_date,
        0
      ) );
      
     }
     else
     {
      $_SESSION["brute_count"] = $_SESSION["brute_count"] + 1;
     
      $try_date = gmdate("Y-m-d"); 
       
       //check limit
        
      $check_query = "SELECT attempts FROM ".IPBLOCKER_TABLE." WHERE ip_addr = %s AND try_date = %s";
        
      $attempt_count = $wpdb-&gt;get_var($wpdb-&gt;prepare($check_query, $_SERVER['REMOTE_ADDR'], $try_date ));
    
       if($attempt_count &gt;= LOGIN_FAILURES)
       {
         unset($_SESSION["brute_count"]);
         
         $update_query = "UPDATE ".IPBLOCKER_TABLE." SET is_blocked = 1 WHERE ip_addr = %s AND try_date = %s";
         
         $wpdb-&gt;query($wpdb-&gt;prepare($update_query, $_SERVER['REMOTE_ADDR'], $try_date ));
         
         wp_redirect(site_url('/wp-admin/'));
         
         exit;
         
       }
       else{
         
        $query = "UPDATE ".IPBLOCKER_TABLE." SET attempts = %d WHERE ip_addr = %s AND try_date = %s";
        
        $wpdb-&gt;query( $wpdb-&gt;prepare( 
          $query,  
          $_SESSION["brute_count"],
          $_SERVER['REMOTE_ADDR'],
          $try_date
         ) ); 
         
         
       }
     } 
  }  

  add_action("wp_login_failed", "simple_ip_blocker_reset_bruteforce");
?>

 

7. So far so good. Now we will create a function to display the data of
failed logins in the wordpress backend. We will call this function
“simple_ipblocker_menu_callback”. It will simply query the database table
that we created and list out the information in tabular form.

See the code below:

<?php 

function simple_ipblocker_menu_callback() { 

  global $wpdb; 
  $get_history = "SELECT * FROM ".IPBLOCKER_TABLE; //&quot; LIMIT $offset, 10; 
  
  $history = $wpdb->get_results($get_history, ARRAY_A); ?> 
  <h1>Simple IP Blocker active!</h1> 
  <table border="0" cellspacing="5" cellpadding="5" class="widefat" > 
  <tr>
    <td>S. No.</td>
    <td>IP Address</td>
    <td>Login Attempts</td> 
    <td>Try Date</td>
    <td>Blocked</td> 
  </tr> 
  <?php foreach($history as $row){ ?>
    <tr>
      <td><?php echo $row["id"]; ?></td>
      <td><?php echo $row["ip_addr"]; ?></td>
      <td><?php echo $row["attempts"]; ?></td>
      <td><?php echo $row["try_date"]; ?></td> 
      <td><?php echo ($row["is_blocked"] == 1)?"blocked":"unblocked"; ?></td>
    </tr>
  <?php } ?> 
  </table> 
<?php } ?>

 

8. In this step, we will simply write some code to call the function created above whenever the user
clicks the link for the plugin in the admin sidebar on the left. See below:

<?php 

function simple_ipblocker_menu_add() { 

     add_menu_page("Simple IP Blocker", "Simple IP Blocker", "administrator", "simple-ip-blocker", "simple_ipblocker_menu_callback" ); 

} 

add_action("admin_menu", "simple_ipblocker_menu_add"); 

?>

 

9. The last function to be created is the function that checks if the user’s IP is blocked. If so,
the user will not be able to login to the admin dashboard on that day. However, the user may try
logging in on the next day again.
We will call this function “simple_ip_blocker_check_ip”. In this function, we will check if the user’s
IP address is marked 1 in the is_blocked field. If so, the user will be prevented from logging in.
The function hooks into “wp_authenticate” and hence will fire before every login attempt.

The code is as follows:

<?php 
       function simple_ip_blocker_check_ip() { 
               global $wpdb; 
               $try_date = gmdate("Y-m-d"); 
               $check_IP = "SELECT is_blocked FROM ".IPBLOCKER_TABLE." WHERE ip_addr = %s AND try_date = %s"; 
               $blocked = $wpdb-&gt;get_var( $wpdb-&gt;prepare( 
          $check_IP,  
          $_SERVER['REMOTE_ADDR'],
          $try_date
         ) );
         
    if($blocked == 1)
    {
      wp_die("IP address blocked!");
    }
  }

  add_action("wp_authenticate", "simple_ip_blocker_check_ip");
?>

 

10. Lastly, now that the coding is complete, we need to activate the “Simple IP Blocker” plugin listed in the
wp-admin and test it according to the functionality in the steps above.

The full listing is as follows:

<?php  
/*
* Plugin Name: My Simple IP Blocker
*/  
global $wpdb;

define("LOGIN_FAILURES", 3);
define("IPBLOCKER_TABLE", $wpdb->prefix.'ip_blocker');

function simple_ip_blocker_create_table()
{
  global $wpdb, $table_prefix;
  
  $create_tab_query = "CREATE TABLE IF NOT EXISTS `".IPBLOCKER_TABLE."`(
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `ip_addr` varchar(20) NOT NULL,
    `attempts` int(4) NOT NULL,
    `try_date` date NOT NULL,
    `is_blocked` tinyint(1) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8";
  
  $wpdb->query($create_tab_query);
}

register_activation_hook( __FILE__, 'simple_ip_blocker_create_table' );


function simple_ip_blocker_reset_bruteforce()
{ 
   @session_start(); 
   
   global $wpdb, $table_prefix;
   
   if(!isset($_SESSION["brute_count"]))
   {
    $_SESSION["brute_count"] = 1; 
    
    $query = "INSERT INTO ".IPBLOCKER_TABLE."(ip_addr, attempts, try_date, is_blocked) VALUES(%s, %d, %s, %d)";
    
    $try_date = gmdate("Y-m-d");
    
    $wpdb->query( $wpdb->prepare( 
      $query, 
      $_SERVER["REMOTE_ADDR"], 
      $_SESSION["brute_count"], 
      $try_date,
      0
    ) );
    
   }
   else
   {
    $_SESSION["brute_count"] = $_SESSION["brute_count"] + 1;
   
    $try_date = gmdate("Y-m-d"); 
     
     //check limit
      
    $check_query = "SELECT attempts FROM ".IPBLOCKER_TABLE." WHERE ip_addr = %s AND try_date = %s";
      
    $attempt_count = $wpdb->get_var($wpdb->prepare($check_query, $_SERVER['REMOTE_ADDR'], $try_date ));
  
     if($attempt_count >= LOGIN_FAILURES)
     {
       unset($_SESSION["brute_count"]);
       
       $update_query = "UPDATE ".IPBLOCKER_TABLE." SET is_blocked = 1 WHERE ip_addr = %s AND try_date = %s";
       
       $wpdb->query($wpdb->prepare($update_query, $_SERVER['REMOTE_ADDR'], $try_date ));
       
       wp_redirect(site_url('/wp-admin/'));
       
       exit;
       
     }
     else{
       
      $query = "UPDATE ".IPBLOCKER_TABLE." SET attempts = %d WHERE ip_addr = %s AND try_date = %s";
      
      $wpdb->query( $wpdb->prepare( 
        $query,  
        $_SESSION["brute_count"],
        $_SERVER['REMOTE_ADDR'],
        $try_date
       ) ); 
       
       
     }
   } 
}  

add_action("wp_login_failed", "simple_ip_blocker_reset_bruteforce");  //plugin admin panel


//pre-authentication

function simple_ip_blocker_check_ip()
{
  //die('done');
  global $wpdb;
  
  $try_date = gmdate("Y-m-d");
  
  $check_IP = "SELECT is_blocked FROM ".IPBLOCKER_TABLE." WHERE ip_addr = %s AND try_date = %s";
  
  $blocked = $wpdb->get_var( $wpdb->prepare( 
        $check_IP,  
        $_SERVER['REMOTE_ADDR'],
        $try_date
       ) );
       
  if($blocked == 1)
  {
    wp_die("IP address blocked!");
  }
}

add_action("wp_authenticate", "simple_ip_blocker_check_ip");

function simple_ipblocker_menu_callback()
{ 

  global $wpdb;
  
  /* $page = (isset($_GET['pg']))?$_GET['pg']:1;
  
  $offset = ($page - 1) * 10; */
  
  $get_history = "SELECT * FROM ".IPBLOCKER_TABLE; //" LIMIT $offset, 10";
  
  $history = $wpdb->get_results($get_history, ARRAY_A);
  
  ?>
  <h1>Simple IP Blocker active!</h1>
    <table border="0" cellspacing="5" cellpadding="5" class="widefat">
      <tr>
        <td>S. No.</td>
        <td>IP Address</td>
        <td>Login Attempts</td>
        <td>Try Date</td>
        <td>Blocked</td>
      </tr>
      <?php 
        foreach($history as $row)
        {
          ?>
          <tr>
            <td><?php echo $row["id"]; ?></td>
            <td><?php echo $row["ip_addr"]; ?></td>
            <td><?php echo $row["attempts"]; ?></td>
            <td><?php echo $row["try_date"]; ?></td>
            <td><?php echo ($row["is_blocked"] == 1)?"blocked":"unblocked"; ?></td>
          </tr>
          <?php 
        }
      ?>
    </table>
  <?php
  
  
  
}  

function simple_ipblocker_menu_add()
{
  add_menu_page("Simple IP Blocker", "Simple IP Blocker", "administrator", "simple-ip-blocker", "simple_ipblocker_menu_callback" );
}  

add_action("admin_menu", "simple_ipblocker_menu_add");
//plugin admin panel end

?>

 

Create a Basic WordPress Plugin From Scratch

In my post here, I had shown you how to create a plugin from existing code. In this post, I will show how to create a basic ‘Hello World’ wordpress plugin from scratch.

First of all, create a ‘hello-world’ folder in your plugins subfolder under the wp-content folder of your wordpress installation.
Then, create a blank file in the ‘hello-world’ folder and name it ‘index.php’.
After that, open your index.php file and put the following code in it:

<?php
/*
Plugin Name: Hello World Plugin
Plugin URI: http://myexamplesite.com/hello-world
Description: A simple WordPress Hello World plugin
Version: 1.0
Author: Author Name 
Author URI: http://myownsite.com
License: GPL2
*/
 ?>

 

This will create a descriptive header in the listing of plugins under the plugins section in wp-admin.

Now create a simple hello_world function in the example index.php page like so:

<?php 

function hello_world()
{
     echo "<h1>Hello World!</h1>"; 
}

?>

But this function needs to be called somewhere to get its output.

To get the output, we need to add the following code to our index.php file.

<?php

function hello_world_callback()
{
      add_menu_page("Hello World", "Hello World", "administrator", "hello-world", "hello_world");
}

add_action("admin_menu", "hello_world_callback");

?>

The add_action function hooks into ‘admin_menu’ to create a link to the plugin in the admin sidebar on the left of your dashboard. On clicking this link, the ‘hello_world’ function is called and the output is displayed on that page.

We will get the output in wp-admin under the “Hello World” tab once we activate the plugin.

So the complete code that needs to be there in the index.php is the following:

<?php
/*
Plugin Name: Hello World Plugin
Plugin URI: http://myexamplesite.com/hello-world
Description: A simple WordPress Hello World plugin
Version: 1.0
Author: Author Name 
Author URI: http://myownsite.com
License: GPL2
*/

function hello_world()
{
     echo "<h1>Hello World!</h1>"; 
} 

function hello_world_callback() { 
     add_menu_page("Hello World", "Hello World", "administrator", "hello-world", "hello_world"); 
} 

add_action("admin_menu", "hello_world_callback");

?>

 

The video above shows the installation and working of the plugin.

Click the following link for a more detailed tutorial.