GSoC Weekly update #2

Coding period for GSoC has started the past week and I have been working on a very simple implementation of the proposal in C and two tiny bash scripts. My code is available here: https://github.com/nandajavarma/Automated-Rendering-Testing

The first thing to be done to test using these scripts is create a file that contains a set of words to be tested to see if their rendering is correct. Here I have taken a sample test data file created by SMC a while ago (ml-harfbuzz-testdata,txt). Now pass this file through the script render_test.sh along with the necessary font file. That is:

./render_test.sh ml-harfbuzz-testdata.txt /path/to/fontfile

This will create a file named rendered_glyphs.txt that contains the output of hb-shape function of harfbuzz, i.e. the glyph name followed by some additional numbers (which will be ignored for now).

Now create a file that contains the actual glyph names of the words in the the test data wordfile. I got the data from font forge. This has to be created manually and, as of now, obeying the following structure:

[glyph11,glyph12,glyph13,…,glyph1n]

[glyph21,glyph22,glyph33,….,glyph2n]

.

.

.

Also make sure that glyph names of each word is in the same order as that of the corresponding words in the test data file. I have named it orig_glyphs.txt Once this is done, we can pass the above two files through the executable of the script rendering_testing.c, say rendering_testing. That is:

./rendering_testing orig_glyphs.txt rendered_glyphs.txt

This script will compare the glyphs in order and if it find any pairs that doesn’t match, it will write to a file, result.txt, the line number in which the word appears in the test data file. Otherwise it will tell you the renderings are perfect.

Once this is done, to see the words with wrong renderings we will have to run the third script show_rendering.sh. It takes as input the result.txt file, the test data file and also the font file. That is:

./show_rendering.sh result.txt ml-harfbuzz-testdata.txt /path/to/fontfile

This script will create png images of the wrongly rendered words in the current directory.

That is all about my scripts. But the C code is very much inefficient. It even spits segmentation faults with some files. Once I make sure that I am on the right path after discussing with my mentor, I will be working on improving my algorithm and making this code better. That would be my next week’s work.

Advertisements

GSoC – Community engagement period

GSoC 2013 approved project list was published on May 27th and the community engagement period was started from May 29th onwards. During this period the students are supposed to bond with their mentors, read the documentations and finalize your plans so you can have a head start with your project. The project topic for which I have got accepted for is “Automated rendering testing” and I will be completing that project under Swathanthra Malayalam Computing. I could learn a lot a new stuff so far during this community bonding period with a heavy deal of help from my mentor Rajeesh K Nambiar, although I haven’t started actual coding yet. I will try to explain my proposal status and further steps here, in detail.

Basically, my project idea is to create an automated way to test the rendering of Indic fonts by rendering engines like harfbuzz. The procedure I wish to follow here is quite simple. Create a test file that contains a set of words, mostly characters with ligatures that will be used for testing the rendering. Along with that I will be maintaining a file that contain the glyph infos of the words/characters in the test file for a particular font, say Malayalam font Rachana. As of now I am preparing it manually, can switch to font forge scripts if required.

Once I have got all the test data, my main script will accept the entries in the test file and render it using Harfbuzz for the font Rachana. The words will be rendered using hb-shape and the output glyph values will be compared with the original glyph indices of these words that I have collected manually. If the glyph indices doesn’t match, an error flag will be set for that particular word. At the end of the comparisons, the words with error flag set can be rendered using hb-view and stored in another html file. This file can be looked up to see for rendering issues.

This is what I will be implementing first. Depending on its efficiency, will move to any other solutions. In the above procedure, the most inefficient step, I think, is collecting the test file step and collecting the glyph index step. We can resolve the latter by, may be, using a scripts for extraction or using the .ttx file of the font (which is quite complex). But the former is a real issue. If the user wants to check for rendering issues in a font, she will have to create this file with a set of words manually. Will have to think of a way to overcome this issue.

That’s it for now!

Bangalore Diaries

I remember times when I used to eagerly wait for my school final exams to get through with, so that I can enjoy the long summer holidays that follows. I have been missing that feeling for a while now. But this year I was impatiently waiting for summer to arrive because I knew what was waiting for me this summer season. A long month ahead filled with knowledge, fun and freedom. An internship in Bangalore! But once  I reached Bangalore city, I could feel that my all my excitement was turning into ashes. My nerves started kicking in (As it always does) and I started wondering ‘What the heck am I doing here?’. I am joining as a temp intern in this cool Australian Software company called Bang the table . I don’t know Ruby on Rails or even Ruby without which basically all I am eligible to apply for is probably the post of an office boy/girl (Which is already taken, FYI). I got a small place (very small) to live which I knew I would love from the first sight of it and got three amazing roommates, who have been trying so hard to make my Hindi speaking skills better till date.

