All hail authoritarianism

Authoritarians, no matter how they come to power – by a coup or elections, will do what authoritarians do – subvert freedom and human rights, promote a personality cult, encourage crony capitalism and doing long term harm to the nation. Removing them is also not easy. They destroy the systems put in place to check their power – judiciary, independent media. They use the brute force of the state to silence any criticism. It takes long period of struggle often decades to get rid of them.

In the coming days however, getting rid of authoritarian leaders will become almost impossible. The newfound tools of social media and the ability of spreading mass propaganda coupled with never-before-seen capabilities of surveillance will ensure that the majority of the people don’t even feel the need to protest and those who do are identified and dealt with swiftly.

Social media might be instrumental in organising many of the mass protests in recent past, but those capitalist platforms will eventually side with or give in to the governmental pressure and make it almost impossible to use them for anything but state propaganda.

But hey, if majority of the people are happy with the authoritarians, does it even matter if they take away the rights and lives of a few people?

The cutest thing about people who support authoritarians is that they think that the authoritarian leader will always be on their side.

First they came for…

Capitalist Welfare State

There are no purely capitalist or purely socialist countries in the world. In its purest form, capitalism will lead to slavery with a handful of individuals controlling most means of production. In its purest form, socialism too will lead to slavery with a handful of individuals controlling most means of production.

What the world needs is a capitalist welfare state. Government has no business owning and running businesses. Capitalism with oversight will foster entrepreneurship and ensure fare wages are paid and rights of workers are protected. It will improve productivity and increased tax revenue for government which can then be sued to support the struggling class of the society. A universal basic income, basic standard of living, basic education and basic healthcare if what a government should focus on.

Housie/Bingo/Tambola ticket generator and number generator mobile apps

Over the weekend, I dabbled into Flutter – a cross platform app development framework. The purpose was to learn Flutter and my preferred way of learning any new programming language or framework is to use in a project or app.

So I ported my Housie ticket generator and number generator to mobile apps for Android and iPhone. I built the app and deployed it on the Google Play Store and Apple App Store.

Building a Housie/Bingo/Tambola Ticket Generator

I had created a Housie/Bingo/Tambola number generator some months back. Now I have also created a Housie/Bingo/Tambola Ticket Generator.

Housie is a group game. It is played when a bunch of friends and family have gathered. Everyone gets a Housie ticket and one person calls out numbers. The host picks up a number token and calls it out, those who have the number on their ticket mark it. There are prizes for the first person to mark 5 numbers on their ticket, for being the first one to mark all numbers on the top, middle and bottom row and then finally a full house – marking all numbers on the ticket.

Creating the Housie number generator was easy because it was only about generating a random number between 1-90.

Creating the ticket was a bit more complex. A Housie ticket has a set of rules

  • It has 3 rows and 9 columns.
  • Column 1 has numbers from 1-9, column 2 has from 21-29, column 3 has 31-39 and so on. Last column has numbers from 81-90.
  • Each row has 5 numbers, 15 numbers total on a ticket.
  • Each column can have 1 to 3 numbers.
  • Any column can’t be blank, any row can’t be blank.

This is what the House tickets look like

At first I thought it would be easy to generate. I would just have to generate 3 random numbers from each column falling between the minimum and maximum numbers for that column. But that would generate 27 numbers. I need only 15. Picking 15 random numbers from those 27 had a chance of one of tens (one column) not being picked at all.

I then decided to generate between 1 and 3 random numbers for each column. Again, it would not give me exact 15 numbers. It could generate any number between 9 and 27. So I put it in a loop to keep generating numbers till the final count of the numbers generated was 15. This would mean an uncertain number of iterations.

It gave me 15 numbers, but placing them was an issue.

Say it generated these numbers

1,3,
16,
21,22,
33,
42,45,48
55,59
63,68
74,
88

I have numbers for each column but how do I place them? Take first column. It has 1,3. I can place it as 1,3,blank or 1,blank,3 or blank,1,3. I could have randomize that placement but then I won’t be sure if I will get exactly 5 numbers in each row.

This is where the complexity comes in. The numbers have to be distributed such that each row has exactly 5 numbers. I concluded that if I generated numbers first and then tried to place them, I would have to do multiple passes to distribute them evenly. It would take multiple loops and would be very complicated.

So I chucked the idea of generating numbers first. I decided to mark the cells which will have numbers.

I created an array of 9 elements containing zeros and ones. It should have 5 ones. Because each row has 5 numbers. Zeros are blank cells with no numbers in them. After generating this array I counted the number of ones. If the count of ones is not 5, I recreated the array till I got an array with 5 ones. This gave me my one row. I repeated the process two more times and I had 3 rows, each having 5 ones and 4 zeros.

for (r = 0; r < 3; r++) {
    var row = [];
    var onecount = 0;
    while (onecount != 5) {
	onecount = 0;
	row = [];
	for (c = 0; c < 9; c++) {
	    n = getZeroOne();
	    if (n == 1) onecount++;
	    row.push(n);
	}
    }
    rows.push(row);
}

