Friday, December 26, 2014

Fedora 21 Release Party Mumbai

On Sunday, 21st December 2014, we had the Fedora 21 Release Party at Homi Bhabha Center for Science Education (TIFR). I thought I would put together few major points from the event as a report and follow-up. But it seems few participants have already done a good job of writing excellent reports on the event. So just wish to pass on links to their blogs for detailed reports. If you are wondering what's there to report on a small party like this, then please do read them, they may seem interesting and educating.

1. Trupti Kini's take on the event

2. Praveen Kumar's report as a speaker

Thanks to both Trupti and Praveen!

Special thanks to HBCSE and the team in Gnowledge lab, and especially Dr. Nagarjun who has been our inspiration for working on free software, for helping us out in managing the event, letting us use the space, and most importantly guiding us for future directions.

[P.S. Will write separately about the contemplation over and ideas that emerged during the wonderful discussions at the party. ]

Sunday, September 21, 2014

Teach how to think and not what to think

With the changing times and across levels of education, one thing that might have remained constant is that good teachers always teach how to think instead of being just the source of information on what to think. They use all the resources around them to help student's build their personalities. The goal of education cannot be mere preparation for earning livelihood in future. Coaching and training are enough for that purpose and anyone with proper access to the information can gain enough knowledge to earn a living. Better society is not formed by better earning future generation alone, it is formed by better ideas, innovation and evolution of human values, generation after generation. 

Given the technological advances and access to enormous information, students of 21st century are not dependent on formal coaching for making ends meet. Before a teacher starts teaching a topic in classroom, some of the students may already have number of different pieces of information on the topic which may very well be differing from the textbook version of the facts, not any particular of them being necessarily the correct one. This makes the role of teachers in the process of education of 21st century even more critical and challenging.
In the vast sea of information, teachers first need to learn fast on their own, be updated on the various perspectives on the same topic, learn from the students, and above all of this, they need to be the guides who will ensure that the learners are going in the right direction while surfing through all the information. While technology brings lot of resources for teachers, it also makes their role even more challenging. The more reluctant teachers are to adapting this change, the more directionless will be the future generations.
So should the teachers gain a lot of knowledge? Should they really know which direction is correct for each of the students? That would fairly impractical and inefficient. So while being updated on the teaching resources, the teachers need to be able to guide and mentor their students on certain basic values which will help them filter the information for its rationality, correctness, interest, ethics and practicality. There would be more such basic values and each teacher needs to develop them on their own. But once the students get the sufficient 'coaching' on these while learning the set courses, there is more likelihood that they would neither be lost in the amount of content, nor be restricted in their perspectives. This would further help them be more self-driven, innovative and practical. Once these values are imbibed, they would be sufficiently equipped to both sustaining a livelihood as well as making a better society of their own.
Teachers need not just remain the source of information, either from textbooks or from internet, either on paper or on the screen, they just need to provide proper pointers on what to look out for, how to filter that, and further encourage its practical use by means of 'creating' various kinds of useful resources from that. For doing all these, they can very well make use of the technology solutions, which facilitate creationism, collaboration, prototyping, and automation for the mundane tasks.

Thursday, September 18, 2014

Launching the project 'i18nWidgets for Android'

A lot of Android devices, platforms and apps have several issues regarding rendering of non-English text especially that of Indic text. Though many of them claim to support various Indic and other languages, it usually either means that they have a font for that language included or they have some of the native apps supporting all these languages. But this does not mean all the app will be able to render the non-English text properly. This usually happens for one of the following problem being present:

1. No fonts added in the device (or the native android system)
2. Fonts are not accessible by the third party application
3. App has its own Unicode font, but the native android system does not support text layout rendering for the language
4. App has the font and the android system also supports the language, but the sdk for the particular platform does not have widgets integrated with the complex text rendering features.

This problem gave birth to the idea of developing and extending android widgets which will be integrated with text layout and rendering system on their own. So that, the apps that make use of these widgets will have their own independent rendering system free from the underlying bugs and limitations of the base android system.

The good part is, we do not need to rewrite those rendering systems. The two very well known projects that we need to make use of are Harfbuzz and Freetype. Harfbuzz for text layout of the complex scripts, and Freetype for drawing the font glyphs. 

