Javascript Infovis Toolkit

Hi All,

I am just writing this post to help anyone out there who is using JIT Spacetree just like me and facing label overflow issue, where the node is hidden but because of the label it is still visible.

You just need to add overflow: hidden on the #infovis element to hide. I mistakenly remove the css because of which it started showing and after a while only I had this overflow issue. So just do this and your issue will be solved.

Cheers!

unlink() – FamilyTree

I have recently bought a new laptop and hence it does not have Ubuntu installed in it. Since I am currently working with *AMP stack which also works on Windows. So I started with Windows as of now.

So this post was to write about the issue that I faced recently while I was working on FamilyTree. So while installation of FamilyTree, it checks for required folder permissions by creating a file in the given folder. If it is able to then we have the permission else we don’t.

The code was working for past 4 year I think. Now I was getting a permission denied error. So I checked permission which were all fine, but still it was not working.

So my function was able to create test lock file in the folder but not able to delete it. But how is this possible, if it able to create a file, then we should have access to delete it also.

Then after 4 days I noticed that I was not closing the file handle which would create the file for me. So I did fclose() and it started working.

The code has been tested on Linux, Windows 7 and Mac. They both allow deleting of the file even if the file handle in open. But Windows 10 denied deleting the file up until the file handle was closed.

Now I don’t know whether to applaud Microsoft for this or not. 😛 But yes it made me figure my mistake So I think I should. Thanks Microsoft.

Php Application Updater Theory

I have to add auto updation in one of the php Application that I have made (FamilyTree). So I started thinking as in how I can implement this. I have seen this thing in lots of applications such as WordPress itself. Wonder how they do it. Anyway, hear whay I have to say.

I use git as Version Control so I basically deal with commits. Whenever there is a release marked in git. It is basically after a commit. A certain commit is marked as the final commit of some version which solves the final issue of that version or implements the final feature of that version.

Let’s say I had earlier released 0.1 of my software. Now I am releasing version 0.2 of my software. To know the changes that you have made from one commit to another, you will have to read all the commit reasons that you have mentioned when you added that commit given that you have explained each of your commits properly.

Now we had php application, now we don’t have to compile, we just have to replace the files. That would be easy I suppose. All we have to do is to find out the files which were changed from 0.1 commit point to 0.2 commit point. I found out a git command which can do this for me.

git diff --name-only HEAD~10..HEAD yourdir

This command right now show the files that were changed in the last 10 commits. We want to know from one commit point to another. So just replace them with the commit SHA of your two commit points and voila!!. yourdir is just a directory. If you are running this command inside repository. Then you don’t need that.

Now we have all the files which were changed from 0.1 version to 0.2. Our Updater should just replace all of these files and we are good to go.

But wait a min! What if we have database and we have made changes in the database to. How will we manage then?

Now one more feature has been added to our application that if database has changes such as we have added more columns in one of the tables. Then insert sql scripts which migrates the database to the new schema and make certain changes in the database. Now after this, you application is using latest code and is on latest database schema.

Here is all of the above theories practical. There can be a script which after running collects all the files mentioned by the above git command and puts in zip file. Now modify that zip file and add sql files which will modify the database accordingly.

Cons of this Theory:  This way is incremental way as it is relative to the previous version. For example, A user is using 0.1 version and latest version of the software is 0.3. Then first he would have to update to 0.2 and then go to 0.3 which can take some time to happen.

Right now I only have this theory in mind. I haven’t yet implemented. I will let you know on this same blog about the challenges that I faced while implementing the same.

Till then sayonara!

Final Report

After midterm my next task was to write units tests for functions. I had to select a Testing Framework for this task. I had chosen Google Test in the proposal but I was advised not to use it. So I went for DejaGNU.

The folder testsuite has two subfolders. One is XMLSuite and the other is Testcases. TestCases folder contains all the tests. I have tried to include as many tests as I could. For the testcases to run, you will have to install DejaGNU. You can do by running the following command if you use Debian based Linux.