So I joined my office exactly on April 1st ( Which date could be more appropriate than this, eh? ). All the faces were extremely welcoming and warm, and some of which quite familiar too, most of them being mallu faces. I had great fun shooting people with laser guns on my first day itself. Thanks to Ershad for his awesome birthday treat. My timing was just perfect.

Image

My internship started off pretty smoothly. Although I didn’t know Ruby I managed to understand their code base to a very small extend and started poking around with it. Office has been just awesome. To add to the fun, there is a refrigerator for you to raid whenever you are hungry and a coffeemaker which refreshes you with lattes and cappachinos (which I’ll miss very badly) 😦

I completed my first week pretty smoothly and was wondering what to do during weekends in this anjaana shehar.  Luckily for me, as two of my friends Hrishi and Adhil were free those days, I did hang out with them and it was great fun. We just did roam around  Bangalore city (Not to mention, got lost at many points), ate good Kerala  food and happily wasted a whole day. 😀

The following weekend also I met with my friends here (more of online friends) like Jishnu, Praveen, Anivar, Joshina and many others which was basically a Swathanthra Malayalam Computing meet-up and had fun then as well.

On the week next to it, We had our Australian directors visiting us (Again perfect timing of mine). The whole bang the table team went out, played paintball (which again involves shooting people) and had an awesome party at the end of the day. I consider myselves quite lucky that I got the chance to meet all those amazing people. That day will definitely stay in my memory for a long time to come.

That was about my office. Now coming to my hostel, it is an entirely different scene here. I have been living in hostel for the past 3 years but the hostel life here was quite different. The thing I loved the most is, the level of intimacy is really high here. I am not used to roomies who take so much care of each other just like sisters do. I am really going to miss these guys.

So what I achieved within this one month period. Difficult to answer. Definitely would have regretted if I missed this opportunity my entire life. So now gratitude time. 🙂 Thanks to Vamsee who offered me the internship in the first place. Thanks to my parents for letting me go, although they were a little hesitant in the beginning. Thanks to my senior from college Haris, who gave me the courage to go for it (He has been doing it for a while now and my biggest regret is that I couldn’t meet with him in person). Thanks to my friends Hrishi, Adhil, Jishnu and all the others who didn’t make me feel alone at all in this new place.

(Does that sound like a pageant show winner’s speech? Ugh! To all those who keep nagging me to write, In your face! :-P)

Anyway, I have packed my bags and am about to leave this place tomorrow and Boy, Am I sad going back home? 😛

(Hope the title is creative commons)

MiniDebConf at NIT-C

Ever since I started loving FOSS, I really wanted to attend a FOSSMeet. And last month I got extremely lucky and could attend FOSSMeet at NIT-C. This year along with FOSSMeet a MiniDebConf was also arranged. A month prior to it, I was asked to give a Ruby gem packaging session at this MiniDebConf. I was quite nervous because this was the first FOSS event I ever attended and I was asked to give a session. But I knew it would be a great experience, So I decided to go with it.

FOSSMeet was conducted from 22nd to 24th of February and my session was scheduled for 24th. I reached Calicut town on 23rd morning (Obviously unprepared) and when I was just about to hop into a bus to NIT, one of the MiniDebConf organizers, Vipin called me and said that my session was preponed to that day afternoon. I started freaking out because I still had to prepare slides and decide what all to include in my session. As soon as I reached NIT, I had to go to my relatives’ place at the NIT apartments, where I was supposed to stay for the next two days ( I preferred hostel, but whatever!). After that I rushed to NIT campus, got my speaker’s ID card from the registration counter and started roaming around the campus searching for the MiniDebConf venue. Finally I found that it was going on at the networks lab and got there. When I entered Pavi and Shirish were giving talks on debian releases and stuff and I quite honestly didn’t know how to introduce myself. ‘Hey, I am Nandaja. I am a speaker here’ didn’t sound polite enough. So I followed a guy, who assigned me a system in the lab thinking I am a delegate there. So I sat there and started preparing slides for my session until the lunch break.  Once I reached the hall were lunch was being served, I decided to socialize. I met some cool SMC people who were really easy going and friendly and then I met Praveen, whom I was more than happy to meet. After the lunch, we went back to the NSL lab and there Praveen introduced me to Shirish and Pavi, two Debian gurus. It was the time for Debian installation workshop. Pavi asked me to help the delegates with the partitioning and stuff, which I tried doing and I don’t think the students who listened understood much. We clapped for the teams who successfully completed the installation. The session lasted till evening and it was supper time soon after. So my packaging session was again rescheduled for the next day. I again met some cool geeks there. There was a really nice Aaron Swartz memorial talk by Vishnu later that night. Following that was hack night and a talk by Praveen on open source contributions. It was getting too late and had to get back to the relatives’ place. So I missed it (The reason why I preferred hostel).