So, this is what the project 'i18nWidgets for Android' is, under which we are developing independent widgets for app development which will have their own complex text rendering support through integration with freetype and harfbuzz libraries.

The project tree is already made suitable for using with eclipse and hence is readily testable from within eclipse. There are three dependencies to take care of while building:
1. Andoroid SDK 14/15: You may have to configure your development environment for Android SDK 14/15 
2. Android NDK 8: Make sure to have NDK 8 support enabled. 
3. Also have the appcompat_v7_2 library added properly to the project dependencies. 

Please make sure to have exact sdk and ndk versions setup, as the project includes working with native C/C++ libraries along with android platform and hence may run into tedious binary incompatibility issues if not built with proper resources. I have made best attempt to keep things simple for working within eclipse, but do go through the documentation of above development environment thoroughly if you are new to developing native android apps, in case you are struck at some compilation issue.

The project tree has following important components:
1. /jni : This contains the complex-script-rendering library that integrates Android Java widget with the C/C++ libraries of Harfbuzz and Freetype. The entire source tree of particular working snapshot of HB and FT are given in the repo to avoid any incompatibilities during the compilation. Also their makefiles are tuned to work with the given setup.
2. /src/gujaratirendering : This package contains a widget IndicTextView, an extension to the TextView widget which can render Gujarati text. Currently 
3. /src/com/example/i18nwidgetdemo: This is a demo package for testing the the IndicTextView widget with sample text on a simple app screen with Lohit-Gujarati font.
4. /assets: It contains the Lohit-Gujarati font to be used in the demo app

The library complex-script-rendering is based on the original work from Shiva Kumar, and is enhanced and made more generic. Indeed the attempt is to make it further generic and extendable. 

As of now, the project supports text rendering on app being developed for ICS platform and Gujarati language, but the language is not a necessarily limitation. Its just that I tried it with one language to start with, and this can be easily extended and made flexible for auto-supporting any language on the fly. Currently, one will have to make a small change in the complex-script-rendering.c to support language other than Gujarati and add the font of the respective language.

The objectives of the project are:
1. To further improve the library and the widgets code (may involve a lot of code cleaning to fit the norms)
2. Add support for all the languages, by detecting the language of the running text
3. Add more extended widgets to support complete android SDK
4. Create and maintain different branches supporting different android platforms

As of now the platform supported is Android 4.0.3 ICS. One would argue why support an older revision, but that's exactly where the problem is relevant. As many of the lower end widely used android devices are still to upgrade to the latest version, there are vast number of users still struggling to use their native languages, where as the developers who wish to maintain compatibility with these devices are also struggling while making apps for those users. 

While the language support on android systems and their sdk is continuously improving, there is no reason why an independent, reliable, native lang support cannot be added to the apps with help of widgets developed in such manner. This would only improve the reach of technology to those who are facing the economical and linguistic barriers. 

Monday, August 25, 2014

Installing fonts on Android, simple yet unnecessarily tricky

Most android devices come with set of fonts already installed for all the general purpose use with variety of styles and various languages. There is also something called 'fallback' font which ensures that in case a required font is not available, the system falls back to this font with wide range of characters and more generic style to display the text. But sometimes, you really want to use that specific font which is not there on the device or you just 'have' to use a some non-english font because the system by default does not have the font for the language you wish to use. Though upfront it looks like a simple task of installing the font, unfortunately android does not yet provide a simple way of doing it in user space. It is possible for an application to provide a custom font and use it within the application, but that's not really installing it on the device, its applicable only within the app.

Recently while working with some Indic languages on android, I was faced with this problem where I had to display Kannada and Gujarati in browser, but my old ICS device, did not have any Gujarati or Kannada font by default. So I started looking for an app for installing fonts. Interestingly every app I could find required the phone to be rooted. Rooting the device for such a simple task! But anyway had to do it, and that's actually not very difficult with ready to use apps like vroot. Next downloaded one of the popular font installing app, iFont. Good thing about iFont is it provides numerous fonts by default, so if any of them suites your purpose, you may go ahead with it. But if the font you want is not listed, you need to add it to the app and then install it from there. So went ahead and installed the Gujarati font using iFont, it gave some sort of warning that things may break somehow, which I of course ignored. Reboot. And things did break down. All of the text on my screen was just vanished, except for few bits of Gujarati somewhere. So following just the icons, I started the iFont again and somehow figured out the section where my font was listed and tried uninstalling it. Reboot. And everything was back. That was scary for a simple font addition.