Now I put the 3 arrays into a larger array and checked if each column had at least 1 one. If one column was entirely blank, I would regenerate all the 3 arrays again.

for (c = 0; c < 9; c++) {
    if (rows[0][c] == 1 || rows[1][c] == 1 || rows[2][c] == 1) {
	columnok = true;
    }
    else {
	columnok = false;
	//$("#notes").append("Not OK<br>");
	break;
    }
}

There is a scope for optimization here, I will come to it later.

So finally I had a grid of zeros and ones where each row had exactly five numbers and each column had at least one number.

I replaced all zeros with blank. Now I just had to replace ones with numbers. I iterated from column 1 to 9, got the count of ones in that column. Say there were 2 ones in the column, I generated two random numbers between the minimum and maximum of that column and replaced the ones with those numbers. I had my final grid ready.

for (c = 0; c < 9; c++) {
    //get count of 1s in this column
    var nums = rows[0][c] + rows[1][c] + rows[2][c];
    var min = c * 10 + 1;
    var max = min + 8;
    if (c == 8) max = 90;
    var tmp = [];
    for (n = min; n <= max; n++) {
        tmp.push(n);
    }
    var arr = getRandom(tmp, nums).sort().reverse();
    for (r = 0; r < 3; r++) {
        if (rows[r][c] == 1) {
	    rows[r][c] = arr.pop();
        }
    }
}

I then added some bells and whistles like a random ticket colour every time you generate a new ticket. Added a confetti animation using confetti.js for marking first 5 numbers, and marking all the numbers in each of the rows. I also added a pure CSS shake animation on the ticket table.

Marking was just about adding a class on click on the TD. Instead of doing a simple jQuery toggleClass, I added a confirmation prompt for unmarking a number to prevent accidental unmarking.

Optimization

There is scope for optimizing and reducing the number of iterations in number generation.

As I mentioned above, I generate the row array repeatedly till I get exact 5 ones. Instead, I can start with a fixed array of 5 ones and 4 zeros and then randomise (shuffle) that array, this will eliminate the need for generating the array again and again.

I also regenerate all the 3 row arrays repeatedly till I get a grid where each column has at least 1 one. This can also be optimized. After I have generated first two rows, I can check which column is still blank and put a 1 in the bottom cell of that column. I will again have to iterate through the last row to see if has 5 ones and if there are less than 5, I will have to put missing ones in some random blank cells in the bottom row.

Check out the Housie/Bingo/Tambola Ticket Generator at https://yash.info/bingo-ticket.htm

Bingo/Housie/Tambola Ticket Generator

Check out the Housie/Bingo/Tombola Ticket Generator created by me

https://yash.info/bingo-ticket.htm

Now for playing Housie with your friends and family you don’t need physical tickets and pens to mark the numbers. Everyone can have a digital ticket on their phone and mark the numbers just by tapping it.

It also show a cool animation when you mark your first 5 numbers and any of the rows.

Use it in conjunction with my earlier Housie Number Generator

https://yash.info/bingo.htm

Citizenship Amendment Act – what’s wrong with it?

The act is meant to give citizenship to persecuted minorities from Afghanistan, Pakistan and Bangladesh who have come to India before 2014.

The good

It is good that India is giving shelter and citizenship to persecuted minorities from neighbouring countries. That’s the right thing to do.

The bad

It does so on the basis of religion of the refugees. This is not good.

Why is giving citizenship on the basis of religion not a good thing?

Because India is a secular nation. Indian laws treat everyone equally irrespective of their religion. Once we start giving preference to people of certain religion and exclude others, we going down a slippery slop and setting a very wrong precedent.

How so?

CAA is to be followed by NRC – The National Register of Citizens. Everyone in India will be asked to prove their citizenship. How do you prove you are a citizen of India? The exact process will be laid out when NRC is implemented, but if we look at how it was done in Assam then it’s a problematic process.

It took 10 years and 1200 cores to implement NRC in Assam and in the end, no one was happy with it. More Hindus were not able to prove their citizenship than Muslims.

NRC, if and when implemented will mostly affect the poor. They are the ones who don’t have proper documents. If they can’t prove they are citizens, what happens to them? Enter CAA.

Under CAA, those who can’t provide adequate documents can still be counted as citizens if their religion is as per prescribed in CAA. Whom does it leave out? Muslims.

Amit Shah has gone on record and BJP has made it amply clear time and again that CAA is to be followed by NRC.

CAA+NRC is bad for the social fabric of the country.

Even CAA on it’s own is bad. Because it makes religion a basis of citizenship. This means India is a country for people of specific religions. This does not help a country in the long run. Just look at Pakistan.

In 1947, Pakistan was created as a separate country for Muslims. India, did not choose to be a country of Hindus. It adopted a secular constitution. (Thank Nehru, Ambedkar, Patel and other visionary leaders for that). Today, India is a flawed yet fledging democracy. Pakistan is an almost failed state.

Pakistan is controlled by the army via a puppet government. It’s economy is in doldrums and it is living on alms from US, China and wealthy Arabs. The country is rife with sectarian violence and terrorism. Religion has ruined the country.