So it was day-2 and my session was scheduled as the first event at MiniDebConf, that day. I got into NSL and heard all of them had real fun last night, albeit it wasn’t that much of a ‘hack’ night. It was supposed to be a full day packaging session at MiniDebConf, which me and Praveen decided to do together. But as many other interesting events were happening simultaneously, only very few came. So we decided we’ll start packaging session once all other interesting events are over. But unfortunately, the students who showed up started leaving one by one. Luckily for me, a very enthusiastic girl showed up, who missed first day’s session and wanted to learn more about Debian. I started giving a private session for her. But around half an hour later, she said she has got a farewell party to attend and left (Yeah! She literally ran away 😛 ). Till the lunch time we sat there chit-chatting. We even went to the 3D-Blender workshop but as soon as the speaker’s lap screen showed a windows desktop we left (Come on, It’s FOSSMeet, man!). After lunch, we exactly had 6 people at the packaging session and we decided to do it anyway. Hrishi started off the session with an introduction to diaspora. Then me and Praveen together started explaining packaging. There were some really cool people there, like, Vamsee Kanakala, the Executive developer at Bang The Table, a government employee, whose sole intention was to attend the packaging event and four other enthusiastic students. The session proceeded pretty well and they were picking it up pretty fast. Almost by the end of the session, Vamsee asked me if I would like to do an internship at Bang The Table and I accepted the offer right away. 🙂 We couldn’t cover the whole packaging process because it was time for the closing ceremony. Anish, Praveen Vamsee and many others gave the feedback. Vamsee was really kind and he even mentioned my name at the feedback session. I was also asked to give the feedback and honestly I don’t remember what the heck I said there. All of us speakers got a beautiful momento. I bought a FOSSMeet t-shirt and was about to leave.

Just then, Vipin, Jaseem, Pavi, Praveen, Shirish, Akshat, Jishnu and Anish were planning to have a group dinner and invited me as well. It was pretty cool. I never though I would have so much fun hanging out with such uber geeks. After that, it was time for us to bid farewell and all of us went on our own ways.

As it was late, I couldn’t go back home that day. I left Calicut the day after. Quite frankly, I was pretty sad that the FOSSMeet was over. But I was really happy too at the same time, because I made some new geeky friends, got an internship offer at Bangalore and had a lot of fun. Plans for the next MiniDebConf were going on. I am so looking forward to attend that one and hope it happens soon. 🙂

Patching using quilt

Patch files are files used to apply changes to the source code of a computer program. These changes may be for fixing bugs or for extending functionality. Quilt is a software utility for managing patches. Quilt is highly used among Linux kernal developers for managing patches. I started using quilt when I had to patch a piece of code while I was packaging for debian. Debian source packages usually use quilt. It has been incorporated into dpkg (Debian’s package manager).

So, Let’s say you downloaded a debian package and found a bug in it. So you will have to create a patch and send it to the Debian developers for their review and approval.

Assuming that you’ve quilt installed (sudo apt-get install quilt) first step is to create the configuration file .quiltrc.

Create a file named .quiltrc in your home directory and open it up in your favorite editor. Copy the following lines into the editor, save it and exit.

QUILT_PATCHES=debian/patches
QUILT_NO_DIFF_INDEX=1
QUILT_NO_DIFF_TIMESTAMPS=1
QUILT_REFRESH_ARGS="-p ab"

Quilt work with some directories. It will create a .pc/ directory and patches/ directory. As in the case of debian packages, you can find the patches you made (Or going to make) under debian/patches/ directory.

Now we will create the new patch.

quilt new this_is_my_patch.patch

Next step is to let quilt know which file we are going to edit and for that the command is as follows.

quilt add /path/to/the/file/to/edit

Now open up the file in your favorite editor, make the changes, save it and exit. Alternatively, you can add and edit the file in a single step like this :

quilt edit path/to/the/file/to/edit

