Thank you

Opw has come to an end and looking back I feeel so proud and happy.I become more confident .I figured out what I want to do next.I also had fun, met a lot of amazing people .All good things come to an end. This is a small thank you note to thank all those wonder full people who have helped me in making this internship the best opportunity I ever had. My parents friends for their constant support and motivation.There are some persons I specifically want to thank

Rebecca Billings: My mentor,I am so privileged to have her as my mentor.I am really inspired by her the way she organizes her time.I have learned to organize my time.My commmunication skill has improved over the time,it is because of her.

Bob Silverberg:  I have improved a lot pair programming with him.I learned not just scripting in python but modularizing code so that its make the code more readable.He gives  exceptionally good PR reviewer that hardly any bug goes unnoticed. He has been patient when i took time more than required.

Stephend mbrand and mozwebqa team.I owe you a lot.Thanking for the constant support and words of motivation.I like to explore more

February 7:Sharing experience as an OPW intern at Mozilla Quality Assurance

Featured image

February 7 ,2015 has been a really special day in event life.I had shared my experience as an OPW intern at Mozilla Web Maker Party organised at Rajagiry School of Engineering and Technology,Kochi. Thank you Rebecca Billings for connecting me with the mozilla reps in my region and thanking Vigneshwar Dhinakaran  who trusted me to take the session.

It was my first ever conference in which I handled a session, and it was next to awesome.The maker party gave me an opportunity to network with other mozilla people at my region. Further in this post I shall my experience of the event.

I reached the venue at 9.00 a.m.and met Vigneshar Dhinakaran.Vigneshwar is the Mozilla rep and main organiser of the event.He proved to be friendly host and smart organizer. RSETians where waiting with enthusiasm to for the event.A few hours later I met another team of Mozilla reps who co-organised with Vigneshawar including Nidhya,Praveen,Abid.Praveen was GSOC intern in one of the previous round. Praveen blog is quite informative. Click here to read his blog

Featured image

The session started with transforming ideas into prototype,followed by an introduction to web technologies and mozilla web maker,after that Praveen and myself shared our experience as an intern at Mozilla and SMC(Swantantra Malayalam Computing).We spoke about opportunities like Google Summer Code OPW and Rails Girls  summer code.

We both explained our respective projects Oneanddone. It was interesting to know about his project  developing and adding support for Indic language layouts for Firefox OS.

Featured image

I spoke about the upcoming opw round, and gave some tips to get started.We  talked about  irc,encouraged them to subscribe to mailing list,use irc and learn github. We were able to help them in finding  resources for learning like openhatch,trygit etc.

We found that students really doesn’t get  a chance to contribute in open source projects. There is a popular misconception that open source projects has place only for highly skilled developers.We presented open source as a platform for developing skills.I gave  a brief description about how they can be a part of documentation,quality and testing etc.

To conclude open source is an important part of technical education.But students are not aware of  how they can contribute in open source. Providing them proper mentorship could help them bringing to forefront. Opportunities like OPW and GSOC could be a good dive into open source.To achieve this the mozilla reps has decided to organise a boot camp in the upcoming week.Stay tuned

Git pre-commit hook

When I got repeated reviews about code not passing flake8 checking bob mentioned about using hooks. It was then a new term to me. After checking a couple of webpages I found it very interesting. I wrote a git pre-commit-hook using shell scripting.My script checks two case

1: Check if the current branch is a master branch.
2: Check for python file for checking python syntax errors

What are git hooks?
git can trigger some import actions before you perform an important function like commit, rebase etc. A pre-commit hook is triggered before a commit occurs. Git hooks are stored in hooks directory of .git

Step 1

cd .git/hooks
vi pre- commit

Step 2: Copy the code