Later I figured out from the application logs, what exactly this iFont did. It simply took the backup of DroidSansFallback.ttf font on the system and replaced it with my font. It meant all the characters (glyphs) in fallback font other than Gujarati were gone. For weird reasons, my system was looking into DroidSansFallback.ttf for displaying the normal English text on screen. Hence all the text was vanished. In any case whatever iFont was doing did not seem promising and it also appeared that most available font installers did the same thing. So I fell back to look for a manual procedure.

In general font installing involves just two things, copying the font file to specific location and sourcing some configuration file to declare few properties to the system. On desktops, these things mostly happen automatically, or at the most you have to click the install button and it does everything required. The basic procedure on android is also similar, just that there is no direct button yet. So once the phone/device is rooted, this is what you need to do:

1. Copy the font file to /system/fonts/ directory.
2. Add an entry in some xml file for the font.

Of these, step '1' can be done in multiple ways. but most commonly you will have to use adb shell to get access to the device file system. There is enough documentation on installing android developer environments and using adb shell over internet depending upon your operating system. So not repeating all that. So once connected by adb shell, you can simply use 'adb push MyFont.ttf  /system/fonts/MyFont.ttf' to push the font file from computer to the direct path on the phone. Or you may also use 'adb shell' to get shell access of the android system. By default android will not provide 'cp' command, so you may have to use 'cat inputfile -> outputfile' method to copy. Or you may also download 'busybox' to get ease of using all the general purpose linux commands on android shell. 

For the step '2', again we do not have luxury of fontconfig like tool for configuring everything. So you need to check the font properties, such as 'font-family' on your own, any font viewer on the desktop system would be able to show that much. Now if you have already done the 'busybox' thing mentioned earlier, you may directly use 'vi editor' on the 'adb shell' or you may get the xml file copied to the desktop machine by 'adb pull file', edit on desktop and then push to the device. The file you need to look for is '/system/etc/fallback_fonts.xml'. See the file '/system/etc/system_fonts.xml' for more details on format and possible parameters. Save the file on the device after making proper entries for your font and your font would be installed on the system after reboot.

If you are already used to accessing and editing android system files, this should be a simple two step procedure, otherwise you may need a little getting used to and few google searches to get your way to safely accessing and editing system files. Sorry for not giving the step-by-step guide on this, but that was never the purpose.

Ideally, there shouldn't have been a need to root the phone in first place for simple font installation. It should have been possible to install the font in user domain by simply keeping font file in some user accessible location and a related xml file for describing it. Did not get the logic behind keeping it so inaccessible to common people. Anyone would have done a simple app to give user interface to it. I may not be aware, but if anyone knows better on this, I would love to know it. If indeed there is no other proper way than rooting the device, I think android should give it a serious thought to improve font management, even integrating fontconfig by default may be enough for this.

Apart from that, the apps like iFont can also do away with dangerously insane modification of fallback font. It virtually disables everything that needs to fall back, and given the number of languages, a lot of people do need to fall back for basic viewing of text. Anyway the app needs root access, so why not use it responsibly and make only intended changes to simple configuration files instead of other shortcuts. Hopefully the upcoming versions of android will have better font management by default, especially since use of non-english languages is consistently growing on mobile platform where this feature could become increasingly critical.

[Also read at: GnowTantra]

Tuesday, August 19, 2014

15th Aug, Independence Day, a Beggar and a Tea

