Accident waiting to happen

{{This article was originally posted on December 24, 2016. Lost and found, it is posted again. }}

The Central Bank of Bangladesh was broken a while ago and over 81 million dollars heisted. Though there were traces to try and hack into over a billion dollars a minor error in the part of the hackers led to the heist being uncovered and duly blocked. 2 months on the case has completely gone away from our minds as we move on with our everyday lives knowing that such disasters might never strike again.

When people built the Titanic they claimed it was unbreakable, yet it was broken in its maiden voyage. The feeling or sense of security may not be in actuality the realization of security. As was the case with the Central Bank of Bangladesh.

I had been following this case as much as I could due to my varied interest in communications and communications security. This case was interesting for me from the communications point of view, mainly in how the communications infra-structure was utilized for the heist.

Due to the sensitivity of the case a lot of forensic analysis is being carried out around the world to try and figure out what happened, how it happened, what were the weak links exploited and how. Recently a forensic report article on the Reuters (http://www.reuters.com/article/us-usa-fed-bangladesh-idUSKCN0XI1UO) caught my eye. At first I just read through it as any other article on forensic analysis and accepted the findings by thinking it would happen to others too. Scrolling back up to the heading some words stood out with prominence — cheap switches and no firewall. Then I read the article again, but this time trying to put Nepal and Nepali organizations in the places where Central Bank of Bangladesh was mentioned.

Since I am an “IT” guy, during most of my visits to organizations I am shown either full or parts of their IT infra-structure. If I am doing work on system design or development then 100% of the time I am shown the entire IT infra-structure. In most cases I have seen cheap switches, that we normally tend to use at home, being used in even very large organizations or even in financial institutions. I don’t know much about the firewalls as I am not a working computer security professional, but I see the hardware.

I remember a time while talking to a security professional and him telling me that the Government of Nepal should not give licenses to people to use certain frequencies because the security professionals and institutions used them. I disagreed with him on the term that atleast one knows that these licensees could be using the frequency. What happens if a malicious use uses them without a license? These days a Software Defined Radio costs less than 20 dollars, is easily passable as a USB dongle and can be used to scan and read frequencies in the range from 100MHz to 3.7GHz. This means the device can scan the GSM bands, wifi bands besides the VHF and UHF bands that are most commonly used for all communications in Nepal. Wifi scanners on mobiles can break into Wifi networks within minutes if security features are not activated properly.

The advantage of IT far more outweigh the disadvantages and threats from it. So avoiding IT is not a solution, but being prudent and living upto the challenges is a better way ahead. Understanding that the weakest link controls the strongest of security is crucial here and should be given priority. The usual notion of it has worked and will continue to work should not be accepted. An openly available statistics on security breaches available at http://bhutabe.blogspot.com/2015/04/nepal-web-security-status.html on Nepal looks pretty dismal.

This brings me back to the Reuters article and the usage of cheap switches and lack of firewall. I feel we can agree that most organizations do use cheap switches. Also that most organizations do not run any firewalls. Also most organizations run softwares where quality is compromised to cost.
This I call the “Cheap Chinese” syndrome.

Since our markets have been flooded with low quality Chinese products (disclaimer : I am not saying all Chinese products are low quality) at extremely reduced prices we have flocked onto them  for all of our needs,

The biggest problem in Nepal is that most human resource in organization do not really have sufficient knowledge regarding the usage of IT. Therefore the hardware and software are compromised for price rather than quality. Most organizations lack policies or practices that help better use the boon of IT and communications technology. Most organizations do not have or do not commit enough budget to better enhance their IT infra-structure.

All this helps me frame a dire question in my mind — are we on the path to become the next big victim???

Rapid Forest

{{This article was originally posted on December 24, 2016. Having lost and found, it is posted again.}}

While being obssessed with climate change and looking into making applications that could be effective for people to manage climate change in multiple ways, I came across the story of these 2 guys — Jadav “Molai” Payeng from Northern India and Yacouba Sawadogo from Burkina Faso.

Both build forests out of barren lands, showing that it is possible if one tries. SALUTE to both these guys.

Inspired by their example I wanted to learn about how their methodology worked and what we could do in similar lines to create new forests. Also how could we use similar ideas in agriculture for food security.

Article of Jadav — http://www.mnn.com/earth-matters/wilderness-resources/stories/indian-man-single-handedly-plants-a-1360-acre-forest

Article of Yacouba — http://www.odditycentral.com/news/meet-yacouba-sawadogo-the-man-who-stopped-the-desert.html The commonality in both seem to be usage of native plant species, compost and bio material from nearby areas, optimum utilization of rain water and other water sources and working in partnership with nature.

Looking around found that the technique (though age old) is contributed to a Japanese person and is called the Miyawaki Technique.

Based on this technique an Indian company has started a commercial venture called Rapid Forest (www.afforestt.com) and has open sourced all their techniques, tools and methodologies.Shubhendu Sharma, the founder of Rapid Forest, has done a ted talk and ted blog : http:/http://blog.ted.com/shubhendusharma// and http://dirtyclassroom.com/diy-build-your-own-forest-alex-eisenreich/ This lead me to a binge on agriculture, irrigation, local knowledge, etc… that is documented in another blog article.

Pro-poor credit Rating

{{This article was originally posted on December 23,2016. After loosing and retrieving it here it is posted again.}}

I was (still am) fascinated by how micro-financing works, specially they social insurance and social credit system. I got hands on, in the field sessions with 2 micro-finance Organizations (MFI), Chimek Bikas Bank and Jeewan Bikas Sanstha, is regards to some work that I was working with them on. During these trips I was able to see how the credit was provided for individuals as being part of a group (social credit). This created a little bit of restrictions in that the person needed to be known and was bound geographically.

With the blockchain revolution I thought that the micro-finance’s social credit could be taken online. But I see one issue, the initial credit that needs to be provided for one to become known to a social unit. In the current scenario that is being done by physically being known among someone in the group. The analogy does not look possible to replicate in blockchains.

So I have been thinking maybe an initial credit rating of a person should be done that could then be used to continue forward in the blockchain. As the person does not have any collateral or even a social network to show, we might need to be imaginative in doing this credit rating.

The initial credit should be :
Profile + weighting factors

where Profile :
Personal Income level
Household Income level
Mouths to feed
Potential of income in near future
Land
Business
Vehicles
Any terminal illness (I feel this needs to be there, but am not comfortable as it marginalizes)

Weighting Factors:
How long has someone stayed in the current place?
How many times has someone moved locations so far in life?
Current family members vs members outside (within Nepal and outside)
Own land location
Own home location
Current field size VS soil type in that region
Current animals VS national requirements for those animals
Personal education vs district education
Personal income vs district income
Animals possessed
Variety of animal vs animal requirement of district and country

As all financial facilities go, there cannot be an access to major funds right a the beginning. Credit has to be built. There always needs a starting point. So making initial credit rating is starting point. Incremental building of credit rating by honoring the guarantees — this will allow to develop trust over a period of time.

Individuals would try to get into the blockchain so that they have a credit rating and social guarantee to be eligible for loans and other financial transactions. Banks and other institutions could look into the blockchain as a way to make informed decisions regarding particular person.

In this case not having anything on the blockchain would be penalizing for the potential user. So incentive to put everything there could be rewarding enough for the motivation to just do it.

Note : when I discussed this with my friend, Lewis Kaneshiro, he deeply feels that putting a person’s information in blockchain itself seems not like a good idea as it puts someone’s entire life into a permanent storage that people can query into way past the person. Looking at it from that perspective I left this thought as a thought only and didn’t do a binge on.

Bucket List

{{This article was originally posted on December 22, 2016. My posts were lost and after being found I am re-posting them.}}

One day (in 2011) got a whim to try and write a Python program to that will try and find the best combinations of numbers (within given range and given tolerances) that will add up to a fixed target total. Didn’t think of much use for it then, but have used it in multiple instances to get some good results. The algorithm works as the diagram below :

The Python code for it :

import random
def generateBucketList():
    fixedTargetTotal = 94
    bucketMidPoints = [[10, 5], [5, 10], [6], [5], [5], [6], [6], [8], [6], [8], [5, 5, 5, 5]]
    bucketAssign = [1, 2, 3]
    rangeFromMidPoint = [2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4]
    bucketMidPoints = sum(bucketMidPoints, [])
    finalAssign = []
    if sum(bucketMidPoints) > fixedTargetTotal:  # reduce(lambda x, y: x + y, bucketMidPoints) > fixedTargetTotal:
        while sum(bucketAssign) != fixedTargetTotal:  # reduce(lambda x, y: x + y, bucketAssign) != fixedTargetTotal:
            # bucketAssign = [random.randint(int(0.6*i),i) for i in bucketMidPoints]
            bucketAssign = []
            for i in bucketMidPoints:
                if i != 0:
                    bucketAssign.append(random.randint(int(0.6 * i), i))
                else:
                    bucketAssign.append(i)
    else:
        marks = "Bucket dispersal is not above given expected Target Total"
    # Print the list in given order from here
    startMarker = 0
    endMarker = 0
    for i in rangeFromMidPoint:
        endMarker = endMarker + i
        tempList = bucketAssign[startMarker: endMarker]
        finalAssign.append(tempList)
        startMarker = startMarker + i
    for i, j in enumerate(finalAssign):
        print i + 1, " -> ", j
    print "\n"
    print bucketAssign, sum(bucketAssign)  # reduce(lambda x, y: x + y, bucketAssign)

if __name__ == "__main__":
    generateBucketList()
    print "Demo!!!..."

Weather Predictor — in Python

{{This article was originally posted on December 22, 2016. My posts were lost and after being found I am re-posting them.}}

“””This is based on my binge study to learn about climate change and predicting weather at rural community levels using low power devices. Original thought was to try and do community level weather predicting so that locals are aware of the changes that are occuring around them and plan for agriculture better.“”” Hearing much about climate change and weather pattern changes got me thinking if I could make a simple weather prediction system. For hardware I had a raspberry pi that had temperature sensor, humidity sensor and pressure sensor. Then I didn’t have rain guage or wind direction sensor, but I wanted to suppose that if I had all that, could I use the raspberry pi to predict weather parameters at local level. My thought if I could have a lot of cheap weather monitoring stations at community schools in villages, then I could use my system to predict the weather at the station as well as pass on the data to other stations. So other stations could predict using their data and the one sent from the first one. slowly the data would be passed to each other resulting in more accurate predictions. Without bothering about how to pass the data I looked at ways of creating a simple wether prediction system that could easily work off raspberry pi as well as be able to scale up to parallelly be able to predict these parameters when used at aggregator levels. I settled on the windowing technique to do the prediction as described on the paper : http://www.hindawi.com/journals/isrn/2013/156540/ Weather data is available through a CSV file in following format:

datemaxTempminTemprainfallmorningHumidityeveningHumidity
2004-01-0118.82.4096.981.7
2004-01-02191.1096.978.5
2004-01-0318.31.7010086.6
2004-01-0418.31096.782.6
2004-01-0517.81.3096.786.9
2004-01-0619.52094.465.7
2004-01-0720.9209772.5

Explanations : The way the algorithm is implemented right now is as follows: from the latest 7 days weather parameter data a 7 day dataframe is created this dataframe is compared against a running window of 7 days dataframe going through the whole year and then over years. the dataframe and testframe that creates the least delta is taken as similar weather predictions. The delta is added to dataframe and predictions given. My list of readings is below :Books :

  • DETECTING TREND AND OTHER CHANGES IN HYDROLOGICAL DATA Zbigniew W. Kundzewicz and Alice Robson (Editors) WMO/TD-No. 1013 (Geneva, May 2000)
  • Weather and Climate Extremes in a Changing Climate Regions of Focus: North America, Hawaii, Caribbean, and U.S. Pacific Islands U.S. Climate Change Science Program
  • Synthesis and Assessment Product 3.3 June 2008
  • Introduction to Time Series Analysis and Forecasting DOUGLAS C. MONTGOMERY, CHERYL L. JENNINGS, MURAT KULAHCI Wiley Publications 2008
  • An Introductory Study on Time Series Modeling and Forecasting Ratnadip Adhikari R. K. Agrawal
  • Python In Hydrology Sat Kumar Tomer Green Tea Press 2011

Articles :

  • Trend analysis of rainfall and temperature data for India Sharad K. Jain and Vijay Kumar
  • Detecting changes in rainfall pattern and seasonality index vis-`a-vis increasing water scarcity in Maharashtra Pulak Guhathakurta and Elizabeth Saji
  • Trend Detection in the Temporal Pattern of the Precipitation at Different Timescales – Application to a Case Study: the Watershed of the Stream Gauging Station of Torrão Do Alentejo. Ana RAMALHEIRA, Maria Manuela PORTELA, Cristina FAEL
  • Correlation and Regression without Sums of Squares (Kendall’s Tau) Rudy A. Gideon
  • Change detection in hydrological records—a review of the methodology / Revue méthodologique de la détection de changements dans les chroniques hydrologiques Zbigniew W. Kundzewicz & Alice J. Robson
  • Changes in the intra-annual rainfall pattern as an evidence of climate change Carlos Manuel Cotafo Martins
  • Application of Data Mining Techniques in Weather Prediction and Climate Change Studies Folorunsho Olaiya

github repo : https://github.com/pravenj/weatherPredict

Rijal Samabeshi Dewali — Lung

{{This article was originally posted on December 22, 2016. My posts were lost and after being found I am re-posting them.}}

Recently (6th-8th Dec) I visited Lung, Pyuthan, Mid-Western Region of Nepal for the Rijal Dewali. My in-laws are Rijals. They hail from Lung, Pyuthan and still form important figures of the 4 day festival that drew over 200,000 people this year.

Many will say that the puja is 2 days, but I beg to differ based on the oral history that is recited as chants by the Dhamis during the program. They say “Panchami awahan…… Asthami Puja” — that makes it a total of 4 days.

The Dewali is believed to have started by the Rijals of Lung 400 years ago and is a spectacle of events mainly on the 3rd and 4th, starting by the lighting of the traditional lamp at sundown, followed by karnal band, drums and 100s of Dhamis chanting mantras and bells. The Dewali program seems to revolve around bells with all the Dhamis wearing bells on their bodies as well as ringing of the bells continuously throughout the last 2 days.

The 4th day saw the Aalam procession, which for a distance of about 1 kilometers too the best part of 4 hours. Starting off with just a bamboo pole carried by a person, it slowly grew to a volume with all the red and white cloth placed by the devotees. The Aalam procession saw most of the Dhamis singing and dancing and was a spectacle to see.

Once the Aalam arrived at the Gaura, from its starting point of the Kulghar, puja was conducted at the Gaura and then the goat cutting began.

Few points that I noticed:

  • There was very less or no use of tika material like Aabir, sindur, etc.
  • Bells, bells and more bells everywhere
  • Participation of whole communities, gender, caste, etc… It really stood for democracy
  • History and the process of the festival was sung as incantations by the Dhamis
  • Red and white color occupied all significance

My thinking — this puja seems to be somehow dedicated to wind.

Videos:

https://youtu.be/MUnn5TW167I — Start of the Puja (after Sundown) and early morning procession
https://youtu.be/OowaQclQC1k — Procession continues with trance and dance
https://youtu.be/AU0AhR_pSYs — Special dance. Salute to those who can guess what is the dance called and what the person who is wearing the special dress is called
Last video : https://youtu.be/y0VXckXouPg — son is shocked to realize that most of the Dhamis and Pujaris are his Grand-fathers.

Jump Search

{{This article was originally posted on December 22, 2016. My posts were lost and after being found I am re-posting them.}}

Few years ago (I think in 2013), I read this article on Jump Search : http://www.stoimen.com/blog/2011/12/12/computer-algorithms-jump-search/ Since the code presented was in php, got the urge to try it in Python. So wrote the code, forgot about it and discovered it in my hard drive few months ago. So putting it up as an archive. The Jump Search works as in picture below:

Fig.: diagrammatic representation of how jump search works

My Python code is as given below:

import math

def jumpSearch(noToSearch, lis):
    lenOfList = len(lis)
    prev = 0
    counter = 0
    step = int(math.floor(math.sqrt(lenOfList)))
    while lis[step if step < lenOfList else (lenOfList-1)] < noToSearch:
        prev = step
        print "Inside while : ", prev
        step = step + int(math.floor(math.sqrt(lenOfList)))
        counter = counter + 1
        print "Count : ", counter
        if step >= lenOfList:
            break
    while lis[prev] < noToSearch:
        prev = prev + 1
        counter = counter + 1
        print "Count : ", counter
    return prev+1

if __name__ == "__main__":
    lis = range(1,1000)
    print jumpSearch(624, lis)

Nepalish — English Nepalized

{{This article was originally posted on February 1, 2017. My posts were lost and after being found I am re-posting them.}}

When I was in school, we had an interesting person as the night watchman at the Infirmary. His name was Dominique. Once, in class 8, I felt sick and stayed in the infirmary. At night Dominique and I used to talk. Just before leaving he would say “Good garauna” and we would shake hands. I didn’t think about it much then.

When in class 10, I got sick again and the nightly chats with Dominique started. Again he would say “Good garauna” and we would shake hands. From then on those words stuck in my head, but I really didn’t understand what he was saying.

By the time I was in college I had forgotten about Dominique and his Good garauna. I visited Pokhara once and was talking to an ex-British Gurkha army man. When parting he said “Good garauna”. That suddenly brought back Dominique. This time I asked him why he said that. He said it was practise among most ex-British Gurkha army men to say that before shaking hands. Dominique had also served in the British army. So I began to see connections.

Few years later, out of college, and visiting Pokhara again, I met an ex-British Gurkha army man. While in conversation I mentioned to him that most ex-British army men tended to say Good garne and he said that was standard practice and that it had become common in most rural parts of Nepal to say that. He explained to me that the term came from the British saying “Good Morning” or “Good Afternoon”, while shaking hands. Nepali army men didn’t understand the other terms, but heard “Good” everytime and then took it that the process of shaking hands was called “Doing Good” — “Good garne” in Nepali.

That was that!!!… Understand, suddenly aaha moments, all smiles, but rapidly forgotten. Fars forward 17 years to last year when Shailendra (one of my students, currently studying in China) came back from his home in Ramechhap. We got to talking about farming and food stuff and milk. So I asked him the price of milk and he said “NRs. 40 for one Horlicks”. I was taken aback. I had heard and used metric system heavily, heard of emperical system, written software for conversion of various Nepali measurement units. And here was an unit that I could have never ever imagined. It turned out that the milk was measured using Horlicks bottles and its size was half a liter. So instead of saying half a liter, people just called it 1 Horlicks.

Since then I have been meaning to write an article on the Nepalish language and this it is.

Nepalish has a rich vocabulary, a non-exhaustive list of words is given at the end of this article. Before the list though there is three other words that I was to specifically talk about, first of which is courtesy Dominique (remember the Good garne guy!). We used to have movie nights every Friday. A Friday fell on one of the days when I had fallen ill and retired to the infirmary. Dominque came in and said “you missed the 22 scope today right”. Puzzled I asked him what “22 scope” was. He, in his own strange way, rounded his fingers and looked through indicating, and making me realize, about the movie. Again, puzzled as ever, I put to brain the word 22 scope, which supposedly stood for movies. Recently I remembered the word and looked put to find that it meant Cinemascope film shot with 22mm focal length cameras. It seems in some old movies the word “22 SCOPE” would be written in bold and, during their British army days, people seem to have picked up the words to mean cinema.

The second word is “bushat”. Bushat is shortened Nepalized word for Shirts with Buttons. I just like the sound fo that word. Hehe… What can I say!!!…

And the third is “matshaab”, shortened Nepalized word for Master Shaab, commonly term for teachers. This word is dear to me as my father has been a teacher for over 50 years now and as long as I can remember people have called him  “matshaab”.

A non-exhaustive list of words in Nepalish:
genoon – genuine
goltin – tin with golden coloring originally. Now all tin cans.
tikas –  ticket
misscall hanne – call from phone, but hangup just before receiving on the other side
tausi – taxi
tyam – time
tem – time
phoon – phone
byar – beer
bayler – broiler chicken
paiit – pant
point – pant
pilate – plate
gilas – glass
cilas – class
fuscilas – first class
pias – plyers
wrenchu – wrench
bingness – business
almunim – aluminium
meassage – message
bodi – body
bicut – boycott
heroni – heroine
millen – million
billen – billion
lop parne – have an affair
commnista – communist
easta coat – waist coat
patty – party
patty – political party

Biskoot — Biscuit
Saraf — Detergent (derived from an Indian brand of detergent called Surf)
Cocola — Coca Cola
Bottal – Bottle
Baiscope — Cinema (Comes from 22 scope, a film format used in really olden days

Filim — Film

Tinisin — Tension

Gilas — glass
Cinima — Cinema

Vote of Thanks – to Santosh, Prajwal, Aakarshan and Barsha for bringing into attention so many of the words in this list.

Note : This is a work in progress. If anyone has any words please feel free to send them. I will add with proper credits.

Looking at Flowers

This lock down my daughter and I felt a project to do was to document all flowers in our home.

Lots of plants all around the home, but we had never taken the time to look around and see what we had. This was a perfect opportunity to look at the plants as well as try out and provide some data to plantnet.org plant recognition app.

We used the Android version of the app we it would allow direct upload of images from camera. So made the whole process a lot easier.

Overall it was able to recognize about 80% of the plants in our home. the rest 20% we uploaded data and coordinates. The reason for non-recognition could be these plants are found more in South-east Asia (mainly around Nepal and India). Data maybe sparse on the plantnet.org platform from this region.

Curious case of lost Man

It happened about two years ago. One of my friend’s brother went missing or rather he went out of the house and did not return.

Friend’s brother was around 50 years old then. He was diagnosed with mental illness earlier on in life and lived mostly at home roaming around the neighborhood.

One day he did not return and the search for him started. People went all around Kathmandu, all old age homes, all hospitals, all shelters, the brother’s usual hangout locations. Nowhere was he to be found. Police were informed.

3 days later people found him body in the morgue at a hospital. The family went to check and confirmed it was him. Family performed his last rights at the Aryaghat below the Pashupatinath temple on the banks of the river Bagmati.

As per Hindu customs they performed staunch mourning for 5 days. Since he was unmarried and did not have any kids the rights needed to be performed were taken care for by his brothers, including my friend.

On the fifth day they finished the mourning ritual with a puja and all changed the dresses and were getting ready to have proper meal after the five days.

Suddenly my friend got a call from one of his friends who had gone out to an lost person shelter in Patan. He asked if the rites had been completed. Then he said he found the lost brother. To confirm he sent a photo through Whatsapp, which everybody looked at. To the surprise of all it was the lost brother!

This brings up a few questions to anybody’s mind — who did they find before? Whose body was cremated? What basically happened?

The questions remained unanswered till today. The lost brother is fit and fine and still hangs around the neighborhood.