Tuesday, April 25, 2017

This is a continuation of the list of important software incidents in recent history as described here.   
11) Price markdown: A wrong position of a decimal in the price of an item can make it very popular for purchase and often resulting in tremendous loss for the online retailer. This was exactly the case in its sale of first class air tickets on Feb 11 2015 on its Danish website by United Airlines. The flight from London to New York was priced $74 which was a discount of over 5000 US dollars.  The glitch was unnoticed for several hours and as per the quotes, resulted in “several thousand” tickets purchase attempts. Fortunately some of the safeguards within the website’s purchasing deterred many buyers. 
12) Price Markup: The price of the item need not come down for buyers to take advantage of the company. Mr.Klug from San Mateo California bought Discovery Channel CDs from Amazon for a ticker price of $2,904,980,000 plus shipping and handling. Since he had an Amazon Visa three percent rewards card, he was entitled to roughly $87 million in rewards. Thankfully for Mr.Klug, his card was not charged by Amazon because as per their policy they don’t charge until the item is in packaging.  
13Price wars: It’s one thing for a company to make mistakes on the price of its products. It’s another for companies to compete with each other for the lowest price in favor of the buyer. This was the case again with Amazon. Discounts were offered on Apple MacBook in November 2016 but the discount was calculated wrong and resulted in over 360$ off the regular price far lower than any competitor. Although the misprice was found and rectified, within a few hours, it didn’t stop buyers from making good on the price and the company decided to honor them anyways.  
14Space age: Software bugs can occur anywhere but probably the most costly ones happen where no man has gone before and especially when it takes a long time to go there. In 2006, the Mars Global Surveyor had remained operational for almost a decade when a software bug ended its life. A software update threw open a possibility for data to be written to a wrong memory address which in turn caused the solar panels of the Surveyor to get stuck. The Surveyor then made movements to face the sun exposing its battery which overheated and became non-functional.  
15) To find the Ozone hole: Software bugs may not just result in incorrect behavior; they can cause long delays in the calculations. Analysis of atmospheric data by NASA also involves immense calculations. One such project that was launched in 1975 to map the Ozone layer, was designed to ignore values that were the outliers in the expected measurements. The hole in the Ozone was not found until after the data was reviewed. NASA did not find the Ozone hole. It was the British Antarctic company in 1985 that obtained data with a ground based instrument from a measuring station and were the first to find the Ozone hole. 
16) Explosions from bugs: Software bugs are generally reduced with testing and validations in mission critical applications which greatly reduce the risk of running software. However, if the bugs are planted deliberately, hazards do result. In the cold war era, the CIA is said to have slipped the Russians faulty control software to be used for a major gas pipeline which the KGB was stealing from a Canadian company. The bug caused a huge Siberian pipeline explosion in 1982 and the US satellites could observe the explosion and fire from space. 
#codingexercise
In a boolean matrix, find the length of the largest region. A region is a group of cells with value 1 such that each cell is adjacent to another cell also with value 1 and adjacency can be horizontal, vertical or diagonal.
int GetLargest(int[,] M, int row, int col)
{
var visited = new bool[row,col];
int result = int_min;
for (int i =0; i < row; i++)
   for (int j =0; j<col;j++)
       if (M[i,j] && !visited[i,j])
       {
           int count = 1;
           DFS(M,i,j, ref visited, ref count);
           result = Math.max(result, count);
       }
return result;
}
// DFS attempts all the eight adjacent cells a d only proceeds to recursion on that when it is safe to do that. Here safe means the cell is a valid position, has a 1 and has not been visited before. All the eight adjacent positions are tried.

No comments:

Post a Comment