On this 15th August, afternoon, I was sipping on a tea at a roadside stall, sitting on a bench, waiting for a colleague, when I heard an aged female voice over my head, 'चहा पाजतु का दादा' ('would you help with some tea'). Before I could realize that there was a fairly old couple, woman having a limped leg, and old man, mostly her husband in 70s, were asking the two cab drivers for some tea, the cab drivers responded, 'पाजतु ना' (sure why not). I generally have a strict rule of not heeding to the pleas of beggars (and I have my moral position on that considering the beggar mafia openly ruling the streets in Mumbai), but once in a while some one catches your attention and you just can't help stopping yourself from doing something if not just giving away 2 rupees. This time the instant assurance of the cab driver to buy them two cups of tea caught my eye and especially ear. The old couple did not look exactly like beggars, their clothes were fine for someone from rural area, just helpless people out of home, out of money and without any support at all. The driver asked her about her situation, whether she has a family etc. to which the woman told him about her only son, a drunkard, who is selling off every vessel and nut of the house for his liquor, his beaten up wife has left the house and prefers staying at her parents, even the land and farm in the village are on the way to get sold, the son has lost so much of himself that he even runs after his father with a knife in hand for money for his drink. So finally, they have been thrown out to roam on streets and beg for 2 rupees as the old man could not get any physical work, while woman was already on one leg and a stick in hand. Quite a heart-touching story it was, and for most of it, it looked real.

I was silently appreciating the cab drivers kindness of lending the tea for two, just then he said something to the woman, something so drastic, unimaginable, sudden and sharp, that it took that moment to a completely different level for me. "Now listen to me, do one thing, both of you, there's a railway-station nearby, just go there. Walk a few yards beyond the platform and then just sleep on the tracks. And ohh yes! bring your son too and make him go under the train before you go." Cruel. Disgusting insults on two lives of more than 70 years by someone in his 30s, in exchange of two 'cutting chai' Rs 6 each. Realization of why one poor showed some pity on another poor, for being able to insult in such a way and enjoy the authority to do so for just 12 bucks was worse than my own cruel rule of ignoring beggars and a little guilt that follows at times. But that was not the end. The woman was adamant for continuation of her son's life, as well as her own. Death was not an option for her, life, no matter what it meant had to be lived. I didn't understand the need of her 2-3 sentences of adamant denial to the man who advised death, but appreciated the will to survive.

Once this was settled, the drivers gone, and couple calmly sipping the tea, I initiated a talk with the woman with no specific plan. As she went on about her helplessness, and as she said 'our nature is of giving not begging, but have to do it', it had both a reflection of a decent past, a little bit of pride, and huge hollowness of everything before survival. With an intent to help in a more meaningful manner, I asked her to stop roaming around like beggars at this age, asked if she knew anything about any charitable organizations nearby. On knowing that the couple knew nothing of the sorts, I gave them options where they could find some help. At least a roof, and some food on daily basis. This included some charitable orphanages, Temple trusts, rich spiritual shrines nearby, including a Balaji temple, Gurudwara, Sai Baba temple, a list of social and govt organizations who could help, and were within few minutes distance by train, the nearest of them being a Buddha vihar at a 5 mins of walking distance. She looked intrigued and willing to consider those suggestions over the option of begging on streets. But then something happened that took me on another mental journey altogether.

This woman, defeated by life, defeated by the conditions, betrayed by her own blood, having been asked to die in exchange of two cutting chai, having lost the meaning of her life if anything was there, came closer and in a slightly lowered voice, repeated the list of places I suggested, took names of all the gods, whose named trusts I suggested, went on adding gods from her own list, and said she will go to any of them, Balaji will do, even Sai Baba will do, "but I will NOT go to the Buddha temple!" Shocked and taken aback, I tried to recompose and asked "why not, its just there, beyond this street" but "No, not that. No Buddha temple!"

My friend had arrived, he called me out, and off we went. I kept looking back for a while, not sure if indeed physically turning my neck or just in my thoughts, but her words kept coming back.

Its not that I didn't get what she meant, she certainly did not know a thing about Buddha's teachings, so there was no way I could take it as an offence against Buddha, also since I wasn't selling her any religion or preaching there, merely advising on what places she could go, being an atheist actually listing most of the temples, her choice of any of them had no bearing on what I should have felt. But why would a woman, in her condition, rather than making a simple choice of where she should go, takes efforts to let me know where she would NOT go, no matter what. So all my educated and intellectual friends, please spare a moment to think over it why this would have happened. Why for a poor Hindu (ahh well there were enough signs on them to suggest that, so don't bring up the stereotypical allegation of stereotyping religion. Sometimes common sense prevails), a Sikh charity is all right, any imaginary god is fine, government is fine, even a Muslim sage is fine, but not a very own Indian real person of the stature of Buddha whose teachings have shaped major part of our accommodating non-violent culture, not so fine? Put your grey cells to work and make me understand the contradiction to the intellectual Indian's constant rhetoric that Buddha is very much Hindu and very much a part of the same system, just another 'panth'(branch), in the same family of spiritual and cultural traditions against the practicality of this unusual separatism.