The file will open up either in nano or vim where you can make changes, save and exit.

Now to apply the patch enter the command:

quilt refresh

Now two other important commands while we are dealing with quilt is pop and push. Pop will remove a patch while push will apply it. The patches are basically arranged in a stack like form by quilt. If we do a pop, the patch we applied recently will be removed, even though we can find the patch file under patches directory. So when we do a push now, that patch will be re-applied. Commands for both these are quite straightforward.

quilt pop

quilt push

Now, If you want to edit an existing patch, Make sure that the patch is applied. That is,

quilt push -a               

(‘a’ as in all)

Then edit the file as required and just run:

quilt refresh

While we are building the package, We may want to remove all the patches associated with it. And to do that either we can enter the command quilt pop -a each time we build the package or we can create a file named local-changes under debian/source/ directory containing the single line unapply-patches so that the patches will be automatically removed after a local build (Considered as a good practice. ).

echo “unapply-patches” > debian/source/local-changes

 That’s pretty much the most basic steps involved. For diving in deeper (Ha! As if. ) refer : http://www.debian.org/doc/manuals/maint-guide/modify.en.html#quiltrc (Didn’t help me much. )

Also there are some standards we ought to follow when we are creating a patch, so that everyone can understand it’s purpose, author etc. The one I followed is DEP-3 and find more about it here: http://dep.debian.net/deps/dep3/ . It involves just some simple steps when we add some line in the beginning of our patch file like – Description, Author, Forwarded, Date modified, etc.

And do not forget to let git know all the changes you’ve made, if you are using git.

Anti virus for Linux

Using an anti virus software in my Linux machine is something that I have not given much thought to. I know for the fact that the odds for a Linux system to get affected by a malware is pretty low. As of my understanding, the fact that Linux systems use open source software is a big bonus here. I mean, why would some one bother in sitting and writing a harmful program when everyone can see your code. Also crackers aim at a much elaborate target. I am sure they have better things to do than messing with some Linux users, which is only 2% of world computer users’ population. Still, there are executable files that may get into your system via mails or flash drives. But in Linux, nothing will happen if you simply double click an executable file (provided you don’t have Wine installed). It won’t get executed unless you give it permission for execution. This is much unlikely to happen as Linux users are supposed to know what they are doing (Myself excluded!). And of course, there are many more reasons like user privileges, simplicity of kernal, etc.

But this doesn’t mean that we don’t need an anti virus software installed. For instance, as in my case, I thought of  using an anti virus software when my windows using friends started blaming me for spreading malwares via flash drives. And also, being a music junkie, I constantly give my phone a hard time copying downloaded files to it from my computer.

After going through several forums, I decided to go for clamAV. It is an absolutely open source anti virus software. You can install the package clamav or clamtk (If you want the GUI).

sudo apt-get install clamav

Now to start scanning, run the following command in the terminal.

clamscan -r  <folder or file to be scanned>

(-r as in recursive)

Now update your virus database definitions by running the command :

freshclam 

You may also want to uncomment the line that includes the path to the local socket in the clamd.conf file (/etc/clamav/clamd.conf).

Now we are good to go.

Quick tip: Installing a software in linux using files in .run format

The .run files are binary executable files. These files need to be executed to install the software. Such files are often considered as unsafe as we cannot find a way to uninstall them and we cannot say what the code will do to your system. But some games and apps are available that are packaged in this file format. Installing using .run file is rather easy.

First of all download the required .run file.

For example, in your terminal run the command:

wget -c < URL to the .run file >

(Get the .run file as you wish. I just mentioned wget here because it is one of my favorite GNU/Linux utilities. It enables a very nifty download of files from internet and the tab -c can help you get data from a partially downloaded file. If the file to be downloaded is quite bulky and you don’t trust your Internet connection then -c tab is what you need.)

Method 1:

Go to the directory where the .run file is saved and run the following command in your terminal:

chmod +x foo.run

Here I have arbitrarily named my .run file as foo.run. Here we are using +x to give permission for the owner to execute the file as a program. (If we replace +x with ugo+x, then the user, group and others will get the permission to execute that file as well.)

Now run the executable file, that is, run the command :

./foo.run

Now the installer will run.

Method 2:

We can do the same steps rather interactively as below.

Right click the .run file and select properties. Under the permission tab check the box that says ‘Allow executing file as program’ and click close.

Double click the .run file and select ‘Run in terminal’.

This will run the installer.

Both worked perfectly in Ubuntu 12.04. If different in other distros please let me know.