(git diff --cached --name-only

git diff–cached is used to find the difference between latest commit and files added for staging.
–name-only list only names of the that have changed.

(git diff --cached --name-only --diff-filter=ACM | grep -e '\.py$'

This list all the python files.

flake8 $file --ignore=E501

This ignores E501(line too long).

Step3: Make the file executable

chmod +x pre-commit-hook

And that’s it. Now every time when you commit your code, git will run flake8 for you. Also you may not fear about accidentally committing your master branch.

Data Migration in Django

Changing the database is one side of the equation, but often a migration involves changing data as well;

Consider this case

Bug 1096431 Able to create tasks with duplicate names.Task names should be unique

class Task:

     name = models.CharField(max_length=255, verbose_name=title)

    start_date = models.DateTimeField(blank=True, null=True)
Solution

Schema migration of course. ie Add unique = True. If you apply this migration to production it will cause an IntergrityError because you make a database column unique, while it’s contents are not unique. To solve this you need to find all tasks with duplicate names and rename them to something unique. This will be a datamigration instead of a schemamigration. Thanks to Giorgos Logiotatidis for the guidance,

Step1 : Create a few task with same names say ‘task’

Step2 : This is datamigration part

python manage.py datamigration Tasks _make_taskname_unique.py

Step 3: When you Open up the newly created file you can see the skeleton  of forwards and backwards function.I wrote a code to rename the duplicate taskname.


Step4 : Now add the unique keyword to the field and apply a schemamigration

Step5 :Finally migrate the model tasks.Now you can the the duplicate tasks gets renamed as  task 2 task 3 etc

Gnome Internship Status Update Week 2 and Week3

In the past week I have been picking issues from bugzilla and fixing them. I had  been lucky to get the support  of  amazing people like Giorgos and Anastasios who had been kind to review my PR .

Accomplishments

Status of four bugs has been marked resolved in the bugzilla. I have received feedbacks on other bugs which I expect to resolve it soon

Challenges and Feedbacks

I have been receiving repeated feedbacks about the indentation issues in the HTML code which needs to be fixed soon. I shall fix it and explain it in the next post 🙂

Need to make marks as taken as there are chances for multiple users taking up the tasks

 Whats next?

Found an awesome task management tool Google keep.Its comes as a chrome extension and android application.Decided to use it

Decided to work some days extra to make up two days loss

I am sharing an extremely useful resource on the review process  .Thanks to Bob Silverberg for sharing.

The initial two weeks has come to an end and have learned a lot.Some advance git commands . I know there more to learn.

First week Tasks

It took pretty long time to get into my blog. The code is yet to be merged .But I must say it was challenging and interesting.

Task1: Display users who have completed a given task on the task detail page

How i did?

I wrote  a simple method to the model Task which returns the list of users who have completed the given task.

@property
def users_who_completed_this_task(self):
return User.objects.filter(
taskattempt__in=TaskAttempt.objects.filter(
task=self.id, state=TaskAttempt.FINISHED)).distinct()

The property decorator lets you to access the method as an attribute of the class. So that if task1 is an instance of the model Task, task1.users_who_completed_task returns all users who completed the specific task.

My first unit test case

  • This was most challenging and exciting part.I wrote unit test cases for the code i wrote.Thanks to Bob silverberg for the helping me with  constant feedbacks. If you are new to unit testing this check this link.🙂

Task2: Add date completed in the Task Activity page

This was quite easy . 🙂

modified=attempt.modified.strftime(‘%Y-%m-%d: %I:%M:%S %p’).lower())

What i learned

    • Some simple filters used in jinja2 templates like strfttime. Here is a simple code snippet for a comma separated list of users in the template

 {% for each_user in users %}
{{ each_user.profile.name }}{% if not loop.last %},{% endif %}
{% endfor %}

  • Writing unit testcase

Patches submitted for OPW Internship

In this post i shall explain about the patches i submitted for gnome opw.After going through all the projects i choose Mozilla oneanddone which is basically a task board where contributers can pick a task and feel good about them.Tasks usually includes automation,manual testing,verification etc.This site is written in django and playdolph.I have submitted three patches to the project

patch1: Made Task description intended not required

Make the task description optional.Find the field in the table that stories task description.Set null on the column in database and in forms allow this field to be left blank.In django it simple a line of code in the model

short_description = models.CharField(blank=True, null=True, max_length=255, verbose_name=description)

and use south for migration

Step 2:  manage.py schemamigration tasks –initial

manage.py migrate tasks

patch 2: Add an optional personal url in users profile:

My favorite part was writing a custom form field for personal url

http://csnipp.com/s/830

Patch2:Linkify home page

Learned about translational strings )

patch 2