No, its not just Buddha. Of course he does not fit as well as the intellectuals try to fit him into the Indian Hindu nationalist spiritual rhetoric. But there is something deeper than that. If you know even a little bit about rural Maharashtra, Buddha means only one thing, the new God of the 'untouchable' people, the 'untouchable God'. By all means the emotional journey over the sad life of a poor old couple, took me through several planes and suddenly dropped in the pile of castes. Making me realize that even beggars could have a false-pride, note that its not your good romantic self-esteem, its an outrageous, unnatural, hollow pride. And my dear friends, I know some of you who love me a little extra would be jumping to put the credit of bringing caste into this, but no, it was forced. Forced by the woman thrashed on the roads, by her own son, still having a hollow sense of pride and separatism based on a very 'important(?)' aspect of her life, the caste. Being unnecessarily looked down or rejected by the people with possessions is not at all new for someone from depressed class, but being looked down, for no reason from someone with no possessions, no powers, no resources and no knowledge, only on the basis of a false sense of caste-pride and that hollow dignity was all new experience that intellectual educated Indians will rarely understand. No my dear friends, its not that a beggar cannot look down upon someone, its not that a beggar cannot have a self-esteem, every researcher and every sage who lives on donation amounts and free alms is a beggar, so any beggar with apt possessions in various moral and ethical forms can and should have the dignity, self-esteem, self-respect, but when its based on something as stupid and as ugly as caste, its not a self-esteem, its a farce, ugly farce, that's going on for generations after generations. Its everywhere, and each one of the depressed class human, and not just human but even their God, is facing it every day. I could give number of examples of casteist attitudes and insults thrown towards people I know personally, experiences of my own, but don't want to dilute the intensity of this one experience, they are more of a regular offences, everybody likes to turn blind eye to them. But no matter how much you deny, caste is 'the' en-slaver of Indian mind, just remember how you got married or how in future you would and you would know what I mean. The society and the mind of Indians are still not free from this mental gutter which does transform itself into physical plagues on a regular basis. The freedom is a long awaited dream and far away target. Hope the real freedom will rise some day. May the old couple get to any one of the place and spend their remaining life in peace and in search of meaning, not just bread and pride.

[P.S. So my educated intellectual friends, no matter what your opinions are, on what basis they are formed, and no matter how much you declare yourself not guilty of being part and fuel in this entire scheme of caste based discrimination, atrocious culture and separatism, if you utter a word about caste being just a political tool, not a social evil as much, it being only irrelevant and non-existent or a non-significant problem, and claim that your religion(whichever it is) has no base for this menace, and its the dalits/untouchables that are responsible for its existence, just imagine the level of sanity that would be attributed to you. If there is any anger or bitterness in my words, its not against the poor lady, she is just another slave of the system, so the anger is against this system, against this culture. Also this is not just a random rambling, yes there would be proactive opponents who would ask what's the use of all these rants. But before going into the usefulness of words against actions and before some outrageous good-for-nothing person asks about the evidence of action(the usual 'what have YOU done'), let me remind that I am not obliged to answer that, this is a collection words and thoughts based on personal experience without any specific target, apart from a simple objective of expression and hope that even if some of the people realize how deep rooted the imprints of caste and its false pride and divisiveness are on the Indian mind, even if only a few realize how much disservice this attitude of forced separatism with false superiority is doing towards overall economic, social and spiritual growth of the people of this country and people who follow this culture, even if only one person at a time changes his/her mental attitude on reading such snippets of experiences, it would be enough for this much writing effort. You don't inhale each breath with a plan to change the world, with every breath its only the oxygen that matters, rest goes on independently. Hope sane people get sane message to ponder upon from this slightly painful but a lot more disturbing experience. (uff, see how many defenses one has to be prepared with even before talking about such topics in a supposedly free speech society!)]