With CAA, making religion the deciding factor in granting citizenships, we have taken the first step in becoming a mirror image of Pakistan.

Not good for the future of India.

We already know what happens when the government gives more importance to religious issues than economy, jobs and growth.

We are no longer debating the falling GDP growth rate, lack of jobs, poor quality of infrastructure and education. We are debating Ram mandir, citizenship laws, triple talaq, article 370 – all issues which have religion at its core.

If you are a BJP supporter, this is something for you to ponder over, what kind of India do you want for your children? A mirror image of Pakistan or a free, secular, inclusive India which treats everyone as equals regardless of their religion, caste, creed, language and gender?

Think.

Future: A world without jobs

It is future. Automation and robots have taken over all the routine jobs. There are hardly any jobs for humans to do. Machines dig the earth and extract minerals, they transport them to factories where other machines produce good for human consumption from them. Machines do the farming, process and cook the food. Humans only eat. Only a few humans are required to work. They design new machines, create new algorithms and supervise the machines. These jobs require very specific knowledge and high degree of skills, which are expensive to acquire. These humans command top dollar salaries. Rest of the human race is jobless. So how do they survive?

On government welfare. Most of things in life required for sustenance are free. Housing, food, healthcare, basic education, transportation – all paid for by the government. Where does government get money from? From taxes on corporations. Government is both a customer and service provider for corporations. Corporations are mighty profitable thanks to automation. Cost of production is very low and they don’t mind paying high taxes because those taxes eventually come back to them as sales revenue from the people.

What do people do? They mostly have fun, play augmented reality games and watch virtual reality movies and shows. Some people create works of art – poetry, music, plays, stories, paintings, sculptures. Humans do things that require random thinking because there’s one thing that computers can’t do is generate a truly random number.

Economy keeps chugging along by combined economic activity of machines producing goods and service of routine nature and humans producing good and services of random nature.

Mission Mangal is disappointing

Mission Mangal is a bad joke of a movie. A great movie could have been made about India’s stupendous achievement. But in a typical Bollywoodian fashion, it gets bogged down with unnecessary jingoism, heroism and melodrama. It’s such a shame! While the movie does have some moments that give you goose bumps, overall it’s a collection of scenes of half developed characters with ISRO in the background.
A monumental scientific endeavour like India’s first moon mission would have had its own thrilling moments which could definitely have been used to create the necessary drama for any “underdogs achieve great success” movie. But this movie instead tries to do too many things.

If anyone wants to see how to convert a real event into a great thrilling story – just watch Chernobyl or Sully or Everest. Mission Mangal is a wasted opportunity. How do you create thrill or suspense about a real event, the end result of which you already know? Watch Apollo 13.

I don’t understand why Indian movies shy away from using real characters. They invent every single character and give them emotional back stories. In the quest to add fictional elements to a real world event, our directors can’t resist the temptation of going full fictional to the extent that the real world event just becomes a backdrop. It becomes more like an alternative history movie rather than a movie based on true events. They would rather say at the beginning “this happened in an alternate universe”.

Yes, directors must take creative freedom and add fictional elements, otherwise it would be a documentary. But to what extent you do that is a call that a director has to take.

We went to Mars. On the first attempt. It’s an amazing feat. This movie fails to do justice to that.

Indian cricket has come a long way

I just watched an interview of Virat Kohli from World Cup. “We are not looking to entertain; we are looking at winning the game”. That explains a lot. I have watched a few games India has played this world cup. Many of them have been boring. Like a test match. You don’t see too many sixes being hit. But the Indian team is the only team so far that has not lost a game in this world cup.

Indian cricket team has come a long way from where it used to rely on individual performances of a Tendulkar or a Sehwag or a Kumble to win them a game. This is a side that works as a team. It has a definite plan. They have a plan for how to bowl to each opposition player to get them out. They have a plan while batting. Over by over.

Fitness. Virat Kohli runs between wickets at speed of 25 Kmph! I watched another of his video where he mentioned how he maintains a certain diet to be in top condition for the game. Gone are the days of portly cricketers who couldn’t run for their life. This Indian team actually looks like it’s made of professional athletes.

The bench strength of the Indian team is amazing. They lost a top batsman and a top bowler midway through the World Cup due to injuries and it has not made a difference in their performance on the field. This team hunts in a pack. When the batting doesn’t click, bowlers save the day. India has been the best fielding side this World Cup. Who would have thought?!

This Indian cricket team is so unlike other things Indian. There is an intent to win. It has skills and professionalism. They work well together. They plan meticulously and execute it superbly. How did we get here?

I believe the credit has to be given to BCCI and IPL. BCCI is a private business. The players are their products and the games they play is their business. It brings in the moolah. BCCI has invested in players, infrastructure and improved quality of the game. IPL for all its flaws has done wonders to improve the quality of Indian cricket. The increased competition has forced players to give it their best and stay in supreme condition to retain their place in the side.

Right now India are favourites to win the World Cup.

Scroll to top