sudo apt-get install dejagnu

If you are on any other distribution, you can check their their website for compiled binaries or you can compile it from source.

To run the Unit tests, you just have to use command

make check

This command will first run the XMLSuite then it will run all the tests. There would be lots of output after this command. For the result of XMLSuite, you can check the result.htm created in xmlsuite folder. The result of unit tests will be shown in terminal itself. One of the limitation of DejaGNU is, that it doesn’t allow to customize the output. Hence, all these output can be put in one HTML file. The tests are written such as it doesnot depend on other functions since they are the one which are under test. But bit_write_B and bit_read_B has been used a little at some places. The tests for these functions are independent of them.

The current output would be something like this.

Screenshot from 2014-08-22 00:59:48

As you may have noticed that there are tests that are failing. To check which tests are failing, you can scroll up. You will see something like this.Screenshot from 2014-08-22 01:16:00

All the tests are grouped together in a system. With every tests there is a EXP file which runs the tests to get the results and to show it on terminal. The name of the EXP file is same as that of the Unit Tests C file. To check for failed function you can check the corresponding C file which will contain the function that failed. There can be as many test as one wants. The more tests there are, the better it is.

This was a very cool summer and I learnt a lot. There are still some things that needs to be improved. I would hopefully be part of GNU LibreDWG for a long time after this to see the TestSuite become what I have planned for it.

GSOC: Last Day

Today is the last of coding. We can still continue to do work. But we cannot submit that code to Google. Before ending I did some tweaks to the code. I generated documentation of the code and checked if everything was coming out OK. I tried installing on different systems so that I can know. I found few of the things. Most of them were fixable except for one.

One of the requirements of TestSuite are python-libxml2. But there is no way to check in AutoConf for python modules. There is a provision to check for python but not for python modules. So I have mentioned this requirement on the Wiki Page. If any user faces problem he can look it over there.

GSOC: 16th August 2014

I have started wrapping and documenting the code. The indentation was done with the help GNU Indent. I made my work easy, although I had already done most of it while I was coding. I have made changes in the configure and makefile accordingly. The changes which were needed were to add dejagnu and libxml2 as requirements.

I am looking all over for any more changes there might be need. I will be done by tomorrow. I have yet to update the wiki page. I will update that tomorrow. I had not updated till yet as I was not sure how it will turn out in the end. Now everything has been finalised. So now I can update the wiki accordingly.

All the user have to do is to run `make check` to run the test suite. It will first run the XMLSuite and then the unit tests. I will also write a README file on how to make any change in Testsuite so that further developers can make changes as promised in the Proposal.

GSOC: 12th August

I was again today looking at the requirements written on the wiki page related to Test Suite. Not all of them can be fulfilled because of the tools I am using. But I am trying to fulfil most of them. It needed to generate html output of the result. I spent the last days generating html output of the result. Now it creates an html page whenever XML Suite is run having all the information.

GSOC: 10th August 2014

Today was Raksha Bandan. It is a festival celebrated in India. I wasn’t able to work whole day. But I found out some time in night.

The time is almost over. I am done with my unit tests. I have started to do some left out job with xmlsuite and integrate it with Makefile. I found out a way but it is not working right now. After this, I will start wrapping up the project. Today my work will be finished. I have left the last week for testing and documentation.

GSOC: 7/8 August 2014

The time is almost over. I am still on the unit tests phase. I am almost done though. The current as I can see it is

314 tests passed and 16 tests failed

Still there are some functions left in decode.c whose tests are to be written. I am going to complete them today. After that we have few tasks left such as Configuring Makefile to run xmlsuite when `make check` command is executed. The tests for bits.c are to be improved a bit. After this, It would have completed.

I have almost tried to follow coding guidelines everywhere, but I still I have to check it, and documentation is missing for few functions. I have to write that down too. I have 2 days to complete the work. I will perform the documentation part after that.