Skip to main content

Posts

Showing posts from September, 2020

Scramble app with Kannada words

 A simple scramble game - that was my original intention. But I needed that words to be in Kannada.      Get a word list - can be inside the code Scramble the list to get random words Select a random word Separate the letters of the word Now scramble the letters of the word Display the scrambled letters  Let the user click on each letter in order to unscramble it Simple. Quite simple. Only difficulty in this case - our dear mother tongue which uses two unicode characters to display a compound letter like kaa, and uses more to display a ottakshara like kka kku etc.  So if the letter is any of the vowel sounds or half letter, we need to add this the the existing a character in step 4. So basically the the list size will be lesser than the string length. e.g. ಶಾಲೆಯಲ್ಲಿ  must give us only four letters -  ಶಾ,   ಲೆ,  ಯ  and   ಲ್ಲಿ    So here is the code in Kotlin There are two kotlin files - one is viewmodel and the other is activity package com . hegdeapps . scramble import android.gr

Javascript and infinite recursion

 What happens if there is a stack overflow? But we all fondly ask what (disaster) would have happened if there was no stackoverflow ?   But I am talking about actual stack overflow happening. When a recursive function goes into an infinite recursion? We all have seen such code and been wiser after them. But I wasn't ready for this disaster when there was a infinite recursion in a javascript. Was there a stack overflow? Was there a memory error? I really could not tell because.... Because the browser stopped working, the mouse stopped working. I was unable to start a terminal to kill the browser. I was not even able to switch terminals using ctrl alt f3 f4 etc. After switching off the computer - using the power button for nth time, I suspected malfunction by HTML editor. Checked its desktop file. Checked the type of executable - is it some kind of rogue script? No it wasn't. It was the normal ELF file. I checked the config directories. I even checked system logs. Could not find